From e56090cd7eecdf0fd53f8e51d08b0418da9a0fb5 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Thu, 28 Sep 2023 13:25:25 -0700 Subject: [PATCH 1/3] feat: Generate Firefox plugin So far, plugin only handles VRML. But it loads as a temporary plugin in Firefox OK, and it generates viewers as necessary, including overlaying existing images that are links to VRML files. --- .gitignore | 1 + etc/deps/jquery.js | 10716 ++ etc/deps/x_ite/assets/components/Scripting.js | 942 + etc/deps/x_ite/assets/components/Text.js | 16465 ++ etc/deps/x_ite/assets/images/logo.128.png | Bin 0 -> 12372 bytes etc/deps/x_ite/x_ite.css | 1 + etc/deps/x_ite/{x_ite.d.ts => x_ite.d.mts} | 9 +- etc/deps/x_ite/x_ite.mjs | 121723 +++++++++++++++ etc/manifest.json | 23 + package.json5 | 7 +- pnpm-lock.yaml | 18 + src/giveAwrl.civet | 89 +- src/index.civet | 4 - tools/copyDeps.bash | 2 + tools/fetchDeps.bash | 16 +- tools/makePlugin.bash | 12 + 16 files changed, 149982 insertions(+), 46 deletions(-) create mode 100644 etc/deps/jquery.js create mode 100644 etc/deps/x_ite/assets/components/Scripting.js create mode 100644 etc/deps/x_ite/assets/components/Text.js create mode 100644 etc/deps/x_ite/assets/images/logo.128.png create mode 100644 etc/deps/x_ite/x_ite.css rename etc/deps/x_ite/{x_ite.d.ts => x_ite.d.mts} (99%) create mode 100644 etc/deps/x_ite/x_ite.mjs create mode 100644 etc/manifest.json delete mode 100644 src/index.civet create mode 100644 tools/makePlugin.bash diff --git a/.gitignore b/.gitignore index bd3dc16..9ec83ad 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ tsbuild jsbuild public/js +extension # Editor backups *~ diff --git a/etc/deps/jquery.js b/etc/deps/jquery.js new file mode 100644 index 0000000..1a86433 --- /dev/null +++ b/etc/deps/jquery.js @@ -0,0 +1,10716 @@ +/*! + * jQuery JavaScript Library v3.7.1 + * https://jquery.com/ + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license + * https://jquery.org/license + * + * Date: 2023-08-28T13:37Z + */ +( function( global, factory ) { + + "use strict"; + + if ( typeof module === "object" && typeof module.exports === "object" ) { + + // For CommonJS and CommonJS-like environments where a proper `window` + // is present, execute the factory and get jQuery. + // For environments that do not have a `window` with a `document` + // (such as Node.js), expose a factory as module.exports. + // This accentuates the need for the creation of a real `window`. + // e.g. var jQuery = require("jquery")(window); + // See ticket trac-14549 for more info. + module.exports = global.document ? + factory( global, true ) : + function( w ) { + if ( !w.document ) { + throw new Error( "jQuery requires a window with a document" ); + } + return factory( w ); + }; + } else { + factory( global ); + } + +// Pass this if window is not defined yet +} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { + +// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 +// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode +// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common +// enough that all such attempts are guarded in a try block. +"use strict"; + +var arr = []; + +var getProto = Object.getPrototypeOf; + +var slice = arr.slice; + +var flat = arr.flat ? function( array ) { + return arr.flat.call( array ); +} : function( array ) { + return arr.concat.apply( [], array ); +}; + + +var push = arr.push; + +var indexOf = arr.indexOf; + +var class2type = {}; + +var toString = class2type.toString; + +var hasOwn = class2type.hasOwnProperty; + +var fnToString = hasOwn.toString; + +var ObjectFunctionString = fnToString.call( Object ); + +var support = {}; + +var isFunction = function isFunction( obj ) { + + // Support: Chrome <=57, Firefox <=52 + // In some browsers, typeof returns "function" for HTML elements + // (i.e., `typeof document.createElement( "object" ) === "function"`). + // We don't want to classify *any* DOM node as a function. + // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 + // Plus for old WebKit, typeof returns "function" for HTML collections + // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) + return typeof obj === "function" && typeof obj.nodeType !== "number" && + typeof obj.item !== "function"; + }; + + +var isWindow = function isWindow( obj ) { + return obj != null && obj === obj.window; + }; + + +var document = window.document; + + + + var preservedScriptAttributes = { + type: true, + src: true, + nonce: true, + noModule: true + }; + + function DOMEval( code, node, doc ) { + doc = doc || document; + + var i, val, + script = doc.createElement( "script" ); + + script.text = code; + if ( node ) { + for ( i in preservedScriptAttributes ) { + + // Support: Firefox 64+, Edge 18+ + // Some browsers don't support the "nonce" property on scripts. + // On the other hand, just using `getAttribute` is not enough as + // the `nonce` attribute is reset to an empty string whenever it + // becomes browsing-context connected. + // See https://github.com/whatwg/html/issues/2369 + // See https://html.spec.whatwg.org/#nonce-attributes + // The `node.getAttribute` check was added for the sake of + // `jQuery.globalEval` so that it can fake a nonce-containing node + // via an object. + val = node[ i ] || node.getAttribute && node.getAttribute( i ); + if ( val ) { + script.setAttribute( i, val ); + } + } + } + doc.head.appendChild( script ).parentNode.removeChild( script ); + } + + +function toType( obj ) { + if ( obj == null ) { + return obj + ""; + } + + // Support: Android <=2.3 only (functionish RegExp) + return typeof obj === "object" || typeof obj === "function" ? + class2type[ toString.call( obj ) ] || "object" : + typeof obj; +} +/* global Symbol */ +// Defining this global in .eslintrc.json would create a danger of using the global +// unguarded in another place, it seems safer to define global only for this module + + + +var version = "3.7.1", + + rhtmlSuffix = /HTML$/i, + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + + // The jQuery object is actually just the init constructor 'enhanced' + // Need init if jQuery is called (just allow error to be thrown if not included) + return new jQuery.fn.init( selector, context ); + }; + +jQuery.fn = jQuery.prototype = { + + // The current version of jQuery being used + jquery: version, + + constructor: jQuery, + + // The default length of a jQuery object is 0 + length: 0, + + toArray: function() { + return slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + + // Return all the elements in a clean array + if ( num == null ) { + return slice.call( this ); + } + + // Return just the one element from the set + return num < 0 ? this[ num + this.length ] : this[ num ]; + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + each: function( callback ) { + return jQuery.each( this, callback ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map( this, function( elem, i ) { + return callback.call( elem, i, elem ); + } ) ); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + even: function() { + return this.pushStack( jQuery.grep( this, function( _elem, i ) { + return ( i + 1 ) % 2; + } ) ); + }, + + odd: function() { + return this.pushStack( jQuery.grep( this, function( _elem, i ) { + return i % 2; + } ) ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); + }, + + end: function() { + return this.prevObject || this.constructor(); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: arr.sort, + splice: arr.splice +}; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[ 0 ] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + + // Skip the boolean and the target + target = arguments[ i ] || {}; + i++; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !isFunction( target ) ) { + target = {}; + } + + // Extend jQuery itself if only one argument is passed + if ( i === length ) { + target = this; + i--; + } + + for ( ; i < length; i++ ) { + + // Only deal with non-null/undefined values + if ( ( options = arguments[ i ] ) != null ) { + + // Extend the base object + for ( name in options ) { + copy = options[ name ]; + + // Prevent Object.prototype pollution + // Prevent never-ending loop + if ( name === "__proto__" || target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject( copy ) || + ( copyIsArray = Array.isArray( copy ) ) ) ) { + src = target[ name ]; + + // Ensure proper type for the source value + if ( copyIsArray && !Array.isArray( src ) ) { + clone = []; + } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { + clone = {}; + } else { + clone = src; + } + copyIsArray = false; + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend( { + + // Unique for each copy of jQuery on the page + expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), + + // Assume jQuery is ready without the ready module + isReady: true, + + error: function( msg ) { + throw new Error( msg ); + }, + + noop: function() {}, + + isPlainObject: function( obj ) { + var proto, Ctor; + + // Detect obvious negatives + // Use toString instead of jQuery.type to catch host objects + if ( !obj || toString.call( obj ) !== "[object Object]" ) { + return false; + } + + proto = getProto( obj ); + + // Objects with no prototype (e.g., `Object.create( null )`) are plain + if ( !proto ) { + return true; + } + + // Objects with prototype are plain iff they were constructed by a global Object function + Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; + return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; + }, + + isEmptyObject: function( obj ) { + var name; + + for ( name in obj ) { + return false; + } + return true; + }, + + // Evaluates a script in a provided context; falls back to the global one + // if not specified. + globalEval: function( code, options, doc ) { + DOMEval( code, { nonce: options && options.nonce }, doc ); + }, + + each: function( obj, callback ) { + var length, i = 0; + + if ( isArrayLike( obj ) ) { + length = obj.length; + for ( ; i < length; i++ ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } else { + for ( i in obj ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } + + return obj; + }, + + + // Retrieve the text value of an array of DOM nodes + text: function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + + // If no nodeType, this is expected to be an array + while ( ( node = elem[ i++ ] ) ) { + + // Do not traverse comment nodes + ret += jQuery.text( node ); + } + } + if ( nodeType === 1 || nodeType === 11 ) { + return elem.textContent; + } + if ( nodeType === 9 ) { + return elem.documentElement.textContent; + } + if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + + // Do not include comment or processing instruction nodes + + return ret; + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArrayLike( Object( arr ) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + return arr == null ? -1 : indexOf.call( arr, elem, i ); + }, + + isXMLDoc: function( elem ) { + var namespace = elem && elem.namespaceURI, + docElem = elem && ( elem.ownerDocument || elem ).documentElement; + + // Assume HTML when documentElement doesn't yet exist, such as inside + // document fragments. + return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" ); + }, + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + merge: function( first, second ) { + var len = +second.length, + j = 0, + i = first.length; + + for ( ; j < len; j++ ) { + first[ i++ ] = second[ j ]; + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, invert ) { + var callbackInverse, + matches = [], + i = 0, + length = elems.length, + callbackExpect = !invert; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + callbackInverse = !callback( elems[ i ], i ); + if ( callbackInverse !== callbackExpect ) { + matches.push( elems[ i ] ); + } + } + + return matches; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var length, value, + i = 0, + ret = []; + + // Go through the array, translating each of the items to their new values + if ( isArrayLike( elems ) ) { + length = elems.length; + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + } + + // Flatten any nested arrays + return flat( ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // jQuery.support is not used in Core but other projects attach their + // properties to it so it needs to exist. + support: support +} ); + +if ( typeof Symbol === "function" ) { + jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; +} + +// Populate the class2type map +jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), + function( _i, name ) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); + } ); + +function isArrayLike( obj ) { + + // Support: real iOS 8.2 only (not reproducible in simulator) + // `in` check used to prevent JIT error (gh-2145) + // hasOwn isn't used here due to false negatives + // regarding Nodelist length in IE + var length = !!obj && "length" in obj && obj.length, + type = toType( obj ); + + if ( isFunction( obj ) || isWindow( obj ) ) { + return false; + } + + return type === "array" || length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj; +} + + +function nodeName( elem, name ) { + + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + +} +var pop = arr.pop; + + +var sort = arr.sort; + + +var splice = arr.splice; + + +var whitespace = "[\\x20\\t\\r\\n\\f]"; + + +var rtrimCSS = new RegExp( + "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", + "g" +); + + + + +// Note: an element does not contain itself +jQuery.contains = function( a, b ) { + var bup = b && b.parentNode; + + return a === bup || !!( bup && bup.nodeType === 1 && ( + + // Support: IE 9 - 11+ + // IE doesn't have `contains` on SVG. + a.contains ? + a.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + ) ); +}; + + + + +// CSS string/identifier serialization +// https://drafts.csswg.org/cssom/#common-serializing-idioms +var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; + +function fcssescape( ch, asCodePoint ) { + if ( asCodePoint ) { + + // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER + if ( ch === "\0" ) { + return "\uFFFD"; + } + + // Control characters and (dependent upon position) numbers get escaped as code points + return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; + } + + // Other potentially-special ASCII characters get backslash-escaped + return "\\" + ch; +} + +jQuery.escapeSelector = function( sel ) { + return ( sel + "" ).replace( rcssescape, fcssescape ); +}; + + + + +var preferredDoc = document, + pushNative = push; + +( function() { + +var i, + Expr, + outermostContext, + sortInput, + hasDuplicate, + push = pushNative, + + // Local document vars + document, + documentElement, + documentIsHTML, + rbuggyQSA, + matches, + + // Instance-specific data + expando = jQuery.expando, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + nonnativeSelectorCache = createCache(), + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + } + return 0; + }, + + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" + + "loop|multiple|open|readonly|required|scoped", + + // Regular expressions + + // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram + identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + + "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", + + // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + + + // Operator (capture 2) + "*([*^$|!~]?=)" + whitespace + + + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + + whitespace + "*\\]", + + pseudos = ":(" + identifier + ")(?:\\((" + + + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: + // 1. quoted (capture 3; capture 4 or capture 5) + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + + + // 2. simple (capture 6) + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + + + // 3. anything else (capture 2) + ".*" + + ")\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rwhitespace = new RegExp( whitespace + "+", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + + whitespace + "*" ), + rdescend = new RegExp( whitespace + "|>" ), + + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + ID: new RegExp( "^#(" + identifier + ")" ), + CLASS: new RegExp( "^\\.(" + identifier + ")" ), + TAG: new RegExp( "^(" + identifier + "|[*])" ), + ATTR: new RegExp( "^" + attributes ), + PSEUDO: new RegExp( "^" + pseudos ), + CHILD: new RegExp( + "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + bool: new RegExp( "^(?:" + booleans + ")$", "i" ), + + // For use in libraries implementing .is() + // We use this for POS matching in `select` + needsContext: new RegExp( "^" + whitespace + + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rsibling = /[+~]/, + + // CSS escapes + // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + + "?|\\\\([^\\r\\n\\f])", "g" ), + funescape = function( escape, nonHex ) { + var high = "0x" + escape.slice( 1 ) - 0x10000; + + if ( nonHex ) { + + // Strip the backslash prefix from a non-hex escape sequence + return nonHex; + } + + // Replace a hexadecimal escape sequence with the encoded Unicode code point + // Support: IE <=11+ + // For values outside the Basic Multilingual Plane (BMP), manually construct a + // surrogate pair + return high < 0 ? + String.fromCharCode( high + 0x10000 ) : + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }, + + // Used for iframes; see `setDocument`. + // Support: IE 9 - 11+, Edge 12 - 18+ + // Removing the function wrapper causes a "Permission Denied" + // error in IE/Edge. + unloadHandler = function() { + setDocument(); + }, + + inDisabledFieldset = addCombinator( + function( elem ) { + return elem.disabled === true && nodeName( elem, "fieldset" ); + }, + { dir: "parentNode", next: "legend" } + ); + +// Support: IE <=9 only +// Accessing document.activeElement can throw unexpectedly +// https://bugs.jquery.com/ticket/13393 +function safeActiveElement() { + try { + return document.activeElement; + } catch ( err ) { } +} + +// Optimize for push.apply( _, NodeList ) +try { + push.apply( + ( arr = slice.call( preferredDoc.childNodes ) ), + preferredDoc.childNodes + ); + + // Support: Android <=4.0 + // Detect silently failing push.apply + // eslint-disable-next-line no-unused-expressions + arr[ preferredDoc.childNodes.length ].nodeType; +} catch ( e ) { + push = { + apply: function( target, els ) { + pushNative.apply( target, slice.call( els ) ); + }, + call: function( target ) { + pushNative.apply( target, slice.call( arguments, 1 ) ); + } + }; +} + +function find( selector, context, results, seed ) { + var m, i, elem, nid, match, groups, newSelector, + newContext = context && context.ownerDocument, + + // nodeType defaults to 9, since context defaults to document + nodeType = context ? context.nodeType : 9; + + results = results || []; + + // Return early from calls with invalid selector or context + if ( typeof selector !== "string" || !selector || + nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { + + return results; + } + + // Try to shortcut find operations (as opposed to filters) in HTML documents + if ( !seed ) { + setDocument( context ); + context = context || document; + + if ( documentIsHTML ) { + + // If the selector is sufficiently simple, try using a "get*By*" DOM method + // (excepting DocumentFragment context, where the methods don't exist) + if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { + + // ID selector + if ( ( m = match[ 1 ] ) ) { + + // Document context + if ( nodeType === 9 ) { + if ( ( elem = context.getElementById( m ) ) ) { + + // Support: IE 9 only + // getElementById can match elements by name instead of ID + if ( elem.id === m ) { + push.call( results, elem ); + return results; + } + } else { + return results; + } + + // Element context + } else { + + // Support: IE 9 only + // getElementById can match elements by name instead of ID + if ( newContext && ( elem = newContext.getElementById( m ) ) && + find.contains( context, elem ) && + elem.id === m ) { + + push.call( results, elem ); + return results; + } + } + + // Type selector + } else if ( match[ 2 ] ) { + push.apply( results, context.getElementsByTagName( selector ) ); + return results; + + // Class selector + } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) { + push.apply( results, context.getElementsByClassName( m ) ); + return results; + } + } + + // Take advantage of querySelectorAll + if ( !nonnativeSelectorCache[ selector + " " ] && + ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) { + + newSelector = selector; + newContext = context; + + // qSA considers elements outside a scoping root when evaluating child or + // descendant combinators, which is not what we want. + // In such cases, we work around the behavior by prefixing every selector in the + // list with an ID selector referencing the scope context. + // The technique has to be used as well when a leading combinator is used + // as such selectors are not recognized by querySelectorAll. + // Thanks to Andrew Dupont for this technique. + if ( nodeType === 1 && + ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) { + + // Expand context for sibling selectors + newContext = rsibling.test( selector ) && testContext( context.parentNode ) || + context; + + // We can use :scope instead of the ID hack if the browser + // supports it & if we're not changing the context. + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when + // strict-comparing two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( newContext != context || !support.scope ) { + + // Capture the context ID, setting it first if necessary + if ( ( nid = context.getAttribute( "id" ) ) ) { + nid = jQuery.escapeSelector( nid ); + } else { + context.setAttribute( "id", ( nid = expando ) ); + } + } + + // Prefix every selector in the list + groups = tokenize( selector ); + i = groups.length; + while ( i-- ) { + groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + + toSelector( groups[ i ] ); + } + newSelector = groups.join( "," ); + } + + try { + push.apply( results, + newContext.querySelectorAll( newSelector ) + ); + return results; + } catch ( qsaError ) { + nonnativeSelectorCache( selector, true ); + } finally { + if ( nid === expando ) { + context.removeAttribute( "id" ); + } + } + } + } + } + + // All others + return select( selector.replace( rtrimCSS, "$1" ), context, results, seed ); +} + +/** + * Create key-value caches of limited size + * @returns {function(string, object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var keys = []; + + function cache( key, value ) { + + // Use (key + " ") to avoid collision with native prototype properties + // (see https://github.com/jquery/sizzle/issues/157) + if ( keys.push( key + " " ) > Expr.cacheLength ) { + + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return ( cache[ key + " " ] = value ); + } + return cache; +} + +/** + * Mark a function for special use by jQuery selector module + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created element and returns a boolean result + */ +function assert( fn ) { + var el = document.createElement( "fieldset" ); + + try { + return !!fn( el ); + } catch ( e ) { + return false; + } finally { + + // Remove from its parent by default + if ( el.parentNode ) { + el.parentNode.removeChild( el ); + } + + // release memory in IE + el = null; + } +} + +/** + * Returns a function to use in pseudos for input types + * @param {String} type + */ +function createInputPseudo( type ) { + return function( elem ) { + return nodeName( elem, "input" ) && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for buttons + * @param {String} type + */ +function createButtonPseudo( type ) { + return function( elem ) { + return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) && + elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for :enabled/:disabled + * @param {Boolean} disabled true for :disabled; false for :enabled + */ +function createDisabledPseudo( disabled ) { + + // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable + return function( elem ) { + + // Only certain elements can match :enabled or :disabled + // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled + // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled + if ( "form" in elem ) { + + // Check for inherited disabledness on relevant non-disabled elements: + // * listed form-associated elements in a disabled fieldset + // https://html.spec.whatwg.org/multipage/forms.html#category-listed + // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled + // * option elements in a disabled optgroup + // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled + // All such elements have a "form" property. + if ( elem.parentNode && elem.disabled === false ) { + + // Option elements defer to a parent optgroup if present + if ( "label" in elem ) { + if ( "label" in elem.parentNode ) { + return elem.parentNode.disabled === disabled; + } else { + return elem.disabled === disabled; + } + } + + // Support: IE 6 - 11+ + // Use the isDisabled shortcut property to check for disabled fieldset ancestors + return elem.isDisabled === disabled || + + // Where there is no isDisabled, check manually + elem.isDisabled !== !disabled && + inDisabledFieldset( elem ) === disabled; + } + + return elem.disabled === disabled; + + // Try to winnow out elements that can't be disabled before trusting the disabled property. + // Some victims get caught in our net (label, legend, menu, track), but it shouldn't + // even exist on them, let alone have a boolean value. + } else if ( "label" in elem ) { + return elem.disabled === disabled; + } + + // Remaining elements are neither :enabled nor :disabled + return false; + }; +} + +/** + * Returns a function to use in pseudos for positionals + * @param {Function} fn + */ +function createPositionalPseudo( fn ) { + return markFunction( function( argument ) { + argument = +argument; + return markFunction( function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ ( j = matchIndexes[ i ] ) ] ) { + seed[ j ] = !( matches[ j ] = seed[ j ] ); + } + } + } ); + } ); +} + +/** + * Checks a node for validity as a jQuery selector context + * @param {Element|Object=} context + * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value + */ +function testContext( context ) { + return context && typeof context.getElementsByTagName !== "undefined" && context; +} + +/** + * Sets document-related variables once based on the current document + * @param {Element|Object} [node] An element or document object to use to set the document + * @returns {Object} Returns the current document + */ +function setDocument( node ) { + var subWindow, + doc = node ? node.ownerDocument || node : preferredDoc; + + // Return early if doc is invalid or already selected + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { + return document; + } + + // Update global variables + document = doc; + documentElement = document.documentElement; + documentIsHTML = !jQuery.isXMLDoc( document ); + + // Support: iOS 7 only, IE 9 - 11+ + // Older browsers didn't support unprefixed `matches`. + matches = documentElement.matches || + documentElement.webkitMatchesSelector || + documentElement.msMatchesSelector; + + // Support: IE 9 - 11+, Edge 12 - 18+ + // Accessing iframe documents after unload throws "permission denied" errors + // (see trac-13936). + // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`, + // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well. + if ( documentElement.msMatchesSelector && + + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + preferredDoc != document && + ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { + + // Support: IE 9 - 11+, Edge 12 - 18+ + subWindow.addEventListener( "unload", unloadHandler ); + } + + // Support: IE <10 + // Check if getElementById returns elements by name + // The broken getElementById methods don't pick up programmatically-set names, + // so use a roundabout getElementsByName test + support.getById = assert( function( el ) { + documentElement.appendChild( el ).id = jQuery.expando; + return !document.getElementsByName || + !document.getElementsByName( jQuery.expando ).length; + } ); + + // Support: IE 9 only + // Check to see if it's possible to do matchesSelector + // on a disconnected node. + support.disconnectedMatch = assert( function( el ) { + return matches.call( el, "*" ); + } ); + + // Support: IE 9 - 11+, Edge 12 - 18+ + // IE/Edge don't support the :scope pseudo-class. + support.scope = assert( function() { + return document.querySelectorAll( ":scope" ); + } ); + + // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only + // Make sure the `:has()` argument is parsed unforgivingly. + // We include `*` in the test to detect buggy implementations that are + // _selectively_ forgiving (specifically when the list includes at least + // one valid selector). + // Note that we treat complete lack of support for `:has()` as if it were + // spec-compliant support, which is fine because use of `:has()` in such + // environments will fail in the qSA path and fall back to jQuery traversal + // anyway. + support.cssHas = assert( function() { + try { + document.querySelector( ":has(*,:jqfake)" ); + return false; + } catch ( e ) { + return true; + } + } ); + + // ID filter and find + if ( support.getById ) { + Expr.filter.ID = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + return elem.getAttribute( "id" ) === attrId; + }; + }; + Expr.find.ID = function( id, context ) { + if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { + var elem = context.getElementById( id ); + return elem ? [ elem ] : []; + } + }; + } else { + Expr.filter.ID = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== "undefined" && + elem.getAttributeNode( "id" ); + return node && node.value === attrId; + }; + }; + + // Support: IE 6 - 7 only + // getElementById is not reliable as a find shortcut + Expr.find.ID = function( id, context ) { + if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { + var node, i, elems, + elem = context.getElementById( id ); + + if ( elem ) { + + // Verify the id attribute + node = elem.getAttributeNode( "id" ); + if ( node && node.value === id ) { + return [ elem ]; + } + + // Fall back on getElementsByName + elems = context.getElementsByName( id ); + i = 0; + while ( ( elem = elems[ i++ ] ) ) { + node = elem.getAttributeNode( "id" ); + if ( node && node.value === id ) { + return [ elem ]; + } + } + } + + return []; + } + }; + } + + // Tag + Expr.find.TAG = function( tag, context ) { + if ( typeof context.getElementsByTagName !== "undefined" ) { + return context.getElementsByTagName( tag ); + + // DocumentFragment nodes don't have gEBTN + } else { + return context.querySelectorAll( tag ); + } + }; + + // Class + Expr.find.CLASS = function( className, context ) { + if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { + return context.getElementsByClassName( className ); + } + }; + + /* QSA/matchesSelector + ---------------------------------------------------------------------- */ + + // QSA and matchesSelector support + + rbuggyQSA = []; + + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert( function( el ) { + + var input; + + documentElement.appendChild( el ).innerHTML = + "" + + ""; + + // Support: iOS <=7 - 8 only + // Boolean attributes and "value" are not treated correctly in some XML documents + if ( !el.querySelectorAll( "[selected]" ).length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); + } + + // Support: iOS <=7 - 8 only + if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { + rbuggyQSA.push( "~=" ); + } + + // Support: iOS 8 only + // https://bugs.webkit.org/show_bug.cgi?id=136851 + // In-page `selector#id sibling-combinator selector` fails + if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { + rbuggyQSA.push( ".#.+[+~]" ); + } + + // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ + // In some of the document kinds, these selectors wouldn't work natively. + // This is probably OK but for backwards compatibility we want to maintain + // handling them through jQuery traversal in jQuery 3.x. + if ( !el.querySelectorAll( ":checked" ).length ) { + rbuggyQSA.push( ":checked" ); + } + + // Support: Windows 8 Native Apps + // The type and name attributes are restricted during .innerHTML assignment + input = document.createElement( "input" ); + input.setAttribute( "type", "hidden" ); + el.appendChild( input ).setAttribute( "name", "D" ); + + // Support: IE 9 - 11+ + // IE's :disabled selector does not pick up the children of disabled fieldsets + // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ + // In some of the document kinds, these selectors wouldn't work natively. + // This is probably OK but for backwards compatibility we want to maintain + // handling them through jQuery traversal in jQuery 3.x. + documentElement.appendChild( el ).disabled = true; + if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Support: IE 11+, Edge 15 - 18+ + // IE 11/Edge don't find elements on a `[name='']` query in some cases. + // Adding a temporary attribute to the document before the selection works + // around the issue. + // Interestingly, IE 10 & older don't seem to have the issue. + input = document.createElement( "input" ); + input.setAttribute( "name", "" ); + el.appendChild( input ); + if ( !el.querySelectorAll( "[name='']" ).length ) { + rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + + whitespace + "*(?:''|\"\")" ); + } + } ); + + if ( !support.cssHas ) { + + // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ + // Our regular `try-catch` mechanism fails to detect natively-unsupported + // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) + // in browsers that parse the `:has()` argument as a forgiving selector list. + // https://drafts.csswg.org/selectors/#relational now requires the argument + // to be parsed unforgivingly, but browsers have not yet fully adjusted. + rbuggyQSA.push( ":has" ); + } + + rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); + + /* Sorting + ---------------------------------------------------------------------- */ + + // Document order sorting + sortOrder = function( a, b ) { + + // Flag for duplicate removal + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + // Sort on method existence if only one input has compareDocumentPosition + var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; + if ( compare ) { + return compare; + } + + // Calculate position if both inputs belong to the same document + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? + a.compareDocumentPosition( b ) : + + // Otherwise we know they are disconnected + 1; + + // Disconnected nodes + if ( compare & 1 || + ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { + + // Choose the first element that is related to our preferred document + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( a === document || a.ownerDocument == preferredDoc && + find.contains( preferredDoc, a ) ) { + return -1; + } + + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( b === document || b.ownerDocument == preferredDoc && + find.contains( preferredDoc, b ) ) { + return 1; + } + + // Maintain original order + return sortInput ? + ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : + 0; + } + + return compare & 4 ? -1 : 1; + }; + + return document; +} + +find.matches = function( expr, elements ) { + return find( expr, null, null, elements ); +}; + +find.matchesSelector = function( elem, expr ) { + setDocument( elem ); + + if ( documentIsHTML && + !nonnativeSelectorCache[ expr + " " ] && + ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { + + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || + + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch ( e ) { + nonnativeSelectorCache( expr, true ); + } + } + + return find( expr, document, null, [ elem ] ).length > 0; +}; + +find.contains = function( context, elem ) { + + // Set document vars if needed + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( ( context.ownerDocument || context ) != document ) { + setDocument( context ); + } + return jQuery.contains( context, elem ); +}; + + +find.attr = function( elem, name ) { + + // Set document vars if needed + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( ( elem.ownerDocument || elem ) != document ) { + setDocument( elem ); + } + + var fn = Expr.attrHandle[ name.toLowerCase() ], + + // Don't get fooled by Object.prototype properties (see trac-13807) + val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? + fn( elem, name, !documentIsHTML ) : + undefined; + + if ( val !== undefined ) { + return val; + } + + return elem.getAttribute( name ); +}; + +find.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Document sorting and removing duplicates + * @param {ArrayLike} results + */ +jQuery.uniqueSort = function( results ) { + var elem, + duplicates = [], + j = 0, + i = 0; + + // Unless we *know* we can detect duplicates, assume their presence + // + // Support: Android <=4.0+ + // Testing for detecting duplicates is unpredictable so instead assume we can't + // depend on duplicate detection in all browsers without a stable sort. + hasDuplicate = !support.sortStable; + sortInput = !support.sortStable && slice.call( results, 0 ); + sort.call( results, sortOrder ); + + if ( hasDuplicate ) { + while ( ( elem = results[ i++ ] ) ) { + if ( elem === results[ i ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + splice.call( results, duplicates[ j ], 1 ); + } + } + + // Clear input after sorting to release objects + // See https://github.com/jquery/sizzle/pull/225 + sortInput = null; + + return results; +}; + +jQuery.fn.uniqueSort = function() { + return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) ); +}; + +Expr = jQuery.expr = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + attrHandle: {}, + + find: {}, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + ATTR: function( match ) { + match[ 1 ] = match[ 1 ].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" ) + .replace( runescape, funescape ); + + if ( match[ 2 ] === "~=" ) { + match[ 3 ] = " " + match[ 3 ] + " "; + } + + return match.slice( 0, 4 ); + }, + + CHILD: function( match ) { + + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 what (child|of-type) + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 4 xn-component of xn+y argument ([+-]?\d*n|) + 5 sign of xn-component + 6 x of xn-component + 7 sign of y-component + 8 y of y-component + */ + match[ 1 ] = match[ 1 ].toLowerCase(); + + if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { + + // nth-* requires argument + if ( !match[ 3 ] ) { + find.error( match[ 0 ] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[ 4 ] = +( match[ 4 ] ? + match[ 5 ] + ( match[ 6 ] || 1 ) : + 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) + ); + match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); + + // other types prohibit arguments + } else if ( match[ 3 ] ) { + find.error( match[ 0 ] ); + } + + return match; + }, + + PSEUDO: function( match ) { + var excess, + unquoted = !match[ 6 ] && match[ 2 ]; + + if ( matchExpr.CHILD.test( match[ 0 ] ) ) { + return null; + } + + // Accept quoted arguments as-is + if ( match[ 3 ] ) { + match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && + + // Get excess from tokenize (recursively) + ( excess = tokenize( unquoted, true ) ) && + + // advance to the next closing parenthesis + ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { + + // excess is a negative index + match[ 0 ] = match[ 0 ].slice( 0, excess ); + match[ 2 ] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + TAG: function( nodeNameSelector ) { + var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); + return nodeNameSelector === "*" ? + function() { + return true; + } : + function( elem ) { + return nodeName( elem, expectedNodeName ); + }; + }, + + CLASS: function( className ) { + var pattern = classCache[ className + " " ]; + + return pattern || + ( pattern = new RegExp( "(^|" + whitespace + ")" + className + + "(" + whitespace + "|$)" ) ) && + classCache( className, function( elem ) { + return pattern.test( + typeof elem.className === "string" && elem.className || + typeof elem.getAttribute !== "undefined" && + elem.getAttribute( "class" ) || + "" + ); + } ); + }, + + ATTR: function( name, operator, check ) { + return function( elem ) { + var result = find.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + if ( operator === "=" ) { + return result === check; + } + if ( operator === "!=" ) { + return result !== check; + } + if ( operator === "^=" ) { + return check && result.indexOf( check ) === 0; + } + if ( operator === "*=" ) { + return check && result.indexOf( check ) > -1; + } + if ( operator === "$=" ) { + return check && result.slice( -check.length ) === check; + } + if ( operator === "~=" ) { + return ( " " + result.replace( rwhitespace, " " ) + " " ) + .indexOf( check ) > -1; + } + if ( operator === "|=" ) { + return result === check || result.slice( 0, check.length + 1 ) === check + "-"; + } + + return false; + }; + }, + + CHILD: function( type, what, _argument, first, last ) { + var simple = type.slice( 0, 3 ) !== "nth", + forward = type.slice( -4 ) !== "last", + ofType = what === "of-type"; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, _context, xml ) { + var cache, outerCache, node, nodeIndex, start, + dir = simple !== forward ? "nextSibling" : "previousSibling", + parent = elem.parentNode, + name = ofType && elem.nodeName.toLowerCase(), + useCache = !xml && !ofType, + diff = false; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( ( node = node[ dir ] ) ) { + if ( ofType ? + nodeName( node, name ) : + node.nodeType === 1 ) { + + return false; + } + } + + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === "only" && !start && "nextSibling"; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + + // Seek `elem` from a previously-cached index + outerCache = parent[ expando ] || ( parent[ expando ] = {} ); + cache = outerCache[ type ] || []; + nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; + diff = nodeIndex && cache[ 2 ]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( ( node = ++nodeIndex && node && node[ dir ] || + + // Fallback to seeking `elem` from the start + ( diff = nodeIndex = 0 ) || start.pop() ) ) { + + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + outerCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + } else { + + // Use previously-cached element index if available + if ( useCache ) { + outerCache = elem[ expando ] || ( elem[ expando ] = {} ); + cache = outerCache[ type ] || []; + nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; + diff = nodeIndex; + } + + // xml :nth-child(...) + // or :nth-last-child(...) or :nth(-last)?-of-type(...) + if ( diff === false ) { + + // Use the same loop as above to seek `elem` from the start + while ( ( node = ++nodeIndex && node && node[ dir ] || + ( diff = nodeIndex = 0 ) || start.pop() ) ) { + + if ( ( ofType ? + nodeName( node, name ) : + node.nodeType === 1 ) && + ++diff ) { + + // Cache the index of each encountered element + if ( useCache ) { + outerCache = node[ expando ] || + ( node[ expando ] = {} ); + outerCache[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + PSEUDO: function( pseudo, argument ) { + + // pseudo-class names are case-insensitive + // https://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + find.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as jQuery does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction( function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf.call( seed, matched[ i ] ); + seed[ idx ] = !( matches[ idx ] = matched[ i ] ); + } + } ) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + + // Potentially complex pseudos + not: markFunction( function( selector ) { + + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrimCSS, "$1" ) ); + + return matcher[ expando ] ? + markFunction( function( seed, matches, _context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( ( elem = unmatched[ i ] ) ) { + seed[ i ] = !( matches[ i ] = elem ); + } + } + } ) : + function( elem, _context, xml ) { + input[ 0 ] = elem; + matcher( input, null, xml, results ); + + // Don't keep the element + // (see https://github.com/jquery/sizzle/issues/299) + input[ 0 ] = null; + return !results.pop(); + }; + } ), + + has: markFunction( function( selector ) { + return function( elem ) { + return find( selector, elem ).length > 0; + }; + } ), + + contains: markFunction( function( text ) { + text = text.replace( runescape, funescape ); + return function( elem ) { + return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1; + }; + } ), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // https://www.w3.org/TR/selectors/#lang-pseudo + lang: markFunction( function( lang ) { + + // lang value must be a valid identifier + if ( !ridentifier.test( lang || "" ) ) { + find.error( "unsupported lang: " + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( ( elemLang = documentIsHTML ? + elem.lang : + elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; + } + } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); + return false; + }; + } ), + + // Miscellaneous + target: function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + root: function( elem ) { + return elem === documentElement; + }, + + focus: function( elem ) { + return elem === safeActiveElement() && + document.hasFocus() && + !!( elem.type || elem.href || ~elem.tabIndex ); + }, + + // Boolean properties + enabled: createDisabledPseudo( false ), + disabled: createDisabledPseudo( true ), + + checked: function( elem ) { + + // In CSS3, :checked should return both checked and selected elements + // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + return ( nodeName( elem, "input" ) && !!elem.checked ) || + ( nodeName( elem, "option" ) && !!elem.selected ); + }, + + selected: function( elem ) { + + // Support: IE <=11+ + // Accessing the selectedIndex property + // forces the browser to treat the default option as + // selected when in an optgroup. + if ( elem.parentNode ) { + // eslint-disable-next-line no-unused-expressions + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + empty: function( elem ) { + + // https://www.w3.org/TR/selectors/#empty-pseudo + // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), + // but not by others (comment: 8; processing instruction: 7; etc.) + // nodeType < 6 works because attributes (2) do not appear as children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeType < 6 ) { + return false; + } + } + return true; + }, + + parent: function( elem ) { + return !Expr.pseudos.empty( elem ); + }, + + // Element/input types + header: function( elem ) { + return rheader.test( elem.nodeName ); + }, + + input: function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + button: function( elem ) { + return nodeName( elem, "input" ) && elem.type === "button" || + nodeName( elem, "button" ); + }, + + text: function( elem ) { + var attr; + return nodeName( elem, "input" ) && elem.type === "text" && + + // Support: IE <10 only + // New HTML5 attribute values (e.g., "search") appear + // with elem.type === "text" + ( ( attr = elem.getAttribute( "type" ) ) == null || + attr.toLowerCase() === "text" ); + }, + + // Position-in-collection + first: createPositionalPseudo( function() { + return [ 0 ]; + } ), + + last: createPositionalPseudo( function( _matchIndexes, length ) { + return [ length - 1 ]; + } ), + + eq: createPositionalPseudo( function( _matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + } ), + + even: createPositionalPseudo( function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + } ), + + odd: createPositionalPseudo( function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + } ), + + lt: createPositionalPseudo( function( matchIndexes, length, argument ) { + var i; + + if ( argument < 0 ) { + i = argument + length; + } else if ( argument > length ) { + i = length; + } else { + i = argument; + } + + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + } ), + + gt: createPositionalPseudo( function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + } ) + } +}; + +Expr.pseudos.nth = Expr.pseudos.eq; + +// Add button/input type pseudos +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); +} +for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); +} + +// Easy API for creating new setFilters +function setFilters() {} +setFilters.prototype = Expr.filters = Expr.pseudos; +Expr.setFilters = new setFilters(); + +function tokenize( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || ( match = rcomma.exec( soFar ) ) ) { + if ( match ) { + + // Don't consume trailing commas as valid + soFar = soFar.slice( match[ 0 ].length ) || soFar; + } + groups.push( ( tokens = [] ) ); + } + + matched = false; + + // Combinators + if ( ( match = rleadingCombinator.exec( soFar ) ) ) { + matched = match.shift(); + tokens.push( { + value: matched, + + // Cast descendant combinators to space + type: match[ 0 ].replace( rtrimCSS, " " ) + } ); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || + ( match = preFilters[ type ]( match ) ) ) ) { + matched = match.shift(); + tokens.push( { + value: matched, + type: type, + matches: match + } ); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + if ( parseOnly ) { + return soFar.length; + } + + return soFar ? + find.error( selector ) : + + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +} + +function toSelector( tokens ) { + var i = 0, + len = tokens.length, + selector = ""; + for ( ; i < len; i++ ) { + selector += tokens[ i ].value; + } + return selector; +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + skip = combinator.next, + key = skip || dir, + checkNonElements = base && key === "parentNode", + doneName = done++; + + return combinator.first ? + + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( ( elem = elem[ dir ] ) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + return false; + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var oldCache, outerCache, + newCache = [ dirruns, doneName ]; + + // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching + if ( xml ) { + while ( ( elem = elem[ dir ] ) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( ( elem = elem[ dir ] ) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || ( elem[ expando ] = {} ); + + if ( skip && nodeName( elem, skip ) ) { + elem = elem[ dir ] || elem; + } else if ( ( oldCache = outerCache[ key ] ) && + oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { + + // Assign to newCache so results back-propagate to previous elements + return ( newCache[ 2 ] = oldCache[ 2 ] ); + } else { + + // Reuse newcache so results back-propagate to previous elements + outerCache[ key ] = newCache; + + // A match means we're done; a fail means we have to keep checking + if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { + return true; + } + } + } + } + } + return false; + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[ i ]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[ 0 ]; +} + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + find( selector, contexts[ i ], results ); + } + return results; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( ( elem = unmatched[ i ] ) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction( function( seed, results, context, xml ) { + var temp, i, elem, matcherOut, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || + multipleContexts( selector || "*", + context.nodeType ? [ context ] : context, [] ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems; + + if ( matcher ) { + + // If we have a postFinder, or filtered seed, or non-seed postFilter + // or preexisting results, + matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results; + + // Find primary matches + matcher( matcherIn, matcherOut, context, xml ); + } else { + matcherOut = matcherIn; + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( ( elem = temp[ i ] ) ) { + matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( ( elem = matcherOut[ i ] ) ) { + + // Restore matcherIn since elem is not yet a final match + temp.push( ( matcherIn[ i ] = elem ) ); + } + } + postFinder( null, ( matcherOut = [] ), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( ( elem = matcherOut[ i ] ) && + ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) { + + seed[ temp ] = !( results[ temp ] = elem ); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + } ); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[ 0 ].type ], + implicitRelative = leadingRelative || Expr.relative[ " " ], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf.call( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || ( + ( checkContext = context ).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + + // Avoid hanging onto element + // (see https://github.com/jquery/sizzle/issues/299) + checkContext = null; + return ret; + } ]; + + for ( ; i < len; i++ ) { + if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { + matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; + } else { + matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[ j ].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( + + // If the preceding token was a descendant combinator, insert an implicit any-element `*` + tokens.slice( 0, i - 1 ) + .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) + ).replace( rtrimCSS, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + var bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, outermost ) { + var elem, j, matcher, + matchedCount = 0, + i = "0", + unmatched = seed && [], + setMatched = [], + contextBackup = outermostContext, + + // We must always have either seed elements or outermost context + elems = seed || byElement && Expr.find.TAG( "*", outermost ), + + // Use integer dirruns iff this is the outermost matcher + dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), + len = elems.length; + + if ( outermost ) { + + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + outermostContext = context == document || context || outermost; + } + + // Add elements passing elementMatchers directly to results + // Support: iOS <=7 - 9 only + // Tolerate NodeList properties (IE: "length"; Safari: ) matching + // elements by id. (see trac-14142) + for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { + if ( byElement && elem ) { + j = 0; + + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( !context && elem.ownerDocument != document ) { + setDocument( elem ); + xml = !documentIsHTML; + } + while ( ( matcher = elementMatchers[ j++ ] ) ) { + if ( matcher( elem, context || document, xml ) ) { + push.call( results, elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + + // They will have gone through all possible matchers + if ( ( elem = !matcher && elem ) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // `i` is now the count of elements visited above, and adding it to `matchedCount` + // makes the latter nonnegative. + matchedCount += i; + + // Apply set filters to unmatched elements + // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` + // equals `i`), unless we didn't visit _any_ elements in the above loop because we have + // no element matchers and no seed. + // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that + // case, which will result in a "00" `matchedCount` that differs from `i` but is also + // numerically zero. + if ( bySet && i !== matchedCount ) { + j = 0; + while ( ( matcher = setMatchers[ j++ ] ) ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !( unmatched[ i ] || setMatched[ i ] ) ) { + setMatched[ i ] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + jQuery.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +function compile( selector, match /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ selector + " " ]; + + if ( !cached ) { + + // Generate a function of recursive functions that can be used to check each element + if ( !match ) { + match = tokenize( selector ); + } + i = match.length; + while ( i-- ) { + cached = matcherFromTokens( match[ i ] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, + matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + + // Save selector and tokenization + cached.selector = selector; + } + return cached; +} + +/** + * A low-level selection function that works with jQuery's compiled + * selector functions + * @param {String|Function} selector A selector or a pre-compiled + * selector function built with jQuery selector compile + * @param {Element} context + * @param {Array} [results] + * @param {Array} [seed] A set of elements to match against + */ +function select( selector, context, results, seed ) { + var i, tokens, token, type, find, + compiled = typeof selector === "function" && selector, + match = !seed && tokenize( ( selector = compiled.selector || selector ) ); + + results = results || []; + + // Try to minimize operations if there is only one selector in the list and no seed + // (the latter of which guarantees us context) + if ( match.length === 1 ) { + + // Reduce context if the leading compound selector is an ID + tokens = match[ 0 ] = match[ 0 ].slice( 0 ); + if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && + context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { + + context = ( Expr.find.ID( + token.matches[ 0 ].replace( runescape, funescape ), + context + ) || [] )[ 0 ]; + if ( !context ) { + return results; + + // Precompiled matchers will still verify ancestry, so step up a level + } else if ( compiled ) { + context = context.parentNode; + } + + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[ i ]; + + // Abort if we hit a combinator + if ( Expr.relative[ ( type = token.type ) ] ) { + break; + } + if ( ( find = Expr.find[ type ] ) ) { + + // Search, expanding context for leading sibling combinators + if ( ( seed = find( + token.matches[ 0 ].replace( runescape, funescape ), + rsibling.test( tokens[ 0 ].type ) && + testContext( context.parentNode ) || context + ) ) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, seed ); + return results; + } + + break; + } + } + } + } + + // Compile and execute a filtering function if one is not provided + // Provide `match` to avoid retokenization if we modified the selector above + ( compiled || compile( selector, match ) )( + seed, + context, + !documentIsHTML, + results, + !context || rsibling.test( selector ) && testContext( context.parentNode ) || context + ); + return results; +} + +// One-time assignments + +// Support: Android <=4.0 - 4.1+ +// Sort stability +support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; + +// Initialize against the default document +setDocument(); + +// Support: Android <=4.0 - 4.1+ +// Detached nodes confoundingly follow *each other* +support.sortDetached = assert( function( el ) { + + // Should return 1, but returns 4 (following) + return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; +} ); + +jQuery.find = find; + +// Deprecated +jQuery.expr[ ":" ] = jQuery.expr.pseudos; +jQuery.unique = jQuery.uniqueSort; + +// These have always been private, but they used to be documented as part of +// Sizzle so let's maintain them for now for backwards compatibility purposes. +find.compile = compile; +find.select = select; +find.setDocument = setDocument; +find.tokenize = tokenize; + +find.escape = jQuery.escapeSelector; +find.getText = jQuery.text; +find.isXML = jQuery.isXMLDoc; +find.selectors = jQuery.expr; +find.support = jQuery.support; +find.uniqueSort = jQuery.uniqueSort; + + /* eslint-enable */ + +} )(); + + +var dir = function( elem, dir, until ) { + var matched = [], + truncate = until !== undefined; + + while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { + if ( elem.nodeType === 1 ) { + if ( truncate && jQuery( elem ).is( until ) ) { + break; + } + matched.push( elem ); + } + } + return matched; +}; + + +var siblings = function( n, elem ) { + var matched = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + matched.push( n ); + } + } + + return matched; +}; + + +var rneedsContext = jQuery.expr.match.needsContext; + +var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); + + + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, not ) { + if ( isFunction( qualifier ) ) { + return jQuery.grep( elements, function( elem, i ) { + return !!qualifier.call( elem, i, elem ) !== not; + } ); + } + + // Single element + if ( qualifier.nodeType ) { + return jQuery.grep( elements, function( elem ) { + return ( elem === qualifier ) !== not; + } ); + } + + // Arraylike of elements (jQuery, arguments, Array) + if ( typeof qualifier !== "string" ) { + return jQuery.grep( elements, function( elem ) { + return ( indexOf.call( qualifier, elem ) > -1 ) !== not; + } ); + } + + // Filtered directly for both simple and complex selectors + return jQuery.filter( qualifier, elements, not ); +} + +jQuery.filter = function( expr, elems, not ) { + var elem = elems[ 0 ]; + + if ( not ) { + expr = ":not(" + expr + ")"; + } + + if ( elems.length === 1 && elem.nodeType === 1 ) { + return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; + } + + return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { + return elem.nodeType === 1; + } ) ); +}; + +jQuery.fn.extend( { + find: function( selector ) { + var i, ret, + len = this.length, + self = this; + + if ( typeof selector !== "string" ) { + return this.pushStack( jQuery( selector ).filter( function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + } ) ); + } + + ret = this.pushStack( [] ); + + for ( i = 0; i < len; i++ ) { + jQuery.find( selector, self[ i ], ret ); + } + + return len > 1 ? jQuery.uniqueSort( ret ) : ret; + }, + filter: function( selector ) { + return this.pushStack( winnow( this, selector || [], false ) ); + }, + not: function( selector ) { + return this.pushStack( winnow( this, selector || [], true ) ); + }, + is: function( selector ) { + return !!winnow( + this, + + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + typeof selector === "string" && rneedsContext.test( selector ) ? + jQuery( selector ) : + selector || [], + false + ).length; + } +} ); + + +// Initialize a jQuery object + + +// A central reference to the root jQuery(document) +var rootjQuery, + + // A simple way to check for HTML strings + // Prioritize #id over to avoid XSS via location.hash (trac-9521) + // Strict HTML recognition (trac-11290: must start with <) + // Shortcut simple #id case for speed + rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, + + init = jQuery.fn.init = function( selector, context, root ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Method init() accepts an alternate rootjQuery + // so migrate can support jQuery.sub (gh-2101) + root = root || rootjQuery; + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector[ 0 ] === "<" && + selector[ selector.length - 1 ] === ">" && + selector.length >= 3 ) { + + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && ( match[ 1 ] || !context ) ) { + + // HANDLE: $(html) -> $(array) + if ( match[ 1 ] ) { + context = context instanceof jQuery ? context[ 0 ] : context; + + // Option to run scripts is true for back-compat + // Intentionally let the error be thrown if parseHTML is not present + jQuery.merge( this, jQuery.parseHTML( + match[ 1 ], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + + // Properties of context are called as methods if possible + if ( isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[ 2 ] ); + + if ( elem ) { + + // Inject the element directly into the jQuery object + this[ 0 ] = elem; + this.length = 1; + } + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || root ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this[ 0 ] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( isFunction( selector ) ) { + return root.ready !== undefined ? + root.ready( selector ) : + + // Execute immediately if ready is not present + selector( jQuery ); + } + + return jQuery.makeArray( selector, this ); + }; + +// Give the init function the jQuery prototype for later instantiation +init.prototype = jQuery.fn; + +// Initialize central reference +rootjQuery = jQuery( document ); + + +var rparentsprev = /^(?:parents|prev(?:Until|All))/, + + // Methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend( { + has: function( target ) { + var targets = jQuery( target, this ), + l = targets.length; + + return this.filter( function() { + var i = 0; + for ( ; i < l; i++ ) { + if ( jQuery.contains( this, targets[ i ] ) ) { + return true; + } + } + } ); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + matched = [], + targets = typeof selectors !== "string" && jQuery( selectors ); + + // Positional selectors never match, since there's no _selection_ context + if ( !rneedsContext.test( selectors ) ) { + for ( ; i < l; i++ ) { + for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { + + // Always skip document fragments + if ( cur.nodeType < 11 && ( targets ? + targets.index( cur ) > -1 : + + // Don't pass non-elements to jQuery#find + cur.nodeType === 1 && + jQuery.find.matchesSelector( cur, selectors ) ) ) { + + matched.push( cur ); + break; + } + } + } + } + + return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); + }, + + // Determine the position of an element within the set + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; + } + + // Index in selector + if ( typeof elem === "string" ) { + return indexOf.call( jQuery( elem ), this[ 0 ] ); + } + + // Locate the position of the desired element + return indexOf.call( this, + + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[ 0 ] : elem + ); + }, + + add: function( selector, context ) { + return this.pushStack( + jQuery.uniqueSort( + jQuery.merge( this.get(), jQuery( selector, context ) ) + ) + ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter( selector ) + ); + } +} ); + +function sibling( cur, dir ) { + while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} + return cur; +} + +jQuery.each( { + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, _i, until ) { + return dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, _i, until ) { + return dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, _i, until ) { + return dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return siblings( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return siblings( elem.firstChild ); + }, + contents: function( elem ) { + if ( elem.contentDocument != null && + + // Support: IE 11+ + // elements with no `data` attribute has an object + // `contentDocument` with a `null` prototype. + getProto( elem.contentDocument ) ) { + + return elem.contentDocument; + } + + // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only + // Treat the template element as a regular one in browsers that + // don't support it. + if ( nodeName( elem, "template" ) ) { + elem = elem.content || elem; + } + + return jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var matched = jQuery.map( this, fn, until ); + + if ( name.slice( -5 ) !== "Until" ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + matched = jQuery.filter( selector, matched ); + } + + if ( this.length > 1 ) { + + // Remove duplicates + if ( !guaranteedUnique[ name ] ) { + jQuery.uniqueSort( matched ); + } + + // Reverse order for parents* and prev-derivatives + if ( rparentsprev.test( name ) ) { + matched.reverse(); + } + } + + return this.pushStack( matched ); + }; +} ); +var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); + + + +// Convert String-formatted options into Object-formatted ones +function createOptions( options ) { + var object = {}; + jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { + object[ flag ] = true; + } ); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + createOptions( options ) : + jQuery.extend( {}, options ); + + var // Flag to know if list is currently firing + firing, + + // Last fire value for non-forgettable lists + memory, + + // Flag to know if list was already fired + fired, + + // Flag to prevent firing + locked, + + // Actual callback list + list = [], + + // Queue of execution data for repeatable lists + queue = [], + + // Index of currently firing callback (modified by add/remove as needed) + firingIndex = -1, + + // Fire callbacks + fire = function() { + + // Enforce single-firing + locked = locked || options.once; + + // Execute callbacks for all pending executions, + // respecting firingIndex overrides and runtime changes + fired = firing = true; + for ( ; queue.length; firingIndex = -1 ) { + memory = queue.shift(); + while ( ++firingIndex < list.length ) { + + // Run callback and check for early termination + if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && + options.stopOnFalse ) { + + // Jump to end and forget the data so .add doesn't re-fire + firingIndex = list.length; + memory = false; + } + } + } + + // Forget the data if we're done with it + if ( !options.memory ) { + memory = false; + } + + firing = false; + + // Clean up if we're done firing for good + if ( locked ) { + + // Keep an empty list if we have data for future add calls + if ( memory ) { + list = []; + + // Otherwise, this object is spent + } else { + list = ""; + } + } + }, + + // Actual Callbacks object + self = { + + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + + // If we have memory from a past run, we should fire after adding + if ( memory && !firing ) { + firingIndex = list.length - 1; + queue.push( memory ); + } + + ( function add( args ) { + jQuery.each( args, function( _, arg ) { + if ( isFunction( arg ) ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && toType( arg ) !== "string" ) { + + // Inspect recursively + add( arg ); + } + } ); + } )( arguments ); + + if ( memory && !firing ) { + fire(); + } + } + return this; + }, + + // Remove a callback from the list + remove: function() { + jQuery.each( arguments, function( _, arg ) { + var index; + while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + + // Handle firing indexes + if ( index <= firingIndex ) { + firingIndex--; + } + } + } ); + return this; + }, + + // Check if a given callback is in the list. + // If no argument is given, return whether or not list has callbacks attached. + has: function( fn ) { + return fn ? + jQuery.inArray( fn, list ) > -1 : + list.length > 0; + }, + + // Remove all callbacks from the list + empty: function() { + if ( list ) { + list = []; + } + return this; + }, + + // Disable .fire and .add + // Abort any current/pending executions + // Clear all callbacks and values + disable: function() { + locked = queue = []; + list = memory = ""; + return this; + }, + disabled: function() { + return !list; + }, + + // Disable .fire + // Also disable .add unless we have memory (since it would have no effect) + // Abort any pending executions + lock: function() { + locked = queue = []; + if ( !memory && !firing ) { + list = memory = ""; + } + return this; + }, + locked: function() { + return !!locked; + }, + + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + if ( !locked ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + queue.push( args ); + if ( !firing ) { + fire(); + } + } + return this; + }, + + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; + + +function Identity( v ) { + return v; +} +function Thrower( ex ) { + throw ex; +} + +function adoptValue( value, resolve, reject, noValue ) { + var method; + + try { + + // Check for promise aspect first to privilege synchronous behavior + if ( value && isFunction( ( method = value.promise ) ) ) { + method.call( value ).done( resolve ).fail( reject ); + + // Other thenables + } else if ( value && isFunction( ( method = value.then ) ) ) { + method.call( value, resolve, reject ); + + // Other non-thenables + } else { + + // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: + // * false: [ value ].slice( 0 ) => resolve( value ) + // * true: [ value ].slice( 1 ) => resolve() + resolve.apply( undefined, [ value ].slice( noValue ) ); + } + + // For Promises/A+, convert exceptions into rejections + // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in + // Deferred#then to conditionally suppress rejection. + } catch ( value ) { + + // Support: Android 4.0 only + // Strict mode functions invoked without .call/.apply get global-object context + reject.apply( undefined, [ value ] ); + } +} + +jQuery.extend( { + + Deferred: function( func ) { + var tuples = [ + + // action, add listener, callbacks, + // ... .then handlers, argument index, [final state] + [ "notify", "progress", jQuery.Callbacks( "memory" ), + jQuery.Callbacks( "memory" ), 2 ], + [ "resolve", "done", jQuery.Callbacks( "once memory" ), + jQuery.Callbacks( "once memory" ), 0, "resolved" ], + [ "reject", "fail", jQuery.Callbacks( "once memory" ), + jQuery.Callbacks( "once memory" ), 1, "rejected" ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + "catch": function( fn ) { + return promise.then( null, fn ); + }, + + // Keep pipe for back-compat + pipe: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + + return jQuery.Deferred( function( newDefer ) { + jQuery.each( tuples, function( _i, tuple ) { + + // Map tuples (progress, done, fail) to arguments (done, fail, progress) + var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; + + // deferred.progress(function() { bind to newDefer or newDefer.notify }) + // deferred.done(function() { bind to newDefer or newDefer.resolve }) + // deferred.fail(function() { bind to newDefer or newDefer.reject }) + deferred[ tuple[ 1 ] ]( function() { + var returned = fn && fn.apply( this, arguments ); + if ( returned && isFunction( returned.promise ) ) { + returned.promise() + .progress( newDefer.notify ) + .done( newDefer.resolve ) + .fail( newDefer.reject ); + } else { + newDefer[ tuple[ 0 ] + "With" ]( + this, + fn ? [ returned ] : arguments + ); + } + } ); + } ); + fns = null; + } ).promise(); + }, + then: function( onFulfilled, onRejected, onProgress ) { + var maxDepth = 0; + function resolve( depth, deferred, handler, special ) { + return function() { + var that = this, + args = arguments, + mightThrow = function() { + var returned, then; + + // Support: Promises/A+ section 2.3.3.3.3 + // https://promisesaplus.com/#point-59 + // Ignore double-resolution attempts + if ( depth < maxDepth ) { + return; + } + + returned = handler.apply( that, args ); + + // Support: Promises/A+ section 2.3.1 + // https://promisesaplus.com/#point-48 + if ( returned === deferred.promise() ) { + throw new TypeError( "Thenable self-resolution" ); + } + + // Support: Promises/A+ sections 2.3.3.1, 3.5 + // https://promisesaplus.com/#point-54 + // https://promisesaplus.com/#point-75 + // Retrieve `then` only once + then = returned && + + // Support: Promises/A+ section 2.3.4 + // https://promisesaplus.com/#point-64 + // Only check objects and functions for thenability + ( typeof returned === "object" || + typeof returned === "function" ) && + returned.then; + + // Handle a returned thenable + if ( isFunction( then ) ) { + + // Special processors (notify) just wait for resolution + if ( special ) { + then.call( + returned, + resolve( maxDepth, deferred, Identity, special ), + resolve( maxDepth, deferred, Thrower, special ) + ); + + // Normal processors (resolve) also hook into progress + } else { + + // ...and disregard older resolution values + maxDepth++; + + then.call( + returned, + resolve( maxDepth, deferred, Identity, special ), + resolve( maxDepth, deferred, Thrower, special ), + resolve( maxDepth, deferred, Identity, + deferred.notifyWith ) + ); + } + + // Handle all other returned values + } else { + + // Only substitute handlers pass on context + // and multiple values (non-spec behavior) + if ( handler !== Identity ) { + that = undefined; + args = [ returned ]; + } + + // Process the value(s) + // Default process is resolve + ( special || deferred.resolveWith )( that, args ); + } + }, + + // Only normal processors (resolve) catch and reject exceptions + process = special ? + mightThrow : + function() { + try { + mightThrow(); + } catch ( e ) { + + if ( jQuery.Deferred.exceptionHook ) { + jQuery.Deferred.exceptionHook( e, + process.error ); + } + + // Support: Promises/A+ section 2.3.3.3.4.1 + // https://promisesaplus.com/#point-61 + // Ignore post-resolution exceptions + if ( depth + 1 >= maxDepth ) { + + // Only substitute handlers pass on context + // and multiple values (non-spec behavior) + if ( handler !== Thrower ) { + that = undefined; + args = [ e ]; + } + + deferred.rejectWith( that, args ); + } + } + }; + + // Support: Promises/A+ section 2.3.3.3.1 + // https://promisesaplus.com/#point-57 + // Re-resolve promises immediately to dodge false rejection from + // subsequent errors + if ( depth ) { + process(); + } else { + + // Call an optional hook to record the error, in case of exception + // since it's otherwise lost when execution goes async + if ( jQuery.Deferred.getErrorHook ) { + process.error = jQuery.Deferred.getErrorHook(); + + // The deprecated alias of the above. While the name suggests + // returning the stack, not an error instance, jQuery just passes + // it directly to `console.warn` so both will work; an instance + // just better cooperates with source maps. + } else if ( jQuery.Deferred.getStackHook ) { + process.error = jQuery.Deferred.getStackHook(); + } + window.setTimeout( process ); + } + }; + } + + return jQuery.Deferred( function( newDefer ) { + + // progress_handlers.add( ... ) + tuples[ 0 ][ 3 ].add( + resolve( + 0, + newDefer, + isFunction( onProgress ) ? + onProgress : + Identity, + newDefer.notifyWith + ) + ); + + // fulfilled_handlers.add( ... ) + tuples[ 1 ][ 3 ].add( + resolve( + 0, + newDefer, + isFunction( onFulfilled ) ? + onFulfilled : + Identity + ) + ); + + // rejected_handlers.add( ... ) + tuples[ 2 ][ 3 ].add( + resolve( + 0, + newDefer, + isFunction( onRejected ) ? + onRejected : + Thrower + ) + ); + } ).promise(); + }, + + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 5 ]; + + // promise.progress = list.add + // promise.done = list.add + // promise.fail = list.add + promise[ tuple[ 1 ] ] = list.add; + + // Handle state + if ( stateString ) { + list.add( + function() { + + // state = "resolved" (i.e., fulfilled) + // state = "rejected" + state = stateString; + }, + + // rejected_callbacks.disable + // fulfilled_callbacks.disable + tuples[ 3 - i ][ 2 ].disable, + + // rejected_handlers.disable + // fulfilled_handlers.disable + tuples[ 3 - i ][ 3 ].disable, + + // progress_callbacks.lock + tuples[ 0 ][ 2 ].lock, + + // progress_handlers.lock + tuples[ 0 ][ 3 ].lock + ); + } + + // progress_handlers.fire + // fulfilled_handlers.fire + // rejected_handlers.fire + list.add( tuple[ 3 ].fire ); + + // deferred.notify = function() { deferred.notifyWith(...) } + // deferred.resolve = function() { deferred.resolveWith(...) } + // deferred.reject = function() { deferred.rejectWith(...) } + deferred[ tuple[ 0 ] ] = function() { + deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); + return this; + }; + + // deferred.notifyWith = list.fireWith + // deferred.resolveWith = list.fireWith + // deferred.rejectWith = list.fireWith + deferred[ tuple[ 0 ] + "With" ] = list.fireWith; + } ); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( singleValue ) { + var + + // count of uncompleted subordinates + remaining = arguments.length, + + // count of unprocessed arguments + i = remaining, + + // subordinate fulfillment data + resolveContexts = Array( i ), + resolveValues = slice.call( arguments ), + + // the primary Deferred + primary = jQuery.Deferred(), + + // subordinate callback factory + updateFunc = function( i ) { + return function( value ) { + resolveContexts[ i ] = this; + resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; + if ( !( --remaining ) ) { + primary.resolveWith( resolveContexts, resolveValues ); + } + }; + }; + + // Single- and empty arguments are adopted like Promise.resolve + if ( remaining <= 1 ) { + adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, + !remaining ); + + // Use .then() to unwrap secondary thenables (cf. gh-3000) + if ( primary.state() === "pending" || + isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { + + return primary.then(); + } + } + + // Multiple arguments are aggregated like Promise.all array elements + while ( i-- ) { + adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); + } + + return primary.promise(); + } +} ); + + +// These usually indicate a programmer mistake during development, +// warn about them ASAP rather than swallowing them by default. +var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; + +// If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error +// captured before the async barrier to get the original error cause +// which may otherwise be hidden. +jQuery.Deferred.exceptionHook = function( error, asyncError ) { + + // Support: IE 8 - 9 only + // Console exists when dev tools are open, which can happen at any time + if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { + window.console.warn( "jQuery.Deferred exception: " + error.message, + error.stack, asyncError ); + } +}; + + + + +jQuery.readyException = function( error ) { + window.setTimeout( function() { + throw error; + } ); +}; + + + + +// The deferred used on DOM ready +var readyList = jQuery.Deferred(); + +jQuery.fn.ready = function( fn ) { + + readyList + .then( fn ) + + // Wrap jQuery.readyException in a function so that the lookup + // happens at the time of error handling instead of callback + // registration. + .catch( function( error ) { + jQuery.readyException( error ); + } ); + + return this; +}; + +jQuery.extend( { + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See trac-6781 + readyWait: 1, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + } +} ); + +jQuery.ready.then = readyList.then; + +// The ready event handler and self cleanup method +function completed() { + document.removeEventListener( "DOMContentLoaded", completed ); + window.removeEventListener( "load", completed ); + jQuery.ready(); +} + +// Catch cases where $(document).ready() is called +// after the browser event has already occurred. +// Support: IE <=9 - 10 only +// Older IE sometimes signals "interactive" too soon +if ( document.readyState === "complete" || + ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { + + // Handle it asynchronously to allow scripts the opportunity to delay ready + window.setTimeout( jQuery.ready ); + +} else { + + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", completed ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", completed ); +} + + + + +// Multifunctional method to get and set values of a collection +// The value/s can optionally be executed if it's a function +var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0, + len = elems.length, + bulk = key == null; + + // Sets many values + if ( toType( key ) === "object" ) { + chainable = true; + for ( i in key ) { + access( elems, fn, i, key[ i ], true, emptyGet, raw ); + } + + // Sets one value + } else if ( value !== undefined ) { + chainable = true; + + if ( !isFunction( value ) ) { + raw = true; + } + + if ( bulk ) { + + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + + // ...except when executing function values + } else { + bulk = fn; + fn = function( elem, _key, value ) { + return bulk.call( jQuery( elem ), value ); + }; + } + } + + if ( fn ) { + for ( ; i < len; i++ ) { + fn( + elems[ i ], key, raw ? + value : + value.call( elems[ i ], i, fn( elems[ i ], key ) ) + ); + } + } + } + + if ( chainable ) { + return elems; + } + + // Gets + if ( bulk ) { + return fn.call( elems ); + } + + return len ? fn( elems[ 0 ], key ) : emptyGet; +}; + + +// Matches dashed string for camelizing +var rmsPrefix = /^-ms-/, + rdashAlpha = /-([a-z])/g; + +// Used by camelCase as callback to replace() +function fcamelCase( _all, letter ) { + return letter.toUpperCase(); +} + +// Convert dashed to camelCase; used by the css and data modules +// Support: IE <=9 - 11, Edge 12 - 15 +// Microsoft forgot to hump their vendor prefix (trac-9572) +function camelCase( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); +} +var acceptData = function( owner ) { + + // Accepts only: + // - Node + // - Node.ELEMENT_NODE + // - Node.DOCUMENT_NODE + // - Object + // - Any + return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); +}; + + + + +function Data() { + this.expando = jQuery.expando + Data.uid++; +} + +Data.uid = 1; + +Data.prototype = { + + cache: function( owner ) { + + // Check if the owner object already has a cache + var value = owner[ this.expando ]; + + // If not, create one + if ( !value ) { + value = {}; + + // We can accept data for non-element nodes in modern browsers, + // but we should not, see trac-8335. + // Always return an empty object. + if ( acceptData( owner ) ) { + + // If it is a node unlikely to be stringify-ed or looped over + // use plain assignment + if ( owner.nodeType ) { + owner[ this.expando ] = value; + + // Otherwise secure it in a non-enumerable property + // configurable must be true to allow the property to be + // deleted when data is removed + } else { + Object.defineProperty( owner, this.expando, { + value: value, + configurable: true + } ); + } + } + } + + return value; + }, + set: function( owner, data, value ) { + var prop, + cache = this.cache( owner ); + + // Handle: [ owner, key, value ] args + // Always use camelCase key (gh-2257) + if ( typeof data === "string" ) { + cache[ camelCase( data ) ] = value; + + // Handle: [ owner, { properties } ] args + } else { + + // Copy the properties one-by-one to the cache object + for ( prop in data ) { + cache[ camelCase( prop ) ] = data[ prop ]; + } + } + return cache; + }, + get: function( owner, key ) { + return key === undefined ? + this.cache( owner ) : + + // Always use camelCase key (gh-2257) + owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; + }, + access: function( owner, key, value ) { + + // In cases where either: + // + // 1. No key was specified + // 2. A string key was specified, but no value provided + // + // Take the "read" path and allow the get method to determine + // which value to return, respectively either: + // + // 1. The entire cache object + // 2. The data stored at the key + // + if ( key === undefined || + ( ( key && typeof key === "string" ) && value === undefined ) ) { + + return this.get( owner, key ); + } + + // When the key is not a string, or both a key and value + // are specified, set or extend (existing objects) with either: + // + // 1. An object of properties + // 2. A key and value + // + this.set( owner, key, value ); + + // Since the "set" path can have two possible entry points + // return the expected data based on which path was taken[*] + return value !== undefined ? value : key; + }, + remove: function( owner, key ) { + var i, + cache = owner[ this.expando ]; + + if ( cache === undefined ) { + return; + } + + if ( key !== undefined ) { + + // Support array or space separated string of keys + if ( Array.isArray( key ) ) { + + // If key is an array of keys... + // We always set camelCase keys, so remove that. + key = key.map( camelCase ); + } else { + key = camelCase( key ); + + // If a key with the spaces exists, use it. + // Otherwise, create an array by matching non-whitespace + key = key in cache ? + [ key ] : + ( key.match( rnothtmlwhite ) || [] ); + } + + i = key.length; + + while ( i-- ) { + delete cache[ key[ i ] ]; + } + } + + // Remove the expando if there's no more data + if ( key === undefined || jQuery.isEmptyObject( cache ) ) { + + // Support: Chrome <=35 - 45 + // Webkit & Blink performance suffers when deleting properties + // from DOM nodes, so set to undefined instead + // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) + if ( owner.nodeType ) { + owner[ this.expando ] = undefined; + } else { + delete owner[ this.expando ]; + } + } + }, + hasData: function( owner ) { + var cache = owner[ this.expando ]; + return cache !== undefined && !jQuery.isEmptyObject( cache ); + } +}; +var dataPriv = new Data(); + +var dataUser = new Data(); + + + +// Implementation Summary +// +// 1. Enforce API surface and semantic compatibility with 1.9.x branch +// 2. Improve the module's maintainability by reducing the storage +// paths to a single mechanism. +// 3. Use the same single mechanism to support "private" and "user" data. +// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) +// 5. Avoid exposing implementation details on user objects (eg. expando properties) +// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 + +var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, + rmultiDash = /[A-Z]/g; + +function getData( data ) { + if ( data === "true" ) { + return true; + } + + if ( data === "false" ) { + return false; + } + + if ( data === "null" ) { + return null; + } + + // Only convert to a number if it doesn't change the string + if ( data === +data + "" ) { + return +data; + } + + if ( rbrace.test( data ) ) { + return JSON.parse( data ); + } + + return data; +} + +function dataAttr( elem, key, data ) { + var name; + + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = getData( data ); + } catch ( e ) {} + + // Make sure we set the data so it isn't changed later + dataUser.set( elem, key, data ); + } else { + data = undefined; + } + } + return data; +} + +jQuery.extend( { + hasData: function( elem ) { + return dataUser.hasData( elem ) || dataPriv.hasData( elem ); + }, + + data: function( elem, name, data ) { + return dataUser.access( elem, name, data ); + }, + + removeData: function( elem, name ) { + dataUser.remove( elem, name ); + }, + + // TODO: Now that all calls to _data and _removeData have been replaced + // with direct calls to dataPriv methods, these can be deprecated. + _data: function( elem, name, data ) { + return dataPriv.access( elem, name, data ); + }, + + _removeData: function( elem, name ) { + dataPriv.remove( elem, name ); + } +} ); + +jQuery.fn.extend( { + data: function( key, value ) { + var i, name, data, + elem = this[ 0 ], + attrs = elem && elem.attributes; + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = dataUser.get( elem ); + + if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { + i = attrs.length; + while ( i-- ) { + + // Support: IE 11 only + // The attrs elements can be null (trac-14894) + if ( attrs[ i ] ) { + name = attrs[ i ].name; + if ( name.indexOf( "data-" ) === 0 ) { + name = camelCase( name.slice( 5 ) ); + dataAttr( elem, name, data[ name ] ); + } + } + } + dataPriv.set( elem, "hasDataAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each( function() { + dataUser.set( this, key ); + } ); + } + + return access( this, function( value ) { + var data; + + // The calling jQuery object (element matches) is not empty + // (and therefore has an element appears at this[ 0 ]) and the + // `value` parameter was not undefined. An empty jQuery object + // will result in `undefined` for elem = this[ 0 ] which will + // throw an exception if an attempt to read a data cache is made. + if ( elem && value === undefined ) { + + // Attempt to get data from the cache + // The key will always be camelCased in Data + data = dataUser.get( elem, key ); + if ( data !== undefined ) { + return data; + } + + // Attempt to "discover" the data in + // HTML5 custom data-* attrs + data = dataAttr( elem, key ); + if ( data !== undefined ) { + return data; + } + + // We tried really hard, but the data doesn't exist. + return; + } + + // Set the data... + this.each( function() { + + // We always store the camelCased key + dataUser.set( this, key, value ); + } ); + }, null, value, arguments.length > 1, null, true ); + }, + + removeData: function( key ) { + return this.each( function() { + dataUser.remove( this, key ); + } ); + } +} ); + + +jQuery.extend( { + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = dataPriv.get( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || Array.isArray( data ) ) { + queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } + + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + // Clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // Not public - generate a queueHooks object, or return the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { + empty: jQuery.Callbacks( "once memory" ).add( function() { + dataPriv.remove( elem, [ type + "queue", key ] ); + } ) + } ); + } +} ); + +jQuery.fn.extend( { + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[ 0 ], type ); + } + + return data === undefined ? + this : + this.each( function() { + var queue = jQuery.queue( this, type, data ); + + // Ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + } ); + }, + dequeue: function( type ) { + return this.each( function() { + jQuery.dequeue( this, type ); + } ); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while ( i-- ) { + tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } +} ); +var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; + +var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); + + +var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; + +var documentElement = document.documentElement; + + + + var isAttached = function( elem ) { + return jQuery.contains( elem.ownerDocument, elem ); + }, + composed = { composed: true }; + + // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only + // Check attachment across shadow DOM boundaries when possible (gh-3504) + // Support: iOS 10.0-10.2 only + // Early iOS 10 versions support `attachShadow` but not `getRootNode`, + // leading to errors. We need to check for `getRootNode`. + if ( documentElement.getRootNode ) { + isAttached = function( elem ) { + return jQuery.contains( elem.ownerDocument, elem ) || + elem.getRootNode( composed ) === elem.ownerDocument; + }; + } +var isHiddenWithinTree = function( elem, el ) { + + // isHiddenWithinTree might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + + // Inline style trumps all + return elem.style.display === "none" || + elem.style.display === "" && + + // Otherwise, check computed style + // Support: Firefox <=43 - 45 + // Disconnected elements can have computed display: none, so first confirm that elem is + // in the document. + isAttached( elem ) && + + jQuery.css( elem, "display" ) === "none"; + }; + + + +function adjustCSS( elem, prop, valueParts, tween ) { + var adjusted, scale, + maxIterations = 20, + currentValue = tween ? + function() { + return tween.cur(); + } : + function() { + return jQuery.css( elem, prop, "" ); + }, + initial = currentValue(), + unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), + + // Starting value computation is required for potential unit mismatches + initialInUnit = elem.nodeType && + ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && + rcssNum.exec( jQuery.css( elem, prop ) ); + + if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { + + // Support: Firefox <=54 + // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) + initial = initial / 2; + + // Trust units reported by jQuery.css + unit = unit || initialInUnit[ 3 ]; + + // Iteratively approximate from a nonzero starting point + initialInUnit = +initial || 1; + + while ( maxIterations-- ) { + + // Evaluate and update our best guess (doubling guesses that zero out). + // Finish if the scale equals or crosses 1 (making the old*new product non-positive). + jQuery.style( elem, prop, initialInUnit + unit ); + if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { + maxIterations = 0; + } + initialInUnit = initialInUnit / scale; + + } + + initialInUnit = initialInUnit * 2; + jQuery.style( elem, prop, initialInUnit + unit ); + + // Make sure we update the tween properties later on + valueParts = valueParts || []; + } + + if ( valueParts ) { + initialInUnit = +initialInUnit || +initial || 0; + + // Apply relative offset (+=/-=) if specified + adjusted = valueParts[ 1 ] ? + initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : + +valueParts[ 2 ]; + if ( tween ) { + tween.unit = unit; + tween.start = initialInUnit; + tween.end = adjusted; + } + } + return adjusted; +} + + +var defaultDisplayMap = {}; + +function getDefaultDisplay( elem ) { + var temp, + doc = elem.ownerDocument, + nodeName = elem.nodeName, + display = defaultDisplayMap[ nodeName ]; + + if ( display ) { + return display; + } + + temp = doc.body.appendChild( doc.createElement( nodeName ) ); + display = jQuery.css( temp, "display" ); + + temp.parentNode.removeChild( temp ); + + if ( display === "none" ) { + display = "block"; + } + defaultDisplayMap[ nodeName ] = display; + + return display; +} + +function showHide( elements, show ) { + var display, elem, + values = [], + index = 0, + length = elements.length; + + // Determine new display value for elements that need to change + for ( ; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + + display = elem.style.display; + if ( show ) { + + // Since we force visibility upon cascade-hidden elements, an immediate (and slow) + // check is required in this first loop unless we have a nonempty display value (either + // inline or about-to-be-restored) + if ( display === "none" ) { + values[ index ] = dataPriv.get( elem, "display" ) || null; + if ( !values[ index ] ) { + elem.style.display = ""; + } + } + if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { + values[ index ] = getDefaultDisplay( elem ); + } + } else { + if ( display !== "none" ) { + values[ index ] = "none"; + + // Remember what we're overwriting + dataPriv.set( elem, "display", display ); + } + } + } + + // Set the display of the elements in a second loop to avoid constant reflow + for ( index = 0; index < length; index++ ) { + if ( values[ index ] != null ) { + elements[ index ].style.display = values[ index ]; + } + } + + return elements; +} + +jQuery.fn.extend( { + show: function() { + return showHide( this, true ); + }, + hide: function() { + return showHide( this ); + }, + toggle: function( state ) { + if ( typeof state === "boolean" ) { + return state ? this.show() : this.hide(); + } + + return this.each( function() { + if ( isHiddenWithinTree( this ) ) { + jQuery( this ).show(); + } else { + jQuery( this ).hide(); + } + } ); + } +} ); +var rcheckableType = ( /^(?:checkbox|radio)$/i ); + +var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); + +var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); + + + +( function() { + var fragment = document.createDocumentFragment(), + div = fragment.appendChild( document.createElement( "div" ) ), + input = document.createElement( "input" ); + + // Support: Android 4.0 - 4.3 only + // Check state lost if the name is set (trac-11217) + // Support: Windows Web Apps (WWA) + // `name` and `type` must use .setAttribute for WWA (trac-14901) + input.setAttribute( "type", "radio" ); + input.setAttribute( "checked", "checked" ); + input.setAttribute( "name", "t" ); + + div.appendChild( input ); + + // Support: Android <=4.1 only + // Older WebKit doesn't clone checked state correctly in fragments + support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE <=11 only + // Make sure textarea (and checkbox) defaultValue is properly cloned + div.innerHTML = ""; + support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; + + // Support: IE <=9 only + // IE <=9 replaces "; + support.option = !!div.lastChild; +} )(); + + +// We have to close these tags to support XHTML (trac-13200) +var wrapMap = { + + // XHTML parsers do not magically insert elements in the + // same way that tag soup parsers do. So we cannot shorten + // this by omitting or other required elements. + thead: [ 1, "", "
" ], + col: [ 2, "", "
" ], + tr: [ 2, "", "
" ], + td: [ 3, "", "
" ], + + _default: [ 0, "", "" ] +}; + +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +// Support: IE <=9 only +if ( !support.option ) { + wrapMap.optgroup = wrapMap.option = [ 1, "" ]; +} + + +function getAll( context, tag ) { + + // Support: IE <=9 - 11 only + // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) + var ret; + + if ( typeof context.getElementsByTagName !== "undefined" ) { + ret = context.getElementsByTagName( tag || "*" ); + + } else if ( typeof context.querySelectorAll !== "undefined" ) { + ret = context.querySelectorAll( tag || "*" ); + + } else { + ret = []; + } + + if ( tag === undefined || tag && nodeName( context, tag ) ) { + return jQuery.merge( [ context ], ret ); + } + + return ret; +} + + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + dataPriv.set( + elems[ i ], + "globalEval", + !refElements || dataPriv.get( refElements[ i ], "globalEval" ) + ); + } +} + + +var rhtml = /<|&#?\w+;/; + +function buildFragment( elems, context, scripts, selection, ignored ) { + var elem, tmp, tag, wrap, attached, j, + fragment = context.createDocumentFragment(), + nodes = [], + i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( toType( elem ) === "object" ) { + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); + + // Deserialize a standard representation + tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; + + // Descend through wrappers to the right content + j = wrap[ 0 ]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( nodes, tmp.childNodes ); + + // Remember the top-level container + tmp = fragment.firstChild; + + // Ensure the created nodes are orphaned (trac-12392) + tmp.textContent = ""; + } + } + } + + // Remove wrapper from fragment + fragment.textContent = ""; + + i = 0; + while ( ( elem = nodes[ i++ ] ) ) { + + // Skip elements already in the context collection (trac-4087) + if ( selection && jQuery.inArray( elem, selection ) > -1 ) { + if ( ignored ) { + ignored.push( elem ); + } + continue; + } + + attached = isAttached( elem ); + + // Append to fragment + tmp = getAll( fragment.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( attached ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( ( elem = tmp[ j++ ] ) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + return fragment; +} + + +var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +function on( elem, types, selector, data, fn, one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + on( elem, type, selector, data, types[ type ], one ); + } + return elem; + } + + if ( data == null && fn == null ) { + + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return elem; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return elem.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + } ); +} + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + + var handleObjIn, eventHandle, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = dataPriv.get( elem ); + + // Only attach events to objects that accept data + if ( !acceptData( elem ) ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Ensure that invalid selectors throw exceptions at attach time + // Evaluate against documentElement in case elem is a non-element node (e.g., document) + if ( selector ) { + jQuery.find.matchesSelector( documentElement, selector ); + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !( events = elemData.events ) ) { + events = elemData.events = Object.create( null ); + } + if ( !( eventHandle = elemData.handle ) ) { + eventHandle = elemData.handle = function( e ) { + + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? + jQuery.event.dispatch.apply( elem, arguments ) : undefined; + }; + } + + // Handle multiple events separated by a space + types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[ t ] ) || []; + type = origType = tmp[ 1 ]; + namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); + + // There *must* be a type, no attaching namespace-only handlers + if ( !type ) { + continue; + } + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend( { + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join( "." ) + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !( handlers = events[ type ] ) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener if the special events handler returns false + if ( !special.setup || + special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var j, origCount, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); + + if ( !elemData || !( events = elemData.events ) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[ t ] ) || []; + type = origType = tmp[ 1 ]; + namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[ 2 ] && + new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || + selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || + special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove data and the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + dataPriv.remove( elem, "handle events" ); + } + }, + + dispatch: function( nativeEvent ) { + + var i, j, ret, matched, handleObj, handlerQueue, + args = new Array( arguments.length ), + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( nativeEvent ), + + handlers = ( + dataPriv.get( this, "events" ) || Object.create( null ) + )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[ 0 ] = event; + + for ( i = 1; i < arguments.length; i++ ) { + args[ i ] = arguments[ i ]; + } + + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( ( handleObj = matched.handlers[ j++ ] ) && + !event.isImmediatePropagationStopped() ) { + + // If the event is namespaced, then each handler is only invoked if it is + // specially universal or its namespaces are a superset of the event's. + if ( !event.rnamespace || handleObj.namespace === false || + event.rnamespace.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || + handleObj.handler ).apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( ( event.result = ret ) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var i, handleObj, sel, matchedHandlers, matchedSelectors, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Find delegate handlers + if ( delegateCount && + + // Support: IE <=9 + // Black-hole SVG instance trees (trac-13180) + cur.nodeType && + + // Support: Firefox <=42 + // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) + // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click + // Support: IE 11 only + // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) + !( event.type === "click" && event.button >= 1 ) ) { + + for ( ; cur !== this; cur = cur.parentNode || this ) { + + // Don't check non-elements (trac-13208) + // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764) + if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { + matchedHandlers = []; + matchedSelectors = {}; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (trac-13203) + sel = handleObj.selector + " "; + + if ( matchedSelectors[ sel ] === undefined ) { + matchedSelectors[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) > -1 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matchedSelectors[ sel ] ) { + matchedHandlers.push( handleObj ); + } + } + if ( matchedHandlers.length ) { + handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); + } + } + } + } + + // Add the remaining (directly-bound) handlers + cur = this; + if ( delegateCount < handlers.length ) { + handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); + } + + return handlerQueue; + }, + + addProp: function( name, hook ) { + Object.defineProperty( jQuery.Event.prototype, name, { + enumerable: true, + configurable: true, + + get: isFunction( hook ) ? + function() { + if ( this.originalEvent ) { + return hook( this.originalEvent ); + } + } : + function() { + if ( this.originalEvent ) { + return this.originalEvent[ name ]; + } + }, + + set: function( value ) { + Object.defineProperty( this, name, { + enumerable: true, + configurable: true, + writable: true, + value: value + } ); + } + } ); + }, + + fix: function( originalEvent ) { + return originalEvent[ jQuery.expando ] ? + originalEvent : + new jQuery.Event( originalEvent ); + }, + + special: { + load: { + + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + click: { + + // Utilize native event to ensure correct state for checkable inputs + setup: function( data ) { + + // For mutual compressibility with _default, replace `this` access with a local var. + // `|| data` is dead code meant only to preserve the variable through minification. + var el = this || data; + + // Claim the first handler + if ( rcheckableType.test( el.type ) && + el.click && nodeName( el, "input" ) ) { + + // dataPriv.set( el, "click", ... ) + leverageNative( el, "click", true ); + } + + // Return false to allow normal processing in the caller + return false; + }, + trigger: function( data ) { + + // For mutual compressibility with _default, replace `this` access with a local var. + // `|| data` is dead code meant only to preserve the variable through minification. + var el = this || data; + + // Force setup before triggering a click + if ( rcheckableType.test( el.type ) && + el.click && nodeName( el, "input" ) ) { + + leverageNative( el, "click" ); + } + + // Return non-false to allow normal event-path propagation + return true; + }, + + // For cross-browser consistency, suppress native .click() on links + // Also prevent it if we're currently inside a leveraged native-event stack + _default: function( event ) { + var target = event.target; + return rcheckableType.test( target.type ) && + target.click && nodeName( target, "input" ) && + dataPriv.get( target, "click" ) || + nodeName( target, "a" ); + } + }, + + beforeunload: { + postDispatch: function( event ) { + + // Support: Firefox 20+ + // Firefox doesn't alert if the returnValue field is not set. + if ( event.result !== undefined && event.originalEvent ) { + event.originalEvent.returnValue = event.result; + } + } + } + } +}; + +// Ensure the presence of an event listener that handles manually-triggered +// synthetic events by interrupting progress until reinvoked in response to +// *native* events that it fires directly, ensuring that state changes have +// already occurred before other listeners are invoked. +function leverageNative( el, type, isSetup ) { + + // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add + if ( !isSetup ) { + if ( dataPriv.get( el, type ) === undefined ) { + jQuery.event.add( el, type, returnTrue ); + } + return; + } + + // Register the controller as a special universal handler for all event namespaces + dataPriv.set( el, type, false ); + jQuery.event.add( el, type, { + namespace: false, + handler: function( event ) { + var result, + saved = dataPriv.get( this, type ); + + if ( ( event.isTrigger & 1 ) && this[ type ] ) { + + // Interrupt processing of the outer synthetic .trigger()ed event + if ( !saved ) { + + // Store arguments for use when handling the inner native event + // There will always be at least one argument (an event object), so this array + // will not be confused with a leftover capture object. + saved = slice.call( arguments ); + dataPriv.set( this, type, saved ); + + // Trigger the native event and capture its result + this[ type ](); + result = dataPriv.get( this, type ); + dataPriv.set( this, type, false ); + + if ( saved !== result ) { + + // Cancel the outer synthetic event + event.stopImmediatePropagation(); + event.preventDefault(); + + return result; + } + + // If this is an inner synthetic event for an event with a bubbling surrogate + // (focus or blur), assume that the surrogate already propagated from triggering + // the native event and prevent that from happening again here. + // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the + // bubbling surrogate propagates *after* the non-bubbling base), but that seems + // less bad than duplication. + } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { + event.stopPropagation(); + } + + // If this is a native event triggered above, everything is now in order + // Fire an inner synthetic event with the original arguments + } else if ( saved ) { + + // ...and capture the result + dataPriv.set( this, type, jQuery.event.trigger( + saved[ 0 ], + saved.slice( 1 ), + this + ) ); + + // Abort handling of the native event by all jQuery handlers while allowing + // native handlers on the same element to run. On target, this is achieved + // by stopping immediate propagation just on the jQuery event. However, + // the native event is re-wrapped by a jQuery one on each level of the + // propagation so the only way to stop it for jQuery is to stop it for + // everyone via native `stopPropagation()`. This is not a problem for + // focus/blur which don't bubble, but it does also stop click on checkboxes + // and radios. We accept this limitation. + event.stopPropagation(); + event.isImmediatePropagationStopped = returnTrue; + } + } + } ); +} + +jQuery.removeEvent = function( elem, type, handle ) { + + // This "if" is needed for plain objects + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle ); + } +}; + +jQuery.Event = function( src, props ) { + + // Allow instantiation without the 'new' keyword + if ( !( this instanceof jQuery.Event ) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = src.defaultPrevented || + src.defaultPrevented === undefined && + + // Support: Android <=2.3 only + src.returnValue === false ? + returnTrue : + returnFalse; + + // Create target properties + // Support: Safari <=6 - 7 only + // Target should not be a text node (trac-504, trac-13143) + this.target = ( src.target && src.target.nodeType === 3 ) ? + src.target.parentNode : + src.target; + + this.currentTarget = src.currentTarget; + this.relatedTarget = src.relatedTarget; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || Date.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + constructor: jQuery.Event, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + isSimulated: false, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + + if ( e && !this.isSimulated ) { + e.preventDefault(); + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + + if ( e && !this.isSimulated ) { + e.stopPropagation(); + } + }, + stopImmediatePropagation: function() { + var e = this.originalEvent; + + this.isImmediatePropagationStopped = returnTrue; + + if ( e && !this.isSimulated ) { + e.stopImmediatePropagation(); + } + + this.stopPropagation(); + } +}; + +// Includes all common event props including KeyEvent and MouseEvent specific props +jQuery.each( { + altKey: true, + bubbles: true, + cancelable: true, + changedTouches: true, + ctrlKey: true, + detail: true, + eventPhase: true, + metaKey: true, + pageX: true, + pageY: true, + shiftKey: true, + view: true, + "char": true, + code: true, + charCode: true, + key: true, + keyCode: true, + button: true, + buttons: true, + clientX: true, + clientY: true, + offsetX: true, + offsetY: true, + pointerId: true, + pointerType: true, + screenX: true, + screenY: true, + targetTouches: true, + toElement: true, + touches: true, + which: true +}, jQuery.event.addProp ); + +jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { + + function focusMappedHandler( nativeEvent ) { + if ( document.documentMode ) { + + // Support: IE 11+ + // Attach a single focusin/focusout handler on the document while someone wants + // focus/blur. This is because the former are synchronous in IE while the latter + // are async. In other browsers, all those handlers are invoked synchronously. + + // `handle` from private data would already wrap the event, but we need + // to change the `type` here. + var handle = dataPriv.get( this, "handle" ), + event = jQuery.event.fix( nativeEvent ); + event.type = nativeEvent.type === "focusin" ? "focus" : "blur"; + event.isSimulated = true; + + // First, handle focusin/focusout + handle( nativeEvent ); + + // ...then, handle focus/blur + // + // focus/blur don't bubble while focusin/focusout do; simulate the former by only + // invoking the handler at the lower level. + if ( event.target === event.currentTarget ) { + + // The setup part calls `leverageNative`, which, in turn, calls + // `jQuery.event.add`, so event handle will already have been set + // by this point. + handle( event ); + } + } else { + + // For non-IE browsers, attach a single capturing handler on the document + // while someone wants focusin/focusout. + jQuery.event.simulate( delegateType, nativeEvent.target, + jQuery.event.fix( nativeEvent ) ); + } + } + + jQuery.event.special[ type ] = { + + // Utilize native event if possible so blur/focus sequence is correct + setup: function() { + + var attaches; + + // Claim the first handler + // dataPriv.set( this, "focus", ... ) + // dataPriv.set( this, "blur", ... ) + leverageNative( this, type, true ); + + if ( document.documentMode ) { + + // Support: IE 9 - 11+ + // We use the same native handler for focusin & focus (and focusout & blur) + // so we need to coordinate setup & teardown parts between those events. + // Use `delegateType` as the key as `type` is already used by `leverageNative`. + attaches = dataPriv.get( this, delegateType ); + if ( !attaches ) { + this.addEventListener( delegateType, focusMappedHandler ); + } + dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 ); + } else { + + // Return false to allow normal processing in the caller + return false; + } + }, + trigger: function() { + + // Force setup before trigger + leverageNative( this, type ); + + // Return non-false to allow normal event-path propagation + return true; + }, + + teardown: function() { + var attaches; + + if ( document.documentMode ) { + attaches = dataPriv.get( this, delegateType ) - 1; + if ( !attaches ) { + this.removeEventListener( delegateType, focusMappedHandler ); + dataPriv.remove( this, delegateType ); + } else { + dataPriv.set( this, delegateType, attaches ); + } + } else { + + // Return false to indicate standard teardown should be applied + return false; + } + }, + + // Suppress native focus or blur if we're currently inside + // a leveraged native-event stack + _default: function( event ) { + return dataPriv.get( event.target, type ); + }, + + delegateType: delegateType + }; + + // Support: Firefox <=44 + // Firefox doesn't have focus(in | out) events + // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 + // + // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 + // focus(in | out) events fire after focus & blur events, + // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order + // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 + // + // Support: IE 9 - 11+ + // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch, + // attach a single handler for both events in IE. + jQuery.event.special[ delegateType ] = { + setup: function() { + + // Handle: regular nodes (via `this.ownerDocument`), window + // (via `this.document`) & document (via `this`). + var doc = this.ownerDocument || this.document || this, + dataHolder = document.documentMode ? this : doc, + attaches = dataPriv.get( dataHolder, delegateType ); + + // Support: IE 9 - 11+ + // We use the same native handler for focusin & focus (and focusout & blur) + // so we need to coordinate setup & teardown parts between those events. + // Use `delegateType` as the key as `type` is already used by `leverageNative`. + if ( !attaches ) { + if ( document.documentMode ) { + this.addEventListener( delegateType, focusMappedHandler ); + } else { + doc.addEventListener( type, focusMappedHandler, true ); + } + } + dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 ); + }, + teardown: function() { + var doc = this.ownerDocument || this.document || this, + dataHolder = document.documentMode ? this : doc, + attaches = dataPriv.get( dataHolder, delegateType ) - 1; + + if ( !attaches ) { + if ( document.documentMode ) { + this.removeEventListener( delegateType, focusMappedHandler ); + } else { + doc.removeEventListener( type, focusMappedHandler, true ); + } + dataPriv.remove( dataHolder, delegateType ); + } else { + dataPriv.set( dataHolder, delegateType, attaches ); + } + } + }; +} ); + +// Create mouseenter/leave events using mouseover/out and event-time checks +// so that event delegation works in jQuery. +// Do the same for pointerenter/pointerleave and pointerover/pointerout +// +// Support: Safari 7 only +// Safari sends mouseenter too often; see: +// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 +// for the description of the bug (it existed in older Chrome versions as well). +jQuery.each( { + mouseenter: "mouseover", + mouseleave: "mouseout", + pointerenter: "pointerover", + pointerleave: "pointerout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj; + + // For mouseenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +} ); + +jQuery.fn.extend( { + + on: function( types, selector, data, fn ) { + return on( this, types, selector, data, fn ); + }, + one: function( types, selector, data, fn ) { + return on( this, types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? + handleObj.origType + "." + handleObj.namespace : + handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each( function() { + jQuery.event.remove( this, types, fn, selector ); + } ); + } +} ); + + +var + + // Support: IE <=10 - 11, Edge 12 - 13 only + // In IE/Edge using regex groups here causes severe slowdowns. + // See https://connect.microsoft.com/IE/feedback/details/1736512/ + rnoInnerhtml = /\s*$/g; + +// Prefer a tbody over its parent table for containing new rows +function manipulationTarget( elem, content ) { + if ( nodeName( elem, "table" ) && + nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { + + return jQuery( elem ).children( "tbody" )[ 0 ] || elem; + } + + return elem; +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { + elem.type = elem.type.slice( 5 ); + } else { + elem.removeAttribute( "type" ); + } + + return elem; +} + +function cloneCopyEvent( src, dest ) { + var i, l, type, pdataOld, udataOld, udataCur, events; + + if ( dest.nodeType !== 1 ) { + return; + } + + // 1. Copy private data: events, handlers, etc. + if ( dataPriv.hasData( src ) ) { + pdataOld = dataPriv.get( src ); + events = pdataOld.events; + + if ( events ) { + dataPriv.remove( dest, "handle events" ); + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + } + + // 2. Copy user data + if ( dataUser.hasData( src ) ) { + udataOld = dataUser.access( src ); + udataCur = jQuery.extend( {}, udataOld ); + + dataUser.set( dest, udataCur ); + } +} + +// Fix IE bugs, see support tests +function fixInput( src, dest ) { + var nodeName = dest.nodeName.toLowerCase(); + + // Fails to persist the checked state of a cloned checkbox or radio button. + if ( nodeName === "input" && rcheckableType.test( src.type ) ) { + dest.checked = src.checked; + + // Fails to return the selected option to the default selected state when cloning options + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } +} + +function domManip( collection, args, callback, ignored ) { + + // Flatten any nested arrays + args = flat( args ); + + var fragment, first, scripts, hasScripts, node, doc, + i = 0, + l = collection.length, + iNoClone = l - 1, + value = args[ 0 ], + valueIsFunction = isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( valueIsFunction || + ( l > 1 && typeof value === "string" && + !support.checkClone && rchecked.test( value ) ) ) { + return collection.each( function( index ) { + var self = collection.eq( index ); + if ( valueIsFunction ) { + args[ 0 ] = value.call( this, index, self.html() ); + } + domManip( self, args, callback, ignored ); + } ); + } + + if ( l ) { + fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + // Require either new content or an interest in ignored elements to invoke the callback + if ( first || ignored ) { + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item + // instead of the first because it can end up + // being emptied incorrectly in certain situations (trac-8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( collection[ i ], node, i ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Re-enable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !dataPriv.access( node, "globalEval" ) && + jQuery.contains( doc, node ) ) { + + if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { + + // Optional AJAX dependency, but won't run scripts if not present + if ( jQuery._evalUrl && !node.noModule ) { + jQuery._evalUrl( node.src, { + nonce: node.nonce || node.getAttribute( "nonce" ) + }, doc ); + } + } else { + + // Unwrap a CDATA section containing script contents. This shouldn't be + // needed as in XML documents they're already not visible when + // inspecting element contents and in HTML documents they have no + // meaning but we're preserving that logic for backwards compatibility. + // This will be removed completely in 4.0. See gh-4904. + DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); + } + } + } + } + } + } + + return collection; +} + +function remove( elem, selector, keepData ) { + var node, + nodes = selector ? jQuery.filter( selector, elem ) : elem, + i = 0; + + for ( ; ( node = nodes[ i ] ) != null; i++ ) { + if ( !keepData && node.nodeType === 1 ) { + jQuery.cleanData( getAll( node ) ); + } + + if ( node.parentNode ) { + if ( keepData && isAttached( node ) ) { + setGlobalEval( getAll( node, "script" ) ); + } + node.parentNode.removeChild( node ); + } + } + + return elem; +} + +jQuery.extend( { + htmlPrefilter: function( html ) { + return html; + }, + + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var i, l, srcElements, destElements, + clone = elem.cloneNode( true ), + inPage = isAttached( elem ); + + // Fix IE cloning issues + if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && + !jQuery.isXMLDoc( elem ) ) { + + // We eschew jQuery#find here for performance reasons: + // https://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + for ( i = 0, l = srcElements.length; i < l; i++ ) { + fixInput( srcElements[ i ], destElements[ i ] ); + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0, l = srcElements.length; i < l; i++ ) { + cloneCopyEvent( srcElements[ i ], destElements[ i ] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + // Return the cloned set + return clone; + }, + + cleanData: function( elems ) { + var data, elem, type, + special = jQuery.event.special, + i = 0; + + for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { + if ( acceptData( elem ) ) { + if ( ( data = elem[ dataPriv.expando ] ) ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Support: Chrome <=35 - 45+ + // Assign undefined instead of using delete, see Data#remove + elem[ dataPriv.expando ] = undefined; + } + if ( elem[ dataUser.expando ] ) { + + // Support: Chrome <=35 - 45+ + // Assign undefined instead of using delete, see Data#remove + elem[ dataUser.expando ] = undefined; + } + } + } + } +} ); + +jQuery.fn.extend( { + detach: function( selector ) { + return remove( this, selector, true ); + }, + + remove: function( selector ) { + return remove( this, selector ); + }, + + text: function( value ) { + return access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().each( function() { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.textContent = value; + } + } ); + }, null, value, arguments.length ); + }, + + append: function() { + return domManip( this, arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.appendChild( elem ); + } + } ); + }, + + prepend: function() { + return domManip( this, arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.insertBefore( elem, target.firstChild ); + } + } ); + }, + + before: function() { + return domManip( this, arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + } ); + }, + + after: function() { + return domManip( this, arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + } ); + }, + + empty: function() { + var elem, + i = 0; + + for ( ; ( elem = this[ i ] ) != null; i++ ) { + if ( elem.nodeType === 1 ) { + + // Prevent memory leaks + jQuery.cleanData( getAll( elem, false ) ); + + // Remove any remaining nodes + elem.textContent = ""; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function() { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + } ); + }, + + html: function( value ) { + return access( this, function( value ) { + var elem = this[ 0 ] || {}, + i = 0, + l = this.length; + + if ( value === undefined && elem.nodeType === 1 ) { + return elem.innerHTML; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { + + value = jQuery.htmlPrefilter( value ); + + try { + for ( ; i < l; i++ ) { + elem = this[ i ] || {}; + + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch ( e ) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function() { + var ignored = []; + + // Make the changes, replacing each non-ignored context element with the new content + return domManip( this, arguments, function( elem ) { + var parent = this.parentNode; + + if ( jQuery.inArray( this, ignored ) < 0 ) { + jQuery.cleanData( getAll( this ) ); + if ( parent ) { + parent.replaceChild( elem, this ); + } + } + + // Force callback invocation + }, ignored ); + } +} ); + +jQuery.each( { + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1, + i = 0; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone( true ); + jQuery( insert[ i ] )[ original ]( elems ); + + // Support: Android <=4.0 only, PhantomJS 1 only + // .get() because push.apply(_, arraylike) throws on ancient WebKit + push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +} ); +var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); + +var rcustomProp = /^--/; + + +var getStyles = function( elem ) { + + // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150) + // IE throws on elements created in popups + // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" + var view = elem.ownerDocument.defaultView; + + if ( !view || !view.opener ) { + view = window; + } + + return view.getComputedStyle( elem ); + }; + +var swap = function( elem, options, callback ) { + var ret, name, + old = {}; + + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + ret = callback.call( elem ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + + return ret; +}; + + +var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); + + + +( function() { + + // Executing both pixelPosition & boxSizingReliable tests require only one layout + // so they're executed at the same time to save the second computation. + function computeStyleTests() { + + // This is a singleton, we need to execute it only once + if ( !div ) { + return; + } + + container.style.cssText = "position:absolute;left:-11111px;width:60px;" + + "margin-top:1px;padding:0;border:0"; + div.style.cssText = + "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + + "margin:auto;border:1px;padding:1px;" + + "width:60%;top:1%"; + documentElement.appendChild( container ).appendChild( div ); + + var divStyle = window.getComputedStyle( div ); + pixelPositionVal = divStyle.top !== "1%"; + + // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 + reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; + + // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 + // Some styles come back with percentage values, even though they shouldn't + div.style.right = "60%"; + pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; + + // Support: IE 9 - 11 only + // Detect misreporting of content dimensions for box-sizing:border-box elements + boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; + + // Support: IE 9 only + // Detect overflow:scroll screwiness (gh-3699) + // Support: Chrome <=64 + // Don't get tricked when zoom affects offsetWidth (gh-4029) + div.style.position = "absolute"; + scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; + + documentElement.removeChild( container ); + + // Nullify the div so it wouldn't be stored in the memory and + // it will also be a sign that checks already performed + div = null; + } + + function roundPixelMeasures( measure ) { + return Math.round( parseFloat( measure ) ); + } + + var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, + reliableTrDimensionsVal, reliableMarginLeftVal, + container = document.createElement( "div" ), + div = document.createElement( "div" ); + + // Finish early in limited (non-browser) environments + if ( !div.style ) { + return; + } + + // Support: IE <=9 - 11 only + // Style of cloned element affects source element cloned (trac-8908) + div.style.backgroundClip = "content-box"; + div.cloneNode( true ).style.backgroundClip = ""; + support.clearCloneStyle = div.style.backgroundClip === "content-box"; + + jQuery.extend( support, { + boxSizingReliable: function() { + computeStyleTests(); + return boxSizingReliableVal; + }, + pixelBoxStyles: function() { + computeStyleTests(); + return pixelBoxStylesVal; + }, + pixelPosition: function() { + computeStyleTests(); + return pixelPositionVal; + }, + reliableMarginLeft: function() { + computeStyleTests(); + return reliableMarginLeftVal; + }, + scrollboxSize: function() { + computeStyleTests(); + return scrollboxSizeVal; + }, + + // Support: IE 9 - 11+, Edge 15 - 18+ + // IE/Edge misreport `getComputedStyle` of table rows with width/height + // set in CSS while `offset*` properties report correct values. + // Behavior in IE 9 is more subtle than in newer versions & it passes + // some versions of this test; make sure not to make it pass there! + // + // Support: Firefox 70+ + // Only Firefox includes border widths + // in computed dimensions. (gh-4529) + reliableTrDimensions: function() { + var table, tr, trChild, trStyle; + if ( reliableTrDimensionsVal == null ) { + table = document.createElement( "table" ); + tr = document.createElement( "tr" ); + trChild = document.createElement( "div" ); + + table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; + tr.style.cssText = "box-sizing:content-box;border:1px solid"; + + // Support: Chrome 86+ + // Height set through cssText does not get applied. + // Computed height then comes back as 0. + tr.style.height = "1px"; + trChild.style.height = "9px"; + + // Support: Android 8 Chrome 86+ + // In our bodyBackground.html iframe, + // display for all div elements is set to "inline", + // which causes a problem only in Android 8 Chrome 86. + // Ensuring the div is `display: block` + // gets around this issue. + trChild.style.display = "block"; + + documentElement + .appendChild( table ) + .appendChild( tr ) + .appendChild( trChild ); + + trStyle = window.getComputedStyle( tr ); + reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + + parseInt( trStyle.borderTopWidth, 10 ) + + parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; + + documentElement.removeChild( table ); + } + return reliableTrDimensionsVal; + } + } ); +} )(); + + +function curCSS( elem, name, computed ) { + var width, minWidth, maxWidth, ret, + isCustomProp = rcustomProp.test( name ), + + // Support: Firefox 51+ + // Retrieving style before computed somehow + // fixes an issue with getting wrong values + // on detached elements + style = elem.style; + + computed = computed || getStyles( elem ); + + // getPropertyValue is needed for: + // .css('filter') (IE 9 only, trac-12537) + // .css('--customProperty) (gh-3144) + if ( computed ) { + + // Support: IE <=9 - 11+ + // IE only supports `"float"` in `getPropertyValue`; in computed styles + // it's only available as `"cssFloat"`. We no longer modify properties + // sent to `.css()` apart from camelCasing, so we need to check both. + // Normally, this would create difference in behavior: if + // `getPropertyValue` returns an empty string, the value returned + // by `.css()` would be `undefined`. This is usually the case for + // disconnected elements. However, in IE even disconnected elements + // with no styles return `"none"` for `getPropertyValue( "float" )` + ret = computed.getPropertyValue( name ) || computed[ name ]; + + if ( isCustomProp && ret ) { + + // Support: Firefox 105+, Chrome <=105+ + // Spec requires trimming whitespace for custom properties (gh-4926). + // Firefox only trims leading whitespace. Chrome just collapses + // both leading & trailing whitespace to a single space. + // + // Fall back to `undefined` if empty string returned. + // This collapses a missing definition with property defined + // and set to an empty string but there's no standard API + // allowing us to differentiate them without a performance penalty + // and returning `undefined` aligns with older jQuery. + // + // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED + // as whitespace while CSS does not, but this is not a problem + // because CSS preprocessing replaces them with U+000A LINE FEED + // (which *is* CSS whitespace) + // https://www.w3.org/TR/css-syntax-3/#input-preprocessing + ret = ret.replace( rtrimCSS, "$1" ) || undefined; + } + + if ( ret === "" && !isAttached( elem ) ) { + ret = jQuery.style( elem, name ); + } + + // A tribute to the "awesome hack by Dean Edwards" + // Android Browser returns percentage for some values, + // but width seems to be reliably pixels. + // This is against the CSSOM draft spec: + // https://drafts.csswg.org/cssom/#resolved-values + if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { + + // Remember the original values + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; + + // Put in the new values to get a computed value out + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; + + // Revert the changed values + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; + } + } + + return ret !== undefined ? + + // Support: IE <=9 - 11 only + // IE returns zIndex value as an integer. + ret + "" : + ret; +} + + +function addGetHookIf( conditionFn, hookFn ) { + + // Define the hook, we'll check on the first run if it's really needed. + return { + get: function() { + if ( conditionFn() ) { + + // Hook not needed (or it's not possible to use it due + // to missing dependency), remove it. + delete this.get; + return; + } + + // Hook needed; redefine it so that the support test is not executed again. + return ( this.get = hookFn ).apply( this, arguments ); + } + }; +} + + +var cssPrefixes = [ "Webkit", "Moz", "ms" ], + emptyStyle = document.createElement( "div" ).style, + vendorProps = {}; + +// Return a vendor-prefixed property or undefined +function vendorPropName( name ) { + + // Check for vendor prefixed names + var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), + i = cssPrefixes.length; + + while ( i-- ) { + name = cssPrefixes[ i ] + capName; + if ( name in emptyStyle ) { + return name; + } + } +} + +// Return a potentially-mapped jQuery.cssProps or vendor prefixed property +function finalPropName( name ) { + var final = jQuery.cssProps[ name ] || vendorProps[ name ]; + + if ( final ) { + return final; + } + if ( name in emptyStyle ) { + return name; + } + return vendorProps[ name ] = vendorPropName( name ) || name; +} + + +var + + // Swappable if display is none or starts with table + // except "table", "table-cell", or "table-caption" + // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: "0", + fontWeight: "400" + }; + +function setPositiveNumber( _elem, value, subtract ) { + + // Any relative (+/-) values have already been + // normalized at this point + var matches = rcssNum.exec( value ); + return matches ? + + // Guard against undefined "subtract", e.g., when used as in cssHooks + Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : + value; +} + +function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { + var i = dimension === "width" ? 1 : 0, + extra = 0, + delta = 0, + marginDelta = 0; + + // Adjustment may not be necessary + if ( box === ( isBorderBox ? "border" : "content" ) ) { + return 0; + } + + for ( ; i < 4; i += 2 ) { + + // Both box models exclude margin + // Count margin delta separately to only add it after scroll gutter adjustment. + // This is needed to make negative margins work with `outerHeight( true )` (gh-3982). + if ( box === "margin" ) { + marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); + } + + // If we get here with a content-box, we're seeking "padding" or "border" or "margin" + if ( !isBorderBox ) { + + // Add padding + delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + + // For "border" or "margin", add border + if ( box !== "padding" ) { + delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + + // But still keep track of it otherwise + } else { + extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + + // If we get here with a border-box (content + padding + border), we're seeking "content" or + // "padding" or "margin" + } else { + + // For "content", subtract padding + if ( box === "content" ) { + delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + } + + // For "content" or "padding", subtract border + if ( box !== "margin" ) { + delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } + } + + // Account for positive content-box scroll gutter when requested by providing computedVal + if ( !isBorderBox && computedVal >= 0 ) { + + // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border + // Assuming integer scroll gutter, subtract the rest and round down + delta += Math.max( 0, Math.ceil( + elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - + computedVal - + delta - + extra - + 0.5 + + // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter + // Use an explicit zero to avoid NaN (gh-3964) + ) ) || 0; + } + + return delta + marginDelta; +} + +function getWidthOrHeight( elem, dimension, extra ) { + + // Start with computed style + var styles = getStyles( elem ), + + // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). + // Fake content-box until we know it's needed to know the true value. + boxSizingNeeded = !support.boxSizingReliable() || extra, + isBorderBox = boxSizingNeeded && + jQuery.css( elem, "boxSizing", false, styles ) === "border-box", + valueIsBorderBox = isBorderBox, + + val = curCSS( elem, dimension, styles ), + offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); + + // Support: Firefox <=54 + // Return a confounding non-pixel value or feign ignorance, as appropriate. + if ( rnumnonpx.test( val ) ) { + if ( !extra ) { + return val; + } + val = "auto"; + } + + + // Support: IE 9 - 11 only + // Use offsetWidth/offsetHeight for when box sizing is unreliable. + // In those cases, the computed value can be trusted to be border-box. + if ( ( !support.boxSizingReliable() && isBorderBox || + + // Support: IE 10 - 11+, Edge 15 - 18+ + // IE/Edge misreport `getComputedStyle` of table rows with width/height + // set in CSS while `offset*` properties report correct values. + // Interestingly, in some cases IE 9 doesn't suffer from this issue. + !support.reliableTrDimensions() && nodeName( elem, "tr" ) || + + // Fall back to offsetWidth/offsetHeight when value is "auto" + // This happens for inline elements with no explicit setting (gh-3571) + val === "auto" || + + // Support: Android <=4.1 - 4.3 only + // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) + !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && + + // Make sure the element is visible & connected + elem.getClientRects().length ) { + + isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; + + // Where available, offsetWidth/offsetHeight approximate border box dimensions. + // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the + // retrieved value as a content box dimension. + valueIsBorderBox = offsetProp in elem; + if ( valueIsBorderBox ) { + val = elem[ offsetProp ]; + } + } + + // Normalize "" and auto + val = parseFloat( val ) || 0; + + // Adjust for the element's box model + return ( val + + boxModelAdjustment( + elem, + dimension, + extra || ( isBorderBox ? "border" : "content" ), + valueIsBorderBox, + styles, + + // Provide the current computed size to request scroll gutter calculation (gh-3589) + val + ) + ) + "px"; +} + +jQuery.extend( { + + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; + } + } + } + }, + + // Don't automatically add "px" to these possibly-unitless properties + cssNumber: { + animationIterationCount: true, + aspectRatio: true, + borderImageSlice: true, + columnCount: true, + flexGrow: true, + flexShrink: true, + fontWeight: true, + gridArea: true, + gridColumn: true, + gridColumnEnd: true, + gridColumnStart: true, + gridRow: true, + gridRowEnd: true, + gridRowStart: true, + lineHeight: true, + opacity: true, + order: true, + orphans: true, + scale: true, + widows: true, + zIndex: true, + zoom: true, + + // SVG-related + fillOpacity: true, + floodOpacity: true, + stopOpacity: true, + strokeMiterlimit: true, + strokeOpacity: true + }, + + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: {}, + + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } + + // Make sure that we're working with the right name + var ret, type, hooks, + origName = camelCase( name ), + isCustomProp = rcustomProp.test( name ), + style = elem.style; + + // Make sure that we're working with the right name. We don't + // want to query the value if it is a CSS custom property + // since they are user-defined. + if ( !isCustomProp ) { + name = finalPropName( origName ); + } + + // Gets hook for the prefixed version, then unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; + + // Convert "+=" or "-=" to relative numbers (trac-7345) + if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { + value = adjustCSS( elem, name, ret ); + + // Fixes bug trac-9237 + type = "number"; + } + + // Make sure that null and NaN values aren't set (trac-7116) + if ( value == null || value !== value ) { + return; + } + + // If a number was passed in, add the unit (except for certain CSS properties) + // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append + // "px" to a few hardcoded values. + if ( type === "number" && !isCustomProp ) { + value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); + } + + // background-* props affect original clone's values + if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { + style[ name ] = "inherit"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !( "set" in hooks ) || + ( value = hooks.set( elem, value, extra ) ) !== undefined ) { + + if ( isCustomProp ) { + style.setProperty( name, value ); + } else { + style[ name ] = value; + } + } + + } else { + + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && + ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { + + return ret; + } + + // Otherwise just get the value from the style object + return style[ name ]; + } + }, + + css: function( elem, name, extra, styles ) { + var val, num, hooks, + origName = camelCase( name ), + isCustomProp = rcustomProp.test( name ); + + // Make sure that we're working with the right name. We don't + // want to modify the value if it is a CSS custom property + // since they are user-defined. + if ( !isCustomProp ) { + name = finalPropName( origName ); + } + + // Try prefixed name followed by the unprefixed name + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks ) { + val = hooks.get( elem, true, extra ); + } + + // Otherwise, if a way to get the computed value exists, use that + if ( val === undefined ) { + val = curCSS( elem, name, styles ); + } + + // Convert "normal" to computed value + if ( val === "normal" && name in cssNormalTransform ) { + val = cssNormalTransform[ name ]; + } + + // Make numeric if forced or a qualifier was provided and val looks numeric + if ( extra === "" || extra ) { + num = parseFloat( val ); + return extra === true || isFinite( num ) ? num || 0 : val; + } + + return val; + } +} ); + +jQuery.each( [ "height", "width" ], function( _i, dimension ) { + jQuery.cssHooks[ dimension ] = { + get: function( elem, computed, extra ) { + if ( computed ) { + + // Certain elements can have dimension info if we invisibly show them + // but it must have a current display style that would benefit + return rdisplayswap.test( jQuery.css( elem, "display" ) ) && + + // Support: Safari 8+ + // Table columns in Safari have non-zero offsetWidth & zero + // getBoundingClientRect().width unless display is changed. + // Support: IE <=11 only + // Running getBoundingClientRect on a disconnected node + // in IE throws an error. + ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? + swap( elem, cssShow, function() { + return getWidthOrHeight( elem, dimension, extra ); + } ) : + getWidthOrHeight( elem, dimension, extra ); + } + }, + + set: function( elem, value, extra ) { + var matches, + styles = getStyles( elem ), + + // Only read styles.position if the test has a chance to fail + // to avoid forcing a reflow. + scrollboxSizeBuggy = !support.scrollboxSize() && + styles.position === "absolute", + + // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) + boxSizingNeeded = scrollboxSizeBuggy || extra, + isBorderBox = boxSizingNeeded && + jQuery.css( elem, "boxSizing", false, styles ) === "border-box", + subtract = extra ? + boxModelAdjustment( + elem, + dimension, + extra, + isBorderBox, + styles + ) : + 0; + + // Account for unreliable border-box dimensions by comparing offset* to computed and + // faking a content-box to get border and padding (gh-3699) + if ( isBorderBox && scrollboxSizeBuggy ) { + subtract -= Math.ceil( + elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - + parseFloat( styles[ dimension ] ) - + boxModelAdjustment( elem, dimension, "border", false, styles ) - + 0.5 + ); + } + + // Convert to pixels if value adjustment is needed + if ( subtract && ( matches = rcssNum.exec( value ) ) && + ( matches[ 3 ] || "px" ) !== "px" ) { + + elem.style[ dimension ] = value; + value = jQuery.css( elem, dimension ); + } + + return setPositiveNumber( elem, value, subtract ); + } + }; +} ); + +jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, + function( elem, computed ) { + if ( computed ) { + return ( parseFloat( curCSS( elem, "marginLeft" ) ) || + elem.getBoundingClientRect().left - + swap( elem, { marginLeft: 0 }, function() { + return elem.getBoundingClientRect().left; + } ) + ) + "px"; + } + } +); + +// These hooks are used by animate to expand properties +jQuery.each( { + margin: "", + padding: "", + border: "Width" +}, function( prefix, suffix ) { + jQuery.cssHooks[ prefix + suffix ] = { + expand: function( value ) { + var i = 0, + expanded = {}, + + // Assumes a single number if not a string + parts = typeof value === "string" ? value.split( " " ) : [ value ]; + + for ( ; i < 4; i++ ) { + expanded[ prefix + cssExpand[ i ] + suffix ] = + parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; + } + + return expanded; + } + }; + + if ( prefix !== "margin" ) { + jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; + } +} ); + +jQuery.fn.extend( { + css: function( name, value ) { + return access( this, function( elem, name, value ) { + var styles, len, + map = {}, + i = 0; + + if ( Array.isArray( name ) ) { + styles = getStyles( elem ); + len = name.length; + + for ( ; i < len; i++ ) { + map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); + } + + return map; + } + + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); + } +} ); + + +function Tween( elem, options, prop, end, easing ) { + return new Tween.prototype.init( elem, options, prop, end, easing ); +} +jQuery.Tween = Tween; + +Tween.prototype = { + constructor: Tween, + init: function( elem, options, prop, end, easing, unit ) { + this.elem = elem; + this.prop = prop; + this.easing = easing || jQuery.easing._default; + this.options = options; + this.start = this.now = this.cur(); + this.end = end; + this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + }, + cur: function() { + var hooks = Tween.propHooks[ this.prop ]; + + return hooks && hooks.get ? + hooks.get( this ) : + Tween.propHooks._default.get( this ); + }, + run: function( percent ) { + var eased, + hooks = Tween.propHooks[ this.prop ]; + + if ( this.options.duration ) { + this.pos = eased = jQuery.easing[ this.easing ]( + percent, this.options.duration * percent, 0, 1, this.options.duration + ); + } else { + this.pos = eased = percent; + } + this.now = ( this.end - this.start ) * eased + this.start; + + if ( this.options.step ) { + this.options.step.call( this.elem, this.now, this ); + } + + if ( hooks && hooks.set ) { + hooks.set( this ); + } else { + Tween.propHooks._default.set( this ); + } + return this; + } +}; + +Tween.prototype.init.prototype = Tween.prototype; + +Tween.propHooks = { + _default: { + get: function( tween ) { + var result; + + // Use a property on the element directly when it is not a DOM element, + // or when there is no matching style property that exists. + if ( tween.elem.nodeType !== 1 || + tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { + return tween.elem[ tween.prop ]; + } + + // Passing an empty string as a 3rd parameter to .css will automatically + // attempt a parseFloat and fallback to a string if the parse fails. + // Simple values such as "10px" are parsed to Float; + // complex values such as "rotate(1rad)" are returned as-is. + result = jQuery.css( tween.elem, tween.prop, "" ); + + // Empty strings, null, undefined and "auto" are converted to 0. + return !result || result === "auto" ? 0 : result; + }, + set: function( tween ) { + + // Use step hook for back compat. + // Use cssHook if its there. + // Use .style if available and use plain properties where available. + if ( jQuery.fx.step[ tween.prop ] ) { + jQuery.fx.step[ tween.prop ]( tween ); + } else if ( tween.elem.nodeType === 1 && ( + jQuery.cssHooks[ tween.prop ] || + tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { + jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); + } else { + tween.elem[ tween.prop ] = tween.now; + } + } + } +}; + +// Support: IE <=9 only +// Panic based approach to setting things on disconnected nodes +Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { + set: function( tween ) { + if ( tween.elem.nodeType && tween.elem.parentNode ) { + tween.elem[ tween.prop ] = tween.now; + } + } +}; + +jQuery.easing = { + linear: function( p ) { + return p; + }, + swing: function( p ) { + return 0.5 - Math.cos( p * Math.PI ) / 2; + }, + _default: "swing" +}; + +jQuery.fx = Tween.prototype.init; + +// Back compat <1.8 extension point +jQuery.fx.step = {}; + + + + +var + fxNow, inProgress, + rfxtypes = /^(?:toggle|show|hide)$/, + rrun = /queueHooks$/; + +function schedule() { + if ( inProgress ) { + if ( document.hidden === false && window.requestAnimationFrame ) { + window.requestAnimationFrame( schedule ); + } else { + window.setTimeout( schedule, jQuery.fx.interval ); + } + + jQuery.fx.tick(); + } +} + +// Animations created synchronously will run synchronously +function createFxNow() { + window.setTimeout( function() { + fxNow = undefined; + } ); + return ( fxNow = Date.now() ); +} + +// Generate parameters to create a standard animation +function genFx( type, includeWidth ) { + var which, + i = 0, + attrs = { height: type }; + + // If we include width, step value is 1 to do all cssExpand values, + // otherwise step value is 2 to skip over Left and Right + includeWidth = includeWidth ? 1 : 0; + for ( ; i < 4; i += 2 - includeWidth ) { + which = cssExpand[ i ]; + attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; + } + + if ( includeWidth ) { + attrs.opacity = attrs.width = type; + } + + return attrs; +} + +function createTween( value, prop, animation ) { + var tween, + collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), + index = 0, + length = collection.length; + for ( ; index < length; index++ ) { + if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { + + // We're done with this property + return tween; + } + } +} + +function defaultPrefilter( elem, props, opts ) { + var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, + isBox = "width" in props || "height" in props, + anim = this, + orig = {}, + style = elem.style, + hidden = elem.nodeType && isHiddenWithinTree( elem ), + dataShow = dataPriv.get( elem, "fxshow" ); + + // Queue-skipping animations hijack the fx hooks + if ( !opts.queue ) { + hooks = jQuery._queueHooks( elem, "fx" ); + if ( hooks.unqueued == null ) { + hooks.unqueued = 0; + oldfire = hooks.empty.fire; + hooks.empty.fire = function() { + if ( !hooks.unqueued ) { + oldfire(); + } + }; + } + hooks.unqueued++; + + anim.always( function() { + + // Ensure the complete handler is called before this completes + anim.always( function() { + hooks.unqueued--; + if ( !jQuery.queue( elem, "fx" ).length ) { + hooks.empty.fire(); + } + } ); + } ); + } + + // Detect show/hide animations + for ( prop in props ) { + value = props[ prop ]; + if ( rfxtypes.test( value ) ) { + delete props[ prop ]; + toggle = toggle || value === "toggle"; + if ( value === ( hidden ? "hide" : "show" ) ) { + + // Pretend to be hidden if this is a "show" and + // there is still data from a stopped show/hide + if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { + hidden = true; + + // Ignore all other no-op show/hide data + } else { + continue; + } + } + orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); + } + } + + // Bail out if this is a no-op like .hide().hide() + propTween = !jQuery.isEmptyObject( props ); + if ( !propTween && jQuery.isEmptyObject( orig ) ) { + return; + } + + // Restrict "overflow" and "display" styles during box animations + if ( isBox && elem.nodeType === 1 ) { + + // Support: IE <=9 - 11, Edge 12 - 15 + // Record all 3 overflow attributes because IE does not infer the shorthand + // from identically-valued overflowX and overflowY and Edge just mirrors + // the overflowX value there. + opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; + + // Identify a display type, preferring old show/hide data over the CSS cascade + restoreDisplay = dataShow && dataShow.display; + if ( restoreDisplay == null ) { + restoreDisplay = dataPriv.get( elem, "display" ); + } + display = jQuery.css( elem, "display" ); + if ( display === "none" ) { + if ( restoreDisplay ) { + display = restoreDisplay; + } else { + + // Get nonempty value(s) by temporarily forcing visibility + showHide( [ elem ], true ); + restoreDisplay = elem.style.display || restoreDisplay; + display = jQuery.css( elem, "display" ); + showHide( [ elem ] ); + } + } + + // Animate inline elements as inline-block + if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { + if ( jQuery.css( elem, "float" ) === "none" ) { + + // Restore the original display value at the end of pure show/hide animations + if ( !propTween ) { + anim.done( function() { + style.display = restoreDisplay; + } ); + if ( restoreDisplay == null ) { + display = style.display; + restoreDisplay = display === "none" ? "" : display; + } + } + style.display = "inline-block"; + } + } + } + + if ( opts.overflow ) { + style.overflow = "hidden"; + anim.always( function() { + style.overflow = opts.overflow[ 0 ]; + style.overflowX = opts.overflow[ 1 ]; + style.overflowY = opts.overflow[ 2 ]; + } ); + } + + // Implement show/hide animations + propTween = false; + for ( prop in orig ) { + + // General show/hide setup for this element animation + if ( !propTween ) { + if ( dataShow ) { + if ( "hidden" in dataShow ) { + hidden = dataShow.hidden; + } + } else { + dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); + } + + // Store hidden/visible for toggle so `.stop().toggle()` "reverses" + if ( toggle ) { + dataShow.hidden = !hidden; + } + + // Show elements before animating them + if ( hidden ) { + showHide( [ elem ], true ); + } + + /* eslint-disable no-loop-func */ + + anim.done( function() { + + /* eslint-enable no-loop-func */ + + // The final step of a "hide" animation is actually hiding the element + if ( !hidden ) { + showHide( [ elem ] ); + } + dataPriv.remove( elem, "fxshow" ); + for ( prop in orig ) { + jQuery.style( elem, prop, orig[ prop ] ); + } + } ); + } + + // Per-property setup + propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); + if ( !( prop in dataShow ) ) { + dataShow[ prop ] = propTween.start; + if ( hidden ) { + propTween.end = propTween.start; + propTween.start = 0; + } + } + } +} + +function propFilter( props, specialEasing ) { + var index, name, easing, value, hooks; + + // camelCase, specialEasing and expand cssHook pass + for ( index in props ) { + name = camelCase( index ); + easing = specialEasing[ name ]; + value = props[ index ]; + if ( Array.isArray( value ) ) { + easing = value[ 1 ]; + value = props[ index ] = value[ 0 ]; + } + + if ( index !== name ) { + props[ name ] = value; + delete props[ index ]; + } + + hooks = jQuery.cssHooks[ name ]; + if ( hooks && "expand" in hooks ) { + value = hooks.expand( value ); + delete props[ name ]; + + // Not quite $.extend, this won't overwrite existing keys. + // Reusing 'index' because we have the correct "name" + for ( index in value ) { + if ( !( index in props ) ) { + props[ index ] = value[ index ]; + specialEasing[ index ] = easing; + } + } + } else { + specialEasing[ name ] = easing; + } + } +} + +function Animation( elem, properties, options ) { + var result, + stopped, + index = 0, + length = Animation.prefilters.length, + deferred = jQuery.Deferred().always( function() { + + // Don't match elem in the :animated selector + delete tick.elem; + } ), + tick = function() { + if ( stopped ) { + return false; + } + var currentTime = fxNow || createFxNow(), + remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), + + // Support: Android 2.3 only + // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497) + temp = remaining / animation.duration || 0, + percent = 1 - temp, + index = 0, + length = animation.tweens.length; + + for ( ; index < length; index++ ) { + animation.tweens[ index ].run( percent ); + } + + deferred.notifyWith( elem, [ animation, percent, remaining ] ); + + // If there's more to do, yield + if ( percent < 1 && length ) { + return remaining; + } + + // If this was an empty animation, synthesize a final progress notification + if ( !length ) { + deferred.notifyWith( elem, [ animation, 1, 0 ] ); + } + + // Resolve the animation and report its conclusion + deferred.resolveWith( elem, [ animation ] ); + return false; + }, + animation = deferred.promise( { + elem: elem, + props: jQuery.extend( {}, properties ), + opts: jQuery.extend( true, { + specialEasing: {}, + easing: jQuery.easing._default + }, options ), + originalProperties: properties, + originalOptions: options, + startTime: fxNow || createFxNow(), + duration: options.duration, + tweens: [], + createTween: function( prop, end ) { + var tween = jQuery.Tween( elem, animation.opts, prop, end, + animation.opts.specialEasing[ prop ] || animation.opts.easing ); + animation.tweens.push( tween ); + return tween; + }, + stop: function( gotoEnd ) { + var index = 0, + + // If we are going to the end, we want to run all the tweens + // otherwise we skip this part + length = gotoEnd ? animation.tweens.length : 0; + if ( stopped ) { + return this; + } + stopped = true; + for ( ; index < length; index++ ) { + animation.tweens[ index ].run( 1 ); + } + + // Resolve when we played the last frame; otherwise, reject + if ( gotoEnd ) { + deferred.notifyWith( elem, [ animation, 1, 0 ] ); + deferred.resolveWith( elem, [ animation, gotoEnd ] ); + } else { + deferred.rejectWith( elem, [ animation, gotoEnd ] ); + } + return this; + } + } ), + props = animation.props; + + propFilter( props, animation.opts.specialEasing ); + + for ( ; index < length; index++ ) { + result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); + if ( result ) { + if ( isFunction( result.stop ) ) { + jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = + result.stop.bind( result ); + } + return result; + } + } + + jQuery.map( props, createTween, animation ); + + if ( isFunction( animation.opts.start ) ) { + animation.opts.start.call( elem, animation ); + } + + // Attach callbacks from options + animation + .progress( animation.opts.progress ) + .done( animation.opts.done, animation.opts.complete ) + .fail( animation.opts.fail ) + .always( animation.opts.always ); + + jQuery.fx.timer( + jQuery.extend( tick, { + elem: elem, + anim: animation, + queue: animation.opts.queue + } ) + ); + + return animation; +} + +jQuery.Animation = jQuery.extend( Animation, { + + tweeners: { + "*": [ function( prop, value ) { + var tween = this.createTween( prop, value ); + adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); + return tween; + } ] + }, + + tweener: function( props, callback ) { + if ( isFunction( props ) ) { + callback = props; + props = [ "*" ]; + } else { + props = props.match( rnothtmlwhite ); + } + + var prop, + index = 0, + length = props.length; + + for ( ; index < length; index++ ) { + prop = props[ index ]; + Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; + Animation.tweeners[ prop ].unshift( callback ); + } + }, + + prefilters: [ defaultPrefilter ], + + prefilter: function( callback, prepend ) { + if ( prepend ) { + Animation.prefilters.unshift( callback ); + } else { + Animation.prefilters.push( callback ); + } + } +} ); + +jQuery.speed = function( speed, easing, fn ) { + var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { + complete: fn || !fn && easing || + isFunction( speed ) && speed, + duration: speed, + easing: fn && easing || easing && !isFunction( easing ) && easing + }; + + // Go to the end state if fx are off + if ( jQuery.fx.off ) { + opt.duration = 0; + + } else { + if ( typeof opt.duration !== "number" ) { + if ( opt.duration in jQuery.fx.speeds ) { + opt.duration = jQuery.fx.speeds[ opt.duration ]; + + } else { + opt.duration = jQuery.fx.speeds._default; + } + } + } + + // Normalize opt.queue - true/undefined/null -> "fx" + if ( opt.queue == null || opt.queue === true ) { + opt.queue = "fx"; + } + + // Queueing + opt.old = opt.complete; + + opt.complete = function() { + if ( isFunction( opt.old ) ) { + opt.old.call( this ); + } + + if ( opt.queue ) { + jQuery.dequeue( this, opt.queue ); + } + }; + + return opt; +}; + +jQuery.fn.extend( { + fadeTo: function( speed, to, easing, callback ) { + + // Show any hidden elements after setting opacity to 0 + return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() + + // Animate to the value specified + .end().animate( { opacity: to }, speed, easing, callback ); + }, + animate: function( prop, speed, easing, callback ) { + var empty = jQuery.isEmptyObject( prop ), + optall = jQuery.speed( speed, easing, callback ), + doAnimation = function() { + + // Operate on a copy of prop so per-property easing won't be lost + var anim = Animation( this, jQuery.extend( {}, prop ), optall ); + + // Empty animations, or finishing resolves immediately + if ( empty || dataPriv.get( this, "finish" ) ) { + anim.stop( true ); + } + }; + + doAnimation.finish = doAnimation; + + return empty || optall.queue === false ? + this.each( doAnimation ) : + this.queue( optall.queue, doAnimation ); + }, + stop: function( type, clearQueue, gotoEnd ) { + var stopQueue = function( hooks ) { + var stop = hooks.stop; + delete hooks.stop; + stop( gotoEnd ); + }; + + if ( typeof type !== "string" ) { + gotoEnd = clearQueue; + clearQueue = type; + type = undefined; + } + if ( clearQueue ) { + this.queue( type || "fx", [] ); + } + + return this.each( function() { + var dequeue = true, + index = type != null && type + "queueHooks", + timers = jQuery.timers, + data = dataPriv.get( this ); + + if ( index ) { + if ( data[ index ] && data[ index ].stop ) { + stopQueue( data[ index ] ); + } + } else { + for ( index in data ) { + if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { + stopQueue( data[ index ] ); + } + } + } + + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && + ( type == null || timers[ index ].queue === type ) ) { + + timers[ index ].anim.stop( gotoEnd ); + dequeue = false; + timers.splice( index, 1 ); + } + } + + // Start the next in the queue if the last step wasn't forced. + // Timers currently will call their complete callbacks, which + // will dequeue but only if they were gotoEnd. + if ( dequeue || !gotoEnd ) { + jQuery.dequeue( this, type ); + } + } ); + }, + finish: function( type ) { + if ( type !== false ) { + type = type || "fx"; + } + return this.each( function() { + var index, + data = dataPriv.get( this ), + queue = data[ type + "queue" ], + hooks = data[ type + "queueHooks" ], + timers = jQuery.timers, + length = queue ? queue.length : 0; + + // Enable finishing flag on private data + data.finish = true; + + // Empty the queue first + jQuery.queue( this, type, [] ); + + if ( hooks && hooks.stop ) { + hooks.stop.call( this, true ); + } + + // Look for any active animations, and finish them + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && timers[ index ].queue === type ) { + timers[ index ].anim.stop( true ); + timers.splice( index, 1 ); + } + } + + // Look for any animations in the old queue and finish them + for ( index = 0; index < length; index++ ) { + if ( queue[ index ] && queue[ index ].finish ) { + queue[ index ].finish.call( this ); + } + } + + // Turn off finishing flag + delete data.finish; + } ); + } +} ); + +jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { + var cssFn = jQuery.fn[ name ]; + jQuery.fn[ name ] = function( speed, easing, callback ) { + return speed == null || typeof speed === "boolean" ? + cssFn.apply( this, arguments ) : + this.animate( genFx( name, true ), speed, easing, callback ); + }; +} ); + +// Generate shortcuts for custom animations +jQuery.each( { + slideDown: genFx( "show" ), + slideUp: genFx( "hide" ), + slideToggle: genFx( "toggle" ), + fadeIn: { opacity: "show" }, + fadeOut: { opacity: "hide" }, + fadeToggle: { opacity: "toggle" } +}, function( name, props ) { + jQuery.fn[ name ] = function( speed, easing, callback ) { + return this.animate( props, speed, easing, callback ); + }; +} ); + +jQuery.timers = []; +jQuery.fx.tick = function() { + var timer, + i = 0, + timers = jQuery.timers; + + fxNow = Date.now(); + + for ( ; i < timers.length; i++ ) { + timer = timers[ i ]; + + // Run the timer and safely remove it when done (allowing for external removal) + if ( !timer() && timers[ i ] === timer ) { + timers.splice( i--, 1 ); + } + } + + if ( !timers.length ) { + jQuery.fx.stop(); + } + fxNow = undefined; +}; + +jQuery.fx.timer = function( timer ) { + jQuery.timers.push( timer ); + jQuery.fx.start(); +}; + +jQuery.fx.interval = 13; +jQuery.fx.start = function() { + if ( inProgress ) { + return; + } + + inProgress = true; + schedule(); +}; + +jQuery.fx.stop = function() { + inProgress = null; +}; + +jQuery.fx.speeds = { + slow: 600, + fast: 200, + + // Default speed + _default: 400 +}; + + +// Based off of the plugin by Clint Helfers, with permission. +jQuery.fn.delay = function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = window.setTimeout( next, time ); + hooks.stop = function() { + window.clearTimeout( timeout ); + }; + } ); +}; + + +( function() { + var input = document.createElement( "input" ), + select = document.createElement( "select" ), + opt = select.appendChild( document.createElement( "option" ) ); + + input.type = "checkbox"; + + // Support: Android <=4.3 only + // Default value for a checkbox should be "on" + support.checkOn = input.value !== ""; + + // Support: IE <=11 only + // Must access selectedIndex to make default options select + support.optSelected = opt.selected; + + // Support: IE <=11 only + // An input loses its value after becoming a radio + input = document.createElement( "input" ); + input.value = "t"; + input.type = "radio"; + support.radioValue = input.value === "t"; +} )(); + + +var boolHook, + attrHandle = jQuery.expr.attrHandle; + +jQuery.fn.extend( { + attr: function( name, value ) { + return access( this, jQuery.attr, name, value, arguments.length > 1 ); + }, + + removeAttr: function( name ) { + return this.each( function() { + jQuery.removeAttr( this, name ); + } ); + } +} ); + +jQuery.extend( { + attr: function( elem, name, value ) { + var ret, hooks, + nType = elem.nodeType; + + // Don't get/set attributes on text, comment and attribute nodes + if ( nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === "undefined" ) { + return jQuery.prop( elem, name, value ); + } + + // Attribute hooks are determined by the lowercase version + // Grab necessary hook if one is defined + if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { + hooks = jQuery.attrHooks[ name.toLowerCase() ] || + ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); + } + + if ( value !== undefined ) { + if ( value === null ) { + jQuery.removeAttr( elem, name ); + return; + } + + if ( hooks && "set" in hooks && + ( ret = hooks.set( elem, value, name ) ) !== undefined ) { + return ret; + } + + elem.setAttribute( name, value + "" ); + return value; + } + + if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { + return ret; + } + + ret = jQuery.find.attr( elem, name ); + + // Non-existent attributes return null, we normalize to undefined + return ret == null ? undefined : ret; + }, + + attrHooks: { + type: { + set: function( elem, value ) { + if ( !support.radioValue && value === "radio" && + nodeName( elem, "input" ) ) { + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + } + }, + + removeAttr: function( elem, value ) { + var name, + i = 0, + + // Attribute names can contain non-HTML whitespace characters + // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 + attrNames = value && value.match( rnothtmlwhite ); + + if ( attrNames && elem.nodeType === 1 ) { + while ( ( name = attrNames[ i++ ] ) ) { + elem.removeAttribute( name ); + } + } + } +} ); + +// Hooks for boolean attributes +boolHook = { + set: function( elem, value, name ) { + if ( value === false ) { + + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else { + elem.setAttribute( name, name ); + } + return name; + } +}; + +jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { + var getter = attrHandle[ name ] || jQuery.find.attr; + + attrHandle[ name ] = function( elem, name, isXML ) { + var ret, handle, + lowercaseName = name.toLowerCase(); + + if ( !isXML ) { + + // Avoid an infinite loop by temporarily removing this function from the getter + handle = attrHandle[ lowercaseName ]; + attrHandle[ lowercaseName ] = ret; + ret = getter( elem, name, isXML ) != null ? + lowercaseName : + null; + attrHandle[ lowercaseName ] = handle; + } + return ret; + }; +} ); + + + + +var rfocusable = /^(?:input|select|textarea|button)$/i, + rclickable = /^(?:a|area)$/i; + +jQuery.fn.extend( { + prop: function( name, value ) { + return access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, + + removeProp: function( name ) { + return this.each( function() { + delete this[ jQuery.propFix[ name ] || name ]; + } ); + } +} ); + +jQuery.extend( { + prop: function( elem, name, value ) { + var ret, hooks, + nType = elem.nodeType; + + // Don't get/set properties on text, comment and attribute nodes + if ( nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { + + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && + ( ret = hooks.set( elem, value, name ) ) !== undefined ) { + return ret; + } + + return ( elem[ name ] = value ); + } + + if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { + return ret; + } + + return elem[ name ]; + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + + // Support: IE <=9 - 11 only + // elem.tabIndex doesn't always return the + // correct value when it hasn't been explicitly set + // Use proper attribute retrieval (trac-12072) + var tabindex = jQuery.find.attr( elem, "tabindex" ); + + if ( tabindex ) { + return parseInt( tabindex, 10 ); + } + + if ( + rfocusable.test( elem.nodeName ) || + rclickable.test( elem.nodeName ) && + elem.href + ) { + return 0; + } + + return -1; + } + } + }, + + propFix: { + "for": "htmlFor", + "class": "className" + } +} ); + +// Support: IE <=11 only +// Accessing the selectedIndex property +// forces the browser to respect setting selected +// on the option +// The getter ensures a default option is selected +// when in an optgroup +// eslint rule "no-unused-expressions" is disabled for this code +// since it considers such accessions noop +if ( !support.optSelected ) { + jQuery.propHooks.selected = { + get: function( elem ) { + + /* eslint no-unused-expressions: "off" */ + + var parent = elem.parentNode; + if ( parent && parent.parentNode ) { + parent.parentNode.selectedIndex; + } + return null; + }, + set: function( elem ) { + + /* eslint no-unused-expressions: "off" */ + + var parent = elem.parentNode; + if ( parent ) { + parent.selectedIndex; + + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + } + }; +} + +jQuery.each( [ + "tabIndex", + "readOnly", + "maxLength", + "cellSpacing", + "cellPadding", + "rowSpan", + "colSpan", + "useMap", + "frameBorder", + "contentEditable" +], function() { + jQuery.propFix[ this.toLowerCase() ] = this; +} ); + + + + + // Strip and collapse whitespace according to HTML spec + // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace + function stripAndCollapse( value ) { + var tokens = value.match( rnothtmlwhite ) || []; + return tokens.join( " " ); + } + + +function getClass( elem ) { + return elem.getAttribute && elem.getAttribute( "class" ) || ""; +} + +function classesToArray( value ) { + if ( Array.isArray( value ) ) { + return value; + } + if ( typeof value === "string" ) { + return value.match( rnothtmlwhite ) || []; + } + return []; +} + +jQuery.fn.extend( { + addClass: function( value ) { + var classNames, cur, curValue, className, i, finalValue; + + if ( isFunction( value ) ) { + return this.each( function( j ) { + jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); + } ); + } + + classNames = classesToArray( value ); + + if ( classNames.length ) { + return this.each( function() { + curValue = getClass( this ); + cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); + + if ( cur ) { + for ( i = 0; i < classNames.length; i++ ) { + className = classNames[ i ]; + if ( cur.indexOf( " " + className + " " ) < 0 ) { + cur += className + " "; + } + } + + // Only assign if different to avoid unneeded rendering. + finalValue = stripAndCollapse( cur ); + if ( curValue !== finalValue ) { + this.setAttribute( "class", finalValue ); + } + } + } ); + } + + return this; + }, + + removeClass: function( value ) { + var classNames, cur, curValue, className, i, finalValue; + + if ( isFunction( value ) ) { + return this.each( function( j ) { + jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); + } ); + } + + if ( !arguments.length ) { + return this.attr( "class", "" ); + } + + classNames = classesToArray( value ); + + if ( classNames.length ) { + return this.each( function() { + curValue = getClass( this ); + + // This expression is here for better compressibility (see addClass) + cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); + + if ( cur ) { + for ( i = 0; i < classNames.length; i++ ) { + className = classNames[ i ]; + + // Remove *all* instances + while ( cur.indexOf( " " + className + " " ) > -1 ) { + cur = cur.replace( " " + className + " ", " " ); + } + } + + // Only assign if different to avoid unneeded rendering. + finalValue = stripAndCollapse( cur ); + if ( curValue !== finalValue ) { + this.setAttribute( "class", finalValue ); + } + } + } ); + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var classNames, className, i, self, + type = typeof value, + isValidValue = type === "string" || Array.isArray( value ); + + if ( isFunction( value ) ) { + return this.each( function( i ) { + jQuery( this ).toggleClass( + value.call( this, i, getClass( this ), stateVal ), + stateVal + ); + } ); + } + + if ( typeof stateVal === "boolean" && isValidValue ) { + return stateVal ? this.addClass( value ) : this.removeClass( value ); + } + + classNames = classesToArray( value ); + + return this.each( function() { + if ( isValidValue ) { + + // Toggle individual class names + self = jQuery( this ); + + for ( i = 0; i < classNames.length; i++ ) { + className = classNames[ i ]; + + // Check each className given, space separated list + if ( self.hasClass( className ) ) { + self.removeClass( className ); + } else { + self.addClass( className ); + } + } + + // Toggle whole class name + } else if ( value === undefined || type === "boolean" ) { + className = getClass( this ); + if ( className ) { + + // Store className if set + dataPriv.set( this, "__className__", className ); + } + + // If the element has a class name or if we're passed `false`, + // then remove the whole classname (if there was one, the above saved it). + // Otherwise bring back whatever was previously saved (if anything), + // falling back to the empty string if nothing was stored. + if ( this.setAttribute ) { + this.setAttribute( "class", + className || value === false ? + "" : + dataPriv.get( this, "__className__" ) || "" + ); + } + } + } ); + }, + + hasClass: function( selector ) { + var className, elem, + i = 0; + + className = " " + selector + " "; + while ( ( elem = this[ i++ ] ) ) { + if ( elem.nodeType === 1 && + ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { + return true; + } + } + + return false; + } +} ); + + + + +var rreturn = /\r/g; + +jQuery.fn.extend( { + val: function( value ) { + var hooks, ret, valueIsFunction, + elem = this[ 0 ]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || + jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + + if ( hooks && + "get" in hooks && + ( ret = hooks.get( elem, "value" ) ) !== undefined + ) { + return ret; + } + + ret = elem.value; + + // Handle most common string cases + if ( typeof ret === "string" ) { + return ret.replace( rreturn, "" ); + } + + // Handle cases where value is null/undef or number + return ret == null ? "" : ret; + } + + return; + } + + valueIsFunction = isFunction( value ); + + return this.each( function( i ) { + var val; + + if ( this.nodeType !== 1 ) { + return; + } + + if ( valueIsFunction ) { + val = value.call( this, i, jQuery( this ).val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + + } else if ( typeof val === "number" ) { + val += ""; + + } else if ( Array.isArray( val ) ) { + val = jQuery.map( val, function( value ) { + return value == null ? "" : value + ""; + } ); + } + + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + } ); + } +} ); + +jQuery.extend( { + valHooks: { + option: { + get: function( elem ) { + + var val = jQuery.find.attr( elem, "value" ); + return val != null ? + val : + + // Support: IE <=10 - 11 only + // option.text throws exceptions (trac-14686, trac-14858) + // Strip and collapse whitespace + // https://html.spec.whatwg.org/#strip-and-collapse-whitespace + stripAndCollapse( jQuery.text( elem ) ); + } + }, + select: { + get: function( elem ) { + var value, option, i, + options = elem.options, + index = elem.selectedIndex, + one = elem.type === "select-one", + values = one ? null : [], + max = one ? index + 1 : options.length; + + if ( index < 0 ) { + i = max; + + } else { + i = one ? index : 0; + } + + // Loop through all the selected options + for ( ; i < max; i++ ) { + option = options[ i ]; + + // Support: IE <=9 only + // IE8-9 doesn't update selected after form reset (trac-2551) + if ( ( option.selected || i === index ) && + + // Don't return options that are disabled or in a disabled optgroup + !option.disabled && + ( !option.parentNode.disabled || + !nodeName( option.parentNode, "optgroup" ) ) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + }, + + set: function( elem, value ) { + var optionSet, option, + options = elem.options, + values = jQuery.makeArray( value ), + i = options.length; + + while ( i-- ) { + option = options[ i ]; + + /* eslint-disable no-cond-assign */ + + if ( option.selected = + jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 + ) { + optionSet = true; + } + + /* eslint-enable no-cond-assign */ + } + + // Force browsers to behave consistently when non-matching value is set + if ( !optionSet ) { + elem.selectedIndex = -1; + } + return values; + } + } + } +} ); + +// Radios and checkboxes getter/setter +jQuery.each( [ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + set: function( elem, value ) { + if ( Array.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); + } + } + }; + if ( !support.checkOn ) { + jQuery.valHooks[ this ].get = function( elem ) { + return elem.getAttribute( "value" ) === null ? "on" : elem.value; + }; + } +} ); + + + + +// Return jQuery for attributes-only inclusion +var location = window.location; + +var nonce = { guid: Date.now() }; + +var rquery = ( /\?/ ); + + + +// Cross-browser xml parsing +jQuery.parseXML = function( data ) { + var xml, parserErrorElem; + if ( !data || typeof data !== "string" ) { + return null; + } + + // Support: IE 9 - 11 only + // IE throws on parseFromString with invalid input. + try { + xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); + } catch ( e ) {} + + parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; + if ( !xml || parserErrorElem ) { + jQuery.error( "Invalid XML: " + ( + parserErrorElem ? + jQuery.map( parserErrorElem.childNodes, function( el ) { + return el.textContent; + } ).join( "\n" ) : + data + ) ); + } + return xml; +}; + + +var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + stopPropagationCallback = function( e ) { + e.stopPropagation(); + }; + +jQuery.extend( jQuery.event, { + + trigger: function( event, data, elem, onlyHandlers ) { + + var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, + eventPath = [ elem || document ], + type = hasOwn.call( event, "type" ) ? event.type : event, + namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; + + cur = lastElement = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf( "." ) > -1 ) { + + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split( "." ); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf( ":" ) < 0 && "on" + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); + + // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) + event.isTrigger = onlyHandlers ? 2 : 3; + event.namespace = namespaces.join( "." ); + event.rnamespace = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (trac-9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724) + if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === ( elem.ownerDocument || document ) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { + lastElement = cur; + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && + dataPriv.get( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && handle.apply && acceptData( cur ) ) { + event.result = handle.apply( cur, data ); + if ( event.result === false ) { + event.preventDefault(); + } + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( ( !special._default || + special._default.apply( eventPath.pop(), data ) === false ) && + acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name as the event. + // Don't do default actions on window, that's where global variables be (trac-6170) + if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + + if ( event.isPropagationStopped() ) { + lastElement.addEventListener( type, stopPropagationCallback ); + } + + elem[ type ](); + + if ( event.isPropagationStopped() ) { + lastElement.removeEventListener( type, stopPropagationCallback ); + } + + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + // Piggyback on a donor event to simulate a different one + // Used only for `focus(in | out)` events + simulate: function( type, elem, event ) { + var e = jQuery.extend( + new jQuery.Event(), + event, + { + type: type, + isSimulated: true + } + ); + + jQuery.event.trigger( e, null, elem ); + } + +} ); + +jQuery.fn.extend( { + + trigger: function( type, data ) { + return this.each( function() { + jQuery.event.trigger( type, data, this ); + } ); + }, + triggerHandler: function( type, data ) { + var elem = this[ 0 ]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + } +} ); + + +var + rbracket = /\[\]$/, + rCRLF = /\r?\n/g, + rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, + rsubmittable = /^(?:input|select|textarea|keygen)/i; + +function buildParams( prefix, obj, traditional, add ) { + var name; + + if ( Array.isArray( obj ) ) { + + // Serialize array item. + jQuery.each( obj, function( i, v ) { + if ( traditional || rbracket.test( prefix ) ) { + + // Treat each array item as a scalar. + add( prefix, v ); + + } else { + + // Item is non-scalar (array or object), encode its numeric index. + buildParams( + prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", + v, + traditional, + add + ); + } + } ); + + } else if ( !traditional && toType( obj ) === "object" ) { + + // Serialize object item. + for ( name in obj ) { + buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); + } + + } else { + + // Serialize scalar item. + add( prefix, obj ); + } +} + +// Serialize an array of form elements or a set of +// key/values into a query string +jQuery.param = function( a, traditional ) { + var prefix, + s = [], + add = function( key, valueOrFunction ) { + + // If value is a function, invoke it and use its return value + var value = isFunction( valueOrFunction ) ? + valueOrFunction() : + valueOrFunction; + + s[ s.length ] = encodeURIComponent( key ) + "=" + + encodeURIComponent( value == null ? "" : value ); + }; + + if ( a == null ) { + return ""; + } + + // If an array was passed in, assume that it is an array of form elements. + if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { + + // Serialize the form elements + jQuery.each( a, function() { + add( this.name, this.value ); + } ); + + } else { + + // If traditional, encode the "old" way (the way 1.3.2 or older + // did it), otherwise encode params recursively. + for ( prefix in a ) { + buildParams( prefix, a[ prefix ], traditional, add ); + } + } + + // Return the resulting serialization + return s.join( "&" ); +}; + +jQuery.fn.extend( { + serialize: function() { + return jQuery.param( this.serializeArray() ); + }, + serializeArray: function() { + return this.map( function() { + + // Can add propHook for "elements" to filter or add form elements + var elements = jQuery.prop( this, "elements" ); + return elements ? jQuery.makeArray( elements ) : this; + } ).filter( function() { + var type = this.type; + + // Use .is( ":disabled" ) so that fieldset[disabled] works + return this.name && !jQuery( this ).is( ":disabled" ) && + rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && + ( this.checked || !rcheckableType.test( type ) ); + } ).map( function( _i, elem ) { + var val = jQuery( this ).val(); + + if ( val == null ) { + return null; + } + + if ( Array.isArray( val ) ) { + return jQuery.map( val, function( val ) { + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + } ); + } + + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + } ).get(); + } +} ); + + +var + r20 = /%20/g, + rhash = /#.*$/, + rantiCache = /([?&])_=[^&]*/, + rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, + + // trac-7653, trac-8125, trac-8152: local protocol detection + rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, + rnoContent = /^(?:GET|HEAD)$/, + rprotocol = /^\/\//, + + /* Prefilters + * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) + * 2) These are called: + * - BEFORE asking for a transport + * - AFTER param serialization (s.data is a string if s.processData is true) + * 3) key is the dataType + * 4) the catchall symbol "*" can be used + * 5) execution will start with transport dataType and THEN continue down to "*" if needed + */ + prefilters = {}, + + /* Transports bindings + * 1) key is the dataType + * 2) the catchall symbol "*" can be used + * 3) selection will start with transport dataType and THEN go to "*" if needed + */ + transports = {}, + + // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression + allTypes = "*/".concat( "*" ), + + // Anchor tag for parsing the document origin + originAnchor = document.createElement( "a" ); + +originAnchor.href = location.href; + +// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport +function addToPrefiltersOrTransports( structure ) { + + // dataTypeExpression is optional and defaults to "*" + return function( dataTypeExpression, func ) { + + if ( typeof dataTypeExpression !== "string" ) { + func = dataTypeExpression; + dataTypeExpression = "*"; + } + + var dataType, + i = 0, + dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; + + if ( isFunction( func ) ) { + + // For each dataType in the dataTypeExpression + while ( ( dataType = dataTypes[ i++ ] ) ) { + + // Prepend if requested + if ( dataType[ 0 ] === "+" ) { + dataType = dataType.slice( 1 ) || "*"; + ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); + + // Otherwise append + } else { + ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); + } + } + } + }; +} + +// Base inspection function for prefilters and transports +function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { + + var inspected = {}, + seekingTransport = ( structure === transports ); + + function inspect( dataType ) { + var selected; + inspected[ dataType ] = true; + jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { + var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); + if ( typeof dataTypeOrTransport === "string" && + !seekingTransport && !inspected[ dataTypeOrTransport ] ) { + + options.dataTypes.unshift( dataTypeOrTransport ); + inspect( dataTypeOrTransport ); + return false; + } else if ( seekingTransport ) { + return !( selected = dataTypeOrTransport ); + } + } ); + return selected; + } + + return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); +} + +// A special extend for ajax options +// that takes "flat" options (not to be deep extended) +// Fixes trac-9887 +function ajaxExtend( target, src ) { + var key, deep, + flatOptions = jQuery.ajaxSettings.flatOptions || {}; + + for ( key in src ) { + if ( src[ key ] !== undefined ) { + ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; + } + } + if ( deep ) { + jQuery.extend( true, target, deep ); + } + + return target; +} + +/* Handles responses to an ajax request: + * - finds the right dataType (mediates between content-type and expected dataType) + * - returns the corresponding response + */ +function ajaxHandleResponses( s, jqXHR, responses ) { + + var ct, type, finalDataType, firstDataType, + contents = s.contents, + dataTypes = s.dataTypes; + + // Remove auto dataType and get content-type in the process + while ( dataTypes[ 0 ] === "*" ) { + dataTypes.shift(); + if ( ct === undefined ) { + ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); + } + } + + // Check if we're dealing with a known content-type + if ( ct ) { + for ( type in contents ) { + if ( contents[ type ] && contents[ type ].test( ct ) ) { + dataTypes.unshift( type ); + break; + } + } + } + + // Check to see if we have a response for the expected dataType + if ( dataTypes[ 0 ] in responses ) { + finalDataType = dataTypes[ 0 ]; + } else { + + // Try convertible dataTypes + for ( type in responses ) { + if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { + finalDataType = type; + break; + } + if ( !firstDataType ) { + firstDataType = type; + } + } + + // Or just use first one + finalDataType = finalDataType || firstDataType; + } + + // If we found a dataType + // We add the dataType to the list if needed + // and return the corresponding response + if ( finalDataType ) { + if ( finalDataType !== dataTypes[ 0 ] ) { + dataTypes.unshift( finalDataType ); + } + return responses[ finalDataType ]; + } +} + +/* Chain conversions given the request and the original response + * Also sets the responseXXX fields on the jqXHR instance + */ +function ajaxConvert( s, response, jqXHR, isSuccess ) { + var conv2, current, conv, tmp, prev, + converters = {}, + + // Work with a copy of dataTypes in case we need to modify it for conversion + dataTypes = s.dataTypes.slice(); + + // Create converters map with lowercased keys + if ( dataTypes[ 1 ] ) { + for ( conv in s.converters ) { + converters[ conv.toLowerCase() ] = s.converters[ conv ]; + } + } + + current = dataTypes.shift(); + + // Convert to each sequential dataType + while ( current ) { + + if ( s.responseFields[ current ] ) { + jqXHR[ s.responseFields[ current ] ] = response; + } + + // Apply the dataFilter if provided + if ( !prev && isSuccess && s.dataFilter ) { + response = s.dataFilter( response, s.dataType ); + } + + prev = current; + current = dataTypes.shift(); + + if ( current ) { + + // There's only work to do if current dataType is non-auto + if ( current === "*" ) { + + current = prev; + + // Convert response if prev dataType is non-auto and differs from current + } else if ( prev !== "*" && prev !== current ) { + + // Seek a direct converter + conv = converters[ prev + " " + current ] || converters[ "* " + current ]; + + // If none found, seek a pair + if ( !conv ) { + for ( conv2 in converters ) { + + // If conv2 outputs current + tmp = conv2.split( " " ); + if ( tmp[ 1 ] === current ) { + + // If prev can be converted to accepted input + conv = converters[ prev + " " + tmp[ 0 ] ] || + converters[ "* " + tmp[ 0 ] ]; + if ( conv ) { + + // Condense equivalence converters + if ( conv === true ) { + conv = converters[ conv2 ]; + + // Otherwise, insert the intermediate dataType + } else if ( converters[ conv2 ] !== true ) { + current = tmp[ 0 ]; + dataTypes.unshift( tmp[ 1 ] ); + } + break; + } + } + } + } + + // Apply converter (if not an equivalence) + if ( conv !== true ) { + + // Unless errors are allowed to bubble, catch and return them + if ( conv && s.throws ) { + response = conv( response ); + } else { + try { + response = conv( response ); + } catch ( e ) { + return { + state: "parsererror", + error: conv ? e : "No conversion from " + prev + " to " + current + }; + } + } + } + } + } + } + + return { state: "success", data: response }; +} + +jQuery.extend( { + + // Counter for holding the number of active queries + active: 0, + + // Last-Modified header cache for next request + lastModified: {}, + etag: {}, + + ajaxSettings: { + url: location.href, + type: "GET", + isLocal: rlocalProtocol.test( location.protocol ), + global: true, + processData: true, + async: true, + contentType: "application/x-www-form-urlencoded; charset=UTF-8", + + /* + timeout: 0, + data: null, + dataType: null, + username: null, + password: null, + cache: null, + throws: false, + traditional: false, + headers: {}, + */ + + accepts: { + "*": allTypes, + text: "text/plain", + html: "text/html", + xml: "application/xml, text/xml", + json: "application/json, text/javascript" + }, + + contents: { + xml: /\bxml\b/, + html: /\bhtml/, + json: /\bjson\b/ + }, + + responseFields: { + xml: "responseXML", + text: "responseText", + json: "responseJSON" + }, + + // Data converters + // Keys separate source (or catchall "*") and destination types with a single space + converters: { + + // Convert anything to text + "* text": String, + + // Text to html (true = no transformation) + "text html": true, + + // Evaluate text as a json expression + "text json": JSON.parse, + + // Parse text as xml + "text xml": jQuery.parseXML + }, + + // For options that shouldn't be deep extended: + // you can add your own custom options here if + // and when you create one that shouldn't be + // deep extended (see ajaxExtend) + flatOptions: { + url: true, + context: true + } + }, + + // Creates a full fledged settings object into target + // with both ajaxSettings and settings fields. + // If target is omitted, writes into ajaxSettings. + ajaxSetup: function( target, settings ) { + return settings ? + + // Building a settings object + ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : + + // Extending ajaxSettings + ajaxExtend( jQuery.ajaxSettings, target ); + }, + + ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), + ajaxTransport: addToPrefiltersOrTransports( transports ), + + // Main method + ajax: function( url, options ) { + + // If url is an object, simulate pre-1.5 signature + if ( typeof url === "object" ) { + options = url; + url = undefined; + } + + // Force options to be an object + options = options || {}; + + var transport, + + // URL without anti-cache param + cacheURL, + + // Response headers + responseHeadersString, + responseHeaders, + + // timeout handle + timeoutTimer, + + // Url cleanup var + urlAnchor, + + // Request state (becomes false upon send and true upon completion) + completed, + + // To know if global events are to be dispatched + fireGlobals, + + // Loop variable + i, + + // uncached part of the url + uncached, + + // Create the final options object + s = jQuery.ajaxSetup( {}, options ), + + // Callbacks context + callbackContext = s.context || s, + + // Context for global events is callbackContext if it is a DOM node or jQuery collection + globalEventContext = s.context && + ( callbackContext.nodeType || callbackContext.jquery ) ? + jQuery( callbackContext ) : + jQuery.event, + + // Deferreds + deferred = jQuery.Deferred(), + completeDeferred = jQuery.Callbacks( "once memory" ), + + // Status-dependent callbacks + statusCode = s.statusCode || {}, + + // Headers (they are sent all at once) + requestHeaders = {}, + requestHeadersNames = {}, + + // Default abort message + strAbort = "canceled", + + // Fake xhr + jqXHR = { + readyState: 0, + + // Builds headers hashtable if needed + getResponseHeader: function( key ) { + var match; + if ( completed ) { + if ( !responseHeaders ) { + responseHeaders = {}; + while ( ( match = rheaders.exec( responseHeadersString ) ) ) { + responseHeaders[ match[ 1 ].toLowerCase() + " " ] = + ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) + .concat( match[ 2 ] ); + } + } + match = responseHeaders[ key.toLowerCase() + " " ]; + } + return match == null ? null : match.join( ", " ); + }, + + // Raw string + getAllResponseHeaders: function() { + return completed ? responseHeadersString : null; + }, + + // Caches the header + setRequestHeader: function( name, value ) { + if ( completed == null ) { + name = requestHeadersNames[ name.toLowerCase() ] = + requestHeadersNames[ name.toLowerCase() ] || name; + requestHeaders[ name ] = value; + } + return this; + }, + + // Overrides response content-type header + overrideMimeType: function( type ) { + if ( completed == null ) { + s.mimeType = type; + } + return this; + }, + + // Status-dependent callbacks + statusCode: function( map ) { + var code; + if ( map ) { + if ( completed ) { + + // Execute the appropriate callbacks + jqXHR.always( map[ jqXHR.status ] ); + } else { + + // Lazy-add the new callbacks in a way that preserves old ones + for ( code in map ) { + statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; + } + } + } + return this; + }, + + // Cancel the request + abort: function( statusText ) { + var finalText = statusText || strAbort; + if ( transport ) { + transport.abort( finalText ); + } + done( 0, finalText ); + return this; + } + }; + + // Attach deferreds + deferred.promise( jqXHR ); + + // Add protocol if not provided (prefilters might expect it) + // Handle falsy url in the settings object (trac-10093: consistency with old signature) + // We also use the url parameter if available + s.url = ( ( url || s.url || location.href ) + "" ) + .replace( rprotocol, location.protocol + "//" ); + + // Alias method option to type as per ticket trac-12004 + s.type = options.method || options.type || s.method || s.type; + + // Extract dataTypes list + s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; + + // A cross-domain request is in order when the origin doesn't match the current origin. + if ( s.crossDomain == null ) { + urlAnchor = document.createElement( "a" ); + + // Support: IE <=8 - 11, Edge 12 - 15 + // IE throws exception on accessing the href property if url is malformed, + // e.g. http://example.com:80x/ + try { + urlAnchor.href = s.url; + + // Support: IE <=8 - 11 only + // Anchor's host property isn't correctly set when s.url is relative + urlAnchor.href = urlAnchor.href; + s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== + urlAnchor.protocol + "//" + urlAnchor.host; + } catch ( e ) { + + // If there is an error parsing the URL, assume it is crossDomain, + // it can be rejected by the transport if it is invalid + s.crossDomain = true; + } + } + + // Convert data if not already a string + if ( s.data && s.processData && typeof s.data !== "string" ) { + s.data = jQuery.param( s.data, s.traditional ); + } + + // Apply prefilters + inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); + + // If request was aborted inside a prefilter, stop there + if ( completed ) { + return jqXHR; + } + + // We can fire global events as of now if asked to + // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118) + fireGlobals = jQuery.event && s.global; + + // Watch for a new set of requests + if ( fireGlobals && jQuery.active++ === 0 ) { + jQuery.event.trigger( "ajaxStart" ); + } + + // Uppercase the type + s.type = s.type.toUpperCase(); + + // Determine if request has content + s.hasContent = !rnoContent.test( s.type ); + + // Save the URL in case we're toying with the If-Modified-Since + // and/or If-None-Match header later on + // Remove hash to simplify url manipulation + cacheURL = s.url.replace( rhash, "" ); + + // More options handling for requests with no content + if ( !s.hasContent ) { + + // Remember the hash so we can put it back + uncached = s.url.slice( cacheURL.length ); + + // If data is available and should be processed, append data to url + if ( s.data && ( s.processData || typeof s.data === "string" ) ) { + cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; + + // trac-9682: remove data so that it's not used in an eventual retry + delete s.data; + } + + // Add or update anti-cache param if needed + if ( s.cache === false ) { + cacheURL = cacheURL.replace( rantiCache, "$1" ); + uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + + uncached; + } + + // Put hash and anti-cache on the URL that will be requested (gh-1732) + s.url = cacheURL + uncached; + + // Change '%20' to '+' if this is encoded form body content (gh-2658) + } else if ( s.data && s.processData && + ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { + s.data = s.data.replace( r20, "+" ); + } + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + if ( jQuery.lastModified[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); + } + if ( jQuery.etag[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); + } + } + + // Set the correct header, if data is being sent + if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { + jqXHR.setRequestHeader( "Content-Type", s.contentType ); + } + + // Set the Accepts header for the server, depending on the dataType + jqXHR.setRequestHeader( + "Accept", + s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? + s.accepts[ s.dataTypes[ 0 ] ] + + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : + s.accepts[ "*" ] + ); + + // Check for headers option + for ( i in s.headers ) { + jqXHR.setRequestHeader( i, s.headers[ i ] ); + } + + // Allow custom headers/mimetypes and early abort + if ( s.beforeSend && + ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { + + // Abort if not done already and return + return jqXHR.abort(); + } + + // Aborting is no longer a cancellation + strAbort = "abort"; + + // Install callbacks on deferreds + completeDeferred.add( s.complete ); + jqXHR.done( s.success ); + jqXHR.fail( s.error ); + + // Get transport + transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); + + // If no transport, we auto-abort + if ( !transport ) { + done( -1, "No Transport" ); + } else { + jqXHR.readyState = 1; + + // Send global event + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); + } + + // If request was aborted inside ajaxSend, stop there + if ( completed ) { + return jqXHR; + } + + // Timeout + if ( s.async && s.timeout > 0 ) { + timeoutTimer = window.setTimeout( function() { + jqXHR.abort( "timeout" ); + }, s.timeout ); + } + + try { + completed = false; + transport.send( requestHeaders, done ); + } catch ( e ) { + + // Rethrow post-completion exceptions + if ( completed ) { + throw e; + } + + // Propagate others as results + done( -1, e ); + } + } + + // Callback for when everything is done + function done( status, nativeStatusText, responses, headers ) { + var isSuccess, success, error, response, modified, + statusText = nativeStatusText; + + // Ignore repeat invocations + if ( completed ) { + return; + } + + completed = true; + + // Clear timeout if it exists + if ( timeoutTimer ) { + window.clearTimeout( timeoutTimer ); + } + + // Dereference transport for early garbage collection + // (no matter how long the jqXHR object will be used) + transport = undefined; + + // Cache response headers + responseHeadersString = headers || ""; + + // Set readyState + jqXHR.readyState = status > 0 ? 4 : 0; + + // Determine if successful + isSuccess = status >= 200 && status < 300 || status === 304; + + // Get response data + if ( responses ) { + response = ajaxHandleResponses( s, jqXHR, responses ); + } + + // Use a noop converter for missing script but not if jsonp + if ( !isSuccess && + jQuery.inArray( "script", s.dataTypes ) > -1 && + jQuery.inArray( "json", s.dataTypes ) < 0 ) { + s.converters[ "text script" ] = function() {}; + } + + // Convert no matter what (that way responseXXX fields are always set) + response = ajaxConvert( s, response, jqXHR, isSuccess ); + + // If successful, handle type chaining + if ( isSuccess ) { + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + modified = jqXHR.getResponseHeader( "Last-Modified" ); + if ( modified ) { + jQuery.lastModified[ cacheURL ] = modified; + } + modified = jqXHR.getResponseHeader( "etag" ); + if ( modified ) { + jQuery.etag[ cacheURL ] = modified; + } + } + + // if no content + if ( status === 204 || s.type === "HEAD" ) { + statusText = "nocontent"; + + // if not modified + } else if ( status === 304 ) { + statusText = "notmodified"; + + // If we have data, let's convert it + } else { + statusText = response.state; + success = response.data; + error = response.error; + isSuccess = !error; + } + } else { + + // Extract error from statusText and normalize for non-aborts + error = statusText; + if ( status || !statusText ) { + statusText = "error"; + if ( status < 0 ) { + status = 0; + } + } + } + + // Set data for the fake xhr object + jqXHR.status = status; + jqXHR.statusText = ( nativeStatusText || statusText ) + ""; + + // Success/Error + if ( isSuccess ) { + deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); + } else { + deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); + } + + // Status-dependent callbacks + jqXHR.statusCode( statusCode ); + statusCode = undefined; + + if ( fireGlobals ) { + globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", + [ jqXHR, s, isSuccess ? success : error ] ); + } + + // Complete + completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); + + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); + + // Handle the global AJAX counter + if ( !( --jQuery.active ) ) { + jQuery.event.trigger( "ajaxStop" ); + } + } + } + + return jqXHR; + }, + + getJSON: function( url, data, callback ) { + return jQuery.get( url, data, callback, "json" ); + }, + + getScript: function( url, callback ) { + return jQuery.get( url, undefined, callback, "script" ); + } +} ); + +jQuery.each( [ "get", "post" ], function( _i, method ) { + jQuery[ method ] = function( url, data, callback, type ) { + + // Shift arguments if data argument was omitted + if ( isFunction( data ) ) { + type = type || callback; + callback = data; + data = undefined; + } + + // The url can be an options object (which then must have .url) + return jQuery.ajax( jQuery.extend( { + url: url, + type: method, + dataType: type, + data: data, + success: callback + }, jQuery.isPlainObject( url ) && url ) ); + }; +} ); + +jQuery.ajaxPrefilter( function( s ) { + var i; + for ( i in s.headers ) { + if ( i.toLowerCase() === "content-type" ) { + s.contentType = s.headers[ i ] || ""; + } + } +} ); + + +jQuery._evalUrl = function( url, options, doc ) { + return jQuery.ajax( { + url: url, + + // Make this explicit, since user can override this through ajaxSetup (trac-11264) + type: "GET", + dataType: "script", + cache: true, + async: false, + global: false, + + // Only evaluate the response if it is successful (gh-4126) + // dataFilter is not invoked for failure responses, so using it instead + // of the default converter is kludgy but it works. + converters: { + "text script": function() {} + }, + dataFilter: function( response ) { + jQuery.globalEval( response, options, doc ); + } + } ); +}; + + +jQuery.fn.extend( { + wrapAll: function( html ) { + var wrap; + + if ( this[ 0 ] ) { + if ( isFunction( html ) ) { + html = html.call( this[ 0 ] ); + } + + // The elements to wrap the target around + wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); + + if ( this[ 0 ].parentNode ) { + wrap.insertBefore( this[ 0 ] ); + } + + wrap.map( function() { + var elem = this; + + while ( elem.firstElementChild ) { + elem = elem.firstElementChild; + } + + return elem; + } ).append( this ); + } + + return this; + }, + + wrapInner: function( html ) { + if ( isFunction( html ) ) { + return this.each( function( i ) { + jQuery( this ).wrapInner( html.call( this, i ) ); + } ); + } + + return this.each( function() { + var self = jQuery( this ), + contents = self.contents(); + + if ( contents.length ) { + contents.wrapAll( html ); + + } else { + self.append( html ); + } + } ); + }, + + wrap: function( html ) { + var htmlIsFunction = isFunction( html ); + + return this.each( function( i ) { + jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); + } ); + }, + + unwrap: function( selector ) { + this.parent( selector ).not( "body" ).each( function() { + jQuery( this ).replaceWith( this.childNodes ); + } ); + return this; + } +} ); + + +jQuery.expr.pseudos.hidden = function( elem ) { + return !jQuery.expr.pseudos.visible( elem ); +}; +jQuery.expr.pseudos.visible = function( elem ) { + return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); +}; + + + + +jQuery.ajaxSettings.xhr = function() { + try { + return new window.XMLHttpRequest(); + } catch ( e ) {} +}; + +var xhrSuccessStatus = { + + // File protocol always yields status code 0, assume 200 + 0: 200, + + // Support: IE <=9 only + // trac-1450: sometimes IE returns 1223 when it should be 204 + 1223: 204 + }, + xhrSupported = jQuery.ajaxSettings.xhr(); + +support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); +support.ajax = xhrSupported = !!xhrSupported; + +jQuery.ajaxTransport( function( options ) { + var callback, errorCallback; + + // Cross domain only allowed if supported through XMLHttpRequest + if ( support.cors || xhrSupported && !options.crossDomain ) { + return { + send: function( headers, complete ) { + var i, + xhr = options.xhr(); + + xhr.open( + options.type, + options.url, + options.async, + options.username, + options.password + ); + + // Apply custom fields if provided + if ( options.xhrFields ) { + for ( i in options.xhrFields ) { + xhr[ i ] = options.xhrFields[ i ]; + } + } + + // Override mime type if needed + if ( options.mimeType && xhr.overrideMimeType ) { + xhr.overrideMimeType( options.mimeType ); + } + + // X-Requested-With header + // For cross-domain requests, seeing as conditions for a preflight are + // akin to a jigsaw puzzle, we simply never set it to be sure. + // (it can always be set on a per-request basis or even using ajaxSetup) + // For same-domain requests, won't change header if already provided. + if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { + headers[ "X-Requested-With" ] = "XMLHttpRequest"; + } + + // Set headers + for ( i in headers ) { + xhr.setRequestHeader( i, headers[ i ] ); + } + + // Callback + callback = function( type ) { + return function() { + if ( callback ) { + callback = errorCallback = xhr.onload = + xhr.onerror = xhr.onabort = xhr.ontimeout = + xhr.onreadystatechange = null; + + if ( type === "abort" ) { + xhr.abort(); + } else if ( type === "error" ) { + + // Support: IE <=9 only + // On a manual native abort, IE9 throws + // errors on any property access that is not readyState + if ( typeof xhr.status !== "number" ) { + complete( 0, "error" ); + } else { + complete( + + // File: protocol always yields status 0; see trac-8605, trac-14207 + xhr.status, + xhr.statusText + ); + } + } else { + complete( + xhrSuccessStatus[ xhr.status ] || xhr.status, + xhr.statusText, + + // Support: IE <=9 only + // IE9 has no XHR2 but throws on binary (trac-11426) + // For XHR2 non-text, let the caller handle it (gh-2498) + ( xhr.responseType || "text" ) !== "text" || + typeof xhr.responseText !== "string" ? + { binary: xhr.response } : + { text: xhr.responseText }, + xhr.getAllResponseHeaders() + ); + } + } + }; + }; + + // Listen to events + xhr.onload = callback(); + errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); + + // Support: IE 9 only + // Use onreadystatechange to replace onabort + // to handle uncaught aborts + if ( xhr.onabort !== undefined ) { + xhr.onabort = errorCallback; + } else { + xhr.onreadystatechange = function() { + + // Check readyState before timeout as it changes + if ( xhr.readyState === 4 ) { + + // Allow onerror to be called first, + // but that will not handle a native abort + // Also, save errorCallback to a variable + // as xhr.onerror cannot be accessed + window.setTimeout( function() { + if ( callback ) { + errorCallback(); + } + } ); + } + }; + } + + // Create the abort callback + callback = callback( "abort" ); + + try { + + // Do send the request (this may raise an exception) + xhr.send( options.hasContent && options.data || null ); + } catch ( e ) { + + // trac-14683: Only rethrow if this hasn't been notified as an error yet + if ( callback ) { + throw e; + } + } + }, + + abort: function() { + if ( callback ) { + callback(); + } + } + }; + } +} ); + + + + +// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) +jQuery.ajaxPrefilter( function( s ) { + if ( s.crossDomain ) { + s.contents.script = false; + } +} ); + +// Install script dataType +jQuery.ajaxSetup( { + accepts: { + script: "text/javascript, application/javascript, " + + "application/ecmascript, application/x-ecmascript" + }, + contents: { + script: /\b(?:java|ecma)script\b/ + }, + converters: { + "text script": function( text ) { + jQuery.globalEval( text ); + return text; + } + } +} ); + +// Handle cache's special case and crossDomain +jQuery.ajaxPrefilter( "script", function( s ) { + if ( s.cache === undefined ) { + s.cache = false; + } + if ( s.crossDomain ) { + s.type = "GET"; + } +} ); + +// Bind script tag hack transport +jQuery.ajaxTransport( "script", function( s ) { + + // This transport only deals with cross domain or forced-by-attrs requests + if ( s.crossDomain || s.scriptAttrs ) { + var script, callback; + return { + send: function( _, complete ) { + script = jQuery( " + + Image tag attributes: + + rel:animated_src - If this url is specified, it's loaded into the player instead of src. + This allows a preview frame to be shown until animated gif data is streamed into the canvas + + rel:auto_play - Defaults to 1 if not specified. If set to zero, a call to the play() method is needed + + Constructor options args + + gif Required. The DOM element of an img tag. + loop_mode Optional. Setting this to false will force disable looping of the gif. + auto_play Optional. Same as the rel:auto_play attribute above, this arg overrides the img tag info. + max_width Optional. Scale images over max_width down to max_width. Helpful with mobile. + on_end Optional. Add a callback for when the gif reaches the end of a single loop (one iteration). The first argument passed will be the gif HTMLElement. + loop_delay Optional. The amount of time to pause (in ms) after each single loop (iteration). + draw_while_loading Optional. Determines whether the gif will be drawn to the canvas whilst it is loaded. + show_progress_bar Optional. Only applies when draw_while_loading is set to true. + + Instance methods + + // loading + load( callback ) Loads the gif specified by the src or rel:animated_src sttributie of the img tag into a canvas element and then calls callback if one is passed + load_url( src, callback ) Loads the gif file specified in the src argument into a canvas element and then calls callback if one is passed + + // play controls + play - Start playing the gif + pause - Stop playing the gif + move_to(i) - Move to frame i of the gif + move_relative(i) - Move i frames ahead (or behind if i < 0) + + // getters + get_canvas The canvas element that the gif is playing in. Handy for assigning event handlers to. + get_playing Whether or not the gif is currently playing + get_loading Whether or not the gif has finished loading/parsing + get_auto_play Whether or not the gif is set to play automatically + get_length The number of frames in the gif + get_current_frame The index of the currently displayed frame of the gif + get_frames An array containing the data for all parsed frames + get_duration Returns the duration of the gif in hundredths of a second (standard for GIF spec) + get_duration_ms Returns the duration of the gif in milliseconds + + For additional customization (viewport inside iframe) these params may be passed: + c_w, c_h - width and height of canvas + vp_t, vp_l, vp_ w, vp_h - top, left, width and height of the viewport + + A bonus: few articles to understand what is going on + http://enthusiasms.org/post/16976438906 + http://www.matthewflickinger.com/lab/whatsinagif/bits_and_bytes.asp + http://humpy77.deviantart.com/journal/Frame-Delay-Times-for-Animated-GIFs-214150546 + +*/ +(function (root, factory) { + if (true) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else {} +}(this, function () { + // Generic functions + var bitsToNum = function (ba) { + return ba.reduce(function (s, n) { + return s * 2 + n; + }, 0); + }; + + var byteToBitArr = function (bite) { + var a = []; + for (var i = 7; i >= 0; i--) { + a.push( !! (bite & (1 << i))); + } + return a; + }; + + // Stream + /** + * @constructor + */ + // Make compiler happy. + var Stream = function (data) { + this.data = data; + this.len = this.data.length; + this.pos = 0; + + this.readByte = function () { + if (this.pos >= this.data.length) { + throw new Error('Attempted to read past end of stream.'); + } + if (data instanceof Uint8Array) + return data[this.pos++]; + else + return data.charCodeAt(this.pos++) & 0xFF; + }; + + this.readBytes = function (n) { + var bytes = []; + for (var i = 0; i < n; i++) { + bytes.push(this.readByte()); + } + return bytes; + }; + + this.read = function (n) { + var s = ''; + for (var i = 0; i < n; i++) { + s += String.fromCharCode(this.readByte()); + } + return s; + }; + + this.readUnsigned = function () { // Little-endian. + var a = this.readBytes(2); + return (a[1] << 8) + a[0]; + }; + }; + + var lzwDecode = function (minCodeSize, data) { + // TODO: Now that the GIF parser is a bit different, maybe this should get an array of bytes instead of a String? + var pos = 0; // Maybe this streaming thing should be merged with the Stream? + var readCode = function (size) { + var code = 0; + for (var i = 0; i < size; i++) { + if (data.charCodeAt(pos >> 3) & (1 << (pos & 7))) { + code |= 1 << i; + } + pos++; + } + return code; + }; + + var output = []; + + var clearCode = 1 << minCodeSize; + var eoiCode = clearCode + 1; + + var codeSize = minCodeSize + 1; + + var dict = []; + + var clear = function () { + dict = []; + codeSize = minCodeSize + 1; + for (var i = 0; i < clearCode; i++) { + dict[i] = [i]; + } + dict[clearCode] = []; + dict[eoiCode] = null; + + }; + + var code; + var last; + + while (true) { + last = code; + code = readCode(codeSize); + + if (code === clearCode) { + clear(); + continue; + } + if (code === eoiCode) break; + + if (code < dict.length) { + if (last !== clearCode) { + dict.push(dict[last].concat(dict[code][0])); + } + } + else { + if (code !== dict.length) throw new Error('Invalid LZW code.'); + dict.push(dict[last].concat(dict[last][0])); + } + output.push.apply(output, dict[code]); + + if (dict.length === (1 << codeSize) && codeSize < 12) { + // If we're at the last code and codeSize is 12, the next code will be a clearCode, and it'll be 12 bits long. + codeSize++; + } + } + + // I don't know if this is technically an error, but some GIFs do it. + //if (Math.ceil(pos / 8) !== data.length) throw new Error('Extraneous LZW bytes.'); + return output; + }; + + + // The actual parsing; returns an object with properties. + var parseGIF = function (st, handler) { + handler || (handler = {}); + + // LZW (GIF-specific) + var parseCT = function (entries) { // Each entry is 3 bytes, for RGB. + var ct = []; + for (var i = 0; i < entries; i++) { + ct.push(st.readBytes(3)); + } + return ct; + }; + + var readSubBlocks = function () { + var size, data; + data = ''; + do { + size = st.readByte(); + data += st.read(size); + } while (size !== 0); + return data; + }; + + var parseHeader = function () { + var hdr = {}; + hdr.sig = st.read(3); + hdr.ver = st.read(3); + if (hdr.sig !== 'GIF') throw new Error('Not a GIF file.'); // XXX: This should probably be handled more nicely. + hdr.width = st.readUnsigned(); + hdr.height = st.readUnsigned(); + + var bits = byteToBitArr(st.readByte()); + hdr.gctFlag = bits.shift(); + hdr.colorRes = bitsToNum(bits.splice(0, 3)); + hdr.sorted = bits.shift(); + hdr.gctSize = bitsToNum(bits.splice(0, 3)); + + hdr.bgColor = st.readByte(); + hdr.pixelAspectRatio = st.readByte(); // if not 0, aspectRatio = (pixelAspectRatio + 15) / 64 + if (hdr.gctFlag) { + hdr.gct = parseCT(1 << (hdr.gctSize + 1)); + } + handler.hdr && handler.hdr(hdr); + }; + + var parseExt = function (block) { + var parseGCExt = function (block) { + var blockSize = st.readByte(); // Always 4 + var bits = byteToBitArr(st.readByte()); + block.reserved = bits.splice(0, 3); // Reserved; should be 000. + block.disposalMethod = bitsToNum(bits.splice(0, 3)); + block.userInput = bits.shift(); + block.transparencyGiven = bits.shift(); + + block.delayTime = st.readUnsigned(); + + block.transparencyIndex = st.readByte(); + + block.terminator = st.readByte(); + + handler.gce && handler.gce(block); + }; + + var parseComExt = function (block) { + block.comment = readSubBlocks(); + handler.com && handler.com(block); + }; + + var parsePTExt = function (block) { + // No one *ever* uses this. If you use it, deal with parsing it yourself. + var blockSize = st.readByte(); // Always 12 + block.ptHeader = st.readBytes(12); + block.ptData = readSubBlocks(); + handler.pte && handler.pte(block); + }; + + var parseAppExt = function (block) { + var parseNetscapeExt = function (block) { + var blockSize = st.readByte(); // Always 3 + block.unknown = st.readByte(); // ??? Always 1? What is this? + block.iterations = st.readUnsigned(); + block.terminator = st.readByte(); + handler.app && handler.app.NETSCAPE && handler.app.NETSCAPE(block); + }; + + var parseUnknownAppExt = function (block) { + block.appData = readSubBlocks(); + // FIXME: This won't work if a handler wants to match on any identifier. + handler.app && handler.app[block.identifier] && handler.app[block.identifier](block); + }; + + var blockSize = st.readByte(); // Always 11 + block.identifier = st.read(8); + block.authCode = st.read(3); + switch (block.identifier) { + case 'NETSCAPE': + parseNetscapeExt(block); + break; + default: + parseUnknownAppExt(block); + break; + } + }; + + var parseUnknownExt = function (block) { + block.data = readSubBlocks(); + handler.unknown && handler.unknown(block); + }; + + block.label = st.readByte(); + switch (block.label) { + case 0xF9: + block.extType = 'gce'; + parseGCExt(block); + break; + case 0xFE: + block.extType = 'com'; + parseComExt(block); + break; + case 0x01: + block.extType = 'pte'; + parsePTExt(block); + break; + case 0xFF: + block.extType = 'app'; + parseAppExt(block); + break; + default: + block.extType = 'unknown'; + parseUnknownExt(block); + break; + } + }; + + var parseImg = function (img) { + var deinterlace = function (pixels, width) { + // Of course this defeats the purpose of interlacing. And it's *probably* + // the least efficient way it's ever been implemented. But nevertheless... + var newPixels = new Array(pixels.length); + var rows = pixels.length / width; + var cpRow = function (toRow, fromRow) { + var fromPixels = pixels.slice(fromRow * width, (fromRow + 1) * width); + newPixels.splice.apply(newPixels, [toRow * width, width].concat(fromPixels)); + }; + + // See appendix E. + var offsets = [0, 4, 2, 1]; + var steps = [8, 8, 4, 2]; + + var fromRow = 0; + for (var pass = 0; pass < 4; pass++) { + for (var toRow = offsets[pass]; toRow < rows; toRow += steps[pass]) { + cpRow(toRow, fromRow) + fromRow++; + } + } + + return newPixels; + }; + + img.leftPos = st.readUnsigned(); + img.topPos = st.readUnsigned(); + img.width = st.readUnsigned(); + img.height = st.readUnsigned(); + + var bits = byteToBitArr(st.readByte()); + img.lctFlag = bits.shift(); + img.interlaced = bits.shift(); + img.sorted = bits.shift(); + img.reserved = bits.splice(0, 2); + img.lctSize = bitsToNum(bits.splice(0, 3)); + + if (img.lctFlag) { + img.lct = parseCT(1 << (img.lctSize + 1)); + } + + img.lzwMinCodeSize = st.readByte(); + + var lzwData = readSubBlocks(); + + img.pixels = lzwDecode(img.lzwMinCodeSize, lzwData); + + if (img.interlaced) { // Move + img.pixels = deinterlace(img.pixels, img.width); + } + + handler.img && handler.img(img); + }; + + var parseBlock = function () { + var block = {}; + block.sentinel = st.readByte(); + + switch (String.fromCharCode(block.sentinel)) { // For ease of matching + case '!': + block.type = 'ext'; + parseExt(block); + break; + case ',': + block.type = 'img'; + parseImg(block); + break; + case ';': + block.type = 'eof'; + handler.eof && handler.eof(block); + break; + default: + throw new Error('Unknown block: 0x' + block.sentinel.toString(16)); // TODO: Pad this with a 0. + } + + if (block.type !== 'eof') setTimeout(parseBlock, 0); + }; + + var parse = function () { + parseHeader(); + setTimeout(parseBlock, 0); + }; + + parse(); + }; + + var SuperGif = function ( opts ) { + var options = { + //viewport position + vp_l: 0, + vp_t: 0, + vp_w: null, + vp_h: null, + //canvas sizes + c_w: null, + c_h: null + }; + for (var i in opts ) { options[i] = opts[i] } + if (options.vp_w && options.vp_h) options.is_vp = true; + + var stream; + var hdr; + + var loadError = null; + var loading = false; + + var transparency = null; + var delay = null; + var disposalMethod = null; + var disposalRestoreFromIdx = null; + var lastDisposalMethod = null; + var frame = null; + var lastImg = null; + + var playing = true; + var forward = true; + + var ctx_scaled = false; + + var frames = []; + var frameOffsets = []; // elements have .x and .y properties + + var gif = options.gif; + if (typeof options.auto_play == 'undefined') + options.auto_play = (!gif.getAttribute('rel:auto_play') || gif.getAttribute('rel:auto_play') == '1'); + + var onEndListener = (options.hasOwnProperty('on_end') ? options.on_end : null); + var onErrorListener = (options.hasOwnProperty('on_error') ? options.on_error : null); + var loopDelay = (options.hasOwnProperty('loop_delay') ? options.loop_delay : 0); + var overrideLoopMode = (options.hasOwnProperty('loop_mode') ? options.loop_mode : 'auto'); + var drawWhileLoading = (options.hasOwnProperty('draw_while_loading') ? options.draw_while_loading : true); + var showProgressBar = drawWhileLoading ? (options.hasOwnProperty('show_progress_bar') ? options.show_progress_bar : true) : false; + var progressBarHeight = (options.hasOwnProperty('progressbar_height') ? options.progressbar_height : 25); + var progressBarBackgroundColor = (options.hasOwnProperty('progressbar_background_color') ? options.progressbar_background_color : 'rgba(255,255,255,0.4)'); + var progressBarForegroundColor = (options.hasOwnProperty('progressbar_foreground_color') ? options.progressbar_foreground_color : 'rgba(255,0,22,.8)'); + + var clear = function () { + transparency = null; + delay = null; + lastDisposalMethod = disposalMethod; + disposalMethod = null; + frame = null; + }; + + // XXX: There's probably a better way to handle catching exceptions when + // callbacks are involved. + var doParse = function () { + try { + parseGIF(stream, handler); + } + catch (err) { + doLoadError('parse'); + } + }; + + var doText = function (text) { + toolbar.innerHTML = text; // innerText? Escaping? Whatever. + toolbar.style.visibility = 'visible'; + }; + + var setSizes = function(w, h) { + canvas.width = w * get_canvas_scale(); + canvas.height = h * get_canvas_scale(); + toolbar.style.minWidth = ( w * get_canvas_scale() ) + 'px'; + + tmpCanvas.width = w; + tmpCanvas.height = h; + tmpCanvas.style.width = w + 'px'; + tmpCanvas.style.height = h + 'px'; + tmpCanvas.getContext('2d').setTransform(1, 0, 0, 1, 0, 0); + }; + + var setFrameOffset = function(frame, offset) { + if (!frameOffsets[frame]) { + frameOffsets[frame] = offset; + return; + } + if (typeof offset.x !== 'undefined') { + frameOffsets[frame].x = offset.x; + } + if (typeof offset.y !== 'undefined') { + frameOffsets[frame].y = offset.y; + } + }; + + var doShowProgress = function (pos, length, draw) { + if (draw && showProgressBar) { + var height = progressBarHeight; + var left, mid, top, width; + if (options.is_vp) { + if (!ctx_scaled) { + top = (options.vp_t + options.vp_h - height); + height = height; + left = options.vp_l; + mid = left + (pos / length) * options.vp_w; + width = canvas.width; + } else { + top = (options.vp_t + options.vp_h - height) / get_canvas_scale(); + height = height / get_canvas_scale(); + left = (options.vp_l / get_canvas_scale() ); + mid = left + (pos / length) * (options.vp_w / get_canvas_scale()); + width = canvas.width / get_canvas_scale(); + } + //some debugging, draw rect around viewport + if (false) { var w, h, l, t; } + } + else { + top = (canvas.height - height) / (ctx_scaled ? get_canvas_scale() : 1); + mid = ((pos / length) * canvas.width) / (ctx_scaled ? get_canvas_scale() : 1); + width = canvas.width / (ctx_scaled ? get_canvas_scale() : 1 ); + height /= ctx_scaled ? get_canvas_scale() : 1; + } + + ctx.fillStyle = progressBarBackgroundColor; + ctx.fillRect(mid, top, width - mid, height); + + ctx.fillStyle = progressBarForegroundColor; + ctx.fillRect(0, top, mid, height); + } + }; + + var doLoadError = function (originOfError) { + var drawError = function () { + ctx.fillStyle = 'black'; + ctx.fillRect(0, 0, options.c_w ? options.c_w : hdr.width, options.c_h ? options.c_h : hdr.height); + ctx.strokeStyle = 'red'; + ctx.lineWidth = 3; + ctx.moveTo(0, 0); + ctx.lineTo(options.c_w ? options.c_w : hdr.width, options.c_h ? options.c_h : hdr.height); + ctx.moveTo(0, options.c_h ? options.c_h : hdr.height); + ctx.lineTo(options.c_w ? options.c_w : hdr.width, 0); + ctx.stroke(); + }; + + loadError = originOfError; + hdr = { + width: gif.width, + height: gif.height + }; // Fake header. + frames = []; + drawError(); + + if (originOfError) + onErrorListener (originOfError); + }; + + var doHdr = function (_hdr) { + hdr = _hdr; + setSizes(hdr.width, hdr.height) + }; + + var doGCE = function (gce) { + pushFrame(); + clear(); + transparency = gce.transparencyGiven ? gce.transparencyIndex : null; + delay = gce.delayTime; + disposalMethod = gce.disposalMethod; + // We don't have much to do with the rest of GCE. + }; + + var pushFrame = function () { + if (!frame) return; + frames.push({ + data: frame.getImageData(0, 0, hdr.width, hdr.height), + delay: delay + }); + frameOffsets.push({ x: 0, y: 0 }); + }; + + var doImg = function (img) { + if (!frame) frame = tmpCanvas.getContext('2d'); + + var currIdx = frames.length; + + //ct = color table, gct = global color table + var ct = img.lctFlag ? img.lct : hdr.gct; // TODO: What if neither exists? + + /* + Disposal method indicates the way in which the graphic is to + be treated after being displayed. + + Values : 0 - No disposal specified. The decoder is + not required to take any action. + 1 - Do not dispose. The graphic is to be left + in place. + 2 - Restore to background color. The area used by the + graphic must be restored to the background color. + 3 - Restore to previous. The decoder is required to + restore the area overwritten by the graphic with + what was there prior to rendering the graphic. + + Importantly, "previous" means the frame state + after the last disposal of method 0, 1, or 2. + */ + if (currIdx > 0) { + if (lastDisposalMethod === 3) { + // Restore to previous + // If we disposed every frame including first frame up to this point, then we have + // no composited frame to restore to. In this case, restore to background instead. + if (disposalRestoreFromIdx !== null) { + frame.putImageData(frames[disposalRestoreFromIdx].data, 0, 0); + } else { + frame.clearRect(lastImg.leftPos, lastImg.topPos, lastImg.width, lastImg.height); + } + } else { + disposalRestoreFromIdx = currIdx - 1; + } + + if (lastDisposalMethod === 2) { + // Restore to background color + // Browser implementations historically restore to transparent; we do the same. + // http://www.wizards-toolkit.org/discourse-server/viewtopic.php?f=1&t=21172#p86079 + frame.clearRect(lastImg.leftPos, lastImg.topPos, lastImg.width, lastImg.height); + } + } + // else, Undefined/Do not dispose. + // frame contains final pixel data from the last frame; do nothing + + //Get existing pixels for img region after applying disposal method + var imgData = frame.getImageData(img.leftPos, img.topPos, img.width, img.height); + + //apply color table colors + img.pixels.forEach(function (pixel, i) { + // imgData.data === [R,G,B,A,R,G,B,A,...] + if (pixel !== transparency) { + imgData.data[i * 4 + 0] = ct[pixel][0]; + imgData.data[i * 4 + 1] = ct[pixel][1]; + imgData.data[i * 4 + 2] = ct[pixel][2]; + imgData.data[i * 4 + 3] = 255; // Opaque. + } + }); + + frame.putImageData(imgData, img.leftPos, img.topPos); + + if (!ctx_scaled) { + ctx.scale(get_canvas_scale(),get_canvas_scale()); + ctx_scaled = true; + } + + // We could use the on-page canvas directly, except that we draw a progress + // bar for each image chunk (not just the final image). + if (drawWhileLoading) { + ctx.drawImage(tmpCanvas, 0, 0); + drawWhileLoading = options.auto_play; + } + + lastImg = img; + }; + + var player = (function () { + var i = -1; + var iterationCount = 0; + + var showingInfo = false; + var pinned = false; + + /** + * Gets the index of the frame "up next". + * @returns {number} + */ + var getNextFrameNo = function () { + var delta = (forward ? 1 : -1); + return (i + delta + frames.length) % frames.length; + }; + + var stepFrame = function (amount) { // XXX: Name is confusing. + i = i + amount; + + putFrame(); + }; + + var step = (function () { + var stepping = false; + + var completeLoop = function () { + if (onEndListener !== null) + onEndListener(gif); + iterationCount++; + + if (overrideLoopMode !== false || iterationCount < 0) { + doStep(); + } else { + stepping = false; + playing = false; + } + }; + + var doStep = function () { + stepping = playing; + if (!stepping) return; + + stepFrame(1); + var delay = frames[i].delay * 10; + if (!delay) delay = 100; // FIXME: Should this even default at all? What should it be? + + var nextFrameNo = getNextFrameNo(); + if (nextFrameNo === 0) { + delay += loopDelay; + setTimeout(completeLoop, delay); + } else { + setTimeout(doStep, delay); + } + }; + + return function () { + if (!stepping) setTimeout(doStep, 0); + }; + }()); + + var putFrame = function () { + var offset; + i = parseInt(i, 10); + + if (i > frames.length - 1){ + i = 0; + } + + if (i < 0){ + i = 0; + } + + offset = frameOffsets[i]; + + tmpCanvas.getContext("2d").putImageData(frames[i].data, offset.x, offset.y); + ctx.globalCompositeOperation = "copy"; + ctx.drawImage(tmpCanvas, 0, 0); + }; + + var play = function () { + playing = true; + step(); + }; + + var pause = function () { + playing = false; + }; + + + return { + init: function () { + if (loadError) return; + + if ( ! (options.c_w && options.c_h) ) { + ctx.scale(get_canvas_scale(),get_canvas_scale()); + } + + if (options.auto_play) { + step(); + } + else { + i = 0; + putFrame(); + } + }, + step: step, + play: play, + pause: pause, + playing: playing, + move_relative: stepFrame, + current_frame: function() { return i; }, + length: function() { return frames.length }, + move_to: function ( frame_idx ) { + i = frame_idx; + putFrame(); + } + } + }()); + + var doDecodeProgress = function (draw) { + doShowProgress(stream.pos, stream.data.length, draw); + }; + + var doNothing = function () {}; + /** + * @param{boolean=} draw Whether to draw progress bar or not; this is not idempotent because of translucency. + * Note that this means that the text will be unsynchronized with the progress bar on non-frames; + * but those are typically so small (GCE etc.) that it doesn't really matter. TODO: Do this properly. + */ + var withProgress = function (fn, draw) { + return function (block) { + fn(block); + doDecodeProgress(draw); + }; + }; + + + var handler = { + hdr: withProgress(doHdr), + gce: withProgress(doGCE), + com: withProgress(doNothing), + // I guess that's all for now. + app: { + // TODO: Is there much point in actually supporting iterations? + NETSCAPE: withProgress(doNothing) + }, + img: withProgress(doImg, true), + eof: function (block) { + //toolbar.style.display = ''; + pushFrame(); + doDecodeProgress(false); + if ( ! (options.c_w && options.c_h) ) { + canvas.width = hdr.width * get_canvas_scale(); + canvas.height = hdr.height * get_canvas_scale(); + } + player.init(); + loading = false; + if (load_callback) { + load_callback(gif); + } + + } + }; + + var init = function () { + var parent = gif.parentNode; + + var div = document.createElement('div'); + canvas = document.createElement('canvas'); + ctx = canvas.getContext('2d'); + toolbar = document.createElement('div'); + + tmpCanvas = document.createElement('canvas'); + + div.width = canvas.width = gif.width; + div.height = canvas.height = gif.height; + toolbar.style.minWidth = gif.width + 'px'; + + div.className = 'jsgif'; + toolbar.className = 'jsgif_toolbar'; + div.appendChild(canvas); + div.appendChild(toolbar); + + parent.insertBefore(div, gif); + parent.removeChild(gif); + + if (options.c_w && options.c_h) setSizes(options.c_w, options.c_h); + initialized=true; + }; + + var get_canvas_scale = function() { + var scale; + if (options.max_width && hdr && hdr.width > options.max_width) { + scale = options.max_width / hdr.width; + } + else { + scale = 1; + } + return scale; + } + + var canvas, ctx, toolbar, tmpCanvas; + var initialized = false; + var load_callback = false; + + var load_setup = function(callback) { + if (loading) return false; + if (callback) load_callback = callback; + else load_callback = false; + + loading = true; + frames = []; + clear(); + disposalRestoreFromIdx = null; + lastDisposalMethod = null; + frame = null; + lastImg = null; + + return true; + } + + var calculateDuration = function() { + return frames.reduce(function(duration, frame) { + return duration + frame.delay; + }, 0); + } + + return { + // play controls + play: player.play, + pause: player.pause, + move_relative: player.move_relative, + move_to: player.move_to, + + // getters for instance vars + get_playing : function() { return playing }, + get_canvas : function() { return canvas }, + get_canvas_scale : function() { return get_canvas_scale() }, + get_loading : function() { return loading }, + get_auto_play : function() { return options.auto_play }, + get_length : function() { return player.length() }, + get_frames : function() { return frames }, + get_duration : function() { return calculateDuration() }, + get_duration_ms : function() { return calculateDuration() * 10 }, + get_current_frame: function() { return player.current_frame() }, + load_url: function(src,callback){ + if (!load_setup(callback)) return; + + var h = new XMLHttpRequest(); + // new browsers (XMLHttpRequest2-compliant) + h.open('GET', src, true); + + if ('overrideMimeType' in h) { + h.overrideMimeType('text/plain; charset=x-user-defined'); + } + + // old browsers (XMLHttpRequest-compliant) + else if ('responseType' in h) { + h.responseType = 'arraybuffer'; + } + + // IE9 (Microsoft.XMLHTTP-compliant) + else { + h.setRequestHeader('Accept-Charset', 'x-user-defined'); + } + + h.onloadstart = function() { + // Wait until connection is opened to replace the gif element with a canvas to avoid a blank img + if (!initialized) init(); + }; + h.onload = function(e) { + if (this.status != 200) { + doLoadError('xhr - response'); + } + // emulating response field for IE9 + if (!('response' in this)) { + this.response = new VBArray(this.responseText).toArray().map(String.fromCharCode).join(''); + } + var data = this.response; + if (data.toString().indexOf("ArrayBuffer") > 0) { + data = new Uint8Array(data); + } + + stream = new Stream(data); + setTimeout(doParse, 0); + }; + h.onprogress = function (e) { + if (e.lengthComputable) doShowProgress(e.loaded, e.total, true); + }; + h.onerror = function() { doLoadError('xhr'); }; + h.send(); + }, + load: function (callback) { + this.load_url(gif.getAttribute('rel:animated_src') || gif.src,callback); + }, + load_raw: function(arr, callback) { + if (!load_setup(callback)) return; + if (!initialized) init(); + stream = new Stream(arr); + setTimeout(doParse, 0); + }, + set_frame_offset: setFrameOffset + }; + }; + + return SuperGif; +})); + + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/global */ +/******/ (() => { +/******/ __webpack_require__.g = (function() { +/******/ if (typeof globalThis === 'object') return globalThis; +/******/ try { +/******/ return this || new Function('return this')(); +/******/ } catch (e) { +/******/ if (typeof window === 'object') return window; +/******/ } +/******/ })(); +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { + +// EXPORTS +__webpack_require__.d(__webpack_exports__, { + Z: () => (/* binding */ x_ite) +}); + +;// CONCATENATED MODULE: ./src/x_ite/Namespace.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +const Namespace = new Map (); + +Object .defineProperty (Namespace, "add", +{ + value (name, path, module) + { + if (Namespace .hasOwnProperty (name)) + { + // if (!path .match (/\/components\/\w+$/i)) + // console .warn (`Module ${name} (${path}) already defined.`); + } + else + { + const X3D = window [Symbol .for ("X_ITE.X3D-8.12.4")]; + + if (X3D) + X3D [name] = module; + + Namespace [name] = module; + } + + Namespace .set (path, module); + }, +}); + +Namespace .add ("Namespace", "x_ite/Namespace", Namespace); + +/* harmony default export */ const x_ite_Namespace = (Namespace); + +;// CONCATENATED MODULE: ./src/x_ite/Base/X3DConstants.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +let + BROWSER_EVENT = 0, + LOAD_STATE = 0, + FIELD_TYPE = 0, + NODE_TYPE = 0; + +const X3DConstants = +{ + // Browser event + + CONNECTION_ERROR: BROWSER_EVENT ++, + BROWSER_EVENT: BROWSER_EVENT ++, + INITIALIZED_EVENT: BROWSER_EVENT ++, + SHUTDOWN_EVENT: BROWSER_EVENT ++, + INITIALIZED_ERROR: BROWSER_EVENT ++, + + // Load state + + NOT_STARTED_STATE: LOAD_STATE ++, + IN_PROGRESS_STATE: LOAD_STATE ++, + COMPLETE_STATE: LOAD_STATE ++, + FAILED_STATE: LOAD_STATE ++, + + // Access type + + initializeOnly: 0b001, + inputOnly: 0b010, + outputOnly: 0b100, + inputOutput: 0b111, + + // X3DField + + SFBool: FIELD_TYPE ++, + SFColor: FIELD_TYPE ++, + SFColorRGBA: FIELD_TYPE ++, + SFDouble: FIELD_TYPE ++, + SFFloat: FIELD_TYPE ++, + SFImage: FIELD_TYPE ++, + SFInt32: FIELD_TYPE ++, + SFMatrix3d: FIELD_TYPE ++, + SFMatrix3f: FIELD_TYPE ++, + SFMatrix4d: FIELD_TYPE ++, + SFMatrix4f: FIELD_TYPE ++, + SFNode: FIELD_TYPE ++, + SFRotation: FIELD_TYPE ++, + SFString: FIELD_TYPE ++, + SFTime: FIELD_TYPE ++, + SFVec2d: FIELD_TYPE ++, + SFVec2f: FIELD_TYPE ++, + SFVec3d: FIELD_TYPE ++, + SFVec3f: FIELD_TYPE ++, + SFVec4d: FIELD_TYPE ++, + SFVec4f: FIELD_TYPE ++, + + VrmlMatrix: FIELD_TYPE ++, + + // X3DArrayField + + MFBool: FIELD_TYPE ++, + MFColor: FIELD_TYPE ++, + MFColorRGBA: FIELD_TYPE ++, + MFDouble: FIELD_TYPE ++, + MFFloat: FIELD_TYPE ++, + MFImage: FIELD_TYPE ++, + MFInt32: FIELD_TYPE ++, + MFMatrix3d: FIELD_TYPE ++, + MFMatrix3f: FIELD_TYPE ++, + MFMatrix4d: FIELD_TYPE ++, + MFMatrix4f: FIELD_TYPE ++, + MFNode: FIELD_TYPE ++, + MFRotation: FIELD_TYPE ++, + MFString: FIELD_TYPE ++, + MFTime: FIELD_TYPE ++, + MFVec2d: FIELD_TYPE ++, + MFVec2f: FIELD_TYPE ++, + MFVec3d: FIELD_TYPE ++, + MFVec3f: FIELD_TYPE ++, + MFVec4d: FIELD_TYPE ++, + MFVec4f: FIELD_TYPE ++, + + // Abstract nodes and nodes types are added later. + + X3DBaseNode: NODE_TYPE, + + [Symbol .toStringTag]: "X3DConstants", +}; + +Object .defineProperty (X3DConstants, "addNode", +{ + value ({ typeName }) + { + if (this .hasOwnProperty (typeName)) + return; + + this [typeName] = ++ NODE_TYPE; + }, +}); + +const __default__ = X3DConstants; +; + +x_ite_Namespace .add ("X3DConstants", "x_ite/Base/X3DConstants", __default__); +/* harmony default export */ const Base_X3DConstants = (__default__); +;// CONCATENATED MODULE: ./src/standard/Math/Algorithm.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +const Algorithm = +{ + radians (value) + { + return value * (Math .PI / 180); + }, + degrees (value) + { + return value * (180 / Math .PI); + }, + random (min, max) + { + return min + Math .random () * (max - min); + }, + fract (value) + { + return value % 1; + }, + clamp (value, min, max) + { + // https://registry.khronos.org/OpenGL-Refpages/gl4/html/clamp.xhtml + return Math .min (Math .max (value, min), max); + }, + interval (value, low, high) + { + if (value >= high) + return ((value - low) % (high - low)) + low; + + if (value < low) + return ((value - high) % (high - low)) + high; + + return value; + }, + roundToMultiple (value, multiple) + { + return Math .ceil (value / multiple) * multiple; + }, + lerp (source, destination, t) + { + return source + t * (destination - source); + }, + slerp (source, destination, t) + { + let cosom = source .dot (destination); + + // if (cosom <= -1) ... vectors are inverse colinear. + + if (cosom >= 1) // Both normal vectors are equal. + return source; + + if (cosom < 0) + { + // Reverse signs so we travel the short way round. + cosom = -cosom; + destination .negate (); + } + + const + omega = Math .acos (cosom), + sinom = Math .sin (omega), + scale0 = Math .sin ((1 - t) * omega) / sinom, + scale1 = Math .sin (t * omega) / sinom; + + source .x = source .x * scale0 + destination .x * scale1; + source .y = source .y * scale0 + destination .y * scale1; + source .z = source .z * scale0 + destination .z * scale1; + source .w = source .w * scale0 + destination .w * scale1; + + return source; + }, + simpleSlerp (source, destination, t) + { + const cosom = source .dot (destination); + + // if (cosom <= -1) ... vectors are inverse colinear. + + if (cosom >= 1) // Both normal vectors are equal. + return source; + + const + omega = Math .acos (cosom), + sinom = Math .sin (omega), + scale0 = Math .sin ((1 - t) * omega) / sinom, + scale1 = Math .sin (t * omega) / sinom; + + source .x = source .x * scale0 + destination .x * scale1; + source .y = source .y * scale0 + destination .y * scale1; + source .z = source .z * scale0 + destination .z * scale1; + source .w = source .w * scale0 + destination .w * scale1; + + return source; + }, + isPowerOfTwo (n) + { + return ((n - 1) & n) === 0; + }, + nextPowerOfTwo (n) + { + /// Returns the next power of two of @a n. If n is a power of two, n is returned. + + if (Algorithm .isPowerOfTwo (n)) + return n; + + return 1 << (32 - Math .clz32 (n)); + }, + bitCount (n) + { + n = n - ((n >>> 1) & 0x55555555); + n = (n & 0x33333333) + ((n >>> 2) & 0x33333333); + return ((n + (n >>> 4) & 0xF0F0F0F) * 0x1010101) >>> 24; + }, + cmp (lhs, rhs) + { + return lhs > rhs ? 1 : lhs < rhs ? -1 : 0; + }, + // lexicographicallyCompare (lhs, rhs) + // { + // const + // length1 = lhs .length, + // length2 = rhs .length; + + // for (let i = 0; i < length1 && i < length2; ++ i) + // { + // if (lhs [i] < rhs [i]) + // return -1; + + // if (rhs [i] < lhs [i]) + // return 1; + // } + + // return Algorithm .cmp (length1, length2); + // }, + less (lhs, rhs) + { + return lhs < rhs; + }, + greater (lhs, rhs) + { + return lhs > rhs; + }, + lowerBound (array, first, last, value, comp = Algorithm.less) + { + // https://en.cppreference.com/w/cpp/algorithm/lower_bound + + let + index = 0, + step = 0, + count = last - first; + + while (count > 0) + { + step = count >>> 1; + index = first + step; + + if (comp (array [index], value)) + { + first = ++ index; + count -= step + 1; + } + else + count = step; + } + + return first; + }, + upperBound (array, first, last, value, comp = Algorithm.less) + { + // sen.cppreference.com/w/cpp/algorithm/upper_bound + + let + index = 0, + step = 0, + count = last - first; + + while (count > 0) + { + step = count >>> 1; + index = first + step; + + if (comp (value, array [index])) + count = step; + + else + { + first = ++ index; + count -= step + 1; + } + } + + return first; + }, +}; + +const Algorithm_default_ = Algorithm; +; + +x_ite_Namespace .add ("Algorithm", "standard/Math/Algorithm", Algorithm_default_); +/* harmony default export */ const Math_Algorithm = (Algorithm_default_); +;// CONCATENATED MODULE: ./src/x_ite/InputOutput/Generator.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function Generator ({ style = "TIDY", indent = "", precision = 7, doublePrecision = 15, html = false, closingTags = false }) +{ + this .string = ""; + this .indent = indent; + this .listIndent = indent; + this .precision = Math_Algorithm .clamp (precision, 1, 21); + this .doublePrecision = Math_Algorithm .clamp (doublePrecision, 1, 21); + this .html = html; + this .closingTags = html || closingTags; + + this .floatFormat = new Intl .NumberFormat ("en", { + notation: "standard", + maximumSignificantDigits: this .precision, + useGrouping: false, + }) .format; + + this .floatExponentialFormat = new Intl .NumberFormat ("en", { + notation: "scientific", + maximumSignificantDigits: this .precision, + useGrouping: false, + }) .format; + + this .doubleFormat = new Intl .NumberFormat ("en", { + notation: "standard", + maximumSignificantDigits: this .doublePrecision, + useGrouping: false, + }) .format; + + this .doubleExponentialFormat = new Intl .NumberFormat ("en", { + notation: "scientific", + maximumSignificantDigits: this .doublePrecision, + useGrouping: false, + }) .format; + + this .Style (style); + + this .executionContextStack = [ ]; + this .importedNodesIndex = new Map (); + this .exportedNodesIndex = new Map (); + this .nodes = new Set (); + this .names = new Map (); + this .namesByNode = new Map (); + this .importedNames = new Map (); + this .routeNodes = new Set (); + this .level = 0; + this .containerFields = [ ]; + this .units = true; + this .unitCategories = [ ]; + + this .PushExecutionContext (null); +} + +Object .assign (Generator .prototype, +{ + Style (style) + { + switch (style) + { + case "CLEAN": + { + this .listIndent = ""; + + this .comma = " "; + this .break = " "; + this .tidyBreak = ""; + this .tidySpace = ""; + this .indentChar = ""; + this .listEnclosure = ""; + this .listBreak = ""; + this .listIndentChar = ""; + this .attribBreak = " "; + break; + } + case "SMALL": + { + this .listIndent = ""; + + this .comma = ","; + this .break = "\n"; + this .tidyBreak = "\n"; + this .tidySpace = ""; + this .indentChar = ""; + this .listEnclosure = ""; + this .listBreak = ""; + this .listIndentChar = ""; + this .attribBreak = " "; + break; + } + case "COMPACT": + { + this .listIndent = ""; + + this .comma = ","; + this .break = "\n"; + this .tidyBreak = "\n"; + this .tidySpace = " "; + this .indentChar = " "; + this .listEnclosure = " "; + this .listBreak = " "; + this .listIndentChar = ""; + this .attribBreak = " "; + break; + } + case "TIDY": + default: + { + this .comma = ","; + this .break = "\n"; + this .tidyBreak = "\n"; + this .tidySpace = " "; + this .indentChar = " "; + this .listEnclosure = "\n"; + this .listBreak = "\n"; + this .listIndentChar = " "; + this .attribBreak = "\n"; + break; + } + } + }, + Comma () + { + return this .comma; + }, + Break () + { + return this .break; + }, + TidyBreak () + { + return this .tidyBreak; + }, + ForceBreak () + { + return "\n"; + }, + Space () + { + return " "; + }, + TidySpace () + { + return this .tidySpace; + }, + ListStart () + { + return this .listEnclosure; + }, + ListEnd () + { + return this .listEnclosure; + }, + ListBreak () + { + return this .listBreak; + }, + AttribBreak () + { + return this .attribBreak; + }, + Indent () + { + return this .indent; + }, + ListIndent () + { + return this .listIndent; + }, + IncIndent () + { + this .indent += this .indentChar; + this .listIndent += this .listIndentChar; + + return ""; + }, + DecIndent () + { + this .indent = this .indent .slice (0, this .indent .length - this .indentChar .length); + this .listIndent = this .listIndent .slice (0, this .listIndent .length - this .listIndentChar .length); + + return ""; + }, + FloatFormat (value) + { + if (Number .isFinite (value)) + { + const exponent = Math .log10 (Math .abs (value)); + + if ((this .precision > exponent && exponent >= -4) || value === 0) + return this .floatFormat (value); + + return this .floatExponentialFormat (value) .toLowerCase (); + } + else + { + return String (value); + } + }, + DoubleFormat (value) + { + if (Number .isFinite (value)) + { + const exponent = Math .log10 (Math .abs (value)); + + if ((this .doublePrecision > exponent && exponent >= -4) || value === 0) + return this .doubleFormat (value); + + return this .doubleExponentialFormat (value) .toLowerCase (); + } + else + { + return String (value); + } + }, + PushExecutionContext (executionContext) + { + this .executionContextStack .push (executionContext); + + if (!this .names .has (executionContext)) + this .names .set (executionContext, Object .assign (new Set (), { index: 0 })); + + if (!this .importedNodesIndex .has (executionContext)) + this .importedNodesIndex .set (executionContext, new Set ()); + + if (!this .exportedNodesIndex .has (executionContext)) + this .exportedNodesIndex .set (executionContext, new Set ()); + }, + PopExecutionContext () + { + this .executionContextStack .pop (); + + if (this .ExecutionContext ()) + return; + + this .importedNodesIndex .clear (); + this .exportedNodesIndex .clear (); + }, + ExecutionContext () + { + return this .executionContextStack .at (-1); + }, + EnterScope () + { + ++ this .level; + }, + LeaveScope () + { + -- this .level; + + if (this .level === 0) + { + this .nodes .clear (); + this .namesByNode .clear (); + this .importedNames .clear (); + } + }, + NamedNodes (namedNodes) + { + const + names = this .names .get (this .ExecutionContext ()), + namesByNode = this .namesByNode; + + for (const node of namedNodes) + { + if (node .getNodeName () .match (/^_\d+$/)) + continue; + + names .add (node .getNodeName ()); + namesByNode .set (node .getValue (), node .getNodeName ()) + } + }, + ExportedNodes (exportedNodes) + { + const index = this .exportedNodesIndex .get (this .ExecutionContext ()); + + for (const exportedNode of exportedNodes) + index .add (exportedNode .getLocalNode ()) + }, + ImportedNodes (importedNodes) + { + const index = this .importedNodesIndex .get (this .ExecutionContext ()); + + for (const importedNode of importedNodes) + { + try + { + index .add (importedNode .getInlineNode ()); + } + catch + { } + } + }, + AddImportedNode (exportedNode, importedName) + { + this .importedNames .set (exportedNode, importedName); + }, + AddRouteNode (routeNode) + { + this .routeNodes .add (routeNode); + }, + ExistsRouteNode (routeNode) + { + return this .namesByNode .get (routeNode) || this .routeNodes .has (routeNode); + }, + IsSharedNode (baseNode) + { + return this .ExecutionContext () !== baseNode .getExecutionContext (); + }, + AddNode (baseNode) + { + this .nodes .add (baseNode); + + this .AddRouteNode (baseNode); + }, + ExistsNode (baseNode) + { + return this .nodes .has (baseNode); + }, + Name (baseNode) + { + // Is the node already in index. + + const name = this .namesByNode .get (baseNode); + + if (name !== undefined) + { + return name; + } + else + { + const names = this .names .get (this .ExecutionContext ()); + + // The node has no name. + + if (!this .NeedsName (baseNode)) + return ""; + + const newName = `_${++ names .index}`; + + // Add to indices. + + names .add (newName); + this .namesByNode .set (baseNode, newName); + + return newName; + } + }, + NeedsName (baseNode) + { + if (baseNode .getCloneCount () > 1) + return true; + + if (baseNode .hasRoutes ()) + return true; + + const + executionContext = baseNode .getExecutionContext (), + index = this .importedNodesIndex .get (executionContext); + + if (index) + { + if (index .has (baseNode)) + return true; + } + else + { + const index = this .exportedNodesIndex .get (executionContext); + + if (index) + { + if (index .has (baseNode)) + return true; + } + + return false; + } + }, + LocalName (baseNode) + { + const importedName = this .importedNames .get (baseNode); + + if (importedName !== undefined) + return importedName; + + if (this .ExistsNode (baseNode)) + return this .Name (baseNode); + + throw new Error (`Couldn't get local name for node '${baseNode .getTypeName ()}'.`); + }, + PushContainerField (field) + { + this .containerFields .push (field); + }, + PopContainerField () + { + this .containerFields .pop (); + }, + ContainerField () + { + if (this .containerFields .length) + return this .containerFields [this .containerFields .length - 1]; + + return null; + }, + AccessType (accessType) + { + switch (accessType) + { + case Base_X3DConstants .initializeOnly: + return "initializeOnly"; + case Base_X3DConstants .inputOnly: + return "inputOnly"; + case Base_X3DConstants .outputOnly: + return "outputOnly"; + case Base_X3DConstants .inputOutput: + return "inputOutput"; + } + }, + SetUnits (value) + { + this .units = value; + }, + GetUnits () + { + return this .units; + }, + PushUnitCategory (category) + { + this .unitCategories .push (category); + }, + PopUnitCategory () + { + this .unitCategories .pop (); + }, + Unit (category) + { + if (this .unitCategories .length == 0) + return category; + + return this .unitCategories .at (-1); + }, + ToUnit (category, value) + { + if (this .units) + { + const executionContext = this .ExecutionContext (); + + if (executionContext) + return executionContext .toUnit (category, value); + } + + return value; + }, + XMLEncode: (() => + { + const map = { + "\\": "\\\\", + "\r": " ", + "\n": " ", + "\t": " ", + "\"": "\\\"", + "'": "'", + "<": "<", + ">": ">", + "&": "&", + }; + + const regex = /([\\\r\n\t"'<>&])/g; + + return function (string) + { + return string .replace (regex, char => map [char]); + }; + })(), + XMLEncodeSourceText: (() => + { + const map = { + "\\": "\\\\", + "\"": "\\\"", + "'": "'", + "<": "<", + ">": ">", + "&": "&", + }; + + const regex = /([\\"'<>&])/g; + + return function (string) + { + return string .replace (regex, char => map [char]); + }; + })(), + JSONEncode: (() => + { + const map = { + "\\": "\\\\", + "\r": "\\r", + "\n": "\\n", + "\t": "\\t", + "\"": "\\\"", + }; + + const regex = /([\\\t\n\r"])/g; + + return function (string) + { + return string .replace (regex, char => map [char]); + }; + })(), + JSONNumber (value) + { + switch (value) + { + case "NaN": + case "Infinity": + case "-Infinity": + return '"' + value + '"'; + default: + return value; + } + }, + JSONRemoveComma () + { + // this .string = this .string .replace (/,(\s*)$/s, "$1"); + + this .string = this .string .trimEnd (); + + if (this .string .endsWith (',')) + this .string = this .string .slice (0, -1); + + this .string += this .TidyBreak (); + }, +}); + +for (const key of Object .keys (Generator .prototype)) + Object .defineProperty (Generator .prototype, key, { enumerable: false }); + +const Generator_default_ = Generator; +; + +x_ite_Namespace .add ("Generator", "x_ite/InputOutput/Generator", Generator_default_); +/* harmony default export */ const InputOutput_Generator = (Generator_default_); +;// CONCATENATED MODULE: ./src/standard/Utility/MapUtilities.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +const MapUtilities = +{ + assign: (() => + { + function callback (value, key) + { + this .set (key, value); + } + + return function (m1, m2) + { + m1 .clear (); + m2 .forEach (callback, m1); + + return m1; + }; + })(), + values: (() => + { + function callback (value) + { + this .push (value); + } + + return function (a, m) + { + a .length = 0; + + m .forEach (callback, a); + + return a; + }; + })(), +}; + +const MapUtilities_default_ = MapUtilities; +; + +x_ite_Namespace .add ("MapUtilities", "standard/Utility/MapUtilities", MapUtilities_default_); +/* harmony default export */ const Utility_MapUtilities = (MapUtilities_default_); +;// CONCATENATED MODULE: ./src/x_ite/DEVELOPMENT.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +// Modified during dist build. + +const DEVELOPMENT_default_ = false; +; + +x_ite_Namespace .add ("DEVELOPMENT", "x_ite/DEVELOPMENT", DEVELOPMENT_default_); +/* harmony default export */ const DEVELOPMENT = (DEVELOPMENT_default_); +;// CONCATENATED MODULE: ./src/x_ite/Base/X3DObject.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +const + _name = Symbol (), + _interests = Symbol (), + _values = Symbol (), + _userData = Symbol (); + +function X3DObject () { } + +Object .assign (X3DObject .prototype, +{ + [_name]: "", + [_interests]: new Map (), + [_values]: [ ], + [_userData]: new Map (), + getId () + { + return X3DObject .getId (this); + }, + getTypeName () + { + return this .constructor .typeName; + }, + setName (value) + { + this [_name] = value; + }, + getName () + { + return this [_name]; + }, + getDisplayName () + { + return this [_name]; + }, + hasInterest (callbackName, object) + { + return this [_interests] .has (X3DObject .getInterestId (callbackName, object)); + }, + addInterest (callbackName, object, ... args) + { + if (this [_interests] === X3DObject .prototype [_interests]) + { + this [_interests] = new Map (); + this [_values] = [ ]; + } + + const + interestId = X3DObject .getInterestId (callbackName, object), + callback = object [callbackName]; + + this [_interests] .set (interestId, callback .bind (object, ... args, this)); + }, + removeInterest (callbackName, object) + { + this [_interests] .delete (X3DObject .getInterestId (callbackName, object)); + }, + getInterests () + { + return this [_interests]; + }, + processInterests () + { + if (this [_interests] .size) + { + for (const interest of Utility_MapUtilities .values (this [_values], this [_interests])) + interest (); + } + }, + getUserData (key) + { + return this [_userData] .get (key) + ?? this [_userData] .map ?.get (key); + }, + setUserData (key, value) + { + try + { + if (this [_userData] === X3DObject .prototype [_userData]) + this [_userData] = new WeakMap (); + + this [_userData] .set (key, value); + } + catch + { + if (!this [_userData] .map) + this [_userData] .map = new Map (); + + this [_userData] .map .set (key, value); + } + }, + removeUserData (key) + { + if (this [_userData] .delete (key)) + return; + + this [_userData] .map ?.delete (key); + }, + toString (options = Object .prototype) + { + const generator = new InputOutput_Generator (options); + + if (options .scene) + generator .PushExecutionContext (options .scene); + + this .toStream (generator); + + return generator .string; + }, + toVRMLString (options = Object .prototype) + { + const generator = new InputOutput_Generator (options); + + if (options .scene) + generator .PushExecutionContext (options .scene); + + this .toVRMLStream (generator); + + return generator .string; + }, + toXMLString (options = Object .prototype) + { + const generator = new InputOutput_Generator (options); + + if (options .scene) + generator .PushExecutionContext (options .scene); + + this .toXMLStream (generator); + + return generator .string; + }, + toJSONString (options = Object .prototype) + { + const generator = new InputOutput_Generator (options); + + if (options .scene) + generator .PushExecutionContext (options .scene); + + this .toJSONStream (generator); + + return generator .string; + }, + toStream (generator) + { + generator .string = Object .prototype .toString .call (this); + }, + dispose () + { + this [_interests] .clear (); + this [_userData] .map ?.clear (); + }, +}); + +for (const key of Object .keys (X3DObject .prototype)) + Object .defineProperty (X3DObject .prototype, key, { enumerable: false }); + +Object .defineProperties (X3DObject .prototype, +{ + [Symbol .toStringTag]: + { + get () { return this .getTypeName (); }, + }, +}); + +Object .assign (X3DObject, +{ + getId: DEVELOPMENT ? (() => + { + const + map = new WeakMap (), + cache = [ ], + registry = new FinalizationRegistry (id => cache .push (id)); + + let counter = BigInt (0); + + return function (object) + { + const id = map .get (object); + + if (id !== undefined) + { + return id; + } + else + { + const id = cache .pop () ?? ++ counter; + + map .set (object, id); + registry .register (object, id); + + return id; + } + }; + })() : (() => + { + const map = new WeakMap (); + + let counter = 0; + + return function (object) + { + const id = map .get (object); + + if (id !== undefined) + return id; + + map .set (object, ++ counter); + + return counter; + }; + })(), + getInterestId (callbackName, object) + { + return `${this .getId (object)}.${this .getId (object [callbackName])}`; + }, +}); + +const X3DObject_default_ = X3DObject; +; + +x_ite_Namespace .add ("X3DObject", "x_ite/Base/X3DObject", X3DObject_default_); +/* harmony default export */ const Base_X3DObject = (X3DObject_default_); +;// CONCATENATED MODULE: ./src/x_ite/Base/X3DChildObject.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +const + _modificationTime = Symbol (), + _tainted = Symbol (), + _parents = Symbol (), + _registry = Symbol (); + +function X3DChildObject () +{ + Base_X3DObject .call (this); +} + +if (DEVELOPMENT) +{ + Object .assign (Object .setPrototypeOf (X3DChildObject .prototype, Base_X3DObject .prototype), + { + [_modificationTime]: 0, + [_tainted]: false, + [_parents]: new Map (), + [_registry]: new FinalizationRegistry (Function .prototype), + isInitializable () + { + return true; + }, + isInput () + { + return false; + }, + isOutput () + { + return false; + }, + setModificationTime (value) + { + this [_modificationTime] = value; + }, + getModificationTime () + { + return this [_modificationTime]; + }, + setTainted (value) + { + this [_tainted] = value; + }, + isTainted () + { + return this [_tainted]; + }, + addEvent () + { + this .setModificationTime (Date .now ()); + + for (const parent of this [_parents] .values ()) + parent .deref () ?.addEvent (this); + }, + addEventObject (field, event) + { + this .setModificationTime (Date .now ()); + + for (const parent of this [_parents] .values ()) + parent .deref () ?.addEventObject (this, event); + }, + processEvent () + { + this .setTainted (false); + this .processInterests (); + }, + collectCloneCount () + { + let cloneCount = 0; + + for (const weakRef of this [_parents] .values ()) + cloneCount += weakRef .deref () ?.collectCloneCount (); + + return cloneCount; + }, + addParent (parent) + { + if (this [_parents] === X3DChildObject .prototype [_parents]) + { + this [_parents] = new Map (); + this [_registry] = new FinalizationRegistry (id => + { + this [_parents] .delete (id); + this .parentsChanged (); + }); + } + + this [_parents] .set (parent .getId (), new WeakRef (parent)); + this [_registry] .register (parent, parent .getId (), parent); + + this .parentsChanged (); + }, + removeParent (parent) + { + this [_parents] .delete (parent .getId ()); + this [_registry] .unregister (parent); + + this .parentsChanged (); + }, + getParents () + { + const parents = new Set (); + + for (const weakRef of this [_parents] .values ()) + parents .add (weakRef .deref ()) + + parents .delete (undefined); + + return parents; + }, + parentsChanged () { }, + dispose () + { + this [_parents] .clear (); + + Base_X3DObject .prototype .dispose .call (this); + }, + }); +} +else +{ + Object .assign (Object .setPrototypeOf (X3DChildObject .prototype, Base_X3DObject .prototype), + { + [_modificationTime]: 0, + [_tainted]: false, + [_parents]: new Set (), + isInitializable () + { + return true; + }, + isInput () + { + return false; + }, + isOutput () + { + return false; + }, + setModificationTime (value) + { + this [_modificationTime] = value; + }, + getModificationTime () + { + return this [_modificationTime]; + }, + setTainted (value) + { + this [_tainted] = value; + }, + isTainted () + { + return this [_tainted]; + }, + addEvent () + { + this .setModificationTime (Date .now ()); + + for (const parent of this [_parents]) + parent .addEvent (this); + }, + addEventObject (field, event) + { + this .setModificationTime (Date .now ()); + + for (const parent of this [_parents]) + parent .addEventObject (this, event); + }, + processEvent () + { + this .setTainted (false); + this .processInterests (); + }, + collectCloneCount () + { + let cloneCount = 0; + + for (const parent of this [_parents]) + cloneCount += parent .collectCloneCount (); + + return cloneCount; + }, + addParent (parent) + { + if (this [_parents] === X3DChildObject .prototype [_parents]) + this [_parents] = new Set (); + + this [_parents] .add (parent); + + this .parentsChanged (); + }, + removeParent (parent) + { + this [_parents] .delete (parent); + + this .parentsChanged (); + }, + getParents () + { + return this [_parents]; + }, + parentsChanged () { }, + dispose () + { + this [_parents] .clear (); + + Base_X3DObject .prototype .dispose .call (this); + }, + }); +} + +for (const key of Object .keys (X3DChildObject .prototype)) + Object .defineProperty (X3DChildObject .prototype, key, { enumerable: false }); + +const X3DChildObject_default_ = X3DChildObject; +; + +x_ite_Namespace .add ("X3DChildObject", "x_ite/Base/X3DChildObject", X3DChildObject_default_); +/* harmony default export */ const Base_X3DChildObject = (X3DChildObject_default_); +;// CONCATENATED MODULE: ./src/x_ite/Base/Events.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +const Events = Object .assign ([ ], +{ + create (field) + { + const event = this .pop () ?? new Set (); + + event .field = field; + event .clear (); + + return event; + }, + copy (event) + { + const copy = this .create (event .field); + + for (const source of event) + copy .add (source); + + return copy; + }, +}); + +for (const key of Object .keys (Events)) + Object .defineProperty (Events, key, { enumerable: false }); + +const Events_default_ = Events; +; + +x_ite_Namespace .add ("Events", "x_ite/Base/Events", Events_default_); +/* harmony default export */ const Base_Events = (Events_default_); +;// CONCATENATED MODULE: ./src/x_ite/Base/X3DFieldDefinition.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function X3DFieldDefinition (accessType, name, value) +{ + Object .defineProperties (this, + { + accessType: { value: accessType, enumerable: true }, + dataType: { value: value .getType (), enumerable: true }, + name: { value: name, enumerable: true }, + value: { value: value }, + }); +} + +Object .setPrototypeOf (X3DFieldDefinition .prototype, Base_X3DObject .prototype); + +for (const key of Object .keys (X3DFieldDefinition .prototype)) + Object .defineProperty (X3DFieldDefinition .prototype, key, { enumerable: false }); + +Object .defineProperties (X3DFieldDefinition, +{ + typeName: + { + value: "X3DFieldDefinition", + enumerable: true, + }, +}); + +const X3DFieldDefinition_default_ = X3DFieldDefinition; +; + +x_ite_Namespace .add ("X3DFieldDefinition", "x_ite/Base/X3DFieldDefinition", X3DFieldDefinition_default_); +/* harmony default export */ const Base_X3DFieldDefinition = (X3DFieldDefinition_default_); +;// CONCATENATED MODULE: ./src/x_ite/Base/X3DInfoArray.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +const + _array = Symbol (), + _index = Symbol (), + _valueType = Symbol (); + +const handler = +{ + get (target, key) + { + const value = target [key]; + + if (value !== undefined) + return value; + + if (typeof key === "string") + { + const index = +key; + + if (Number .isInteger (index)) + return target [_array] [index]; + + return; + } + }, + set (target, key, value) + { + if (target [key] === undefined) + return false; + + target [key] = value; + return true; + }, + has (target, key) + { + if (Number .isInteger (+key)) + return key < target [_array] .length; + + return key in target; + }, + ownKeys (target) + { + return Object .keys (target [_array]); + }, + getOwnPropertyDescriptor (target, key) + { + if (typeof key !== "string") + return; + + const index = +key; + + if (Number .isInteger (index) && index < target [_array] .length) + { + const propertyDescriptor = Object .getOwnPropertyDescriptor (target [_array], key); + + if (propertyDescriptor) + propertyDescriptor .writable = false; + + return propertyDescriptor; + } + }, +}; + +function X3DInfoArray (values, valueType) +{ + const proxy = new Proxy (this, handler); + + Base_X3DChildObject .call (this); + + this [_array] = [ ]; + this [_index] = new Map (); + this [_valueType] = valueType; + + for (const [key, value] of values) + this .add (key, value); + + return proxy; +} + +Object .assign (Object .setPrototypeOf (X3DInfoArray .prototype, Base_X3DChildObject .prototype), +{ + *[Symbol .iterator] () + { + yield* this [_array]; + }, + copy () + { + const copy = new (this .constructor) (); + + copy .assign (this); + + return copy; + }, + assign (array) + { + if (!(array instanceof this .constructor)) + throw new Error ("Couldn't assign info array, wrong type."); + + this [_array] = Array .from (array [_array]); + this [_index] = new Map (array [_index]); + + this .addEvent (); + }, + equals (array) + { + const + a = this [_array], + b = array [_array], + length = a .length; + + if (a === b) + return true; + + if (length !== b .length) + return false; + + for (let i = 0; i < length; ++ i) + { + if (a [i] !== b [i]) + return false; + } + + return true; + }, + has (key) + { + return this [_index] .has (key); + }, + get (key) + { + return this [_index] .get (key); + }, + add (key, value) + { + if (this [_index] .has (key)) + throw new Error (`Couldn't add value to ${this .getTypeName ()}, key '${key}' already exists.`); + + if (!(value instanceof this [_valueType])) + throw new Error (`Couldn't add value to ${this .getTypeName ()}, value for key '${key}' has wrong type.`); + + this [_array] .push (value); + this [_index] .set (key, value); + + this .addEvent (); + }, + alias (alias, value) + { + this [_index] .set (alias, value); + + this .addEvent (); + }, + update (oldKey, newKey, value) + { + // TODO: update alias. + + if (!(value instanceof this [_valueType])) + throw new Error (`Couldn't update value of ${this .getTypeName ()}, value for key '${key}' has wrong type.`); + + const oldValue = this [_index] .get (oldKey); + + if (oldKey !== newKey) + this .remove (newKey); + + this [_index] .delete (oldKey); + this [_index] .set (newKey, value); + + if (oldValue !== undefined) + { + const index = this [_array] .indexOf (oldValue); + + if (index > -1) + this [_array] [index] = value; + } + else + { + this [_array] .push (value); + } + + this .addEvent (); + }, + remove (key) + { + // TODO: remove alias. + + const value = this [_index] .get (key); + + if (value === undefined) + return; + + const index = this [_array] .indexOf (value); + + this [_index] .delete (key); + + if (index > -1) + this [_array] .splice (index, 1); + + this .addEvent (); + }, + at: Array .prototype .at, + // concat: Array .prototype .concat, + // copyWithin: Array.prototype.copyWithin, + entries: Array .prototype .entries, + every: Array .prototype .every, + // fill: Array .prototype .fill, + filter (callbackFn, thisArg) + { + return new (this .constructor) (Array .prototype .filter .call (this, callbackFn, thisArg)); + }, + find: Array .prototype .find, + findIndex: Array .prototype .findIndex, + findLast: Array .prototype .findLast, + findLastIndex: Array .prototype .findLastIndex, + // flat: Array .prototype .flat, + // flatMap: Array .prototype .flatMap, + forEach: Array .prototype .forEach, + includes: Array .prototype .includes, + indexOf: Array .prototype .indexOf, + join: Array .prototype .join, + keys: Array .prototype .keys, + lastIndexOf: Array .prototype .lastIndexOf, + map (callbackFn, thisArg) + { + return new (this .constructor) (Array .prototype .map .call (this, callbackFn, thisArg)); + }, + reduce: Array .prototype .reduce, + reduceRight: Array .prototype .reduceRight, + // reverse: Array .prototype .reverse, + slice (start, end) + { + return new (this .constructor) (Array .prototype .slice .call (this, start, end)); + }, + some: Array .prototype .some, + // sort: Array .prototype .sort, + toReversed () + { + return new (this .constructor) ([... this] .reverse ()); + }, + toSorted (compareFn) + { + return new (this .constructor) ([... this] .sort (compareFn)); + }, + toSpliced (start, deleteCount, ... insertValues) + { + const array = [... this]; + + array .splice (start, deleteCount, ... insertValues) + + return new (this .constructor) (array); + }, + values: Array .prototype .values, + with (index, value) + { + const array = [... this]; + + array [index] = value; + + return new (this .constructor) (array); + }, + toVRMLStream (generator) + { + for (const value of this [_array]) + { + try + { + value .toVRMLStream (generator); + + generator .string += generator .Break (); + + if (this .getTypeName () .match (/Proto/)) + generator .string += generator .TidyBreak (); + } + catch (error) + { + // console .error (error); + } + } + }, + toXMLStream (generator) + { + for (const value of this [_array]) + { + try + { + value .toXMLStream (generator); + + generator .string += generator .TidyBreak (); + } + catch (error) + { + // console .error (error); + } + } + }, + toJSONStream (generator, comma) + { + let lastProperty = false; + + for (const value of this [_array]) + { + try + { + value .toJSONStream (generator, true); + + generator .string += ','; + generator .string += generator .TidyBreak (); + + lastProperty = true; + } + catch (error) + { + // console .error (error); + } + } + + if (lastProperty && !comma) + generator .JSONRemoveComma (); + + return lastProperty; + }, +}); + +for (const key of Object .keys (X3DInfoArray .prototype)) + Object .defineProperty (X3DInfoArray .prototype, key, { enumerable: false }); + +Object .defineProperties (X3DInfoArray .prototype, +{ + length: + { + get () { return this [_array] .length; }, + }, +}); + +const X3DInfoArray_default_ = X3DInfoArray; +; + +x_ite_Namespace .add ("X3DInfoArray", "x_ite/Base/X3DInfoArray", X3DInfoArray_default_); +/* harmony default export */ const Base_X3DInfoArray = (X3DInfoArray_default_); +;// CONCATENATED MODULE: ./src/x_ite/Base/FieldDefinitionArray.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function FieldDefinitionArray (values = [ ]) +{ + return Base_X3DInfoArray .call (this, Array .from (values, value => [value .name, value]), Base_X3DFieldDefinition); +} + +Object .setPrototypeOf (FieldDefinitionArray .prototype, Base_X3DInfoArray .prototype); + +for (const key of Object .keys (FieldDefinitionArray .prototype)) + Object .defineProperty (FieldDefinitionArray .prototype, key, { enumerable: false }); + +Object .defineProperties (FieldDefinitionArray, +{ + typeName: + { + value: "FieldDefinitionArray", + enumerable: true, + }, +}); + +const FieldDefinitionArray_default_ = FieldDefinitionArray; +; + +x_ite_Namespace .add ("FieldDefinitionArray", "x_ite/Base/FieldDefinitionArray", FieldDefinitionArray_default_); +/* harmony default export */ const Base_FieldDefinitionArray = (FieldDefinitionArray_default_); +;// CONCATENATED MODULE: ./src/x_ite/Base/X3DField.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + +const + _value = Symbol (), + _accessType = Symbol (), + _unit = Symbol (), + _references = Symbol (), + _referencesCallbacks = Symbol (), + _fieldInterests = Symbol (), + _fieldCallbacks = Symbol (), + _inputRoutes = Symbol (), + _outputRoutes = Symbol (), + _routeCallbacks = Symbol (), + _uniformLocation = Symbol .for ("X_ITE.X3DField.uniformLocation"); + +function X3DField (value) +{ + Base_X3DChildObject .call (this); + + this [_value] = value; +} + +Object .assign (Object .setPrototypeOf (X3DField .prototype, Base_X3DChildObject .prototype), +{ + [_value]: null, + [_accessType]: Base_X3DConstants .initializeOnly, + [_unit]: null, + [_references]: new Set (), + [_referencesCallbacks]: new Map (), + [_fieldInterests]: new Set (), + [_fieldCallbacks]: new Map (), + [_inputRoutes]: new Set (), + [_outputRoutes]: new Set (), + [_routeCallbacks]: new Map (), + [_uniformLocation]: null, + create () + { + return new (this .constructor) (); + }, + equals (field) + { + return this [_value] === field .valueOf (); + }, + assign (field) + { + // Assigns field to this field. + this .set (field .getValue ()); + this .addEvent (); + }, + set (value) + { + // Sets internal value without generating event. + this [_value] = value; + }, + setValue (value) + { + // Sets internal value and generates event. + this .set (value instanceof this .constructor ? value .getValue () : value); + this .addEvent (); + }, + getValue () + { + return this [_value]; + }, + getType () + { + return Base_X3DConstants [this .constructor .typeName]; + }, + setAccessType (value) + { + this [_accessType] = value; + }, + getAccessType () + { + return this [_accessType]; + }, + isInitializable () + { + return !! (this [_accessType] & Base_X3DConstants .initializeOnly); + }, + isInput () + { + return !! (this [_accessType] & Base_X3DConstants .inputOnly); + }, + isOutput () + { + return !! (this [_accessType] & Base_X3DConstants .outputOnly); + }, + isReadable () + { + return this [_accessType] !== Base_X3DConstants .inputOnly; + }, + isWritable () + { + return this [_accessType] !== Base_X3DConstants .outputOnly; + }, + setUnit (value) + { + this [_unit] = value; + }, + getUnit () + { + return this [_unit]; + }, + hasReferences () + { + return this [_references] .size !== 0; + }, + isReference (accessType) + { + return accessType === this [_accessType] || accessType === Base_X3DConstants .inputOutput; + }, + addReference (reference) + { + const references = this .getReferences (); + + if (references .has (reference)) + return; + + references .add (reference); + + // Create IS relationship + + switch (this .getAccessType () & reference .getAccessType ()) + { + case Base_X3DConstants .initializeOnly: + reference .addFieldInterest (this); + this .assign (reference); + break; + case Base_X3DConstants .inputOnly: + reference .addFieldInterest (this); + break; + case Base_X3DConstants .outputOnly: + this .addFieldInterest (reference); + break; + case Base_X3DConstants .inputOutput: + reference .addFieldInterest (this); + this .addFieldInterest (reference); + this .assign (reference); + break; + } + + this .processReferencesCallbacks (); + }, + removeReference (reference) + { + this .getReferences () .delete (reference); + + // Create IS relationship + + switch (this .getAccessType () & reference .getAccessType ()) + { + case Base_X3DConstants .initializeOnly: + reference .removeFieldInterest (this); + break; + case Base_X3DConstants .inputOnly: + reference .removeFieldInterest (this); + break; + case Base_X3DConstants .outputOnly: + this .removeFieldInterest (reference); + break; + case Base_X3DConstants .inputOutput: + reference .removeFieldInterest (this); + this .removeFieldInterest (reference); + break; + } + + this .processReferencesCallbacks (); + }, + getReferences () + { + if (this [_references] === X3DField .prototype [_references]) + this [_references] = new Set (); + + return this [_references]; + }, + addReferencesCallback (key, object) + { + if (this [_referencesCallbacks] === X3DField .prototype [_referencesCallbacks]) + this [_referencesCallbacks] = new Map (); + + this [_referencesCallbacks] .set (key, object); + }, + removeReferencesCallback (key) + { + this [_referencesCallbacks] .delete (key); + }, + getReferencesCallbacks () + { + return this [_referencesCallbacks]; + }, + processReferencesCallbacks: (() => + { + const referencesCallbacksTemp = [ ]; + + return function () + { + if (this [_referencesCallbacks] .size) + { + for (const referencesCallback of Utility_MapUtilities .values (referencesCallbacksTemp, this [_referencesCallbacks])) + referencesCallback (); + } + }; + })(), + addFieldInterest (field) + { + if (this [_fieldInterests] === X3DField .prototype [_fieldInterests]) + this [_fieldInterests] = new Set (); + + this [_fieldInterests] .add (field); + }, + removeFieldInterest (field) + { + this [_fieldInterests] .delete (field); + }, + getFieldInterests () + { + return this [_fieldInterests]; + }, + addFieldCallback (key, object) + { + if (this [_fieldCallbacks] === X3DField .prototype [_fieldCallbacks]) + this [_fieldCallbacks] = new Map (); + + this [_fieldCallbacks] .set (key, object); + }, + removeFieldCallback (key) + { + this [_fieldCallbacks] .delete (key); + }, + getFieldCallbacks () + { + return this [_fieldCallbacks]; + }, + addInputRoute (route) + { + if (this [_inputRoutes] === X3DField .prototype [_inputRoutes]) + this [_inputRoutes] = new Set (); + + this [_inputRoutes] .add (route); + + this .processRouteCallbacks (); + }, + removeInputRoute (route) + { + this [_inputRoutes] .delete (route); + + this .processRouteCallbacks (); + }, + getInputRoutes () + { + return this [_inputRoutes]; + }, + addOutputRoute (route) + { + if (this [_outputRoutes] === X3DField .prototype [_outputRoutes]) + this [_outputRoutes] = new Set (); + + this [_outputRoutes] .add (route); + + this .processRouteCallbacks (); + }, + removeOutputRoute (route) + { + this [_outputRoutes] .delete (route); + + this .processRouteCallbacks (); + }, + getOutputRoutes () + { + return this [_outputRoutes]; + }, + addRouteCallback (key, object) + { + // Processed if routes are changed. + + if (this [_routeCallbacks] === X3DField .prototype [_routeCallbacks]) + this [_routeCallbacks] = new Map (); + + this [_routeCallbacks] .set (key, object); + }, + removeRouteCallback (key) + { + this [_routeCallbacks] .delete (key); + }, + getRouteCallbacks () + { + return this [_routeCallbacks]; + }, + processRouteCallbacks: (() => + { + const routeCallbacksTemp = [ ]; + + return function () + { + if (this [_routeCallbacks] .size) + { + for (const routeCallback of Utility_MapUtilities .values (routeCallbacksTemp, this [_routeCallbacks])) + routeCallback (); + } + }; + })(), + processEvent: (() => + { + const fieldCallbacksTemp = [ ]; + + return function (event = Base_Events .create (this)) + { + if (event .has (this)) + return; + + event .add (this); + + this .setTainted (false); + + const field = event .field; + + if (field !== this) + this .set (field .getValue (), field .length); + + // Process interests. + + this .processInterests (); + + // Process routes. + + let first = true; + + for (const fieldInterest of this [_fieldInterests]) + { + if (first) + { + first = false; + fieldInterest .addEventObject (this, event); + } + else + { + fieldInterest .addEventObject (this, Base_Events .copy (event)); + } + } + + if (first) + Base_Events .push (event); + + // Process field callbacks. + + if (this [_fieldCallbacks] .size) + { + for (const fieldCallback of Utility_MapUtilities .values (fieldCallbacksTemp, this [_fieldCallbacks])) + fieldCallback (this .valueOf ()); + } + }; + })(), + fromString (string, scene) + { + // Function will be overridden in VRMLParser. + }, + dispose () + { + this [_references] .clear (); + this [_referencesCallbacks] .clear (); + this [_fieldInterests] .clear (); + this [_fieldCallbacks] .clear (); + this [_routeCallbacks] .clear (); + + for (const route of new Set (this [_inputRoutes])) + route .dispose (); + + for (const route of new Set (this [_outputRoutes])) + route .dispose (); + + Base_X3DChildObject .prototype .dispose .call (this); + } +}); + +for (const key of Object .keys (X3DField .prototype)) + Object .defineProperty (X3DField .prototype, key, { enumerable: false }); + +const X3DField_default_ = X3DField; +; + +x_ite_Namespace .add ("X3DField", "x_ite/Base/X3DField", X3DField_default_); +/* harmony default export */ const Base_X3DField = (X3DField_default_); +;// CONCATENATED MODULE: ./src/x_ite/Base/FieldArray.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function FieldArray (values = [ ]) +{ + return Base_X3DInfoArray .call (this, Array .from (values, value => [value .getName (), value]), Base_X3DField); +} + +Object .setPrototypeOf (FieldArray .prototype, Base_X3DInfoArray .prototype); + +for (const key of Object .keys (FieldArray .prototype)) + Object .defineProperty (FieldArray .prototype, key, { enumerable: false }); + +Object .defineProperties (FieldArray, +{ + typeName: + { + value: "FieldArray", + enumerable: true, + }, +}); + +const FieldArray_default_ = FieldArray; +; + +x_ite_Namespace .add ("FieldArray", "x_ite/Base/FieldArray", FieldArray_default_); +/* harmony default export */ const Base_FieldArray = (FieldArray_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields/SFBool.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function SFBool (value) +{ + Base_X3DField .call (this, !! value); +} + +Object .assign (Object .setPrototypeOf (SFBool .prototype, Base_X3DField .prototype), +{ + copy () + { + return new SFBool (this .getValue ()); + }, + isDefaultValue () + { + return this .getValue () === false; + }, + set (value) + { + Base_X3DField .prototype .set .call (this, !! value); + }, + valueOf: Base_X3DField .prototype .getValue, + toStream (generator) + { + generator .string += this .getValue () ? "TRUE" : "FALSE"; + }, + toVRMLStream (generator) + { + this .toStream (generator); + }, + toXMLStream (generator) + { + generator .string += this .getValue () ? "true" : "false"; + }, + toJSONStream (generator) + { + this .toJSONStreamValue (generator); + }, + toJSONStreamValue (generator) + { + generator .string += this .getValue () ? "true" : "false"; + }, +}); + +for (const key of Object .keys (SFBool .prototype)) + Object .defineProperty (SFBool .prototype, key, { enumerable: false }); + +Object .defineProperties (SFBool, +{ + typeName: + { + value: "SFBool", + enumerable: true, + }, +}); + +const SFBool_default_ = SFBool; +; + +x_ite_Namespace .add ("SFBool", "x_ite/Fields/SFBool", SFBool_default_); +/* harmony default export */ const Fields_SFBool = (SFBool_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Numbers/Color3.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +const { clamp, interval, degrees } = Math_Algorithm; + +const + _r = Symbol .for ("X_ITE.Color3.r"), + _g = Symbol .for ("X_ITE.Color3.g"), + _b = Symbol .for ("X_ITE.Color3.b"); + +function Color3 (r, g, b) +{ + this [_r] = clamp (r, 0, 1); + this [_g] = clamp (g, 0, 1); + this [_b] = clamp (b, 0, 1); +} + +Object .assign (Color3 .prototype, +{ + *[Symbol .iterator] () + { + yield this [_r]; + yield this [_g]; + yield this [_b]; + }, + copy () + { + const copy = Object .create (Color3 .prototype); + copy [_r] = this [_r]; + copy [_g] = this [_g]; + copy [_b] = this [_b]; + return copy; + }, + assign (color) + { + this [_r] = color [_r]; + this [_g] = color [_g]; + this [_b] = color [_b]; + return this; + }, + set (r, g, b) + { + this [_r] = clamp (r, 0, 1); + this [_g] = clamp (g, 0, 1); + this [_b] = clamp (b, 0, 1); + return this; + }, + equals (color) + { + return this [_r] === color [_r] && + this [_g] === color [_g] && + this [_b] === color [_b]; + }, + getHSV (result) + { + let h, s, v; + + const min = Math .min (this [_r], this [_g], this [_b]); + const max = Math .max (this [_r], this [_g], this [_b]); + v = max; // value + + const delta = max - min; + + if (max !== 0 && delta !== 0) + { + s = delta / max; // s + + if (this [_r] === max) + h = (this [_g] - this [_b]) / delta; // between yellow & magenta + else if (this [_g] === max) + h = 2 + (this [_b] - this [_r]) / delta; // between cyan & yellow + else + h = 4 + (this [_r] - this [_g]) / delta; // between magenta & cyan + + h *= Math .PI / 3; // radiants + if (h < 0) + h += Math .PI * 2; + } + else + s = h = 0; // s = 0, h is undefined + + result [0] = h; + result [1] = s; + result [2] = v; + + return result; + }, + setHSV (h, s, v) + { + s = clamp (s, 0, 1), + v = clamp (v, 0, 1); + + // H is given on [0, 2 * Pi]. S and V are given on [0, 1]. + // RGB are each returned on [0, 1]. + + if (s === 0) + { + // achromatic (grey) + this [_r] = this [_g] = this [_b] = v; + } + else + { + const w = degrees (interval (h, 0, Math .PI * 2)) / 60; // sector 0 to 5 + + const i = Math .floor (w); + const f = w - i; // factorial part of h + const p = v * ( 1 - s ); + const q = v * ( 1 - s * f ); + const t = v * ( 1 - s * ( 1 - f ) ); + + switch (i % 6) + { + case 0: this [_r] = v; this [_g] = t; this [_b] = p; break; + case 1: this [_r] = q; this [_g] = v; this [_b] = p; break; + case 2: this [_r] = p; this [_g] = v; this [_b] = t; break; + case 3: this [_r] = p; this [_g] = q; this [_b] = v; break; + case 4: this [_r] = t; this [_g] = p; this [_b] = v; break; + default: this [_r] = v; this [_g] = p; this [_b] = q; break; + } + } + + return this; + }, + toString () + { + return this [_r] + " " + + this [_g] + " " + + this [_b]; + }, +}); + +const r = { + get () { return this [_r]; }, + set (value) { this [_r] = clamp (value, 0, 1); }, +}; + +const g = { + get () { return this [_g]; }, + set (value) { this [_g] = clamp (value, 0, 1); }, +}; + +const b = { + get () { return this [_b]; }, + set (value) { this [_b] = clamp (value, 0, 1); }, +}; + +Object .defineProperties (Color3 .prototype, +{ + length: { value: 3 }, + 0: r, + 1: g, + 2: b, + r: Object .assign ({ enumerable: true }, r), + g: Object .assign ({ enumerable: true }, g), + b: Object .assign ({ enumerable: true }, b), +}); + +Object .assign (Color3, +{ + Black: new Color3 (0, 0, 0), + White: new Color3 (1, 1, 1), + HSV (h, s, v) + { + const color = Object .create (this .prototype); + color .setHSV (h, s, v); + return color; + }, + lerp (a, b, t, r) + { + // Linearly interpolate in HSV space between source color @a a and destination color @a b by an amount of @a t. + // Source and destination color must be in HSV space. The resulting HSV color is stored in @a r. + + let + [ha, sa, va] = a, + [hb, sb, vb] = b; + + if (sa === 0) + ha = hb; + + if (sb === 0) + hb = ha; + + const range = Math .abs (hb - ha); + + if (range <= Math .PI) + { + r [0] = ha + t * (hb - ha); + r [1] = sa + t * (sb - sa); + r [2] = va + t * (vb - va); + return r; + } + + const + PI2 = Math .PI * 2, + step = (PI2 - range) * t; + + let h = ha < hb ? ha - step : ha + step; + + if (h < 0) + h += PI2; + + else if (h > PI2) + h -= PI2; + + r [0] = h; + r [1] = sa + t * (sb - sa); + r [2] = va + t * (vb - va); + return r; + }, +}); + +const Color3_default_ = Color3; +; + +x_ite_Namespace .add ("Color3", "standard/Math/Numbers/Color3", Color3_default_); +/* harmony default export */ const Numbers_Color3 = (Color3_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields/SFColor.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function SFColor (r, g, b) +{ + switch (arguments .length) + { + case 0: + Base_X3DField .call (this, new Numbers_Color3 (0, 0, 0)); + break; + + case 1: + Base_X3DField .call (this, arguments [0]); + break; + + case 3: + Base_X3DField .call (this, new Numbers_Color3 (+r, +g, +b)); + break; + + default: + throw new Error ("Invalid arguments."); + } +} + +Object .assign (Object .setPrototypeOf (SFColor .prototype, Base_X3DField .prototype), +{ + *[Symbol .iterator] () + { + yield* this .getValue (); + }, + copy () + { + return new SFColor (this .getValue () .copy ()); + }, + equals (color) + { + return this .getValue () .equals (color .getValue ()); + }, + isDefaultValue () + { + return this .getValue () .equals (Numbers_Color3 .Black); + }, + set (value) + { + this .getValue () .assign (value); + }, + getHSV () + { + return this .getValue () .getHSV ([ ]); + }, + setHSV (h, s, v) + { + this .getValue () .setHSV (h, s, v); + this .addEvent (); + }, + lerp: (() => + { + const + s = [ ], + d = [ ], + r = [ ]; + + return function (destination, t) + { + const result = new SFColor (); + + this .getValue () .getHSV (s); + destination .getValue () .getHSV (d); + + Numbers_Color3 .lerp (s, d, t, r); + + result .setHSV (r [0], r [1], r [2]); + + return result; + }; + })(), + toStream (generator) + { + const + value = this .getValue (), + last = value .length - 1; + + for (let i = 0; i < last; ++ i) + { + generator .string += generator .FloatFormat (value [i]); + generator .string += generator .Space (); + } + + generator .string += generator .FloatFormat (value [last]); + }, + toVRMLStream (generator) + { + this .toStream (generator); + }, + toXMLStream (generator) + { + this .toStream (generator); + }, + toJSONStream (generator) + { + generator .string += '['; + generator .string += generator .TidySpace (); + + this .toJSONStreamValue (generator); + + generator .string += generator .TidySpace (); + generator .string += ']'; + }, + toJSONStreamValue (generator) + { + const + value = this .getValue (), + last = value .length - 1; + + for (let i = 0; i < last; ++ i) + { + generator .string += generator .JSONNumber (generator .FloatFormat (value [i])); + generator .string += ','; + generator .string += generator .TidySpace (); + } + + generator .string += generator .JSONNumber (generator .FloatFormat (value [last])); + }, +}); + +for (const key of Object .keys (SFColor .prototype)) + Object .defineProperty (SFColor .prototype, key, { enumerable: false }); + +const SFColor_r = { + get () + { + return this .getValue () .r; + }, + set (value) + { + this .getValue () .r = +value; + this .addEvent (); + }, +}; + +const SFColor_g = { + get () + { + return this .getValue () .g; + }, + set (value) + { + this .getValue () .g = +value; + this .addEvent (); + }, +}; + +const SFColor_b = { + get () + { + return this .getValue () .b; + }, + set (value) + { + this .getValue () .b = +value; + this .addEvent (); + }, +}; + +Object .defineProperties (SFColor .prototype, +{ + 0: SFColor_r, + 1: SFColor_g, + 2: SFColor_b, + r: Object .assign ({ enumerable: true }, SFColor_r), + g: Object .assign ({ enumerable: true }, SFColor_g), + b: Object .assign ({ enumerable: true }, SFColor_b), +}); + +Object .defineProperties (SFColor, +{ + typeName: + { + value: "SFColor", + enumerable: true, + }, +}); + +const SFColor_default_ = SFColor; +; + +x_ite_Namespace .add ("SFColor", "x_ite/Fields/SFColor", SFColor_default_); +/* harmony default export */ const Fields_SFColor = (SFColor_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Numbers/Color4.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +const { clamp: Color4_clamp } = Math_Algorithm; + +const + Color4_r = Symbol .for ("X_ITE.Color3.r"), + Color4_g = Symbol .for ("X_ITE.Color3.g"), + Color4_b = Symbol .for ("X_ITE.Color3.b"), + _a = Symbol (); + +function Color4 (r, g, b, a) +{ + this [Color4_r] = Color4_clamp (r, 0, 1); + this [Color4_g] = Color4_clamp (g, 0, 1); + this [Color4_b] = Color4_clamp (b, 0, 1); + this [_a] = Color4_clamp (a, 0, 1); +} + +Object .assign (Color4 .prototype, +{ + *[Symbol .iterator] () + { + yield this [Color4_r]; + yield this [Color4_g]; + yield this [Color4_b]; + yield this [_a]; + }, + copy () + { + const copy = Object .create (Color4 .prototype); + copy [Color4_r] = this [Color4_r]; + copy [Color4_g] = this [Color4_g]; + copy [Color4_b] = this [Color4_b]; + copy [_a] = this [_a]; + return copy; + }, + assign (color) + { + this [Color4_r] = color [Color4_r]; + this [Color4_g] = color [Color4_g]; + this [Color4_b] = color [Color4_b]; + this [_a] = color [_a]; + return this; + }, + set (r, g, b, a) + { + this [Color4_r] = Color4_clamp (r, 0, 1); + this [Color4_g] = Color4_clamp (g, 0, 1); + this [Color4_b] = Color4_clamp (b, 0, 1); + this [_a] = Color4_clamp (a, 0, 1); + return this; + }, + equals (color) + { + return this [Color4_r] === color [Color4_r] && + this [Color4_g] === color [Color4_g] && + this [Color4_b] === color [Color4_b] && + this [_a] === color [_a]; + }, + getHSVA (result) + { + Numbers_Color3 .prototype .getHSV .call (this, result); + + result [3] = this [_a]; + + return result; + }, + setHSVA (h, s, v, a) + { + Numbers_Color3 .prototype .setHSV .call (this, h, s, v); + + this [_a] = Color4_clamp (a, 0, 1); + + return this; + }, + toString () + { + return this [Color4_r] + " " + + this [Color4_g] + " " + + this [Color4_b] + " " + + this [_a]; + }, +}); + +const Numbers_Color4_r = { + get () { return this [Color4_r]; }, + set (value) { this [Color4_r] = Color4_clamp (value, 0, 1); }, +}; + +const Numbers_Color4_g = { + get () { return this [Color4_g]; }, + set (value) { this [Color4_g] = Color4_clamp (value, 0, 1); }, +}; + +const Numbers_Color4_b = { + get () { return this [Color4_b]; }, + set (value) { this [Color4_b] = Color4_clamp (value, 0, 1); }, +}; + +const a = { + get () { return this [_a]; }, + set (value) { this [_a] = Color4_clamp (value, 0, 1); }, +}; + +Object .defineProperties (Color4 .prototype, +{ + length: { value: 4 }, + 0: Numbers_Color4_r, + 1: Numbers_Color4_g, + 2: Numbers_Color4_b, + 3: a, + r: Object .assign ({ enumerable: true }, Numbers_Color4_r), + g: Object .assign ({ enumerable: true }, Numbers_Color4_g), + b: Object .assign ({ enumerable: true }, Numbers_Color4_b), + a: Object .assign ({ enumerable: true }, a), +}); + +Object .assign (Color4, +{ + Transparent: new Color4 (0, 0, 0, 0), + Black: new Color4 (0, 0, 0, 1), + White: new Color4 (1, 1, 1, 1), + HSVA (h, s, v, a) + { + const color = Object .create (this .prototype); + color .setHSVA (h, s, v, a); + return color; + }, + lerp (a, b, t, r) + { + // Linearely interpolate in HSVA space between source color @a a and destination color @a b by an amount of @a t. + // Source and destination color must be in HSVA space. The resulting HSVA color is stored in @a r. + const aa = a [3]; + Numbers_Color3 .lerp (a, b, t, r); + r [3] = aa + t * (b [3] - aa); + return r; + }, +}); + +const Color4_default_ = Color4; +; + +x_ite_Namespace .add ("Color4", "standard/Math/Numbers/Color4", Color4_default_); +/* harmony default export */ const Numbers_Color4 = (Color4_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields/SFColorRGBA.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function SFColorRGBA (r, g, b, a) +{ + switch (arguments .length) + { + case 0: + Base_X3DField .call (this, new Numbers_Color4 (0, 0, 0, 0)); + break; + + case 1: + Base_X3DField .call (this, arguments [0]); + break; + + case 4: + Base_X3DField .call (this, new Numbers_Color4 (+r, +g, +b, +a)); + break + + default: + throw new Error ("Invalid arguments."); + } +} + +Object .assign (Object .setPrototypeOf (SFColorRGBA .prototype, Base_X3DField .prototype), +{ + *[Symbol .iterator] () + { + yield* this .getValue (); + }, + copy () + { + return new SFColorRGBA (this .getValue () .copy ()); + }, + equals: Fields_SFColor .prototype .equals, + isDefaultValue () + { + return this .getValue () .equals (Numbers_Color4 .Transparent); + }, + set: Fields_SFColor .prototype .set, + getHSVA () + { + return this .getValue () .getHSVA ([ ]); + }, + setHSVA (h, s, v, a) + { + this .getValue () .setHSVA (h, s, v, a); + this .addEvent (); + }, + lerp: (() => + { + const + s = [ ], + d = [ ], + r = [ ]; + + return function (destination, t) + { + const result = new SFColorRGBA (); + + this .getValue () .getHSVA (s); + destination .getValue () .getHSVA (d); + + Numbers_Color4 .lerp (s, d, t, r); + + result .setHSVA (r [0], r [1], r [2], r [3]); + + return result; + }; + })(), + toStream: Fields_SFColor .prototype .toStream, + toVRMLStream: Fields_SFColor .prototype .toVRMLStream, + toXMLStream: Fields_SFColor .prototype .toXMLStream, + toJSONStream: Fields_SFColor .prototype .toJSONStream, + toJSONStreamValue: Fields_SFColor .prototype .toJSONStreamValue, +}); + +for (const key of Object .keys (SFColorRGBA .prototype)) + Object .defineProperty (SFColorRGBA .prototype, key, { enumerable: false }); + +const SFColorRGBA_r = { + get () + { + return this .getValue () .r; + }, + set (value) + { + this .getValue () .r = +value; + this .addEvent (); + }, +}; + +const SFColorRGBA_g = { + get () + { + return this .getValue () .g; + }, + set (value) + { + this .getValue () .g = +value; + this .addEvent (); + }, +}; + +const SFColorRGBA_b = { + get () + { + return this .getValue () .b; + }, + set (value) + { + this .getValue () .b = +value; + this .addEvent (); + }, +}; + +const SFColorRGBA_a = { + get () + { + return this .getValue () .a; + }, + set (value) + { + this .getValue () .a = +value; + this .addEvent (); + }, +}; + +Object .defineProperties (SFColorRGBA .prototype, +{ + 0: SFColorRGBA_r, + 1: SFColorRGBA_g, + 2: SFColorRGBA_b, + 3: SFColorRGBA_a, + r: Object .assign ({ enumerable: true }, SFColorRGBA_r), + g: Object .assign ({ enumerable: true }, SFColorRGBA_g), + b: Object .assign ({ enumerable: true }, SFColorRGBA_b), + a: Object .assign ({ enumerable: true }, SFColorRGBA_a), +}); + +Object .defineProperties (SFColorRGBA, +{ + typeName: + { + value: "SFColorRGBA", + enumerable: true, + }, +}); + +const SFColorRGBA_default_ = SFColorRGBA; +; + +x_ite_Namespace .add ("SFColorRGBA", "x_ite/Fields/SFColorRGBA", SFColorRGBA_default_); +/* harmony default export */ const Fields_SFColorRGBA = (SFColorRGBA_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields/SFDouble.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function SFDouble (value) +{ + Base_X3DField .call (this, arguments .length ? +value : 0); +} + +Object .assign (Object .setPrototypeOf (SFDouble .prototype, Base_X3DField .prototype), +{ + copy () + { + return new SFDouble (this .getValue ()); + }, + isDefaultValue () + { + return this .getValue () === 0; + }, + set (value) + { + Base_X3DField .prototype .set .call (this, +value); + }, + valueOf: Base_X3DField .prototype .getValue, + toStream (generator) + { + const category = generator .Unit (this .getUnit ()); + + generator .string += generator .DoubleFormat (generator .ToUnit (category, this .getValue ())); + }, + toVRMLStream (generator) + { + this .toStream (generator); + }, + toXMLStream (generator) + { + this .toStream (generator); + }, + toJSONStream (generator) + { + this .toJSONStreamValue (generator); + }, + toJSONStreamValue (generator) + { + const category = generator .Unit (this .getUnit ()); + + generator .string += generator .JSONNumber (generator .DoubleFormat (generator .ToUnit (category, this .getValue ()))); + }, +}); + +for (const key of Object .keys (SFDouble .prototype)) + Object .defineProperty (SFDouble .prototype, key, { enumerable: false }); + +Object .defineProperties (SFDouble, +{ + typeName: + { + value: "SFDouble", + enumerable: true, + }, +}); + +const SFDouble_default_ = SFDouble; +; + +x_ite_Namespace .add ("SFDouble", "x_ite/Fields/SFDouble", SFDouble_default_); +/* harmony default export */ const Fields_SFDouble = (SFDouble_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields/SFFloat.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function SFFloat (value) +{ + Base_X3DField .call (this, arguments .length ? +value : 0); +} + +Object .assign (Object .setPrototypeOf (SFFloat .prototype, Base_X3DField .prototype), +{ + copy () + { + return new SFFloat (this .getValue ()); + }, + isDefaultValue () + { + return this .getValue () === 0; + }, + set (value) + { + Base_X3DField .prototype .set .call (this, +value); + }, + valueOf: Base_X3DField .prototype .getValue, + toStream (generator) + { + const category = generator .Unit (this .getUnit ()); + + generator .string += generator .FloatFormat (generator .ToUnit (category, this .getValue ())); + }, + toVRMLStream (generator) + { + this .toStream (generator); + }, + toXMLStream (generator) + { + this .toStream (generator); + }, + toJSONStream (generator) + { + this .toJSONStreamValue (generator); + }, + toJSONStreamValue (generator) + { + const category = generator .Unit (this .getUnit ()); + + generator .string += generator .JSONNumber (generator .FloatFormat (generator .ToUnit (category, this .getValue ()))); + }, +}); + +for (const key of Object .keys (SFFloat .prototype)) + Object .defineProperty (SFFloat .prototype, key, { enumerable: false }); + +Object .defineProperties (SFFloat, +{ + typeName: + { + value: "SFFloat", + enumerable: true, + }, +}); + +const SFFloat_default_ = SFFloat; +; + +x_ite_Namespace .add ("SFFloat", "x_ite/Fields/SFFloat", SFFloat_default_); +/* harmony default export */ const Fields_SFFloat = (SFFloat_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields/SFInt32.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function SFInt32 (value) +{ + Base_X3DField .call (this, value|0); +} + +Object .assign (Object .setPrototypeOf (SFInt32 .prototype, Base_X3DField .prototype), +{ + copy () + { + return new SFInt32 (this .getValue ()); + }, + isDefaultValue () + { + return this .getValue () === 0; + }, + set (value) + { + Base_X3DField .prototype .set .call (this, value|0); + }, + valueOf: Base_X3DField .prototype .getValue, + toStream (generator) + { + generator .string += this .getValue () .toString (); + }, + toVRMLStream (generator) + { + this .toStream (generator); + }, + toXMLStream (generator) + { + this .toStream (generator); + }, + toJSONStream (generator) + { + this .toStream (generator); + }, + toJSONStreamValue (generator) + { + this .toStream (generator); + }, +}); + +for (const key of Object .keys (SFInt32 .prototype)) + Object .defineProperty (SFInt32 .prototype, key, { enumerable: false }); + +Object .defineProperties (SFInt32, +{ + typeName: + { + value: "SFInt32", + enumerable: true, + }, +}); + +const SFInt32_default_ = SFInt32; +; + +x_ite_Namespace .add ("SFInt32", "x_ite/Fields/SFInt32", SFInt32_default_); +/* harmony default export */ const Fields_SFInt32 = (SFInt32_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields/SFMatrixPrototypeTemplate.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function SFMatrixPrototypeTemplate (Constructor, TypeName, Matrix, SFVec, double) +{ + const _formatter = double ? "DoubleFormat" : "FloatFormat"; + + Object .defineProperties (Constructor, + { + typeName: + { + value: TypeName, + enumerable: true, + }, + }); + + return Object .assign (Object .setPrototypeOf (Constructor .prototype, Base_X3DField .prototype), + { + *[Symbol .iterator] () + { + yield* this .getValue (); + }, + copy () + { + return new (this .constructor) (this .getValue () .copy ()); + }, + equals (matrix) + { + return this .getValue () .equals (matrix .getValue ()); + }, + isDefaultValue () + { + return this .getValue () .equals (Matrix .Identity); + }, + set (value) + { + this .getValue () .assign (value); + }, + setTransform (translation, rotation, scale, scaleOrientation, center) + { + translation = translation ? translation .getValue () : null; + rotation = rotation ? rotation .getValue () : null; + scale = scale ? scale .getValue () : null; + scaleOrientation = scaleOrientation ? scaleOrientation .getValue () : null; + center = center ? center .getValue () : null; + + this .getValue () .set (translation, rotation, scale, scaleOrientation, center); + }, + getTransform (translation, rotation, scale, scaleOrientation, center) + { + translation = translation ? translation .getValue () : null; + rotation = rotation ? rotation .getValue () : null; + scale = scale ? scale .getValue () : null; + scaleOrientation = scaleOrientation ? scaleOrientation .getValue () : null; + center = center ? center .getValue () : null; + + this .getValue () .get (translation, rotation, scale, scaleOrientation, center); + }, + determinant () + { + return this .getValue () .determinant (); + }, + transpose () + { + return new (this .constructor) (this .getValue () .copy () .transpose ()); + }, + inverse () + { + return new (this .constructor) (this .getValue () .copy () .inverse ()); + }, + multLeft (matrix) + { + return new (this .constructor) (this .getValue () .copy () .multLeft (matrix .getValue ())); + }, + multRight (matrix) + { + return new (this .constructor) (this .getValue () .copy () .multRight (matrix .getValue ())); + }, + multVecMatrix (vector) + { + return new SFVec (this .getValue () .multVecMatrix (vector .getValue () .copy ())); + }, + multMatrixVec (vector) + { + return new SFVec (this .getValue () .multMatrixVec (vector .getValue () .copy ())); + }, + multDirMatrix (vector) + { + return new SFVec (this .getValue () .multDirMatrix (vector .getValue () .copy ())); + }, + multMatrixDir (vector) + { + return new SFVec (this .getValue () .multMatrixDir (vector .getValue () .copy ())); + }, + toStream (generator) + { + const + value = this .getValue (), + last = value .length - 1; + + for (let i = 0; i < last; ++ i) + { + generator .string += generator [_formatter] (value [i]); + generator .string += generator .Space (); + } + + generator .string += generator [_formatter] (value [last]); + }, + toVRMLStream (generator) + { + this .toStream (generator); + }, + toXMLStream (generator) + { + this .toStream (generator); + }, + toJSONStream (generator) + { + generator .string += '['; + generator .string += generator .TidySpace (); + + this .toJSONStreamValue (generator); + + generator .string += generator .TidySpace (); + generator .string += ']'; + }, + toJSONStreamValue (generator) + { + const + value = this .getValue (), + last = value .length - 1; + + for (let i = 0; i < last; ++ i) + { + generator .string += generator .JSONNumber (generator [_formatter] (value [i])); + generator .string += ','; + generator .string += generator .TidySpace (); + } + + generator .string += generator .JSONNumber (generator [_formatter] (value [last])); + }, + }); +} + +const SFMatrixPrototypeTemplate_default_ = SFMatrixPrototypeTemplate; +; + +x_ite_Namespace .add ("SFMatrixPrototypeTemplate", "x_ite/Fields/SFMatrixPrototypeTemplate", SFMatrixPrototypeTemplate_default_); +/* harmony default export */ const Fields_SFMatrixPrototypeTemplate = (SFMatrixPrototypeTemplate_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields/SFVecPrototypeTemplate.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function SFVecPrototypeTemplate (Constructor, TypeName, Vector, double) +{ + const _formatter = double ? "DoubleFormat" : "FloatFormat"; + + Object .defineProperties (Constructor, + { + typeName: + { + value: TypeName, + enumerable: true, + }, + }); + + return Object .assign (Object .setPrototypeOf (Constructor .prototype, Base_X3DField .prototype), + { + *[Symbol .iterator] () + { + yield* this .getValue (); + }, + copy () + { + return new (this .constructor) (this .getValue () .copy ()); + }, + equals (vector) + { + return this .getValue () .equals (vector .getValue ()); + }, + isDefaultValue () + { + return this .getValue () .equals (Vector .Zero); + }, + set (value) + { + this .getValue () .assign (value); + }, + abs () + { + return new (this .constructor) (this .getValue () .copy () .abs ()); + }, + add (vector) + { + return new (this .constructor) (this .getValue () .copy () .add (vector .getValue ())); + }, + distance (vector) + { + return this .getValue () .distance (vector .getValue ()); + }, + divide (value) + { + return new (this .constructor) (this .getValue () .copy () .divide (value)); + }, + divVec (vector) + { + return new (this .constructor) (this .getValue () .copy () .divVec (vector .getValue ())); + }, + dot (vector) + { + return this .getValue () .dot (vector .getValue ()); + }, + inverse () + { + return new (this .constructor) (this .getValue () .copy () .inverse ()); + }, + length () + { + return this .getValue () .magnitude (); + }, + lerp (destination, t) + { + return new (this .constructor) (this .getValue () .copy () .lerp (destination, t)); + }, + max (vector) + { + return new (this .constructor) (this .getValue () .copy () .max (vector .getValue ())); + }, + min (vector) + { + return new (this .constructor) (this .getValue () .copy () .min (vector .getValue ())); + }, + multiply (value) + { + return new (this .constructor) (this .getValue () .copy () .multiply (value)); + }, + multVec (vector) + { + return new (this .constructor) (this .getValue () .copy () .multVec (vector .getValue ())); + }, + negate () + { + return new (this .constructor) (this .getValue () .copy () .negate ()); + }, + normalize (vector) + { + return new (this .constructor) (this .getValue () .copy () .normalize ()); + }, + subtract (vector) + { + return new (this .constructor) (this .getValue () .copy () .subtract (vector .getValue ())); + }, + toStream (generator) + { + const + value = this .getValue (), + last = value .length - 1, + category = generator .Unit (this .getUnit ()); + + for (let i = 0; i < last; ++ i) + { + generator .string += generator [_formatter] (generator .ToUnit (category, value [i])); + generator .string += generator .Space (); + } + + generator .string += generator [_formatter] (generator .ToUnit (category, value [last])); + }, + toVRMLStream (generator) + { + this .toStream (generator); + }, + toXMLStream (generator) + { + this .toStream (generator); + }, + toJSONStream (generator) + { + generator .string += '['; + generator .string += generator .TidySpace (); + + this .toJSONStreamValue (generator); + + generator .string += generator .TidySpace (); + generator .string += ']'; + }, + toJSONStreamValue (generator) + { + const + value = this .getValue (), + last = value .length - 1, + category = generator .Unit (this .getUnit ()); + + for (let i = 0; i < last; ++ i) + { + generator .string += generator .JSONNumber (generator [_formatter] (generator .ToUnit (category, value [i]))); + generator .string += ','; + generator .string += generator .TidySpace (); + } + + generator .string += generator .JSONNumber (generator [_formatter] (generator .ToUnit (category, value [last]))); + }, + }); +} + +const SFVecPrototypeTemplate_default_ = SFVecPrototypeTemplate; +; + +x_ite_Namespace .add ("SFVecPrototypeTemplate", "x_ite/Fields/SFVecPrototypeTemplate", SFVecPrototypeTemplate_default_); +/* harmony default export */ const Fields_SFVecPrototypeTemplate = (SFVecPrototypeTemplate_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Numbers/Vector2.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +function Vector2 (x, y) +{ + this .x = x; + this .y = y; +} + +Object .assign (Vector2 .prototype, +{ + *[Symbol .iterator] () + { + yield this .x; + yield this .y; + }, + copy () + { + const copy = Object .create (Vector2 .prototype); + copy .x = this .x; + copy .y = this .y; + return copy; + }, + assign (vector) + { + this .x = vector .x; + this .y = vector .y; + return this; + }, + set (x, y) + { + this .x = x; + this .y = y; + return this; + }, + equals (vector) + { + return this .x === vector .x && + this .y === vector .y; + }, + negate () + { + this .x = -this .x; + this .y = -this .y; + return this; + }, + inverse () + { + this .x = 1 / this .x; + this .y = 1 / this .y; + return this; + }, + add (vector) + { + this .x += vector .x; + this .y += vector .y; + return this; + }, + subtract (vector) + { + this .x -= vector .x; + this .y -= vector .y; + return this; + }, + multiply (value) + { + this .x *= value; + this .y *= value; + return this; + }, + multVec (vector) + { + this .x *= vector .x; + this .y *= vector .y; + return this; + }, + divide (value) + { + this .x /= value; + this .y /= value; + return this; + }, + divVec (vector) + { + this .x /= vector .x; + this .y /= vector .y; + return this; + }, + normalize () + { + const length = Math .hypot (this .x, this .y); + + if (length) + { + this .x /= length; + this .y /= length; + } + + return this; + }, + dot (vector) + { + return this .x * vector .x + + this .y * vector .y; + }, + norm () + { + const { x, y } = this; + + return x * x + + y * y; + }, + magnitude () + { + return Math .hypot (this .x, this .y); + }, + distance (vector) + { + return Math .hypot (this .x - vector .x, + this .y - vector .y); + }, + lerp (destination, t) + { + const { x, y } = this; + + this .x = x + t * (destination .x - x); + this .y = y + t * (destination .y - y); + return this; + }, + abs () + { + this .x = Math .abs (this .x); + this .y = Math .abs (this .y); + return this; + }, + min (vector) + { + let { x, y } = this; + + for (const vector of arguments) + { + x = Math .min (x, vector .x); + y = Math .min (y, vector .y); + } + + this .x = x; + this .y = y; + return this; + }, + max (vector) + { + let { x, y } = this; + + for (const vector of arguments) + { + x = Math .max (x, vector .x); + y = Math .max (y, vector .y); + } + + this .x = x; + this .y = y; + return this; + }, + toString () + { + return this .x + " " + + this .y; + } +}); + +Object .defineProperties (Vector2 .prototype, +{ + length: { value: 2 }, + 0: + { + get () { return this .x; }, + set (value) { this .x = value; }, + }, + 1: + { + get () { return this .y; }, + set (value) { this .y = value; }, + }, +}); + +Object .assign (Vector2, +{ + Zero: new Vector2 (0, 0), + One: new Vector2 (1, 1), + xAxis: new Vector2 (1, 0), + yAxis: new Vector2 (0, 1), +}); + +const Vector2_default_ = Vector2; +; + +x_ite_Namespace .add ("Vector2", "standard/Math/Numbers/Vector2", Vector2_default_); +/* harmony default export */ const Numbers_Vector2 = (Vector2_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields/SFVec2.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function SFVec2Template (TypeName, double) +{ + function SFVec2 (x, y) + { + switch (arguments .length) + { + case 0: + Base_X3DField .call (this, new Numbers_Vector2 (0, 0)); + break; + + case 1: + Base_X3DField .call (this, arguments [0]); + break; + + case 2: + Base_X3DField .call (this, new Numbers_Vector2 (+x, +y)); + break; + + default: + throw new Error ("Invalid arguments."); + } + } + + Fields_SFVecPrototypeTemplate (SFVec2, TypeName, Numbers_Vector2, double); + + for (const key of Object .keys (SFVec2 .prototype)) + Object .defineProperty (SFVec2 .prototype, key, { enumerable: false }); + + const x = { + get () + { + return this .getValue () .x; + }, + set (value) + { + this .getValue () .x = +value; + this .addEvent (); + }, + }; + + const y = { + get () + { + return this .getValue () .y; + }, + set (value) + { + this .getValue () .y = +value; + this .addEvent (); + }, + }; + + Object .defineProperties (SFVec2 .prototype, + { + 0: x, + 1: y, + x: Object .assign ({ enumerable: true }, x), + y: Object .assign ({ enumerable: true }, y), + }); + + return SFVec2; +} + +const SFVec2 = { + SFVec2d: SFVec2Template ("SFVec2d", true), + SFVec2f: SFVec2Template ("SFVec2f", false), +}; + +const SFVec2_default_ = SFVec2; +; + +x_ite_Namespace .add ("SFVec2", "x_ite/Fields/SFVec2", SFVec2_default_); +/* harmony default export */ const Fields_SFVec2 = (SFVec2_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Numbers/Vector3.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function Vector3 (x, y, z) +{ + this .x = x; + this .y = y; + this .z = z; +} + +Object .assign (Vector3 .prototype, +{ + *[Symbol .iterator] () + { + yield this .x; + yield this .y; + yield this .z; + }, + copy () + { + const copy = Object .create (Vector3 .prototype); + copy .x = this .x; + copy .y = this .y; + copy .z = this .z; + return copy; + }, + assign (vector) + { + this .x = vector .x; + this .y = vector .y; + this .z = vector .z; + return this; + }, + set (x, y, z) + { + this .x = x; + this .y = y; + this .z = z; + return this; + }, + equals (vector) + { + return this .x === vector .x && + this .y === vector .y && + this .z === vector .z; + }, + negate () + { + this .x = -this .x; + this .y = -this .y; + this .z = -this .z; + return this; + }, + inverse () + { + this .x = 1 / this .x; + this .y = 1 / this .y; + this .z = 1 / this .z; + return this; + }, + add (vector) + { + this .x += vector .x; + this .y += vector .y; + this .z += vector .z; + return this; + }, + subtract (vector) + { + this .x -= vector .x; + this .y -= vector .y; + this .z -= vector .z; + return this; + }, + multiply (value) + { + this .x *= value; + this .y *= value; + this .z *= value; + return this; + }, + multVec (vector) + { + this .x *= vector .x; + this .y *= vector .y; + this .z *= vector .z; + return this; + }, + divide (value) + { + this .x /= value; + this .y /= value; + this .z /= value; + return this; + }, + divVec (vector) + { + this .x /= vector .x; + this .y /= vector .y; + this .z /= vector .z; + return this; + }, + cross (vector) + { + const + { x: ax, y: ay, z: az } = this, + { x: bx, y: by, z: bz } = vector; + + this .x = ay * bz - az * by; + this .y = az * bx - ax * bz; + this .z = ax * by - ay * bx; + + return this; + }, + normalize () + { + const length = Math .hypot (this .x, this .y, this .z); + + if (length) + { + this .x /= length; + this .y /= length; + this .z /= length; + } + + return this; + }, + dot (vector) + { + return this .x * vector .x + + this .y * vector .y + + this .z * vector .z; + }, + norm () + { + const { x, y, z } = this; + + return x * x + + y * y + + z * z; + }, + magnitude () + { + return Math .hypot (this .x, this .y, this .z); + }, + distance (vector) + { + return Math .hypot (this .x - vector .x, + this .y - vector .y, + this .z - vector .z); + }, + lerp (destination, t) + { + const { x, y, z } = this; + + this .x = x + t * (destination .x - x); + this .y = y + t * (destination .y - y); + this .z = z + t * (destination .z - z); + return this; + }, + slerp: (() => + { + const tmp = new Vector3 (0, 0, 0); + + return function (destination, t) + { + return Math_Algorithm .simpleSlerp (this, tmp .assign (destination), t); + }; + })(), + abs () + { + this .x = Math .abs (this .x); + this .y = Math .abs (this .y); + this .z = Math .abs (this .z); + return this; + }, + min (vector) + { + let { x, y, z } = this; + + for (const vector of arguments) + { + x = Math .min (x, vector .x); + y = Math .min (y, vector .y); + z = Math .min (z, vector .z); + } + + this .x = x; + this .y = y; + this .z = z; + return this; + }, + max (vector) + { + let { x, y, z } = this; + + for (const vector of arguments) + { + x = Math .max (x, vector .x); + y = Math .max (y, vector .y); + z = Math .max (z, vector .z); + } + + this .x = x; + this .y = y; + this .z = z; + return this; + }, + toString () + { + return this .x + " " + + this .y + " " + + this .z; + } +}); + +Object .defineProperties (Vector3 .prototype, +{ + length: { value: 3 }, + 0: + { + get () { return this .x; }, + set (value) { this .x = value; }, + }, + 1: + { + get () { return this .y; }, + set (value) { this .y = value; }, + }, + 2: + { + get () { return this .z; }, + set (value) { this .z = value; }, + }, +}); + +Object .assign (Vector3, +{ + Zero: new Vector3 (0, 0, 0), + One: new Vector3 (1, 1, 1), + xAxis: new Vector3 (1, 0, 0), + yAxis: new Vector3 (0, 1, 0), + zAxis: new Vector3 (0, 0, 1), +}); + +const Vector3_default_ = Vector3; +; + +x_ite_Namespace .add ("Vector3", "standard/Math/Numbers/Vector3", Vector3_default_); +/* harmony default export */ const Numbers_Vector3 = (Vector3_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Numbers/Matrix2.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function Matrix2 () +{ + if (arguments .length) + { + for (let i = 0; i < 4; ++ i) + this [i] = arguments [i]; + } + else + { + this .identity (); + } +} + +Object .assign (Matrix2 .prototype, +{ + *[Symbol .iterator] () + { + for (let i = 0; i < 4; ++ i) + yield this [i]; + }, + copy () + { + const copy = Object .create (Matrix2 .prototype); + + for (let i = 0; i < 4; ++ i) + copy [i] = this [i]; + + return copy; + }, + assign (matrix) + { + for (let i = 0; i < 4; ++ i) + this [i] = matrix [i]; + + return this; + }, + equals (matrix) + { + return this [0] === matrix [0] && + this [1] === matrix [1] && + this [2] === matrix [2] && + this [3] === matrix [3]; + }, + set1 (r, c, value) + { + this [r * this .order + c] = value; + }, + get1 (r, c) + { + return this [r * this .order + c]; + }, + set () + { + switch (arguments .length) + { + case 0: + { + this .identity (); + break; + } + case 4: + { + for (let i = 0; i < 4; ++ i) + this [i] = arguments [i]; + + break; + } + } + + return this; + }, + determinant1 () + { + return this [0]; + }, + determinant () + { + return this [0] * this [3] - + this [1] * this [2]; + }, + transpose () + { + const tmp = this [1]; + + this [1] = this [2]; + this [2] = tmp; + + return this; + }, + inverse () + { + const + { 0: A, 1: B, 2: C, 3: D } = this, + d = A * D - B * C; + + // if (d === 0) ... determinant is zero. + + this [0] = D / d; + this [1] = -B / d; + this [2] = -C / d; + this [3] = A / d; + + return this; + }, + multLeft (matrix) + { + const + { 0: a0, 1: a1, 2: a2, 3: a3 } = this, + { 0: b0, 1: b1, 2: b2, 3: b3 } = matrix; + + this [0] = a0 * b0 + a2 * b1; + this [1] = a1 * b0 + a3 * b1; + this [2] = a0 * b2 + a2 * b3; + this [3] = a1 * b2 + a3 * b3; + + return this; + }, + multRight (matrix) + { + const + { 0: a0, 1: a1, 2: a2, 3: a3 } = this, + { 0: b0, 1: b1, 2: b2, 3: b3 } = matrix; + + this [0] = b0 * a0 + b2 * a1; + this [1] = b1 * a0 + b3 * a1; + this [2] = b0 * a2 + b2 * a3; + this [3] = b1 * a2 + b3 * a3; + + return this; + }, + multVecMatrix (vector) + { + if (typeof vector === "number") + { + const + x = vector, + w = x * this [1] + this [3]; + + return (x * this [0] + this [2]) / w; + } + else + { + const { x, y } = vector; + + vector .x = x * this [0] + y * this [2]; + vector .y = x * this [1] + y * this [3]; + + return vector; + } + }, + multMatrixVec (vector) + { + if (typeof vector === "number") + { + const + x = vector, + w = x * this [2] + this [3]; + + return (x * this [0] + this [1]) / w; + } + else + { + const { x, y } = vector; + + vector .x = x * this [0] + y * this [1]; + vector .y = x * this [2] + y * this [3]; + + return vector; + } + }, + identity () + { + this [0] = 1; + this [1] = 0; + this [2] = 0; + this [3] = 1; + }, + toString () + { + return Array .prototype .join .call (this, " "); + }, +}); + +Object .defineProperties (Matrix2 .prototype, +{ + order: { value: 2 }, + length: { value: 4 }, + x: + { + get: (() => + { + const vector = new Numbers_Vector2 (0, 0); + + return function () { return vector .set (this [0], this [1]); }; + })(), + }, + y: + { + get: (() => + { + const vector = new Numbers_Vector2 (0, 0); + + return function () { return vector .set (this [2], this [3]); }; + })(), + }, + xAxis: + { + get () { return this [0]; }, + }, + origin: + { + get () { return this [2]; }, + }, + submatrix: + { + get () { return this [0]; }, + }, +}); + +Object .assign (Matrix2, +{ + Identity: new Matrix2 (), +}); + +const Matrix2_default_ = Matrix2; +; + +x_ite_Namespace .add ("Matrix2", "standard/Math/Numbers/Matrix2", Matrix2_default_); +/* harmony default export */ const Numbers_Matrix2 = (Matrix2_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Algorithms/eigen_decomposition.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +const eigen_decomposition_a = [ ]; // more scratch +const eigen_decomposition_b = [ ]; // more scratch +const z = [ ]; // more scratch + +// Calculate eigenvalues and eigenvectors. +// This is from SGI Inventor Matrix.cpp. +function eigen_decomposition (matrix, result) +{ + const + ORDER = matrix .order, + SIZE = matrix .length, + values = result .values, + vectors = result .vectors; + + let + sm, // smallest entry + theta, // angle for Jacobi rotation + c, s, t, // cosine, sine, tangent of theta + tau, // sine / (1 + cos) + h, g, // two scrap values + thresh, // threshold below which no rotation done + p, q, i, j; // indices + + // initializations + for (i = 0; i < ORDER; ++ i) + { + eigen_decomposition_a [i] = eigen_decomposition_a [i] ?? [ ]; + eigen_decomposition_b [i] = values [i] = matrix .get1 (i, i); + z [i] = 0; + + for (j = 0; j < ORDER; ++ j) + { + vectors [i] [j] = (i === j) ? 1 : 0; + eigen_decomposition_a [i] [j] = matrix .get1 (j, i); + } + } + + // Why 50? I don't know--it's the way the folks who wrote the + // algorithm did it: + for (i = 0; i < 50; ++ i) + { + sm = 0; + + for (p = 0; p < ORDER - 1; ++ p) + { + for (q = p + 1; q < ORDER; ++ q) + sm += Math .abs (eigen_decomposition_a [p] [q]); + } + + if (sm === 0) + break; + + thresh = i < 3 ? + 0.2 * sm / SIZE : + 0; + + for (p = 0; p < ORDER - 1; ++ p) + { + for (q = p + 1; q < ORDER; ++ q) + { + g = 100 * Math .abs (eigen_decomposition_a [p] [q]); + + if (i > 3 + && (Math .abs (values [p]) + g === Math .abs (values [p])) + && (Math .abs (values [q]) + g === Math .abs (values [q])) + ) + { + eigen_decomposition_a [p] [q] = 0; + } + + else if (Math .abs (eigen_decomposition_a [p] [q]) > thresh) + { + h = values [q] - values [p]; + + if (Math .abs (h) + g === Math .abs (h)) + { + t = eigen_decomposition_a [p] [q] / h; + } + else + { + theta = 0.5 * h / eigen_decomposition_a [p] [q]; + t = 1 / (Math .abs (theta) + Math .sqrt (1 + theta * theta)); + + if (theta < 0) t = -t; + } + // End of computing tangent of rotation angle + + c = 1 / Math .sqrt (1 + t * t); + s = t * c; + tau = s / (1 + c); + h = t * eigen_decomposition_a [p] [q]; + z [p] -= h; + z [q] += h; + values [p] -= h; + values [q] += h; + eigen_decomposition_a [p] [q] = 0; + + for (j = 0; j < p; ++ j) + { + g = eigen_decomposition_a [j] [p]; + h = eigen_decomposition_a [j] [q]; + eigen_decomposition_a [j] [p] = g - s * (h + g * tau); + eigen_decomposition_a [j] [q] = h + s * (g - h * tau); + } + + for (j = p + 1; j < q; ++ j) + { + g = eigen_decomposition_a [p] [j]; + h = eigen_decomposition_a [j] [q]; + eigen_decomposition_a [p] [j] = g - s * (h + g * tau); + eigen_decomposition_a [j] [q] = h + s * (g - h * tau); + } + + for (j = q + 1; j < ORDER; ++ j) + { + g = eigen_decomposition_a [p] [j]; + h = eigen_decomposition_a [q] [j]; + eigen_decomposition_a [p] [j] = g - s * (h + g * tau); + eigen_decomposition_a [q] [j] = h + s * (g - h * tau); + } + + for (j = 0; j < ORDER; ++ j) + { + g = vectors [j] [p]; + h = vectors [j] [q]; + vectors [j] [p] = g - s * (h + g * tau); + vectors [j] [q] = h + s * (g - h * tau); + } + } + } + } + + for (p = 0; p < ORDER; ++ p) + { + values [p] = eigen_decomposition_b [p] += z [p]; + z [p] = 0; + } + } + + return result; +} + +const eigen_decomposition_default_ = eigen_decomposition; +; + +x_ite_Namespace .add ("eigen_decomposition", "standard/Math/Algorithms/eigen_decomposition", eigen_decomposition_default_); +/* harmony default export */ const Algorithms_eigen_decomposition = (eigen_decomposition_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Numbers/Matrix3.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + +function Matrix3 () +{ + if (arguments .length) + { + for (let i = 0; i < 9; ++ i) + this [i] = arguments [i]; + } + else + { + this .identity (); + } +} + +Object .assign (Matrix3 .prototype, +{ + *[Symbol .iterator] () + { + for (let i = 0; i < 9; ++ i) + yield this [i]; + }, + copy () + { + const copy = Object .create (Matrix3 .prototype); + + for (let i = 0; i < 9; ++ i) + copy [i] = this [i]; + + return copy; + }, + assign (matrix) + { + for (let i = 0; i < 9; ++ i) + this [i] = matrix [i]; + + return this; + }, + equals (matrix) + { + return this [0] === matrix [0] && + this [1] === matrix [1] && + this [2] === matrix [2] && + this [3] === matrix [3] && + this [4] === matrix [4] && + this [5] === matrix [5] && + this [6] === matrix [6] && + this [7] === matrix [7] && + this [8] === matrix [8]; + }, + rotation () + { + return Math .atan2 (this [1], this [0]); + }, + set1 (r, c, value) + { + this [r * this .order + c] = value; + + return this; + }, + get1 (r, c) + { + return this [r * this .order + c]; + }, + set: (() => + { + const invCenter = new Numbers_Vector2 (0, 0); + + return function (translation, rotation, scale, scaleOrientation, center) + { + switch (arguments .length) + { + case 0: + { + this .identity (); + break; + } + case 1: + { + if (translation === null) translation = Numbers_Vector2 .Zero; + + this .identity (); + this .translate (translation); + break; + } + case 2: + { + if (translation === null) translation = Numbers_Vector2 .Zero; + if (rotation === null) rotation = 0; + + this .identity (); + this .translate (translation); + + if (rotation !== 0) + this .rotate (rotation); + + break; + } + case 3: + { + if (translation === null) translation = Numbers_Vector2 .Zero; + if (rotation === null) rotation = 0; + if (scale === null) scale = Numbers_Vector2 .One; + + this .identity (); + this .translate (translation); + + if (rotation !== 0) + this .rotate (rotation); + + if (! scale .equals (Numbers_Vector2 .One)) + this .scale (scale); + + break; + } + case 4: + { + if (translation === null) translation = Numbers_Vector2 .Zero; + if (rotation === null) rotation = 0; + if (scale === null) scale = Numbers_Vector2 .One; + if (scaleOrientation === null) scaleOrientation = 0; + + this .identity (); + this .translate (translation); + + if (rotation !== 0) + this .rotate (rotation); + + if (! scale .equals (Numbers_Vector2 .One)) + { + const hasScaleOrientation = scaleOrientation !== 0; + + if (hasScaleOrientation) + { + this .rotate (scaleOrientation); + this .scale (scale); + this .rotate (-scaleOrientation); + } + else + this .scale (scale); + } + + break; + } + case 5: + { + if (translation === null) translation = Numbers_Vector2 .Zero; + if (rotation === null) rotation = 0; + if (scale === null) scale = Numbers_Vector2 .One; + if (scaleOrientation === null) scaleOrientation = 0; + if (center === null) center = Numbers_Vector2 .Zero; + + // P' = T * C * R * SR * S * -SR * -C * P + this .identity (); + this .translate (translation); + + const hasCenter = ! center .equals (Numbers_Vector2 .Zero); + + if (hasCenter) + this .translate (center); + + if (rotation !== 0) + this .rotate (rotation); + + if (! scale .equals (Numbers_Vector2 .One)) + { + if (scaleOrientation !== 0) + { + this .rotate (scaleOrientation); + this .scale (scale); + this .rotate (-scaleOrientation); + } + else + this .scale (scale); + } + + if (hasCenter) + this .translate (invCenter .assign (center) .negate ()); + + break; + } + case 9: + { + for (let i = 0; i < 9; ++ i) + this [i] = arguments [i]; + + break; + } + } + + return this; + }; + })(), + get: (() => + { + const + dummyTranslation = new Numbers_Vector2 (0, 0), + dummyRotation = new Numbers_Vector3 (0, 0, 0), + dummyScale = new Numbers_Vector2 (0, 0), + dummyScaleOrientation = new Numbers_Vector3 (0, 0, 0), + dummyCenter = new Numbers_Vector2 (0, 0), + rotMatrix = new Numbers_Matrix2 (), + soMatrix = new Numbers_Matrix2 (), + c = new Numbers_Vector2 (0, 0); + + return function (translation, rotation, scale, scaleOrientation, center) + { + if (translation === null) translation = dummyTranslation; + if (rotation === null) rotation = dummyRotation; + if (scale === null) scale = dummyScale; + if (scaleOrientation === null) scaleOrientation = dummyScaleOrientation; + if (center === null) center = dummyCenter; + + switch (arguments .length) + { + case 1: + { + translation .set (this [6], this [7]); + break; + } + case 2: + { + this .factor (translation, rotMatrix, dummyScale, soMatrix); + + rotation [0] = rotMatrix [0]; + rotation [1] = rotMatrix [1]; + rotation [2] = Math .atan2 (rotMatrix [1], rotMatrix [0]); + break; + } + case 3: + { + this .factor (translation, rotMatrix, scale, soMatrix); + + rotation [0] = rotMatrix [0]; + rotation [1] = rotMatrix [1]; + rotation [2] = Math .atan2 (rotMatrix [1], rotMatrix [0]); + break; + } + case 4: + { + this .factor (translation, rotMatrix, scale, soMatrix); + + rotation [0] = rotMatrix [0]; + rotation [1] = rotMatrix [1]; + rotation [2] = Math .atan2 (rotMatrix [1], rotMatrix [0]); + + scaleOrientation [0] = soMatrix [0]; + scaleOrientation [1] = soMatrix [1]; + scaleOrientation [2] = Math .atan2 (soMatrix [1], soMatrix [0]); + break; + } + case 5: + { + m .set (c .assign (center) .negate ()); + m .multLeft (this); + m .translate (center); + m .get (translation, rotation, scale, scaleOrientation); + break; + } + } + }; + })(), + factor: (() => + { + const + si = new Numbers_Matrix2 (), + u = new Numbers_Matrix2 (), + b = new Numbers_Matrix2 (); + + const eigen = { values: [ ], vectors: [[ ], [ ]] }; + + return function (translation, rotation, scale, scaleOrientation) + { + // (1) Get translation. + translation .set (this [6], this [7]); + + // (2) Create 3x3 matrix. + const a = this .submatrix; + + // (3) Compute det A. If negative, set sign = -1, else sign = 1 + const det = a .determinant (); + const det_sign = det < 0 ? -1 : 1; + + // (4) B = A * !A (here !A means A transpose) + b .assign (a) .transpose () .multLeft (a); + const e = Algorithms_eigen_decomposition (b, eigen); + + // Find min / max eigenvalues and do ratio test to determine singularity. + + scaleOrientation .set (e .vectors [0] [0], e .vectors [1] [0], + e .vectors [0] [1], e .vectors [1] [1]); + + // Compute s = sqrt(evalues), with sign. Set si = s-inverse + + scale .x = det_sign * Math .sqrt (e .values [0]); + scale .y = det_sign * Math .sqrt (e .values [1]); + + si [0] = 1 / scale .x; + si [3] = 1 / scale .y; + + // (5) Compute U = !R ~S R A. + rotation .assign (u .assign (scaleOrientation) .transpose () .multRight (si) .multRight (scaleOrientation) .multRight (a)); + }; + })(), + determinant2 () + { + return this [0] * this [4] - + this [1] * this [3]; + }, + determinant () + { + const { 0: m0, 1: m1, 2: m2, 3: m3, 4: m4, 5: m5, 6: m6, 7: m7, 8: m8 } = this; + + return m0 * (m4 * m8 - m5 * m7) - + m1 * (m3 * m8 - m5 * m6) + + m2 * (m3 * m7 - m4 * m6); + }, + transpose () + { + let tmp; + + tmp = this [1]; this [1] = this [3]; this [3] = tmp; + tmp = this [2]; this [2] = this [6]; this [6] = tmp; + tmp = this [5]; this [5] = this [7]; this [7] = tmp; + + return this; + }, + inverse () + { + const + { 0: m0, 1: m1, 2: m2, 3: m3, 4: m4, 5: m5, 6: m6, 7: m7, 8: m8 } = this, + t4 = m0 * m4, + t6 = m0 * m7, + t8 = m3 * m1, + t10 = m3 * m7, + t12 = m6 * m1, + t14 = m6 * m4; + + let d = (t4 * m8 - t6 * m5 - t8 * m8 + t10 * m2 + t12 * m5 - t14 * m2); + + // if (d === 0) ... determinant is zero. + + d = 1 / d; + + const + b0 = (m4 * m8 - m7 * m5) * d, + b1 = -(m1 * m8 - m7 * m2) * d, + b2 = (m1 * m5 - m4 * m2) * d, + b3 = -(m3 * m8 - m6 * m5) * d, + b4 = (m0 * m8 - m6 * m2) * d, + b5 = -(m0 * m5 - m3 * m2) * d; + + this [0] = b0; + this [1] = b1; + this [2] = b2; + this [3] = b3; + this [4] = b4; + this [5] = b5; + this [6] = (t10 - t14) * d; + this [7] = -(t6 - t12) * d; + this [8] = (t4 - t8) * d; + + return this; + }, + multLeft (matrix) + { + const + { 0: a0, 1: a1, 2: a2, 3: a3, 4: a4, 5: a5, 6: a6, 7: a7, 8: a8 } = this, + { 0: b0, 1: b1, 2: b2, 3: b3, 4: b4, 5: b5, 6: b6, 7: b7, 8: b8 } = matrix; + + this [0] = a0 * b0 + a3 * b1 + a6 * b2; + this [1] = a1 * b0 + a4 * b1 + a7 * b2; + this [2] = a2 * b0 + a5 * b1 + a8 * b2; + this [3] = a0 * b3 + a3 * b4 + a6 * b5; + this [4] = a1 * b3 + a4 * b4 + a7 * b5; + this [5] = a2 * b3 + a5 * b4 + a8 * b5; + this [6] = a0 * b6 + a3 * b7 + a6 * b8; + this [7] = a1 * b6 + a4 * b7 + a7 * b8; + this [8] = a2 * b6 + a5 * b7 + a8 * b8; + + return this; + }, + multRight (matrix) + { + const + { 0: a0, 1: a1, 2: a2, 3: a3, 4: a4, 5: a5, 6: a6, 7: a7, 8: a8 } = this, + { 0: b0, 1: b1, 2: b2, 3: b3, 4: b4, 5: b5, 6: b6, 7: b7, 8: b8 } = matrix; + + this [0] = a0 * b0 + a1 * b3 + a2 * b6; + this [1] = a0 * b1 + a1 * b4 + a2 * b7; + this [2] = a0 * b2 + a1 * b5 + a2 * b8; + this [3] = a3 * b0 + a4 * b3 + a5 * b6; + this [4] = a3 * b1 + a4 * b4 + a5 * b7; + this [5] = a3 * b2 + a4 * b5 + a5 * b8; + this [6] = a6 * b0 + a7 * b3 + a8 * b6; + this [7] = a6 * b1 + a7 * b4 + a8 * b7; + this [8] = a6 * b2 + a7 * b5 + a8 * b8; + + return this; + }, + multVecMatrix (vector) + { + if (vector .length === 2) + { + const + { x, y } = vector, + w = x * this [2] + y * this [5] + this [8]; + + vector .x = (x * this [0] + y * this [3] + this [6]) / w; + vector .y = (x * this [1] + y * this [4] + this [7]) / w; + + return vector; + } + else + { + const { x, y, z } = vector; + + vector .x = x * this [0] + y * this [3] + z * this [6]; + vector .y = x * this [1] + y * this [4] + z * this [7]; + vector .z = x * this [2] + y * this [5] + z * this [8]; + + return vector; + } + }, + multMatrixVec (vector) + { + if (vector .length === 2) + { + const + { x, y } = vector, + w = x * this [6] + y * this [7] + this [8]; + + vector .x = (x * this [0] + y * this [1] + this [2]) / w; + vector .y = (x * this [3] + y * this [4] + this [5]) / w; + + return vector; + } + else + { + const { x, y, z } = vector; + + vector .x = x * this [0] + y * this [1] + z * this [2]; + vector .y = x * this [3] + y * this [4] + z * this [5]; + vector .z = x * this [6] + y * this [7] + z * this [8]; + + return vector; + } + }, + multDirMatrix (vector) + { + const { x, y } = vector; + + vector .x = x * this [0] + y * this [3]; + vector .y = x * this [1] + y * this [4]; + + return vector; + }, + multMatrixDir (vector) + { + const { x, y } = vector; + + vector .x = x * this [0] + y * this [1]; + vector .y = x * this [3] + y * this [4]; + + return vector; + }, + identity () + { + this [0] = 1; this [1] = 0; this [2] = 0; + this [3] = 0; this [4] = 1; this [5] = 0; + this [6] = 0; this [7] = 0; this [8] = 1; + + return this; + }, + translate (translation) + { + const { x, y } = translation; + + this [6] += this [0] * x + this [3] * y; + this [7] += this [1] * x + this [4] * y; + + return this; + }, + rotate (rotation) + { + return this .multLeft (Matrix3 .Rotation (rotation)); + }, + scale (scale) + { + const { x, y } = scale; + + this [0] *= x; + this [3] *= y; + + this [1] *= x; + this [4] *= y; + + return this; + }, + skewX (angle) + { + const a = Math .tan (angle); + + this [3] += this [0] * a; + this [4] += this [1] * a; + this [5] += this [2] * a; + + return this; + }, + skewY (angle) + { + const a = Math .tan (angle); + + this [0] += this [3] * a; + this [1] += this [4] * a; + this [2] += this [5] * a; + + return this; + }, + toString () + { + return Array .prototype .join .call (this, " "); + }, +}); + +Object .defineProperties (Matrix3 .prototype, +{ + order: { value: 3 }, + length: { value: 9 }, + x: + { + get: (() => + { + const vector = new Numbers_Vector3 (0, 0, 0); + + return function () { return vector .set (this [0], this [1], this [2]); }; + })(), + }, + y: + { + get: (() => + { + const vector = new Numbers_Vector3 (0, 0, 0); + + return function () { return vector .set (this [3], this [4], this [5]); }; + })(), + }, + z: + { + get: (() => + { + const vector = new Numbers_Vector3 (0, 0, 0); + + return function () { return vector .set (this [6], this [7], this [8]); }; + })(), + }, + xAxis: + { + get: (() => + { + const vector = new Numbers_Vector2 (0, 0); + + return function () { return vector .set (this [0], this [1]); }; + })(), + }, + yAxis: + { + get: (() => + { + const vector = new Numbers_Vector2 (0, 0); + + return function () { return vector .set (this [3], this [4]); }; + })(), + }, + origin: + { + get: (() => + { + const vector = new Numbers_Vector2 (0, 0); + + return function () { return vector .set (this [6], this [7]); }; + })(), + }, + submatrix: + { + get: (() => + { + const matrix = new Numbers_Matrix2 (); + + return function () + { + matrix [0] = this [0]; matrix [1] = this [1]; + matrix [2] = this [3]; matrix [3] = this [4]; + return matrix; + }; + })(), + }, +}); + +Object .assign (Matrix3, +{ + Identity: new Matrix3 (), + Rotation (rotation) + { + const + sinAngle = Math .sin (rotation), + cosAngle = Math .cos (rotation); + + return new Matrix3 ( cosAngle, sinAngle, 0, + -sinAngle, cosAngle, 0, + 0, 0, 1); + }, + Matrix2 (matrix) + { + return new Matrix3 (matrix [0], matrix [1], 0, + matrix [2], matrix [3], 0, + 0, 0, 1); + }, +}); + +const m = new Matrix3 (); + +const Matrix3_default_ = Matrix3; +; + +x_ite_Namespace .add ("Matrix3", "standard/Math/Numbers/Matrix3", Matrix3_default_); +/* harmony default export */ const Numbers_Matrix3 = (Matrix3_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields/SFMatrix3.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + +function SFMatrix3Template (TypeName, SFVec2, double) +{ + function SFMatrix3 (m00, m01, m02, + m10, m11, m12, + m20, m21, m22) + { + switch (arguments .length) + { + case 0: + Base_X3DField .call (this, new Numbers_Matrix3 ()); + break; + + case 1: + Base_X3DField .call (this, arguments [0]); + break; + + case 3: + { + const + r0 = arguments [0], + r1 = arguments [1], + r2 = arguments [2]; + + Base_X3DField .call (this, new Numbers_Matrix3 (r0 .x, r0 .y, r0 .z, + r1 .x, r1 .y, r1 .z, + r2 .x, r2 .y, r2 .z)); + + break; + } + case 9: + { + Base_X3DField .call (this, new Numbers_Matrix3 (+m00, +m01, +m02, + +m10, +m11, +m12, + +m20, +m21, +m22)); + + break; + } + default: + throw new Error ("Invalid arguments."); + } + } + + Object .assign (Fields_SFMatrixPrototypeTemplate (SFMatrix3, TypeName, Numbers_Matrix3, SFVec2, double), + { + setTransform (translation, rotation, scale, scaleOrientation, center) + { + translation = translation ? translation .getValue () : null; + rotation = rotation ? rotation : 0; + scale = scale ? scale .getValue () : null; + scaleOrientation = scaleOrientation ? scaleOrientation : 0; + center = center ? center .getValue () : null; + + this .getValue () .set (translation, rotation, scale, scaleOrientation, center); + }, + }); + + for (const key of Object .keys (SFMatrix3 .prototype)) + Object .defineProperty (SFMatrix3 .prototype, key, { enumerable: false }); + + function defineProperty (i) + { + Object .defineProperty (SFMatrix3 .prototype, i, + { + get () + { + return this .getValue () [i]; + }, + set (value) + { + this .getValue () [i] = +value; + this .addEvent (); + }, + enumerable: true, + }); + } + + for (let i = 0, length = Numbers_Matrix3 .prototype .length; i < length; ++ i) + defineProperty (i); + + return SFMatrix3; +} + +const SFMatrix3 = { + SFMatrix3d: SFMatrix3Template ("SFMatrix3d", Fields_SFVec2 .SFVec2d, true), + SFMatrix3f: SFMatrix3Template ("SFMatrix3f", Fields_SFVec2 .SFVec2f, false), +}; + +const SFMatrix3_default_ = SFMatrix3; +; + +x_ite_Namespace .add ("SFMatrix3", "x_ite/Fields/SFMatrix3", SFMatrix3_default_); +/* harmony default export */ const Fields_SFMatrix3 = (SFMatrix3_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields/SFVec3.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function SFVec3Template (TypeName, double) +{ + function SFVec3 (x, y, z) + { + switch (arguments .length) + { + case 0: + Base_X3DField .call (this, new Numbers_Vector3 (0, 0, 0)); + break; + + case 1: + Base_X3DField .call (this, arguments [0]); + break; + + case 3: + Base_X3DField .call (this, new Numbers_Vector3 (+x, +y, +z)); + break; + + default: + throw new Error ("Invalid arguments."); + } + } + + Object .assign (Fields_SFVecPrototypeTemplate (SFVec3, TypeName, Numbers_Vector3, double), + { + cross (vector) + { + return new (this .constructor) (this .getValue () .copy () .cross (vector .getValue ())); + }, + }); + + for (const key of Object .keys (SFVec3 .prototype)) + Object .defineProperty (SFVec3 .prototype, key, { enumerable: false }); + + const x = { + get () + { + return this .getValue () .x; + }, + set (value) + { + this .getValue () .x = +value; + this .addEvent (); + }, + }; + + const y = { + get () + { + return this .getValue () .y; + }, + set (value) + { + this .getValue () .y = +value; + this .addEvent (); + }, + }; + + const z = { + get () + { + return this .getValue () .z; + }, + set (value) + { + this .getValue () .z = +value; + this .addEvent (); + }, + }; + + Object .defineProperties (SFVec3 .prototype, + { + 0: x, + 1: y, + 2: z, + x: Object .assign ({ enumerable: true }, x), + y: Object .assign ({ enumerable: true }, y), + z: Object .assign ({ enumerable: true }, z), + }); + + return SFVec3; +} + +const SFVec3 = { + SFVec3d: SFVec3Template ("SFVec3d", true), + SFVec3f: SFVec3Template ("SFVec3f", false), +}; + +const SFVec3_default_ = SFVec3; +; + +x_ite_Namespace .add ("SFVec3", "x_ite/Fields/SFVec3", SFVec3_default_); +/* harmony default export */ const Fields_SFVec3 = (SFVec3_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Numbers/Vector4.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +function Vector4 (x, y, z, w) +{ + this .x = x; + this .y = y; + this .z = z; + this .w = w; +} + +Object .assign (Vector4 .prototype, +{ + *[Symbol .iterator] () + { + yield this .x; + yield this .y; + yield this .z; + yield this .w; + }, + copy () + { + const copy = Object .create (Vector4 .prototype); + copy .x = this .x; + copy .y = this .y; + copy .z = this .z; + copy .w = this .w; + return copy; + }, + assign (vector) + { + this .x = vector .x; + this .y = vector .y; + this .z = vector .z; + this .w = vector .w; + return this; + }, + set (x, y, z, w) + { + this .x = x; + this .y = y; + this .z = z; + this .w = w; + return this; + }, + equals (vector) + { + return this .x === vector .x && + this .y === vector .y && + this .z === vector .z && + this .w === vector .w; + }, + getReal (vector) + { + vector .x = this .x / this .w; + vector .y = this .y / this .w; + vector .z = this .z / this .w; + return vector; + }, + negate () + { + this .x = -this .x; + this .y = -this .y; + this .z = -this .z; + this .w = -this .w; + return this; + }, + inverse () + { + this .x = 1 / this .x; + this .y = 1 / this .y; + this .z = 1 / this .z; + this .w = 1 / this .w; + return this; + }, + add (vector) + { + this .x += vector .x; + this .y += vector .y; + this .z += vector .z; + this .w += vector .w; + return this; + }, + subtract (vector) + { + this .x -= vector .x; + this .y -= vector .y; + this .z -= vector .z; + this .w -= vector .w; + return this; + }, + multiply (value) + { + this .x *= value; + this .y *= value; + this .z *= value; + this .w *= value; + return this; + }, + multVec (vector) + { + this .x *= vector .x; + this .y *= vector .y; + this .z *= vector .z; + this .w *= vector .w; + return this; + }, + divide (value) + { + this .x /= value; + this .y /= value; + this .z /= value; + this .w /= value; + return this; + }, + divVec (vector) + { + this .x /= vector .x; + this .y /= vector .y; + this .z /= vector .z; + this .w /= vector .w; + return this; + }, + normalize () + { + const length = Math .hypot (this .x, this .y, this .z, this .w); + + if (length) + { + this .x /= length; + this .y /= length; + this .z /= length; + this .w /= length; + } + + return this; + }, + dot (vector) + { + return this .x * vector .x + + this .y * vector .y + + this .z * vector .z + + this .w * vector .w; + }, + norm () + { + const { x, y, z, w } = this; + + return x * x + + y * y + + z * z + + w * w; + }, + magnitude () + { + return Math .hypot (this .x, this .y, this .z, this .w); + }, + distance (vector) + { + return Math .hypot (this .x - vector .x, + this .y - vector .y, + this .z - vector .z, + this .w - vector .w); + }, + lerp (destination, t) + { + const { x, y, z, w } = this; + + this .x = x + t * (destination .x - x); + this .y = y + t * (destination .y - y); + this .z = z + t * (destination .z - z); + this .w = w + t * (destination .w - w); + return this; + }, + abs () + { + this .x = Math .abs (this .x); + this .y = Math .abs (this .y); + this .z = Math .abs (this .z); + this .w = Math .abs (this .w); + return this; + }, + min (vector) + { + let { x, y, z, w } = this; + + for (const vector of arguments) + { + x = Math .min (x, vector .x); + y = Math .min (y, vector .y); + z = Math .min (z, vector .z); + w = Math .min (w, vector .w); + } + + this .x = x; + this .y = y; + this .z = z; + this .w = w; + return this; + }, + max (vector) + { + let { x, y, z, w } = this; + + for (const vector of arguments) + { + x = Math .max (x, vector .x); + y = Math .max (y, vector .y); + z = Math .max (z, vector .z); + w = Math .max (w, vector .w); + } + + this .x = x; + this .y = y; + this .z = z; + this .w = w; + return this; + }, + toString () + { + return this .x + " " + + this .y + " " + + this .z + " " + + this .w; + }, +}); + +Object .defineProperties (Vector4 .prototype, +{ + length: { value: 4 }, + 0: + { + get () { return this .x; }, + set (value) { this .x = value; }, + }, + 1: + { + get () { return this .y; }, + set (value) { this .y = value; }, + }, + 2: + { + get () { return this .z; }, + set (value) { this .z = value; }, + }, + 3: + { + get () { return this .w; }, + set (value) { this .w = value; }, + }, +}); + +Object .assign (Vector4, +{ + Zero: new Vector4 (0, 0, 0, 0), + One: new Vector4 (1, 1, 1, 1), + xAxis: new Vector4 (1, 0, 0, 0), + yAxis: new Vector4 (0, 1, 0, 0), + zAxis: new Vector4 (0, 0, 1, 0), + wAxis: new Vector4 (0, 0, 0, 1), +}); + +const Vector4_default_ = Vector4; +; + +x_ite_Namespace .add ("Vector4", "standard/Math/Numbers/Vector4", Vector4_default_); +/* harmony default export */ const Numbers_Vector4 = (Vector4_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Numbers/Quaternion.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function Quaternion (x, y, z, w) +{ + this .x = x; + this .y = y; + this .z = z; + this .w = w; +} + +Object .assign (Quaternion .prototype, +{ + *[Symbol .iterator] () + { + yield this .x; + yield this .y; + yield this .z; + yield this .w; + }, + copy () + { + const copy = Object .create (Quaternion .prototype); + copy .x = this .x; + copy .y = this .y; + copy .z = this .z; + copy .w = this .w; + return copy; + }, + assign (quat) + { + this .x = quat .x; + this .y = quat .y; + this .z = quat .z; + this .w = quat .w; + return this; + }, + set (x, y, z, w) + { + this .x = x; + this .y = y; + this .z = z; + this .w = w; + return this; + }, + setMatrix (matrix) + { + // First, find largest diagonal in matrix: + if (matrix [0] > matrix [4]) + { + var i = matrix [0] > matrix [8] ? 0 : 2; + } + else + { + var i = matrix [4] > matrix [8] ? 1 : 2; + } + + const scaleRow = matrix [0] + matrix [4] + matrix [8]; + + if (scaleRow > matrix [i * 3 + i]) + { + // Compute w first: + this [3] = Math .sqrt (scaleRow + 1) / 2; + + // And compute other values: + const d = 4 * this [3]; + this [0] = (matrix [5] - matrix [7]) / d; + this [1] = (matrix [6] - matrix [2]) / d; + this [2] = (matrix [1] - matrix [3]) / d; + } + else + { + // Compute x, y, or z first: + const j = (i + 1) % 3; + const k = (i + 2) % 3; + + // Compute first value: + this [i] = Math .sqrt (matrix [i * 3 + i] - matrix [j * 3 + j] - matrix [k * 3 + k] + 1) / 2; + + // And the others: + const d = 4 * this [i]; + this [j] = (matrix [i * 3 + j] + matrix [j * 3 + i]) / d; + this [k] = (matrix [i * 3 + k] + matrix [k * 3 + i]) / d; + this [3] = (matrix [j * 3 + k] - matrix [k * 3 + j]) / d; + } + + return this; + }, + getMatrix (matrix = new Numbers_Matrix3 ()) + { + const { x, y, z, w } = this; + + const + a = x * x, + b = x * y, + c = y * y, + d = y * z, + e = z * x, + f = z * z, + g = w * x, + h = w * y, + i = w * z; + + matrix [0] = 1 - 2 * (c + f); + matrix [1] = 2 * (b + i); + matrix [2] = 2 * (e - h); + + matrix [3] = 2 * (b - i); + matrix [4] = 1 - 2 * (f + a); + matrix [5] = 2 * (d + g); + + matrix [6] = 2 * (e + h); + matrix [7] = 2 * (d - g); + matrix [8] = 1 - 2 * (c + a); + + return matrix; + }, + setEuler (x, y, z, order = "XYZ") + { + // http://www.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/content/SpinCalc.m + + const + c1 = Math .cos (x / 2), + c2 = Math .cos (y / 2), + c3 = Math .cos (z / 2), + s1 = Math .sin (x / 2), + s2 = Math .sin (y / 2), + s3 = Math .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 "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 "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 "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; + } + + return this; + }, + getEuler (euler = [ ], order = "XYZ") + { + const { 0: m0, 1: m1, 2: m2, 3: m3, 4: m4, 5: m5, 6: m6, 7: m7, 8: m8 } = this .getMatrix (Quaternion_m); + + switch (order) + { + case "XYZ": + { + euler [1] = Math .asin (Math_Algorithm .clamp (m6, -1, 1)); + + if (Math .abs (m6) < 0.9999999) + { + euler [0] = Math .atan2 (-m7, m8); + euler [2] = Math .atan2 (-m3, m0); + } + else + { + euler [0] = Math .atan2 (m5, m4); + euler [2] = 0; + } + + break; + } + case "ZYX": + { + euler [1] = Math .asin (- Math_Algorithm .clamp (m2, -1, 1)); + + if (Math .abs (m2) < 0.9999999) + { + euler [0] = Math .atan2 (m5, m8); + euler [2] = Math .atan2 (m1, m0); + } + else + { + euler [0] = 0; + euler [2] = Math .atan2 (-m3, m4); + } + + break; + } + case "YXZ": + { + euler [0] = Math .asin (- Math_Algorithm .clamp (m7, -1, 1)); + + if (Math .abs (m7) < 0.9999999) + { + euler [1] = Math .atan2 (m6, m8); + euler [2] = Math .atan2 (m1, m4); + + } + else + { + euler [1] = Math .atan2 (-m2, m0); + euler [2] = 0; + } + + break; + } + case "ZXY": + { + euler [0] = Math .asin (Math_Algorithm .clamp (m5, -1, 1)); + + if (Math .abs (m5) < 0.9999999) + { + euler [1] = Math .atan2 (-m2, m8); + euler [2] = Math .atan2 (-m3, m4); + } + else + { + euler [1] = 0; + euler [2] = Math .atan2 (m1, m0); + } + + break; + } + case "YZX": + { + euler [2] = Math .asin (Math_Algorithm .clamp (m1, -1, 1)); + + if (Math .abs (m1) < 0.9999999) + { + euler [0] = Math .atan2 (-m7, m4); + euler [1] = Math .atan2 (-m2, m0); + } + else + { + euler [0] = 0; + euler [1] = Math .atan2 (m6, m8); + } + + break; + } + case "XZY": + { + euler [2] = Math .asin (- Math_Algorithm .clamp (m3, -1, 1)); + + if (Math .abs (m3) < 0.9999999) + { + euler [0] = Math .atan2 (m5, m4); + euler [1] = Math .atan2 (m6, m0); + + } + else + { + euler [0] = Math .atan2 (-m7, m8); + euler [1] = 0; + } + + break; + } + } + + return euler; + }, + isReal () + { + return !(this .x || this .y || this .z); + }, + isImag () + { + return !this .w; + }, + equals (quat) + { + return this .x === quat .x && + this .y === quat .y && + this .z === quat .z && + this .w === quat .w; + }, + negate () + { + this .x = -this .x; + this .y = -this .y; + this .z = -this .z; + this .w = -this .w; + return this; + }, + inverse () + { + this .x = -this .x; + this .y = -this .y; + this .z = -this .z; + return this; + }, + add (quat) + { + this .x += quat .x; + this .y += quat .y; + this .z += quat .z; + this .w += quat .w; + return this; + }, + subtract (quat) + { + this .x -= quat .x; + this .y -= quat .y; + this .z -= quat .z; + this .w -= quat .w; + return this; + }, + multiply (value) + { + this .x *= value; + this .y *= value; + this .z *= value; + this .w *= value; + return this; + }, + multLeft (quat) + { + const + { x: ax, y: ay, z: az, w: aw } = this, + { x: bx, y: by, z: bz, w: bw } = quat; + + this .x = aw * bx + ax * bw + ay * bz - az * by; + this .y = aw * by + ay * bw + az * bx - ax * bz; + this .z = aw * bz + az * bw + ax * by - ay * bx; + this .w = aw * bw - ax * bx - ay * by - az * bz; + + return this; + }, + multRight (quat) + { + const + { x: ax, y: ay, z: az, w: aw } = this, + { x: bx, y: by, z: bz, w: bw } = quat; + + this .x = bw * ax + bx * aw + by * az - bz * ay; + this .y = bw * ay + by * aw + bz * ax - bx * az; + this .z = bw * az + bz * aw + bx * ay - by * ax; + this .w = bw * aw - bx * ax - by * ay - bz * az; + + return this; + }, + divide (value) + { + this .x /= value; + this .y /= value; + this .z /= value; + this .w /= value; + return this; + }, + multVecQuat (vector) + { + // https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles#Vector_rotation + + const + { x: qx, y: qy, z: qz, w: qw } = this, + { x: vx, y: vy, z: vz } = vector, + tx = 2 * (qy * vz - qz * vy), + ty = 2 * (qz * vx - qx * vz), + tz = 2 * (qx * vy - qy * vx); + + vector .x += qw * tx + qy * tz - qz * ty; + vector .y += qw * ty + qz * tx - qx * tz; + vector .z += qw * tz + qx * ty - qy * tx; + + return vector; + }, + multQuatVec (vector) + { + // https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles#Vector_rotation + + const + { x: qx, y: qy, z: qz, w: qw } = this, + { x: vx, y: vy, z: vz } = vector, + tx = 2 * (qz * vy - qy * vz), + ty = 2 * (qx * vz - qz * vx), + tz = 2 * (qy * vx - qx * vy); + + vector .x += qw * tx - qy * tz + qz * ty; + vector .y += qw * ty - qz * tx + qx * tz; + vector .z += qw * tz - qx * ty + qy * tx; + + return vector; + }, + normalize () + { + const length = Math .hypot (this .x, this .y, this .z, this .w); + + if (length) + { + this .x /= length; + this .y /= length; + this .z /= length; + this .w /= length; + } + + return this; + }, + dot (quat) + { + return this .x * quat .x + + this .y * quat .y + + this .z * quat .z + + this .w * quat .w; + }, + norm () + { + const { x, y, z, w } = this; + + return x * x + + y * y + + z * z + + w * w; + }, + magnitude () + { + return Math .hypot (this .x, this .y, this .z, this .w); + }, + pow (exponent) + { + if (exponent instanceof Quaternion) + return this .assign (e .assign (exponent) .multRight (this .log ()) .exp ()); + + if (this .isReal ()) + return this .set (0, 0, 0, this .w ** exponent); + + const + l = this .magnitude (), + theta = Math .acos (this .w / l), + li = this .imag .magnitude (), + ltoe = l ** exponent, + et = exponent * theta, + scale = ltoe / li * Math .sin (et); + + this .x *= scale; + this .y *= scale; + this .z *= scale; + this .w = ltoe * Math .cos (et); + return this; + }, + log () + { + if (this .isReal ()) + { + if (this .w > 0) + return this .set (0, 0, 0, Math .log (this .w)); + + else + return this .set (Math .PI, 0, 0, Math .log (-this .w)); + } + + const + l = this .magnitude (), + v = this .imag .normalize () .multiply (Math .acos (this .w / l)), + w = Math .log (l); + + this .x = v .x; + this .y = v .y; + this .z = v .z; + this .w = w; + return this; + }, + exp () + { + if (this .isReal ()) + return this .set (0, 0, 0, Math .exp (this .w)); + + const + i = this .imag, + li = i .magnitude (), + ew = Math .exp (this .w), + w = ew * Math .cos (li), + v = i .multiply (ew * Math .sin (li) / li); + + this .x = v .x; + this .y = v .y; + this .z = v .z; + this .w = w; + return this; + }, + slerp (destination, t) + { + return Math_Algorithm .slerp (this, t1 .assign (destination), t); + }, + squad (a, b, destination, t) + { + // We must use shortest path slerp to prevent flipping. Also see spline. + + return Math_Algorithm .slerp (Math_Algorithm .slerp (this, t1 .assign (destination), t), + Math_Algorithm .slerp (t2 .assign (a), t3 .assign (b), t), + 2 * t * (1 - t)); + }, + toString () + { + return this .x + " " + + this .y + " " + + this .z + " " + + this .w; + }, +}); + +Object .defineProperties (Quaternion .prototype, +{ + length: { value: 4 }, + 0: + { + get () { return this .x; }, + set (value) { this .x = value; }, + }, + 1: + { + get () { return this .y; }, + set (value) { this .y = value; }, + }, + 2: + { + get () { return this .z; }, + set (value) { this .z = value; }, + }, + 3: + { + get () { return this .w; }, + set (value) { this .w = value; }, + }, + real: + { + get () { return this .w; }, + }, + imag: + { + get: (() => + { + const result = new Numbers_Vector3 (0, 0, 0); + + return function () + { + return result .set (this .x, + this .y, + this .z); + }; + })(), + }, +}); + +Object .assign (Quaternion, +{ + Identity: new Quaternion (0, 0, 0, 1), + spline: (() => + { + const + q0 = new Quaternion (0, 0, 0, 1), + q1 = new Quaternion (0, 0, 0, 1), + q2 = new Quaternion (0, 0, 0, 1), + q1_i = new Quaternion (0, 0, 0, 1); + + return function (Q0, Q1, Q2) + { + q0 .assign (Q0); + q1 .assign (Q1); + q2 .assign (Q2); + + // If the dot product is smaller than 0 we must negate the quaternion to prevent flipping. If we negate all + // the terms we get a different quaternion but it represents the same rotation. + + if (q0 .dot (q1) < 0) + q0 .negate (); + + if (q2 .dot (q1) < 0) + q2 .negate (); + + q1_i .assign (q1) .inverse (); + + // The result must be normalized as it will be used in slerp and we can only slerp normalized vectors. + + return q1 .multRight ( + t1 .assign (q1_i) .multRight (q0) .log () .add (t2 .assign (q1_i) .multRight (q2) .log ()) .divide (-4) .exp () + ) + .normalize () .copy (); + }; + })(), +}); + +const + t1 = new Quaternion (0, 0, 0, 1), + t2 = new Quaternion (0, 0, 0, 1), + t3 = new Quaternion (0, 0, 0, 1), + Quaternion_m = new Numbers_Matrix3 (); + +const Quaternion_default_ = Quaternion; +; + +x_ite_Namespace .add ("Quaternion", "standard/Math/Numbers/Quaternion", Quaternion_default_); +/* harmony default export */ const Numbers_Quaternion = (Quaternion_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Numbers/Rotation4.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +const + _x = Symbol (), + _y = Symbol (), + _z = Symbol (), + _angle = Symbol (), + _quaternion = Symbol (); + +function Rotation4 (x, y, z, angle) +{ + this [_x] = 0; + this [_y] = 0; + this [_z] = 1; + this [_angle] = 0; + + switch (arguments .length) + { + case 0: + { + this [_quaternion] = new Numbers_Quaternion (0, 0, 0, 1); + return; + } + case 1: + { + this [_quaternion] = arguments [0]; + this .update (); + return; + } + case 2: + { + const + arg0 = arguments [0], + arg1 = arguments [1]; + + this [_quaternion] = new Numbers_Quaternion (0, 0, 0, 1); + + if (arg1 instanceof Numbers_Vector3) + return this .setFromToVec (arg0, arg1); + + this .set (arg0 .x, + arg0 .y, + arg0 .z, + arg1); + + return; + } + case 4: + { + this [_quaternion] = new Numbers_Quaternion (0, 0, 0, 1); + this .set (x, y, z, angle); + return; + } + } +} + +Object .assign (Rotation4 .prototype, +{ + *[Symbol .iterator] () + { + yield this [_x]; + yield this [_y]; + yield this [_z]; + yield this [_angle]; + }, + update () + { + const rotation = this .get (); + + this [_x] = rotation .x; + this [_y] = rotation .y; + this [_z] = rotation .z; + this [_angle] = rotation .w; + + return this; + }, + copy () + { + const copy = Object .create (Rotation4 .prototype); + + copy [_x] = this [_x]; + copy [_y] = this [_y]; + copy [_z] = this [_z]; + copy [_angle] = this [_angle]; + + copy [_quaternion] = this [_quaternion] .copy (); + + return copy; + }, + assign (rotation) + { + this [_x] = rotation [_x]; + this [_y] = rotation [_y]; + this [_z] = rotation [_z]; + this [_angle] = rotation [_angle]; + + this [_quaternion] .assign (rotation [_quaternion]); + + return this; + }, + set (x, y, z, angle) + { + this [_x] = x; + this [_y] = y; + this [_z] = z; + this [_angle] = angle; + + const scale = Math .hypot (x, y, z); + + if (scale === 0) + { + this [_quaternion] .set (0, 0, 0, 1); + return this; + } + + // Calculate quaternion + + const + halfTheta = Math_Algorithm .interval (angle / 2, 0, Math .PI), + ascale = Math .sin (halfTheta) / scale; + + this [_quaternion] .set (x * ascale, + y * ascale, + z * ascale, + Math .cos (halfTheta)); + return this; + }, + get: (() => + { + const result = new Numbers_Vector4 (0, 0, 0, 0); + + return function () + { + const quaternion = this [_quaternion]; + + if (Math .abs (quaternion .w) > 1) + { + return Numbers_Vector4 .zAxis; + } + else + { + const + angle = Math .acos (quaternion .w) * 2, + scale = Math .sin (angle / 2); + + if (scale === 0) + { + return Numbers_Vector4 .zAxis; + } + else + { + const axis = quaternion .imag .divide (scale); + + return result .set (axis .x, + axis .y, + axis .z, + angle); + } + } + }; + })(), + setAxisAngle (axis, angle) + { + return this .set (axis .x, axis .y, axis .z, angle); + }, + setFromToVec: (() => + { + const + from = new Numbers_Vector3 (0, 0, 0), + to = new Numbers_Vector3 (0, 0, 0), + cv = new Numbers_Vector3 (0, 0, 0), + t = new Numbers_Vector3 (0, 0, 0); + + return function (fromVec, toVec) + { + // https://bitbucket.org/Coin3D/coin/src/abc9f50968c9/src/base/SbRotation.cpp + + from .assign (fromVec) .normalize (); + to .assign (toVec) .normalize (); + + const + cos_angle = Math_Algorithm .clamp (from .dot (to), -1, 1), + crossvec = cv .assign (from) .cross (to) .normalize (), + crosslen = crossvec .magnitude (); + + if (crosslen === 0) + { + // Parallel vectors + // Check if they are pointing in the same direction. + if (cos_angle > 0) + this [_quaternion] .set (0, 0, 0, 1); // standard rotation + + // Ok, so they are parallel and pointing in the opposite direction + // of each other. + else + { + // Try crossing with x axis. + t .assign (from) .cross (Numbers_Vector3 .xAxis); + + // If not ok, cross with y axis. + if (t .norm () === 0) + t .assign (from) .cross (Numbers_Vector3 .yAxis); + + t .normalize (); + + this [_quaternion] .set (t .x, t .y, t .z, 0); + } + } + else + { + // Vectors are not parallel + // The abs () wrapping is to avoid problems when `dot' "overflows" a tiny wee bit, + // which can lead to sqrt () returning NaN. + crossvec .multiply (Math .sqrt (Math .abs (1 - cos_angle) / 2)); + + this [_quaternion] .set (crossvec .x, + crossvec .y, + crossvec .z, + Math .sqrt (Math .abs (1 + cos_angle) / 2)); + } + + this .update (); + + return this; + }; + })(), + setAxis (vector) + { + this .set (vector .x, vector .y, vector .z, this [_angle]); + }, + getAxis (axis = new Numbers_Vector3 (0, 0, 0)) + { + return axis .set (this [_x], this [_y], this [_z]); + }, + setQuaternion (quaternion) + { + this [_quaternion] .assign (quaternion) .normalize (); + this .update (); + return this; + }, + getQuaternion (quaternion = new Numbers_Quaternion (0, 0, 0, 1)) + { + return quaternion .assign (this [_quaternion]); + }, + setMatrix (matrix) + { + this [_quaternion] .setMatrix (matrix) .normalize (); + this .update (); + return this; + }, + getMatrix (matrix = new Numbers_Matrix3 ()) + { + return this [_quaternion] .getMatrix (matrix); + }, + setEuler (x, y, z, order = "XYZ") + { + // Quaternion is then already normalized. + this [_quaternion] .setEuler (x, y, z, order); + this .update (); + return this; + }, + getEuler (euler = [ ], order = "XYZ") + { + return this [_quaternion] .getEuler (euler, order); + }, + equals (rotation) + { + return this [_quaternion] .equals (rotation [_quaternion]); + }, + inverse () + { + this [_quaternion] .inverse (); + this .update (); + return this; + }, + multLeft (rotation) + { + this [_quaternion] .multLeft (rotation [_quaternion]) .normalize (); + this .update (); + return this; + }, + multRight (rotation) + { + this [_quaternion] .multRight (rotation [_quaternion]) .normalize (); + this .update (); + return this; + }, + multVecRot (vector) + { + return this [_quaternion] .multVecQuat (vector); + }, + multRotVec (vector) + { + return this [_quaternion] .multQuatVec (vector); + }, + normalize () + { + this [_quaternion] .normalize (); + this .update (); + return this; + }, + pow (exponent) + { + this [_quaternion] .pow (exponent); + this .update (); + return this; + }, + slerp (dest, t) + { + this [_quaternion] .slerp (dest [_quaternion], t); + this .update (); + return this; + }, + squad (a, b, dest, t) + { + this [_quaternion] .squad (a [_quaternion], b [_quaternion], dest [_quaternion], t); + this .update (); + return this; + }, + toString () + { + return this [_x] + " " + + this [_y] + " " + + this [_z] + " " + + this [_angle]; + } +}); + +const x = { + get () + { + return this [_x]; + }, + set (x) + { + this [_x] = x; + this .set (x, this [_y], this [_z], this [_angle]); + }, + enumerable: true, +}; + +const y = { + get () + { + return this [_y]; + }, + set (y) + { + this [_y] = y; + this .set (this [_x], y, this [_z], this [_angle]); + }, + enumerable: true, +}; + +const Rotation4_z = { + get () + { + return this [_z]; + }, + set (z) + { + this [_z] = z; + this .set (this [_x], this [_y], z, this [_angle]); + }, + enumerable: true, +}; + +const angle = { + get () + { + return this [_angle]; + }, + set (angle) + { + this [_angle] = angle; + this .set (this [_x], this [_y], this [_z], angle); + }, + enumerable: true, +}; + +Object .defineProperties (Rotation4 .prototype, +{ + length: { value: 4 }, + x: x, + y: y, + z: Rotation4_z, + angle: angle, +}); + +x .enumerable = false; +y .enumerable = false; +Rotation4_z .enumerable = false; +angle .enumerable = false; + +Object .defineProperties (Rotation4 .prototype, +{ + 0: x, + 1: y, + 2: Rotation4_z, + 3: angle, +}); + +Object .assign (Rotation4, +{ + Identity: new Rotation4 (), + fromQuaternion (quaternion) + { + return new Rotation4 () .setQuaternion (quaternion); + }, + fromMatrix (matrix) + { + return new Rotation4 () .setMatrix (matrix); + }, + fromEuler (x, y, z, order = "XYZ") + { + return new Rotation4 () .setEuler (x, y, z, order); + }, + spline (r0, r1, r2) + { + const copy = Object .create (this .prototype); + copy [_quaternion] = Numbers_Quaternion .spline (r0 [_quaternion], r1 [_quaternion], r2 [_quaternion]); + copy .update (); + return copy; + }, +}); + +const Rotation4_default_ = Rotation4; +; + +x_ite_Namespace .add ("Rotation4", "standard/Math/Numbers/Rotation4", Rotation4_default_); +/* harmony default export */ const Numbers_Rotation4 = (Rotation4_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Numbers/Matrix4.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function Matrix4_Matrix4 () +{ + if (arguments .length) + { + for (let i = 0; i < 16; ++ i) + this [i] = arguments [i]; + } + else + { + this .identity (); + } +} + +Object .assign (Matrix4_Matrix4 .prototype, +{ + *[Symbol .iterator] () + { + for (let i = 0; i < 16; ++ i) + yield this [i]; + }, + copy () + { + const copy = Object .create (Matrix4_Matrix4 .prototype); + + for (let i = 0; i < 16; ++ i) + copy [i] = this [i]; + + return copy; + }, + assign (matrix) + { + for (let i = 0; i < 16; ++ i) + this [i] = matrix [i]; + + return this; + }, + equals (matrix) + { + return this [ 0] === matrix [ 0] && + this [ 1] === matrix [ 1] && + this [ 2] === matrix [ 2] && + this [ 3] === matrix [ 3] && + this [ 4] === matrix [ 4] && + this [ 5] === matrix [ 5] && + this [ 6] === matrix [ 6] && + this [ 7] === matrix [ 7] && + this [ 8] === matrix [ 8] && + this [ 9] === matrix [ 9] && + this [10] === matrix [10] && + this [11] === matrix [11] && + this [12] === matrix [12] && + this [13] === matrix [13] && + this [14] === matrix [14] && + this [15] === matrix [15]; + }, + set1 (r, c, value) + { + this [r * this .order + c] = value; + + return this; + }, + get1 (r, c) + { + return this [r * this .order + c]; + }, + set: (() => + { + const + invScaleOrientation = new Numbers_Rotation4 (), + invCenter = new Numbers_Vector3 (0, 0, 0); + + return function (translation, rotation, scale, scaleOrientation, center) + { + switch (arguments .length) + { + case 0: + { + this .identity (); + break; + } + case 1: + { + if (translation === null) translation = Numbers_Vector3 .Zero; + + this .identity (); + this .translate (translation); + break; + } + case 2: + { + if (translation === null) translation = Numbers_Vector3 .Zero; + if (rotation === null) rotation = Numbers_Rotation4 .Identity; + + this .identity (); + this .translate (translation); + + if (! rotation .equals (Numbers_Rotation4 .Identity)) + this .rotate (rotation); + + break; + } + case 3: + { + if (translation === null) translation = Numbers_Vector3 .Zero; + if (rotation === null) rotation = Numbers_Rotation4 .Identity; + if (scale === null) scale = Numbers_Vector3 .One; + + this .identity (); + this .translate (translation); + + if (! rotation .equals (Numbers_Rotation4 .Identity)) + this .rotate (rotation); + + if (! scale .equals (Numbers_Vector3 .One)) + this .scale (scale); + + break; + } + case 4: + { + if (translation === null) translation = Numbers_Vector3 .Zero; + if (rotation === null) rotation = Numbers_Rotation4 .Identity; + if (scale === null) scale = Numbers_Vector3 .One; + if (scaleOrientation === null) scaleOrientation = Numbers_Rotation4 .Identity; + + this .identity (); + this .translate (translation); + + if (! rotation .equals (Numbers_Rotation4 .Identity)) + this .rotate (rotation); + + if (! scale .equals (Numbers_Vector3 .One)) + { + const hasScaleOrientation = ! scaleOrientation .equals (Numbers_Rotation4 .Identity); + + if (hasScaleOrientation) + { + this .rotate (scaleOrientation); + this .scale (scale); + this .rotate (invScaleOrientation .assign (scaleOrientation) .inverse ()); + } + else + this .scale (scale); + } + + break; + } + case 5: + { + if (translation === null) translation = Numbers_Vector3 .Zero; + if (rotation === null) rotation = Numbers_Rotation4 .Identity; + if (scale === null) scale = Numbers_Vector3 .One; + if (scaleOrientation === null) scaleOrientation = Numbers_Rotation4 .Identity; + if (center === null) center = Numbers_Vector3 .Zero; + + // P' = T * C * R * SR * S * -SR * -C * P + this .identity (); + this .translate (translation); + + const hasCenter = ! center .equals (Numbers_Vector3 .Zero); + + if (hasCenter) + this .translate (center); + + if (! rotation .equals (Numbers_Rotation4 .Identity)) + this .rotate (rotation); + + if (! scale .equals (Numbers_Vector3 .One)) + { + if (! scaleOrientation .equals (Numbers_Rotation4 .Identity)) + { + this .rotate (scaleOrientation); + this .scale (scale); + this .rotate (invScaleOrientation .assign (scaleOrientation) .inverse ()); + } + else + this .scale (scale); + } + + if (hasCenter) + this .translate (invCenter .assign (center) .negate ()); + + break; + } + case 16: + { + for (let i = 0; i < 16; ++ i) + this [i] = arguments [i]; + + break; + } + } + + return this; + }; + })(), + get: (() => + { + const + dummyTranslation = new Numbers_Vector3 (0, 0, 0), + dummyRotation = new Numbers_Rotation4 (), + dummyScale = new Numbers_Vector3 (0, 0, 0), + dummyScaleOrientation = new Numbers_Rotation4 (), + dummyCenter = new Numbers_Vector3 (0, 0, 0), + rot = new Numbers_Matrix3 (), + so = new Numbers_Matrix3 (), + c = new Numbers_Vector3 (0, 0, 0); + + return function (translation, rotation, scale, scaleOrientation, center) + { + if (translation === null) translation = dummyTranslation; + if (rotation === null) rotation = dummyRotation; + if (scale === null) scale = dummyScale; + if (scaleOrientation === null) scaleOrientation = dummyScaleOrientation; + if (center === null) center = dummyCenter; + + switch (arguments .length) + { + case 1: + { + translation .set (this [12], this [13], this [14]); + break; + } + case 2: + { + this .factor (translation, rot, dummyScale, so); + rotation .setMatrix (rot); + break; + } + case 3: + { + this .factor (translation, rot, scale, so); + rotation .setMatrix (rot); + break; + } + case 4: + { + this .factor (translation, rot, scale, so); + rotation .setMatrix (rot); + scaleOrientation .setMatrix (so); + break; + } + case 5: + { + Matrix4_m .set (c .assign (center) .negate ()); + Matrix4_m .multLeft (this); + Matrix4_m .translate (center); + Matrix4_m .get (translation, rotation, scale, scaleOrientation); + break; + } + } + }; + })(), + setRotation (rotation) + { + return this .setQuaternion (rotation .getQuaternion (q)); + }, + setQuaternion (quaternion) + { + const + { x, y, z, w } = quaternion, + A = y * y, + B = z * z, + C = x * y, + D = z * w, + E = z * x, + F = y * w, + G = x * x, + H = y * z, + I = x * w; + + this [0] = 1 - 2 * (A + B); + this [1] = 2 * (C + D); + this [2] = 2 * (E - F); + this [3] = 0; + this [4] = 2 * (C - D); + this [5] = 1 - 2 * (B + G); + this [6] = 2 * (H + I); + this [7] = 0; + this [8] = 2 * (E + F); + this [9] = 2 * (H - I); + this [10] = 1 - 2 * (A + G); + this [11] = 0; + this [12] = 0; + this [13] = 0; + this [14] = 0; + this [15] = 1; + + return this; + }, + factor: (() => + { + const + si = new Numbers_Matrix3 (), + u = new Numbers_Matrix3 (), + b = new Numbers_Matrix3 (); + + const eigen = { values: [ ], vectors: [[ ], [ ], [ ]] }; + + return function (translation, rotation, scale, scaleOrientation) + { + // (1) Get translation. + translation .set (this [12], this [13], this [14]); + + // (2) Create 3x3 matrix. + const a = this .submatrix; + + // (3) Compute det A. If negative, set sign = -1, else sign = 1 + const det = a .determinant (); + const det_sign = det < 0 ? -1 : 1; + + // (4) B = A * !A (here !A means A transpose) + b .assign (a) .transpose () .multLeft (a); + const e = Algorithms_eigen_decomposition (b, eigen); + + // Find min / max eigenvalues and do ratio test to determine singularity. + + scaleOrientation .set (e .vectors [0] [0], e .vectors [1] [0], e .vectors [2] [0], + e .vectors [0] [1], e .vectors [1] [1], e .vectors [2] [1], + e .vectors [0] [2], e .vectors [1] [2], e .vectors [2] [2]); + + // Compute s = sqrt(evalues), with sign. Set si = s-inverse + + scale .x = det_sign * Math .sqrt (e .values [0]); + scale .y = det_sign * Math .sqrt (e .values [1]); + scale .z = det_sign * Math .sqrt (e .values [2]); + + si [0] = 1 / scale .x; + si [4] = 1 / scale .y; + si [8] = 1 / scale .z; + + // (5) Compute U = !R ~S R A. + rotation .assign (u .assign (scaleOrientation) .transpose () .multRight (si) .multRight (scaleOrientation) .multRight (a)); + }; + })(), + determinant3 () + { + const + m00 = this [0], m01 = this [1], m02 = this [ 2], + m04 = this [4], m05 = this [5], m06 = this [ 6], + m08 = this [8], m09 = this [9], m10 = this [10]; + + return m00 * (m05 * m10 - m06 * m09) - + m01 * (m04 * m10 - m06 * m08) + + m02 * (m04 * m09 - m05 * m08); + }, + determinant () + { + const + { 0: m00, 1: m01, 2: m02, 3: m03, 4: m04, 5: m05, 6: m06, 7: m07, + 8: m08, 9: m09, 10: m10, 11: m11, 12: m12, 13: m13, 14: m14, 15: m15 } = this, + b = m10 * m15, + c = m14 * m11, + d = m06 * m15, + e = m14 * m07, + f = m06 * m11, + g = m10 * m07, + h = m02 * m15, + i = m14 * m03, + j = m02 * m11, + o = m10 * m03, + r = m02 * m07, + x = m06 * m03, + H = b * m05 + e * m09 + f * m13 - (c * m05) - (d * m09) - (g * m13), + I = c * m01 + h * m09 + o * m13 - (b * m01) - (i * m09) - (j * m13), + J = d * m01 + i * m05 + r * m13 - (e * m01) - (h * m05) - (x * m13), + K = g * m01 + j * m05 + x * m09 - (f * m01) - (o * m05) - (r * m09); + + return m00 * H + m04 * I + m08 * J + m12 * K; + }, + transpose () + { + let tmp; + + tmp = this [ 1]; this [ 1] = this [ 4]; this [ 4] = tmp; + tmp = this [ 2]; this [ 2] = this [ 8]; this [ 8] = tmp; + tmp = this [ 3]; this [ 3] = this [12]; this [12] = tmp; + tmp = this [ 6]; this [ 6] = this [ 9]; this [ 9] = tmp; + tmp = this [ 7]; this [ 7] = this [13]; this [13] = tmp; + tmp = this [11]; this [11] = this [14]; this [14] = tmp; + + return this; + }, + inverse () + { + const + { 0: m00, 1: m01, 2: m02, 3: m03, 4: m04, 5: m05, 6: m06, 7: m07, + 8: m08, 9: m09, 10: m10, 11: m11, 12: m12, 13: m13, 14: m14, 15: m15 } = this, + b = m10 * m15, + c = m14 * m11, + d = m06 * m15, + e = m14 * m07, + f = m06 * m11, + g = m10 * m07, + h = m02 * m15, + i = m14 * m03, + j = m02 * m11, + o = m10 * m03, + r = m02 * m07, + x = m06 * m03, + t = m08 * m13, + p = m12 * m09, + v = m04 * m13, + s = m12 * m05, + y = m04 * m09, + z = m08 * m05, + A = m00 * m13, + C = m12 * m01, + D = m00 * m09, + E = m08 * m01, + F = m00 * m05, + G = m04 * m01, + H = b * m05 + e * m09 + f * m13 - ((c * m05) + (d * m09) + (g * m13)), + I = c * m01 + h * m09 + o * m13 - ((b * m01) + (i * m09) + (j * m13)), + J = d * m01 + i * m05 + r * m13 - ((e * m01) + (h * m05) + (x * m13)), + K = g * m01 + j * m05 + x * m09 - ((f * m01) + (o * m05) + (r * m09)); + + let B = m00 * H + m04 * I + m08 * J + m12 * K; + + // if (B === 0) ... determinant is zero. + + B = 1 / B; + + this [ 0] = B * H; + this [ 1] = B * I; + this [ 2] = B * J; + this [ 3] = B * K; + this [ 4] = B * (c * m04 + d * m08 + g * m12 - (b * m04) - (e * m08) - (f * m12)); + this [ 5] = B * (b * m00 + i * m08 + j * m12 - (c * m00) - (h * m08) - (o * m12)); + this [ 6] = B * (e * m00 + h * m04 + x * m12 - (d * m00) - (i * m04) - (r * m12)); + this [ 7] = B * (f * m00 + o * m04 + r * m08 - (g * m00) - (j * m04) - (x * m08)); + this [ 8] = B * (t * m07 + s * m11 + y * m15 - (p * m07) - (v * m11) - (z * m15)); + this [ 9] = B * (p * m03 + A * m11 + E * m15 - (t * m03) - (C * m11) - (D * m15)); + this [10] = B * (v * m03 + C * m07 + F * m15 - (s * m03) - (A * m07) - (G * m15)); + this [11] = B * (z * m03 + D * m07 + G * m11 - (y * m03) - (E * m07) - (F * m11)); + this [12] = B * (v * m10 + z * m14 + p * m06 - (y * m14) - (t * m06) - (s * m10)); + this [13] = B * (D * m14 + t * m02 + C * m10 - (A * m10) - (E * m14) - (p * m02)); + this [14] = B * (A * m06 + G * m14 + s * m02 - (F * m14) - (v * m02) - (C * m06)); + this [15] = B * (F * m10 + y * m02 + E * m06 - (D * m06) - (G * m10) - (z * m02)); + + return this; + }, + multLeft (matrix) + { + const + { 0: a00, 1: a01, 2: a02, 3: a03, 4: a04, 5: a05, 6: a06, 7: a07, + 8: a08, 9: a09, 10: a10, 11: a11, 12: a12, 13: a13, 14: a14, 15: a15 } = this, + { 0: b00, 1: b01, 2: b02, 3: b03, 4: b04, 5: b05, 6: b06, 7: b07, + 8: b08, 9: b09, 10: b10, 11: b11, 12: b12, 13: b13, 14: b14, 15: b15 } = matrix; + + this [ 0] = a00 * b00 + a04 * b01 + a08 * b02 + a12 * b03; + this [ 1] = a01 * b00 + a05 * b01 + a09 * b02 + a13 * b03; + this [ 2] = a02 * b00 + a06 * b01 + a10 * b02 + a14 * b03; + this [ 3] = a03 * b00 + a07 * b01 + a11 * b02 + a15 * b03; + this [ 4] = a00 * b04 + a04 * b05 + a08 * b06 + a12 * b07; + this [ 5] = a01 * b04 + a05 * b05 + a09 * b06 + a13 * b07; + this [ 6] = a02 * b04 + a06 * b05 + a10 * b06 + a14 * b07; + this [ 7] = a03 * b04 + a07 * b05 + a11 * b06 + a15 * b07; + this [ 8] = a00 * b08 + a04 * b09 + a08 * b10 + a12 * b11; + this [ 9] = a01 * b08 + a05 * b09 + a09 * b10 + a13 * b11; + this [10] = a02 * b08 + a06 * b09 + a10 * b10 + a14 * b11; + this [11] = a03 * b08 + a07 * b09 + a11 * b10 + a15 * b11; + this [12] = a00 * b12 + a04 * b13 + a08 * b14 + a12 * b15; + this [13] = a01 * b12 + a05 * b13 + a09 * b14 + a13 * b15; + this [14] = a02 * b12 + a06 * b13 + a10 * b14 + a14 * b15; + this [15] = a03 * b12 + a07 * b13 + a11 * b14 + a15 * b15; + + return this; + }, + multRight (matrix) + { + const + { 0: a00, 1: a01, 2: a02, 3: a03, 4: a04, 5: a05, 6: a06, 7: a07, + 8: a08, 9: a09, 10: a10, 11: a11, 12: a12, 13: a13, 14: a14, 15: a15 } = this, + { 0: b00, 1: b01, 2: b02, 3: b03, 4: b04, 5: b05, 6: b06, 7: b07, + 8: b08, 9: b09, 10: b10, 11: b11, 12: b12, 13: b13, 14: b14, 15: b15 } = matrix; + + this [ 0] = a00 * b00 + a01 * b04 + a02 * b08 + a03 * b12; + this [ 1] = a00 * b01 + a01 * b05 + a02 * b09 + a03 * b13; + this [ 2] = a00 * b02 + a01 * b06 + a02 * b10 + a03 * b14; + this [ 3] = a00 * b03 + a01 * b07 + a02 * b11 + a03 * b15; + this [ 4] = a04 * b00 + a05 * b04 + a06 * b08 + a07 * b12; + this [ 5] = a04 * b01 + a05 * b05 + a06 * b09 + a07 * b13; + this [ 6] = a04 * b02 + a05 * b06 + a06 * b10 + a07 * b14; + this [ 7] = a04 * b03 + a05 * b07 + a06 * b11 + a07 * b15; + this [ 8] = a08 * b00 + a09 * b04 + a10 * b08 + a11 * b12; + this [ 9] = a08 * b01 + a09 * b05 + a10 * b09 + a11 * b13; + this [10] = a08 * b02 + a09 * b06 + a10 * b10 + a11 * b14; + this [11] = a08 * b03 + a09 * b07 + a10 * b11 + a11 * b15; + this [12] = a12 * b00 + a13 * b04 + a14 * b08 + a15 * b12; + this [13] = a12 * b01 + a13 * b05 + a14 * b09 + a15 * b13; + this [14] = a12 * b02 + a13 * b06 + a14 * b10 + a15 * b14; + this [15] = a12 * b03 + a13 * b07 + a14 * b11 + a15 * b15; + + return this; + }, + multVecMatrix (vector) + { + if (vector .length === 3) + { + const + { x, y, z } = vector, + w = 1 / (x * this [3] + y * this [7] + z * this [11] + this [15]); + + vector .x = (x * this [0] + y * this [4] + z * this [ 8] + this [12]) * w; + vector .y = (x * this [1] + y * this [5] + z * this [ 9] + this [13]) * w; + vector .z = (x * this [2] + y * this [6] + z * this [10] + this [14]) * w; + + return vector; + } + else + { + const { x, y, z, w } = vector; + + vector .x = x * this [0] + y * this [4] + z * this [ 8] + w * this [12]; + vector .y = x * this [1] + y * this [5] + z * this [ 9] + w * this [13]; + vector .z = x * this [2] + y * this [6] + z * this [10] + w * this [14]; + vector .w = x * this [3] + y * this [7] + z * this [11] + w * this [15]; + + return vector; + } + }, + multMatrixVec (vector) + { + if (vector .length === 3) + { + const + { x, y, z } = vector, + w = 1 / (x * this [12] + y * this [13] + z * this [14] + this [15]); + + vector .x = (x * this [0] + y * this [1] + z * this [ 2] + this [ 3]) * w; + vector .y = (x * this [4] + y * this [5] + z * this [ 6] + this [ 7]) * w; + vector .z = (x * this [8] + y * this [9] + z * this [10] + this [11]) * w; + + return vector; + } + else + { + const { x, y, z, w } = vector; + + vector .x = x * this [ 0] + y * this [ 1] + z * this [ 2] + w * this [ 3]; + vector .y = x * this [ 4] + y * this [ 5] + z * this [ 6] + w * this [ 7]; + vector .z = x * this [ 8] + y * this [ 9] + z * this [10] + w * this [11]; + vector .w = x * this [12] + y * this [13] + z * this [14] + w * this [15]; + + return vector; + } + }, + multDirMatrix (vector) + { + const { x, y, z } = vector; + + vector .x = x * this [0] + y * this [4] + z * this [ 8]; + vector .y = x * this [1] + y * this [5] + z * this [ 9]; + vector .z = x * this [2] + y * this [6] + z * this [10]; + + return vector; + }, + multMatrixDir (vector) + { + const { x, y, z } = vector; + + vector .x = x * this [0] + y * this [1] + z * this [ 2]; + vector .y = x * this [4] + y * this [5] + z * this [ 6]; + vector .z = x * this [8] + y * this [9] + z * this [10]; + + return vector; + }, + identity () + { + this [ 0] = 1; this [ 1] = 0; this [ 2] = 0; this [ 3] = 0; + this [ 4] = 0; this [ 5] = 1; this [ 6] = 0; this [ 7] = 0; + this [ 8] = 0; this [ 9] = 0; this [10] = 1; this [11] = 0; + this [12] = 0; this [13] = 0; this [14] = 0; this [15] = 1; + + return this; + }, + translate (translation) + { + const { x, y, z } = translation; + + this [12] += this [ 0] * x + this [ 4] * y + this [ 8] * z; + this [13] += this [ 1] * x + this [ 5] * y + this [ 9] * z; + this [14] += this [ 2] * x + this [ 6] * y + this [10] * z; + + return this; + }, + rotate (rotation) + { + return this .multLeft (Matrix4_m .setQuaternion (rotation .getQuaternion (q))); + }, + scale (scale) + { + const { x, y, z } = scale; + + this [ 0] *= x; + this [ 4] *= y; + this [ 8] *= z; + + this [ 1] *= x; + this [ 5] *= y; + this [ 9] *= z; + + this [ 2] *= x; + this [ 6] *= y; + this [10] *= z; + + return this; + }, + toString () + { + return Array .prototype .join .call (this, " "); + }, +}); + +Object .defineProperties (Matrix4_Matrix4 .prototype, +{ + order: { value: 4 }, + length: { value: 16 }, + x: + { + get: (() => + { + const vector = new Numbers_Vector4 (0, 0, 0, 0); + + return function () { return vector .set (this [0], this [1], this [2], this [3]); }; + })(), + }, + y: + { + get: (() => + { + const vector = new Numbers_Vector4 (0, 0, 0, 0); + + return function () { return vector .set (this [4], this [5], this [6], this [7]); }; + })(), + }, + z: + { + get: (() => + { + const vector = new Numbers_Vector4 (0, 0, 0, 0); + + return function () { return vector .set (this [8], this [9], this [10], this [11]); }; + })(), + }, + w: + { + get: (() => + { + const vector = new Numbers_Vector4 (0, 0, 0, 0); + + return function () { return vector .set (this [12], this [13], this [14], this [15]); }; + })(), + }, + xAxis: + { + get: (() => + { + const vector = new Numbers_Vector3 (0, 0, 0); + + return function () { return vector .set (this [0], this [1], this [2]); }; + })(), + }, + yAxis: + { + get: (() => + { + const vector = new Numbers_Vector3 (0, 0, 0); + + return function () { return vector .set (this [4], this [5], this [6]); }; + })(), + }, + zAxis: + { + get: (() => + { + const vector = new Numbers_Vector3 (0, 0, 0); + + return function () { return vector .set (this [8], this [9], this [10]); }; + })(), + }, + origin: + { + get: (() => + { + const vector = new Numbers_Vector3 (0, 0, 0); + + return function () { return vector .set (this [12], this [13], this [14]); }; + })(), + }, + submatrix: + { + get: (() => + { + const matrix = new Numbers_Matrix3 (); + + return function () + { + matrix [0] = this [0]; matrix [1] = this [1]; matrix [2] = this [ 2]; + matrix [3] = this [4]; matrix [4] = this [5]; matrix [5] = this [ 6]; + matrix [6] = this [8]; matrix [7] = this [9]; matrix [8] = this [10]; + return matrix; + }; + })(), + }, +}); + +Object .assign (Matrix4_Matrix4, +{ + Identity: new Matrix4_Matrix4 (), + Rotation (rotation) + { + return Object .create (this .prototype) .setQuaternion (rotation .getQuaternion (q)); + }, + Quaternion (quaternion) + { + return Object .create (this .prototype) .setQuaternion (quaternion); + }, + Matrix3 (matrix) + { + return new Matrix4_Matrix4 (matrix [0], matrix [1], 0, 0, + matrix [3], matrix [4], 0, 0, + 0, 0, 1, 0, + matrix [6], matrix [7], 0, 1); + }, + SubMatrix (matrix) + { + return new Matrix4_Matrix4 (matrix [0], matrix [1], matrix [2], 0, + matrix [3], matrix [4], matrix [5], 0, + matrix [6], matrix [7], matrix [8], 0, + 0, 0, 0, 1); + }, +}); + +const + q = new Numbers_Quaternion (), + Matrix4_m = new Matrix4_Matrix4 (); + +const Matrix4_default_ = Matrix4_Matrix4; +; + +x_ite_Namespace .add ("Matrix4", "standard/Math/Numbers/Matrix4", Matrix4_default_); +/* harmony default export */ const Numbers_Matrix4 = (Matrix4_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields/SFMatrix4.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + +function SFMatrix4Template (TypeName, SFVec3, double) +{ + function SFMatrix4 (m00, m01, m02, m03, + m10, m11, m12, m13, + m20, m21, m22, m23, + m30, m31, m32, m33) + { + switch (arguments .length) + { + case 0: + Base_X3DField .call (this, new Numbers_Matrix4 ()); + break; + + case 1: + Base_X3DField .call (this, arguments [0]); + break; + + case 4: + { + const + r0 = arguments [0], + r1 = arguments [1], + r2 = arguments [2], + r3 = arguments [3]; + + Base_X3DField .call (this, new Numbers_Matrix4 (r0 .x, r0 .y, r0 .z, r0 .w, + r1 .x, r1 .y, r1 .z, r1 .w, + r2 .x, r2 .y, r2 .z, r2 .w, + r3 .x, r3 .y, r3 .z, r3 .w)); + + break; + } + case 16: + { + Base_X3DField .call (this, new Numbers_Matrix4 (+m00, +m01, +m02, +m03, + +m10, +m11, +m12, +m13, + +m20, +m21, +m22, +m23, + +m30, +m31, +m32, +m33)); + + break; + } + default: + throw new Error ("Invalid arguments."); + } + } + + Fields_SFMatrixPrototypeTemplate (SFMatrix4, TypeName, Numbers_Matrix4, SFVec3, double); + + for (const key of Object .keys (SFMatrix4 .prototype)) + Object .defineProperty (SFMatrix4 .prototype, key, { enumerable: false }); + + function defineProperty (i) + { + Object .defineProperty (SFMatrix4 .prototype, i, + { + get () + { + return this .getValue () [i]; + }, + set (value) + { + this .getValue () [i] = value; + this .addEvent (); + }, + enumerable: true, + }); + } + + for (let i = 0, length = Numbers_Matrix4 .prototype .length; i < length; ++ i) + defineProperty (i); + + return SFMatrix4; +} + +const SFMatrix4 = { + SFMatrix4d: SFMatrix4Template ("SFMatrix4d", Fields_SFVec3 .SFVec3d, true), + SFMatrix4f: SFMatrix4Template ("SFMatrix4f", Fields_SFVec3 .SFVec3f, false), + VrmlMatrix: SFMatrix4Template ("VrmlMatrix", Fields_SFVec3 .SFVec3f, false), +}; + +const SFMatrix4_default_ = SFMatrix4; +; + +x_ite_Namespace .add ("SFMatrix4", "x_ite/Fields/SFMatrix4", SFMatrix4_default_); +/* harmony default export */ const Fields_SFMatrix4 = (SFMatrix4_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields/SFNodeCache.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +const cache = new WeakMap (); + +const SFNodeCache = DEVELOPMENT ? +{ + get (baseNode) + { + const node = cache .get (baseNode) ?.deref (); + + if (node) + { + return node; + } + else + { + const node = new Fields_SFNode (baseNode); + + node .dispose = dispose; + + cache .set (baseNode, new WeakRef (node)); + + return node; + } + }, +} : +{ + get (baseNode) + { + const node = cache .get (baseNode); + + if (node) + { + return node; + } + else + { + const node = new Fields_SFNode (baseNode); + + node .dispose = dispose; + + cache .set (baseNode, node); + + return node; + } + }, +}; + +function dispose () +{ + const value = this .getValue (); + + value ?.dispose (); + + Fields_SFNode .prototype .dispose .call (this); + + cache .delete (value); +} + +const SFNodeCache_default_ = SFNodeCache; +; + +x_ite_Namespace .add ("SFNodeCache", "x_ite/Fields/SFNodeCache", SFNodeCache_default_); +/* harmony default export */ const Fields_SFNodeCache = (SFNodeCache_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields/SFNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + +const + _target = Symbol (), + _proxy = Symbol (); + +const SFNode_handler = +{ + get (target, key) + { + try + { + const value = target [key]; + + if (value !== undefined) + return value; + + const + node = target .getValue (), + field = node .getField (key), + accessType = field .getAccessType (); + + // Specification conform would be: accessType & X3DConstants .outputOnly. + // But we allow read access to plain fields, too. + if (accessType === Base_X3DConstants .inputOnly) + return undefined; + + return field .valueOf (); + } + catch + { + return undefined; + } + }, + set (target, key, value) + { + if (key in target) + { + target [key] = value; + return true; + } + + try + { + const + node = target .getValue (), + field = node .getField (key), + accessType = field .getAccessType (); + + if (accessType !== Base_X3DConstants .outputOnly) + field .setValue (value); + + return true; + } + catch (error) + { + console .error (target, key, error); + return false; + } + }, + has (target, key) + { + try + { + return !! target .getValue () .getField (key); + } + catch + { + return key in target; + } + }, + ownKeys (target) + { + const + value = target .getValue (), + ownKeys = [ ]; + + if (value) + { + for (const fieldDefinition of value .getFieldDefinitions ()) + ownKeys .push (fieldDefinition .name); + } + + return ownKeys; + }, + getOwnPropertyDescriptor (target, key) + { + const value = target .getValue (); + + if (value) + { + const fieldDefinition = value .getFieldDefinitions () .get (key); + + if (fieldDefinition) + { + return { + value: this .get (target, key), + writable: fieldDefinition .accessType !== Base_X3DConstants .outputOnly, + enumerable: true, + configurable: true, + }; + } + } + }, +}; + +function SFNode (value) +{ + // Node need to test for X3DBaseNode, because there is a special version of SFNode in Script. + + const proxy = new Proxy (this, SFNode_handler); + + this [_target] = this; + this [_proxy] = proxy; + + if (value) + { + value .addParent (proxy); + + Base_X3DField .call (this, value); + } + else + { + Base_X3DField .call (this, null); + } + + return proxy; +} + +Object .assign (Object .setPrototypeOf (SFNode .prototype, Base_X3DField .prototype), +{ + [_target]: null, + [_proxy]: null, + copy (instance) + { + const + target = this [_target], + value = target .getValue (); + + if (value) + return new SFNode (instance ? value .copy (instance) : value); + + return new SFNode (); + }, + equals (node) + { + const target = this [_target]; + + if (node) + return target .getValue () === node .getValue (); + + return target .getValue () === null; + }, + isDefaultValue () + { + const target = this [_target]; + + return target .getValue () === null; + }, + set (value) + { + const + target = this [_target], + current = target .getValue (); + + if (current) + current .removeParent (target [_proxy]); + + // No need to test for X3DBaseNode, because there is a special version of SFNode in Script. + + if (value) + { + value .addParent (target [_proxy]); + + Base_X3DField .prototype .set .call (target, value); + } + else + { + Base_X3DField .prototype .set .call (target, null); + } + }, + getNodeTypeName () + { + const + target = this [_target], + value = target .getValue (); + + if (value) + return value .getTypeName (); + + throw new Error ("SFNode.getNodeTypeName: node is null."); + }, + getNodeName () + { + const + target = this [_target], + value = target .getValue (); + + if (value) + return value .getName (); + + throw new Error ("SFNode.getNodeName: node is null."); + }, + getNodeDisplayName () + { + const + target = this [_target], + value = target .getValue (); + + if (value) + return value .getDisplayName (); + + throw new Error ("SFNode.getNodeDisplayName: node is null."); + }, + getNodeType () + { + const + target = this [_target], + value = target .getValue (); + + if (value) + return Array .from (value .getType ()); + + throw new Error ("SFNode.getNodeType: node is null."); + }, + getFieldDefinitions () + { + const + target = this [_target], + value = target .getValue (); + + if (value) + return value .getFieldDefinitions (); + + throw new Error ("SFNode.getFieldDefinitions: node is null."); + }, + getField (name) + { + const + target = this [_target], + value = target .getValue (); + + if (value) + return value .getField (name); + + throw new Error ("SFNode is disposed.") + }, + addFieldCallback (name, key, object) + { + const target = this [_target]; + + switch (arguments .length) + { + case 2: + { + return Base_X3DField .prototype .addFieldCallback .apply (target, arguments); + } + case 3: + { + const value = target .getValue (); + + if (value) + return value .getField (name) .addFieldCallback (key, object); + + throw new Error ("SFNode.addFieldCallback: node is null."); + } + } + }, + removeFieldCallback (name, key) + { + const target = this [_target]; + + switch (arguments .length) + { + case 1: + { + return Base_X3DField .prototype .removeFieldCallback .apply (target, arguments); + } + case 2: + { + const value = target .getValue (); + + if (value) + return value .getField (name) .removeFieldCallback (key); + + throw new Error ("SFNode.removeFieldCallback: node is null."); + } + } + }, + getNodeUserData (key) + { + const value = this [_target] .getValue (); + + if (value) + return value .getUserData (key); + + throw new Error ("SFNode.getNodeUserData: node is null."); + }, + setNodeUserData (key, data) + { + const value = this [_target] .getValue (); + + if (value) + return value .setUserData (key, data); + + throw new Error ("SFNode.setNodeUserData: node is null."); + }, + removeNodeUserData (key) + { + const value = this [_target] .getValue (); + + if (value) + return value .removeUserData (key); + + throw new Error ("SFNode.removeNodeUserData: node is null."); + }, + valueOf () + { + const + target = this [_target], + value = target .getValue (); + + return value ? Fields_SFNodeCache .get (value) : null; + }, + toStream (generator) + { + const + target = this [_target], + value = target .getValue (); + + if (value) + value .toStream (generator); + else + generator .string += "NULL"; + }, + toVRMLStream (generator) + { + const + target = this [_target], + value = target .getValue (); + + if (value) + value .toVRMLStream (generator); + else + generator .string += "NULL"; + }, + toXMLStream (generator) + { + const + target = this [_target], + value = target .getValue (); + + if (value) + value .toXMLStream (generator); + else + generator .string += ""; + }, + toJSONStream (generator) + { + this .toJSONStreamValue (generator); + }, + toJSONStreamValue (generator) + { + const + target = this [_target], + value = target .getValue (); + + if (value) + value .toJSONStream (generator); + else + generator .string += "null"; + }, + dispose () + { + const target = this [_target]; + + target .set (null); + target .processInterests (); + + Base_X3DField .prototype .dispose .call (target); + }, +}); + +for (const key of Object .keys (SFNode .prototype)) + Object .defineProperty (SFNode .prototype, key, { enumerable: false }); + +Object .defineProperties (SFNode, +{ + typeName: + { + value: "SFNode", + enumerable: true, + }, +}); + +const SFNode_default_ = SFNode; +; + +x_ite_Namespace .add ("SFNode", "x_ite/Fields/SFNode", SFNode_default_); +/* harmony default export */ const Fields_SFNode = (SFNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields/SFRotation.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + +const + SFVec3d = Fields_SFVec3 .SFVec3d, + SFVec3f = Fields_SFVec3 .SFVec3f, + SFMatrix3d = Fields_SFMatrix3 .SFMatrix3d, + SFMatrix3f = Fields_SFMatrix3 .SFMatrix3f; + +function SFRotation (x, y, z, angle) +{ + switch (arguments .length) + { + case 0: + { + Base_X3DField .call (this, new Numbers_Rotation4 ()); + break; + } + case 1: + { + if ((arguments [0] instanceof SFMatrix3d) || (arguments [0] instanceof SFMatrix3f)) + { + Base_X3DField .call (this, new Numbers_Rotation4 () .setMatrix (arguments [0] .getValue ())); + break; + } + + Base_X3DField .call (this, arguments [0]); + break; + } + case 2: + { + if ((arguments [1] instanceof SFVec3d) || (arguments [1] instanceof SFVec3f)) + { + Base_X3DField .call (this, new Numbers_Rotation4 (arguments [0] .getValue (), arguments [1] .getValue ())); + break; + } + + Base_X3DField .call (this, new Numbers_Rotation4 (arguments [0] .getValue (), +arguments [1])); + break; + } + case 4: + { + Base_X3DField .call (this, new Numbers_Rotation4 (+x, +y, +z, +angle)); + break; + } + default: + throw new Error ("Invalid arguments."); + } +} + +Object .assign (Object .setPrototypeOf (SFRotation .prototype, Base_X3DField .prototype), +{ + *[Symbol .iterator] () + { + yield* this .getValue (); + }, + copy () + { + return new SFRotation (this .getValue () .copy ()); + }, + equals (rotation) + { + return this .getValue () .equals (rotation .getValue ()); + }, + isDefaultValue () + { + return this .getValue () .equals (Numbers_Rotation4 .Identity); + }, + set (value) + { + this .getValue () .assign (value); + }, + setAxis (vector) + { + this .getValue () .setAxis (vector .getValue ()); + this .addEvent (); + }, + getAxis () + { + return new SFVec3f (this .getValue () .getAxis ()); + }, + setMatrix (matrix) + { + this .getValue () .setMatrix (matrix .getValue ()); + this .addEvent (); + }, + getMatrix () + { + return new SFMatrix3f (this .getValue () .getMatrix ()); + }, + inverse () + { + return new SFRotation (this .getValue () .copy () .inverse ()); + }, + multiply (rotation) + { + return new SFRotation (this .getValue () .copy () .multRight (rotation .getValue ())); + }, + multVec (vector) + { + return new (vector .constructor) (this .getValue () .multVecRot (vector .getValue () .copy ())); + }, + slerp (rotation, t) + { + return new SFRotation (this .getValue () .copy () .slerp (rotation .getValue (), t)); + }, + toStream (generator) + { + const { x, y, z, angle } = this .getValue (); + + generator .string += generator .DoubleFormat (x); + generator .string += generator .Space (); + generator .string += generator .DoubleFormat (y); + generator .string += generator .Space (); + generator .string += generator .DoubleFormat (z); + generator .string += generator .Space (); + generator .string += generator .DoubleFormat (generator .ToUnit ("angle", angle)); + }, + toVRMLStream (generator) + { + this .toStream (generator); + }, + toXMLStream (generator) + { + this .toStream (generator); + }, + toJSONStream (generator) + { + generator .string += '['; + generator .string += generator .TidySpace (); + + this .toJSONStreamValue (generator); + + generator .string += generator .TidySpace (); + generator .string += ']'; + }, + toJSONStreamValue (generator) + { + const { x, y, z, angle } = this .getValue (); + + generator .string += generator .JSONNumber (generator .DoubleFormat (x)); + generator .string += ','; + generator .string += generator .TidySpace (); + generator .string += generator .JSONNumber (generator .DoubleFormat (y)); + generator .string += ','; + generator .string += generator .TidySpace (); + generator .string += generator .JSONNumber (generator .DoubleFormat (z)); + generator .string += ','; + generator .string += generator .TidySpace (); + generator .string += generator .JSONNumber (generator .DoubleFormat (generator .ToUnit ("angle", angle))); + }, +}); + +for (const key of Object .keys (SFRotation .prototype)) + Object .defineProperty (SFRotation .prototype, key, { enumerable: false }); + +const SFRotation_x = { + get () + { + return this .getValue () .x; + }, + set (value) + { + this .getValue () .x = +value; + this .addEvent (); + }, +}; + +const SFRotation_y = { + get () + { + return this .getValue () .y; + }, + set (value) + { + this .getValue () .y = +value; + this .addEvent (); + }, +}; + +const SFRotation_z = { + get () + { + return this .getValue () .z; + }, + set (value) + { + this .getValue () .z = +value; + this .addEvent (); + }, +}; + +const SFRotation_angle = { + get () + { + return this .getValue () .angle; + }, + set (value) + { + this .getValue () .angle = +value; + this .addEvent (); + }, +}; + +Object .defineProperties (SFRotation .prototype, +{ + 0: SFRotation_x, + 1: SFRotation_y, + 2: SFRotation_z, + 3: SFRotation_angle, + x: Object .assign ({ enumerable: true }, SFRotation_x), + y: Object .assign ({ enumerable: true }, SFRotation_y), + z: Object .assign ({ enumerable: true }, SFRotation_z), + angle: Object .assign ({ enumerable: true }, SFRotation_angle), +}); + +Object .defineProperties (SFRotation, +{ + typeName: + { + value: "SFRotation", + enumerable: true, + }, +}); + +const SFRotation_default_ = SFRotation; +; + +x_ite_Namespace .add ("SFRotation", "x_ite/Fields/SFRotation", SFRotation_default_); +/* harmony default export */ const Fields_SFRotation = (SFRotation_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields/SFString.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function SFString (value) +{ + Base_X3DField .call (this, arguments .length ? String (value) : ""); +} + +Object .assign (Object .setPrototypeOf (SFString .prototype, Base_X3DField .prototype), +{ + *[Symbol .iterator] () + { + yield* this .getValue (); + }, + copy () + { + return new SFString (this .getValue ()); + }, + isDefaultValue () + { + return this .getValue () === ""; + }, + set (value) + { + Base_X3DField .prototype .set .call (this, String (value)); + }, + valueOf: Base_X3DField .prototype .getValue, + toStream (generator) + { + generator .string += '"'; + generator .string += SFString .escape (this .getValue ()); + generator .string += '"'; + }, + toVRMLStream (generator) + { + this .toStream (generator); + }, + toXMLStream (generator, sourceText = false) + { + generator .string += sourceText + ? generator .XMLEncodeSourceText (this .getValue ()) + : generator .XMLEncode (this .getValue ()); + }, + toJSONStream (generator) + { + this .toJSONStreamValue (generator) + }, + toJSONStreamValue (generator) + { + generator .string += '"'; + generator .string += generator .JSONEncode (this .getValue ()); + generator .string += '"'; + }, +}); + +for (const key of Object .keys (SFString .prototype)) + Object .defineProperty (SFString .prototype, key, { enumerable: false }); + +Object .defineProperty (SFString .prototype, "length", +{ + get () + { + return this .getValue () .length; + }, +}); + +Object .defineProperties (SFString, +{ + typeName: + { + value: "SFString", + enumerable: true, + }, +}); + +Object .assign (SFString, +{ + unescape (string) + { + return string .replace (/\\([\\"])/g, "$1"); + }, + escape (string) + { + return string .replace (/([\\"])/g, "\\$1"); + }, +}); + +const SFString_default_ = SFString; +; + +x_ite_Namespace .add ("SFString", "x_ite/Fields/SFString", SFString_default_); +/* harmony default export */ const Fields_SFString = (SFString_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields/SFTime.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function SFTime (value) +{ + Base_X3DField .call (this, arguments .length ? +value : 0); +} + +Object .assign (Object .setPrototypeOf (SFTime .prototype, Base_X3DField .prototype), +{ + copy () + { + return new SFTime (this .getValue ()); + }, + isDefaultValue () + { + return this .getValue () === 0; + }, + set (value) + { + Base_X3DField .prototype .set .call (this, +value); + }, + valueOf: Base_X3DField .prototype .getValue, + toStream (generator) + { + generator .string += this .getValue (); + }, + toVRMLStream (generator) + { + this .toStream (generator); + }, + toXMLStream (generator) + { + this .toStream (generator); + }, + toJSONStream (generator) + { + this .toJSONStreamValue (generator); + }, + toJSONStreamValue (generator) + { + generator .string += generator .JSONNumber (generator .DoubleFormat (this .getValue ())); + }, +}); + +for (const key of Object .keys (SFTime .prototype)) + Object .defineProperty (SFTime .prototype, key, { enumerable: false }); + +Object .defineProperties (SFTime, +{ + typeName: + { + value: "SFTime", + enumerable: true, + }, +}); + +const SFTime_default_ = SFTime; +; + +x_ite_Namespace .add ("SFTime", "x_ite/Fields/SFTime", SFTime_default_); +/* harmony default export */ const Fields_SFTime = (SFTime_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields/SFVec4.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function SFVec4Template (TypeName, double) +{ + function SFVec4 (x, y, z, w) + { + switch (arguments .length) + { + case 0: + Base_X3DField .call (this, new Numbers_Vector4 (0, 0, 0, 0)); + break; + + case 1: + Base_X3DField .call (this, arguments [0]); + break; + + case 4: + Base_X3DField .call (this, new Numbers_Vector4 (+x, +y, +z, +w)); + break; + + default: + throw new Error ("Invalid arguments."); + } + } + + Fields_SFVecPrototypeTemplate (SFVec4, TypeName, Numbers_Vector4, double); + + for (const key of Object .keys (SFVec4 .prototype)) + Object .defineProperty (SFVec4 .prototype, key, { enumerable: false }); + + const x = { + get () + { + return this .getValue () .x; + }, + set (value) + { + this .getValue () .x = +value; + this .addEvent (); + }, + }; + + const y = { + get () + { + return this .getValue () .y; + }, + set (value) + { + this .getValue () .y = +value; + this .addEvent (); + }, + }; + + const z = { + get () + { + return this .getValue () .z; + }, + set (value) + { + this .getValue () .z = +value; + this .addEvent (); + }, + }; + + const w = { + get () + { + return this .getValue () .w; + }, + set (value) + { + this .getValue () .w = +value; + this .addEvent (); + }, + }; + + Object .defineProperties (SFVec4 .prototype, + { + 0: x, + 1: y, + 2: z, + 3: w, + x: Object .assign ({ enumerable: true }, x), + y: Object .assign ({ enumerable: true }, y), + z: Object .assign ({ enumerable: true }, z), + w: Object .assign ({ enumerable: true }, w), + }); + + return SFVec4; +} + +const SFVec4 = { + SFVec4d: SFVec4Template ("SFVec4d", true), + SFVec4f: SFVec4Template ("SFVec4f", false), +}; + +const SFVec4_default_ = SFVec4; +; + +x_ite_Namespace .add ("SFVec4", "x_ite/Fields/SFVec4", SFVec4_default_); +/* harmony default export */ const Fields_SFVec4 = (SFVec4_default_); +;// CONCATENATED MODULE: ./src/x_ite/Base/X3DArrayField.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function X3DArrayField (value) +{ + Base_X3DField .call (this, value); +} + +Object .assign (Object .setPrototypeOf (X3DArrayField .prototype, Base_X3DField .prototype), +{ + // Implement all function also in TypedArray, if possible. + at: Array .prototype .at, + // concat: Array .prototype .concat, + // copyWithin: Array.prototype.copyWithin, + entries: Array .prototype .entries, + every: Array .prototype .every, + fill: Array .prototype .fill, + filter (/* callbackFn, thisArg */) + { + const array = new (this .constructor) (); + + for (const v of Array .prototype .filter .call (this, ... arguments)) + array .push (v); + + return array; + }, + find: Array .prototype .find, + findIndex: Array .prototype .findIndex, + findLast: Array .prototype .findLast, + findLastIndex: Array .prototype .findLastIndex, + // flat: Array .prototype .flat, + // flatMap: Array .prototype .flatMap, + forEach: Array .prototype .forEach, + includes: Array .prototype .includes, + indexOf: Array .prototype .indexOf, + join: Array .prototype .join, + keys: Array .prototype .keys, + lastIndexOf: Array .prototype .lastIndexOf, + map (/* callbackFn, thisArg */) + { + const array = new (this .constructor) (); + + for (const v of Array .prototype .map .call (this, ... arguments)) + array .push (v); + + return array; + }, + reduce: Array .prototype .reduce, + reduceRight: Array .prototype .reduceRight, + reverse: Array .prototype .reverse, + slice (/* start, end */) + { + const array = new (this .constructor) (); + + for (const v of Array .prototype .slice .call (this, ... arguments)) + array .push (v); + + return array; + }, + some: Array .prototype .some, + sort: Array .prototype .sort, + toReversed () + { + return this .copy () .reverse (); + }, + toSorted (/* compareFn */) + { + return this .copy () .sort (... arguments); + }, + toSpliced (/* start, deleteCount, ... insertValues */) + { + const copy = this .copy (); + + copy .splice (... arguments); + + return copy; + }, + values: Array .prototype .values, + with (index, value) + { + const copy = this .copy (); + + copy [index] = value; + + return copy; + }, +}); + +for (const key of Object .keys (X3DArrayField .prototype)) + Object .defineProperty (X3DArrayField .prototype, key, { enumerable: false }); + +const X3DArrayField_default_ = X3DArrayField; +; + +x_ite_Namespace .add ("X3DArrayField", "x_ite/Base/X3DArrayField", X3DArrayField_default_); +/* harmony default export */ const Base_X3DArrayField = (X3DArrayField_default_); +;// CONCATENATED MODULE: ./src/x_ite/Base/X3DObjectArrayField.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +const + X3DObjectArrayField_target = Symbol (), + X3DObjectArrayField_proxy = Symbol (), + _insert = Symbol (), + _erase = Symbol (); + +const X3DObjectArrayField_handler = +{ + get (target, key) + { + const value = target [key]; + + if (value !== undefined) + return value; + + if (typeof key === "string") + { + const + array = target .getValue (), + index = +key; + + if (Number .isInteger (index)) + { + if (index >= array .length) + target .resize (index + 1); + + return array [index] .valueOf (); + } + else + { + return target [key]; + } + } + }, + set (target, key, value) + { + if (key in target) + { + target [key] = value; + return true; + } + + const + array = target .getValue (), + index = +key; + + if (index >= array .length) + target .resize (index + 1); + + array [index] .setValue (value); + + return true; + }, + has (target, key) + { + if (Number .isInteger (+key)) + return key < target .getValue () .length; + + return key in target; + }, + ownKeys (target) + { + return Object .keys (target .getValue ()); + }, + getOwnPropertyDescriptor (target, key) + { + if (typeof key !== "string") + return; + + const index = +key; + + if (Number .isInteger (index) && index < target .getValue () .length) + return Object .getOwnPropertyDescriptor (target .getValue (), key); + }, +}; + +function X3DObjectArrayField (values) +{ + const proxy = new Proxy (this, X3DObjectArrayField_handler); + + Base_X3DArrayField .call (this, [ ]); + + this [X3DObjectArrayField_target] = this; + this [X3DObjectArrayField_proxy] = proxy; + + for (const value of values) + this .push (value); + + return proxy; +} + +Object .assign (Object .setPrototypeOf (X3DObjectArrayField .prototype, Base_X3DArrayField .prototype), +{ + [X3DObjectArrayField_target]: null, + [X3DObjectArrayField_proxy]: null, + *[Symbol .iterator] () + { + const + target = this [X3DObjectArrayField_target], + array = target .getValue (); + + for (const value of array) + yield value .valueOf (); + }, + getTarget () + { + return this [X3DObjectArrayField_target]; + }, + copy () + { + const + target = this [X3DObjectArrayField_target], + copy = target .create (); + + copy .assign (target); + copy .setModificationTime (0); + + return copy; + }, + equals (array) + { + const + target = this [X3DObjectArrayField_target], + a = target .getValue (), + b = array .getValue (), + length = a .length; + + if (a === b) + return true; + + if (length !== b .length) + return false; + + for (let i = 0; i < length; ++ i) + { + if (!a [i] .equals (b [i])) + return false; + } + + return true; + }, + isDefaultValue () + { + return this .length === 0; + }, + set (value) + { + const + target = this [X3DObjectArrayField_target], + array = target .getValue (), + newLength = value .length; + + target .resize (newLength, undefined, true); + + for (let i = 0; i < newLength; ++ i) + array [i] .set (value [i] instanceof Base_X3DField ? value [i] .getValue () : value [i]); + }, + setValue (value) + { + const target = this [X3DObjectArrayField_target]; + + target .set (value instanceof X3DObjectArrayField ? value .getValue () : value); + target .addEvent (); + }, + unshift (value) + { + const + target = this [X3DObjectArrayField_target], + array = target .getValue (); + + for (let i = arguments .length - 1; i >= 0; -- i) + { + const field = new (target .getSingleType ()) (); + + field .setValue (arguments [i]); + target .addChildObject (field); + array .unshift (field); + } + + target .addEvent (); + + return array .length; + }, + shift () + { + const + target = this [X3DObjectArrayField_target], + array = target .getValue (); + + if (array .length) + { + const + field = array .shift (), + result = field .valueOf (); + + target .removeChildObject (field); + target .addEvent (); + + return result; + } + }, + push (value) + { + const + target = this [X3DObjectArrayField_target], + array = target .getValue (); + + for (const argument of arguments) + { + const field = new (target .getSingleType ()) (); + + field .setValue (argument); + target .addChildObject (field); + array .push (field); + } + + target .addEvent (); + + return array .length; + }, + pop () + { + const + target = this [X3DObjectArrayField_target], + array = target .getValue (); + + if (array .length) + { + const + field = array .pop (), + result = field .valueOf (); + + target .removeChildObject (field); + target .addEvent (); + + return result; + } + }, + splice (index, deleteCount, ... insertValues) + { + const + target = this [X3DObjectArrayField_target], + array = target .getValue (), + length = array .length; + + if (arguments .length === 0) + return new (target .constructor) (); + + if (arguments .length < 2) + deleteCount = length; + + const result = target [_erase] (index, deleteCount); + + if (insertValues .length) + target [_insert] (index, insertValues); + + return result; + }, + [_insert] (index, array) + { + const + target = this [X3DObjectArrayField_target], + args = [ ]; + + for (const value of array) + { + const field = new (target .getSingleType ()) (); + + field .setValue (value); + target .addChildObject (field); + args .push (field); + } + + target .getValue () .splice (index, 0, ... args); + target .addEvent (); + }, + [_erase] (index, deleteCount) + { + const + target = this [X3DObjectArrayField_target], + values = target .getValue () .splice (index, deleteCount), + result = new (target .constructor) (); + + for (const value of values) + { + result .push (value); + target .removeChildObject (value); + } + + target .addEvent (); + + return result; + }, + resize (size, value, silently) + { + const + target = this [X3DObjectArrayField_target], + array = target .getValue (), + length = array .length; + + if (size < length) + { + for (let i = size; i < length; ++ i) + target .removeChildObject (array [i]); + + array .length = size; + + if (!silently) + target .addEvent (); + } + else if (size > length) + { + for (let i = length; i < size; ++ i) + { + const field = new (target .getSingleType ()) (); + + if (value !== undefined) + field .setValue (value); + + target .addChildObject (field); + array .push (field); + } + + if (!silently) + target .addEvent (); + } + }, + addChildObject (value) + { + value .addParent (this [X3DObjectArrayField_proxy]); + }, + removeChildObject (value) + { + value .removeParent (this [X3DObjectArrayField_proxy]); + value .dispose (); + }, + reverse () + { + const target = this [X3DObjectArrayField_target]; + + target .getValue () .reverse (); + target .addEvent (); + + return target [X3DObjectArrayField_proxy]; + }, + sort (compareFn) + { + const target = this [X3DObjectArrayField_target]; + + Array .prototype .sort .call (this, compareFn); + target .addEvent (); + + return target [X3DObjectArrayField_proxy]; + }, + toStream (generator) + { + const + target = this [X3DObjectArrayField_target], + array = target .getValue (); + + switch (array .length) + { + case 0: + { + generator .string += "["; + generator .string += generator .TidySpace (); + generator .string += "]"; + break; + } + case 1: + { + generator .PushUnitCategory (target .getUnit ()); + + array [0] .toStream (generator); + + generator .PopUnitCategory (); + break; + } + default: + { + generator .PushUnitCategory (target .getUnit ()); + + generator .string += "["; + generator .string += generator .ListStart (); + generator .IncIndent (); + + for (let i = 0, length = array .length - 1; i < length; ++ i) + { + generator .string += generator .ListIndent (); + array [i] .toStream (generator); + generator .string += generator .Comma (); + generator .string += generator .ListBreak (); + } + + generator .string += generator .ListIndent (); + array .at (-1) .toStream (generator); + + generator .string += generator .ListEnd (); + generator .DecIndent (); + generator .string += generator .ListIndent (); + generator .string += "]"; + + generator .PopUnitCategory (); + break; + } + } + }, + toVRMLStream (generator) + { + this .toStream (generator); + }, + toXMLStream (generator) + { + const + target = this [X3DObjectArrayField_target], + length = target .length; + + if (length) + { + const array = target .getValue (); + + generator .PushUnitCategory (target .getUnit ()); + + for (let i = 0, length = array .length - 1; i < length; ++ i) + { + array [i] .toXMLStream (generator); + generator .string += generator .Comma (); + generator .string += generator .TidySpace (); + } + + array .at (-1) .toXMLStream (generator); + + generator .PopUnitCategory (); + } + }, + toJSONStream (generator) + { + const + target = this [X3DObjectArrayField_target], + length = target .length; + + if (length) + { + const value = this .getValue (); + + generator .PushUnitCategory (target .getUnit ()); + + generator .string += '['; + generator .string += generator .ListBreak (); + generator .string += generator .IncIndent (); + + for (let i = 0, n = length - 1; i < n; ++ i) + { + generator .string += generator .ListIndent (); + + value [i] .toJSONStreamValue (generator); + + generator .string += ','; + generator .string += generator .ListBreak (); + } + + generator .string += generator .ListIndent (); + + value .at (-1) .toJSONStreamValue (generator); + + generator .string += generator .ListBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .ListIndent (); + generator .string += ']'; + + generator .PopUnitCategory (); + } + else + { + generator .string += '['; + generator .string += generator .TidySpace (); + generator .string += ']'; + } + }, +}); + +for (const key of Object .keys (X3DObjectArrayField .prototype)) + Object .defineProperty (X3DObjectArrayField .prototype, key, { enumerable: false }); + +Object .defineProperty (X3DObjectArrayField .prototype, "length", +{ + get () { return this [X3DObjectArrayField_target] .getValue () .length; }, + set (value) { this [X3DObjectArrayField_target] .resize (value); }, +}); + +const X3DObjectArrayField_default_ = X3DObjectArrayField; +; + +x_ite_Namespace .add ("X3DObjectArrayField", "x_ite/Base/X3DObjectArrayField", X3DObjectArrayField_default_); +/* harmony default export */ const Base_X3DObjectArrayField = (X3DObjectArrayField_default_); +;// CONCATENATED MODULE: ./src/x_ite/Base/X3DTypedArrayField.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +const + X3DTypedArrayField_target = Symbol (), + X3DTypedArrayField_proxy = Symbol (), + _cache = Symbol (), + _tmp = Symbol (), + _length = Symbol (), + X3DTypedArrayField_insert = Symbol (), + X3DTypedArrayField_erase = Symbol (), + _grow = Symbol (); + +const X3DTypedArrayField_handler = +{ + get (target, key) + { + const value = target [key]; + + if (value !== undefined) + return value; + + if (typeof key === "string") + { + const index = +key; + + if (Number .isInteger (index)) + { + const + components = target .getComponents (), + valueType = target .getValueType (); + + let array = target .getValue (); + + if (index >= target [_length]) + array = target .resize (index + 1); + + if (components === 1) + { + // Return native JavaScript value. + return valueType (array [index]); + } + else + { + // Return reference to index. + + return target [_cache] [index] + ?? (target [_cache] [index] = createValue (target, index, components, valueType)); + } + } + else + { + return target [key]; + } + } + }, + set (target, key, value) + { + if (key in target) + { + target [key] = value; + return true; + } + + const components = target .getComponents (); + + let + index = +key, + array = target .getValue (); + + if (index >= target [_length]) + array = target .resize (index + 1); + + if (components === 1) + { + const valueType = target .getValueType (); + + array [index] = valueType (value); + } + else + { + index *= components; + + for (let c = 0; c < components; ++ c, ++ index) + array [index] = value [c]; + } + + target .addEvent (); + + return true; + }, + has (target, key) + { + if (Number .isInteger (+key)) + return key < target [_length]; + + return key in target; + }, + ownKeys (target) + { + const ownKeys = [ ]; + + for (let i = 0, length = target [_length]; i < length; ++ i) + ownKeys .push (String (i)); + + return ownKeys; + }, + getOwnPropertyDescriptor (target, key) + { + if (typeof key !== "string") + return; + + const index = +key; + + if (Number .isInteger (index) && index < target [_length]) + return Object .getOwnPropertyDescriptor (target .getValue (), key); + }, +}; + +function X3DTypedArrayField (values) +{ + const proxy = new Proxy (this, X3DTypedArrayField_handler); + + Base_X3DArrayField .call (this, new (this .getArrayType ()) (16)); + + this [X3DTypedArrayField_target] = this; + this [X3DTypedArrayField_proxy] = proxy; + + if (this .getComponents () > 1) + { + this [_cache] = [ ]; // Cache of elements. + this [_tmp] = [ ]; // Array with components size. + } + + for (const value of values) + this .push (value); + + return proxy; +} + +Object .assign (Object .setPrototypeOf (X3DTypedArrayField .prototype, Base_X3DArrayField .prototype), +{ + [X3DTypedArrayField_target]: null, + [_tmp]: null, + [_length]: 0, + *[Symbol .iterator] () + { + const + target = this [X3DTypedArrayField_target], + array = target .getValue (), + components = target .getComponents (), + valueType = target .getValueType (), + length = target [_length]; + + if (components === 1) + { + // Return native JavaScript value. + + for (let index = 0; index < length; ++ index) + yield valueType (array [index]); + } + else + { + // Return reference to index. + + const cache = target [_cache]; + + for (let index = 0; index < length; ++ index) + { + yield cache [index] + ?? (cache [index] = createValue (target, index, components, valueType)); + } + } + }, + getTarget () + { + return this [X3DTypedArrayField_target]; + }, + copy () + { + const + target = this [X3DTypedArrayField_target], + array = target .getValue (), + copy = target .create (), + copyArray = new (target .getArrayType ()) (array); + + copy [_length] = target [_length]; + + Base_X3DArrayField .prototype .set .call (copy, copyArray); + + copy .setModificationTime (0); + + return copy; + }, + equals (other) + { + const + target = this [X3DTypedArrayField_target], + otherTarget = other [X3DTypedArrayField_target], + length = target [_length]; + + if (target === otherTarget) + return true; + + if (length !== otherTarget [_length]) + return false; + + const + a = target .getValue (), + b = otherTarget .getValue (); + + for (let i = 0, l = length * target .getComponents (); i < l; ++ i) + { + if (a [i] !== b [i]) + return false; + } + + return true; + }, + assign (value) + { + const target = this [X3DTypedArrayField_target]; + + target .set (value .getValue (), value .length); + target .addEvent (); + }, + set (otherArray /* value of field */, l /* length of field */) + { + const + target = this [X3DTypedArrayField_target], + components = target .getComponents (), + length = target [_length]; + + let + array = target .getValue (), + otherLength = l !== undefined ? l * components : otherArray .length; + + const + rest = otherLength % components; + + if (rest) + { + otherLength -= rest; + + console .warn (`Array length must be multiple of components size, which is ${components}.`); + } + + otherLength /= components; + + if (array .length < otherArray .length) + { + array = target [_grow] (otherArray .length); + + array .set (otherArray); + + if (rest) + array .fill (0, otherLength * components, otherLength * components + rest); + } + else + { + array .set (otherArray); + + if (otherLength < length) + array .fill (0, otherLength * components, length * components); + } + + target [_length] = otherLength; + }, + isDefaultValue () + { + return this [_length] === 0; + }, + setValue (value) + { + const target = this [X3DTypedArrayField_target]; + + if (value instanceof target .constructor) + { + target .assign (value); + } + else + { + target .set (value); + target .addEvent (); + } + }, + unshift (value) + { + const + target = this [X3DTypedArrayField_target], + components = target .getComponents (), + length = target [_length], + argumentsLength = arguments .length, + array = target [_grow] ((length + argumentsLength) * components); + + array .copyWithin (argumentsLength * components, 0, length * components); + + if (components === 1) + { + const valueType = target .getValueType (); + + for (let a = 0; a < argumentsLength; ++ a) + array [a] = valueType (arguments [a]); + } + else + { + for (let i = 0, a = 0; a < argumentsLength; ++ a) + { + const argument = arguments [a]; + + for (let c = 0; c < components; ++ c, ++ i) + { + array [i] = argument [c]; + } + } + } + + target [_length] += argumentsLength; + + target .addEvent (); + + return target [_length]; + }, + shift () + { + const + target = this [X3DTypedArrayField_target], + length = target [_length]; + + if (length) + { + const + array = target .getValue (), + components = target .getComponents (), + valueType = target .getValueType (), + newLength = length - 1; + + if (components === 1) + { + var value = valueType (array [0]); + } + else + { + const tmp = target [_tmp]; + + for (let c = 0; c < components; ++ c) + tmp [c] = array [c]; + + var value = new valueType (... tmp); + } + + array .copyWithin (0, components, length * components); + array .fill (0, components * newLength, length * components); + + target [_length] = newLength; + + target .addEvent (); + return value; + } + }, + push (value) + { + const + target = this [X3DTypedArrayField_target], + components = target .getComponents (), + length = target [_length], + argumentsLength = arguments .length, + array = target [_grow] ((length + argumentsLength) * components); + + if (components === 1) + { + const valueType = target .getValueType (); + + for (let a = 0, i = length; a < argumentsLength; ++ a, ++ i) + array [i] = valueType (arguments [a]); + } + else + { + for (let i = length * components, a = 0; a < argumentsLength; ++ a) + { + const argument = arguments [a]; + + for (let c = 0; c < components; ++ c, ++ i) + { + array [i] = argument [c]; + } + } + } + + target [_length] += argumentsLength; + + target .addEvent (); + + return target [_length]; + }, + pop () + { + const + target = this [X3DTypedArrayField_target], + length = target [_length]; + + if (length) + { + const + array = target .getValue (), + components = target .getComponents (), + valueType = target .getValueType (), + newLength = length - 1; + + if (components === 1) + { + var value = valueType (array [length - 1]); // Don't use at(-1). + } + else + { + const tmp = target [_tmp]; + + for (let c = 0, a = newLength * components; c < components; ++ c, ++ a) + tmp [c] = array [a]; + + var value = new valueType (... tmp); + } + + array .fill (0, newLength * components, length * components); + + target [_length] = newLength; + + target .addEvent (); + + return value; + } + }, + splice (index, deleteCount, ... insertValues) + { + const + target = this [X3DTypedArrayField_target], + length = target [_length]; + + if (arguments .length === 0) + return new (target .constructor) (); + + index = Math .min (index|0, length); + + if (arguments .length < 2) + deleteCount = length; + + deleteCount = deleteCount|0; + + if (index + deleteCount > length) + deleteCount = length - index; + + const result = target [X3DTypedArrayField_erase] (index, index + deleteCount); + + if (insertValues .length) + target [X3DTypedArrayField_insert] (index, insertValues); + + target .addEvent (); + + return result; + }, + [X3DTypedArrayField_insert] (index, other) + { + const + target = this [X3DTypedArrayField_target], + components = target .getComponents (), + length = target [_length], + otherLength = other .length, + array = target [_grow] ((length + otherLength) * components); + + index *= components; + + array .copyWithin (index + otherLength * components, index, length * components); + + if (components === 1) + { + const valueType = target .getValueType (); + + for (let a = 0, i = index; a < otherLength; ++ a, ++ i) + array [i] = valueType (other [a]); + } + else + { + for (let i = 0, a = index; i < otherLength; ++ i) + { + const value = other [i]; + + for (let c = 0; c < components; ++ c, ++ a) + array [a] = value [c]; + } + } + + target [_length] += otherLength; + }, + [X3DTypedArrayField_erase] (first, last) + { + const + target = this [X3DTypedArrayField_target], + array = target .getValue (), + components = target .getComponents (), + difference = last - first, + length = target [_length], + newLength = length - difference, + values = target [X3DTypedArrayField_proxy] .slice (first, last); + + first *= components; + last *= components; + + array .copyWithin (first, last, length * components); + array .fill (0, newLength * components, length * components); + + target [_length] = newLength; + + if (components > 1) + target [_cache] .length = newLength; + + target .addEvent (); + + return values; + }, + resize (newLength, value, silently) + { + const + target = this [X3DTypedArrayField_target], + length = target [_length], + components = target .getComponents (); + + let array = target .getValue (); + + if (newLength < length) + { + array .fill (0, newLength * components, length * components); + + if (components > 1) + target [_cache] .length = newLength; + + if (!silently) + target .addEvent (); + } + else if (newLength > length) + { + array = target [_grow] (newLength * components); + + if (value !== undefined) + { + if (components === 1) + { + array .fill (value, length * components, newLength * components); + } + else + { + for (let i = length * components, il = newLength * components; i < il; ) + { + for (let c = 0; c < components; ++ c, ++ i) + { + array [i] = value [c]; + } + } + } + } + + if (!silently) + target .addEvent (); + } + + target [_length] = newLength; + + return array; + }, + [_grow] (length) + { + const + target = this [X3DTypedArrayField_target], + array = target .getValue (); + + if (length < array .length) + return array; + + const + maxLength = Math_Algorithm .nextPowerOfTwo (length), + newArray = new (target .getArrayType ()) (maxLength); + + newArray .set (array); + + Base_X3DArrayField .prototype .set .call (target, newArray); + + return newArray; + }, + shrinkToFit () + { + const + target = this [X3DTypedArrayField_target], + array = target .getValue (), + length = target [_length] * target .getComponents (); + + if (array .length == length) + return array; + + const newArray = array .subarray (0, length); + + Base_X3DArrayField .prototype .set .call (target, newArray); + + return newArray; + }, + reverse () + { + const + target = this [X3DTypedArrayField_target], + array = target .getValue (), + components = target .getComponents (), + length = target [_length] * components, + length1_2 = Math .floor (target [_length] / 2) * components; + + if (components === 1) + { + for (let i = 0; i < length1_2; ++ i) + { + const + i2 = length - i - 1, + t = array [i]; + + array [i] = array [i2]; + array [i2] = t; + } + } + else + { + for (let i = 0; i < length1_2; i += components) + { + for (let c = 0; c < components; ++ c) + { + const + i1 = i + c, + i2 = length - i - 1 - (components - c - 1), + t = array [i1]; + + array [i1] = array [i2]; + array [i2] = t; + } + } + } + + target .addEvent (); + + return target [X3DTypedArrayField_proxy]; + }, + sort (compareFn) + { + const + target = this [X3DTypedArrayField_target], + array = target .getValue (), + components = target .getComponents (), + length = target [_length]; + + if (components === 1) + { + const valueType = target .getValueType (); + + const cmp = compareFn + ? (a, b) => compareFn (valueType (a), valueType (b)) + : Math_Algorithm .cmp; + + target .set (array .subarray (0, length) .sort (cmp)); + } + else + { + const result = Array .from (target [X3DTypedArrayField_proxy], value => value .copy ()) + .sort (compareFn ?? ((a, b) => + { + for (let c = 0; c < components; ++ c) + { + if (a [c] < b [c]) + return -1; + + if (b [c] < a [c]) + return 1; + } + + return 0; + })); + + for (let i = 0; i < length; ++ i) + { + const value = result [i]; + + for (let c = 0, first = i * components; c < components; ++ c, ++ first) + array [first] = value [c]; + } + } + + target .addEvent (); + + return target [X3DTypedArrayField_proxy]; + }, + toStream (generator) + { + const + target = this [X3DTypedArrayField_target], + array = target .getValue (), + length = target [_length], + components = target .getComponents (), + value = new (target .getSingleType ()) (); + + switch (length) + { + case 0: + { + generator .string += "["; + generator .string += generator .TidySpace (); + generator .string += "]"; + break; + } + case 1: + { + generator .PushUnitCategory (target .getUnit ()); + + if (components === 1) + { + value .set (array [0]); + + value .toStream (generator); + } + else + { + for (let c = 0, first = 0; c < components; ++ c, ++ first) + value [c] = array [first]; + + value .toStream (generator); + } + + generator .PopUnitCategory (); + break; + } + default: + { + generator .PushUnitCategory (target .getUnit ()); + + generator .string += "["; + generator .string += generator .ListStart (); + generator .IncIndent (); + + if (components === 1) + { + for (let i = 0, n = length - 1; i < n; ++ i) + { + generator .string += generator .ListIndent (); + + value .set (array [i * components]); + value .toStream (generator); + + generator .string += generator .Comma (); + generator .string += generator .ListBreak (); + } + + generator .string += generator .ListIndent (); + value .set (array [(length - 1) * components]); + value .toStream (generator); + } + else + { + for (let i = 0, n = length - 1; i < n; ++ i) + { + generator .string += generator .ListIndent (); + + for (let c = 0, first = i * components; c < components; ++ c, ++ first) + value [c] = array [first]; + + value .toStream (generator); + + generator .string += generator .Comma (); + generator .string += generator .ListBreak (); + } + + generator .string += generator .ListIndent (); + + for (let c = 0, first = (length - 1) * components; c < components; ++ c, ++ first) + value [c] = array [first]; + + value .toStream (generator); + } + + generator .string += generator .ListEnd (); + generator .DecIndent (); + generator .string += generator .ListIndent (); + generator .string += "]"; + + generator .PopUnitCategory (); + break; + } + } + }, + toVRMLStream (generator) + { + this .toStream (generator); + }, + toXMLStream (generator) + { + const + target = this [X3DTypedArrayField_target], + length = target [_length]; + + if (length) + { + const + array = target .getValue (), + components = target .getComponents (), + value = new (target .getSingleType ()) (); + + generator .PushUnitCategory (target .getUnit ()); + + if (components === 1) + { + for (let i = 0, n = length - 1; i < n; ++ i) + { + value .set (array [i * components]); + value .toXMLStream (generator); + + generator .string += generator .Comma (); + generator .string += generator .TidySpace (); + } + + value .set (array [(length - 1) * components]); + + value .toXMLStream (generator); + } + else + { + for (let i = 0, n = length - 1; i < n; ++ i) + { + for (let c = 0, first = i * components; c < components; ++ c, ++ first) + value [c] = array [first]; + + value .toXMLStream (generator); + + generator .string += generator .Comma (); + generator .string += generator .TidySpace (); + } + + for (let c = 0, first = (length - 1) * components; c < components; ++ c, ++ first) + value [c] = array [first]; + + value .toXMLStream (generator); + } + + generator .PopUnitCategory (); + } + }, + toJSONStream (generator) + { + const + target = this [X3DTypedArrayField_target], + length = target .length; + + if (length) + { + const + array = target .getValue (), + components = target .getComponents (), + value = new (target .getSingleType ()) (); + + generator .PushUnitCategory (target .getUnit ()); + + generator .string += '['; + generator .string += generator .ListBreak (); + generator .string += generator .IncIndent (); + + if (components === 1) + { + for (let i = 0, n = length - 1; i < n; ++ i) + { + generator .string += generator .ListIndent (); + + value .set (array [i * components]); + value .toJSONStreamValue (generator); + + generator .string += ','; + generator .string += generator .ListBreak (); + } + + generator .string += generator .ListIndent (); + + value .set (array [(length - 1) * components]); + value .toJSONStreamValue (generator); + } + else + { + for (let i = 0, n = length - 1; i < n; ++ i) + { + generator .string += generator .ListIndent (); + + for (let c = 0, first = i * components; c < components; ++ c, ++ first) + value [c] = array [first]; + + value .toJSONStreamValue (generator); + + generator .string += ','; + generator .string += generator .ListBreak (); + } + + generator .string += generator .ListIndent (); + + for (let c = 0, first = (length - 1) * components; c < components; ++ c, ++ first) + value [c] = array [first]; + + value .toJSONStreamValue (generator); + } + + generator .string += generator .ListBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .ListIndent (); + generator .string += ']'; + + generator .PopUnitCategory (); + } + else + { + generator .string += '['; + generator .string += generator .TidySpace (); + generator .string += ']'; + } + }, + dispose () + { + Base_X3DArrayField .prototype .dispose .call (this [X3DTypedArrayField_target]); + }, +}); + +for (const key of Object .keys (X3DTypedArrayField .prototype)) + Object .defineProperty (X3DTypedArrayField .prototype, key, { enumerable: false }); + +Object .defineProperty (X3DTypedArrayField .prototype, "length", +{ + get () { return this [_length]; }, + set (value) { this [X3DTypedArrayField_target] .resize (value); }, +}); + +// Getter/Setter functions to reference a value for a given index. + +function createValue (target, index, components, valueType) +{ + const + value = new valueType (), + internalValue = value .getValue (), + i = index * components; + + value .addEvent = addEvent .bind (target, i, components, internalValue); + value .getValue = getValue .bind (target, i, components, internalValue); + + return value; +} + +function getValue (index, components, value) +{ + const array = this .getValue (); + + for (let c = 0; c < components; ++ c, ++ index) + value [c] = array [index]; + + return value; +} + +function addEvent (index, components, value) +{ + const array = this .getValue (); + + for (let c = 0; c < components; ++ c, ++ index) + array [index] = value [c]; + + this .addEvent (); +} + +const X3DTypedArrayField_default_ = X3DTypedArrayField; +; + +x_ite_Namespace .add ("X3DTypedArrayField", "x_ite/Base/X3DTypedArrayField", X3DTypedArrayField_default_); +/* harmony default export */ const Base_X3DTypedArrayField = (X3DTypedArrayField_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields/ArrayFields.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + + + + + +const + { SFMatrix3d: ArrayFields_SFMatrix3d, SFMatrix3f: ArrayFields_SFMatrix3f } = Fields_SFMatrix3, + { SFMatrix4d, SFMatrix4f } = Fields_SFMatrix4, + { SFVec2d, SFVec2f } = Fields_SFVec2, + { SFVec3d: ArrayFields_SFVec3d, SFVec3f: ArrayFields_SFVec3f } = Fields_SFVec3, + { SFVec4d, SFVec4f } = Fields_SFVec4; + +/* + * MFNode + */ + +function MFNode (... args) +{ + return Base_X3DObjectArrayField .call (this, args); +} + +Object .assign (Object .setPrototypeOf (MFNode .prototype, Base_X3DObjectArrayField .prototype), +{ + getSingleType () + { + return Fields_SFNode; + }, + copy (instance) + { + if (instance) + { + const copy = new MFNode (); + + for (const node of this .getValue ()) + copy .push (node .copy (instance)); + + copy .setModificationTime (0); + + return copy; + } + else + { + return Base_X3DObjectArrayField .prototype .copy .call (this); + } + }, + toStream (generator) + { + const + target = this .getTarget (), + array = target .getValue (), + length = array .length; + + switch (length) + { + case 0: + { + generator .string += "["; + generator .string += generator .TidySpace (); + generator .string += "]"; + break; + } + case 1: + { + generator .PushUnitCategory (target .getUnit ()); + + array [0] .toStream (generator); + + generator .PopUnitCategory (); + break; + } + default: + { + generator .PushUnitCategory (target .getUnit ()); + + generator .string += "["; + generator .string += generator .TidyBreak (); + generator .IncIndent (); + + for (let i = 0; i < length; ++ i) + { + generator .string += generator .Indent (); + array [i] .toStream (generator); + generator .string += generator .string .at (-1) === "}" ? generator .TidyBreak () : generator .Break (); + } + + generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += "]"; + + generator .PopUnitCategory (); + break; + } + } + }, + toVRMLStream (generator) + { + const + target = this .getTarget (), + array = target .getValue (), + length = array .length; + + switch (length) + { + case 0: + { + generator .string += "["; + generator .string += generator .TidySpace (); + generator .string += "]"; + break; + } + case 1: + { + generator .EnterScope (); + + array [0] .toVRMLStream (generator); + + generator .LeaveScope (); + break; + } + default: + { + generator .EnterScope (); + + generator .string += "["; + generator .string += generator .TidyBreak (); + generator .IncIndent (); + + for (const element of array) + { + generator .string += generator .Indent (); + element .toVRMLStream (generator); + generator .string += generator .string .at (-1) === "}" ? generator .TidyBreak () : generator .Break (); + } + + generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += "]"; + + generator .LeaveScope (); + break; + } + } + }, + toXMLStream (generator) + { + const + target = this .getTarget (), + length = target .length; + + if (length) + { + generator .EnterScope (); + + const array = target .getValue (); + + for (let i = 0, n = length - 1; i < n; ++ i) + { + const node = array [i] .getValue (); + + if (node) + { + node .toXMLStream (generator); + generator .string += generator .TidyBreak (); + } + else + { + generator .string += generator .Indent (); + generator .string += "<"; + generator .string += "NULL"; + + const containerField = generator .ContainerField (); + + if (containerField) + { + generator .string += generator .Space (); + generator .string += "containerField='"; + generator .string += generator .XMLEncode (containerField .getName ()); + generator .string += "'"; + } + + generator .string += generator .closingTags ? ">" : "/>"; + } + } + + const node = array .at (-1) .getValue (); + + if (node) + { + node .toXMLStream (generator); + } + else + { + generator .string += generator .Indent (); + generator .string += "<"; + generator .string += "NULL"; + + const containerField = generator .ContainerField (); + + if (containerField) + { + generator .string += generator .Space (); + generator .string += "containerField='"; + generator .string += generator .XMLEncode (containerField .getName ()); + generator .string += "'"; + } + } + + generator .LeaveScope (); + } + }, + toJSONStream (generator) + { + const + target = this .getTarget (), + length = target .length; + + if (length) + { + const array = target .getValue (); + + generator .EnterScope (); + + generator .string += '['; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + for (let i = 0, n = length - 1; i < n; ++ i) + { + generator .string += generator .Indent (); + + if (array [i]) + array [i] .toJSONStreamValue (generator); + else + generator .string += 'null'; + + generator .string += ','; + generator .string += generator .TidyBreak (); + } + + generator .string += generator .Indent (); + + if (array .at (-1)) + array .at (-1) .toJSONStreamValue (generator); + else + generator .string += 'null'; + + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += ']'; + + generator .LeaveScope (); + } + else + { + generator .string += '['; + generator .string += generator .TidySpace (); + generator .string += ']'; + } + }, + dispose () + { + const target = this .getTarget (); + + target .resize (0, undefined, false); + target .processInterests (); + + Base_X3DObjectArrayField .prototype .dispose .call (target); + }, +}); + +for (const key of Object .keys (MFNode .prototype)) + Object .defineProperty (MFNode .prototype, key, { enumerable: false }); + +Object .defineProperties (MFNode, +{ + typeName: + { + value: "MFNode", + enumerable: true, + }, +}); + +function MFString (... args) +{ + return Base_X3DObjectArrayField .call (this, args); +} + +Object .assign (Object .setPrototypeOf (MFString .prototype, Base_X3DObjectArrayField .prototype), +{ + getSingleType () + { + return Fields_SFString; + }, + toXMLStream (generator, sourceText = false) + { + const + target = this .getTarget (), + length = target .length; + + if (length) + { + const value = target .getValue (); + + for (let i = 0, n = length - 1; i < n; ++ i) + { + generator .string += "\""; + value [i] .toXMLStream (generator, sourceText); + generator .string += "\""; + generator .string += generator .Comma (); + generator .string += generator .TidySpace (); + } + + generator .string += "\""; + value .at (-1) .toXMLStream (generator, sourceText); + generator .string += "\""; + } + }, +}); + +for (const key of Object .keys (MFString .prototype)) + Object .defineProperty (MFString .prototype, key, { enumerable: false }); + +Object .defineProperties (MFString, +{ + typeName: + { + value: "MFString", + enumerable: true, + }, +}); + +/** + * MFImage + */ + +function MFImage (... args) +{ + return Base_X3DObjectArrayField .call (this, args); +} + +Object .assign (Object .setPrototypeOf (MFImage .prototype, Base_X3DObjectArrayField .prototype), +{ + getSingleType () + { + return Fields_SFImage; + }, +}); + +for (const key of Object .keys (MFImage .prototype)) + Object .defineProperty (MFImage .prototype, key, { enumerable: false }); + +Object .defineProperties (MFImage, +{ + typeName: + { + value: "MFImage", + enumerable: true, + }, +}); + +function TypedArrayTemplate (TypeName, SingleType, ValueType, ArrayType, Components) +{ + function ArrayField (... args) + { + return Base_X3DTypedArrayField .call (this, args); + } + + Object .assign (Object .setPrototypeOf (ArrayField .prototype, Base_X3DTypedArrayField .prototype), + { + getSingleType () + { + return SingleType; + }, + getValueType () + { + return ValueType; + }, + getArrayType () + { + return ArrayType; + }, + getComponents () + { + return Components; + }, + }); + + for (const key of Object .keys (ArrayField .prototype)) + Object .defineProperty (ArrayField .prototype, key, { enumerable: false }); + + Object .defineProperties (ArrayField, + { + typeName: + { + value: TypeName, + enumerable: true, + }, + }); + + return ArrayField; +} + +const Value = value => value; + +const ArrayFields = +{ + MFBool: TypedArrayTemplate ("MFBool", Fields_SFBool, Boolean, Uint8Array, 1), + MFColor: TypedArrayTemplate ("MFColor", Fields_SFColor, Fields_SFColor, Float32Array, 3), + MFColorRGBA: TypedArrayTemplate ("MFColorRGBA", Fields_SFColorRGBA, Fields_SFColorRGBA, Float32Array, 4), + MFDouble: TypedArrayTemplate ("MFDouble", Fields_SFDouble, Value, Float64Array, 1), + MFFloat: TypedArrayTemplate ("MFFloat", Fields_SFFloat, Value, Float32Array, 1), + MFImage: MFImage, + MFInt32: TypedArrayTemplate ("MFInt32", Fields_SFInt32, Value, Int32Array, 1), + MFMatrix3d: TypedArrayTemplate ("MFMatrix3d", ArrayFields_SFMatrix3d, ArrayFields_SFMatrix3d, Float64Array, 9), + MFMatrix3f: TypedArrayTemplate ("MFMatrix3f", ArrayFields_SFMatrix3f, ArrayFields_SFMatrix3f, Float32Array, 9), + MFMatrix4d: TypedArrayTemplate ("MFMatrix4d", SFMatrix4d, SFMatrix4d, Float64Array, 16), + MFMatrix4f: TypedArrayTemplate ("MFMatrix4f", SFMatrix4f, SFMatrix4f, Float32Array, 16), + MFNode: MFNode, + MFRotation: TypedArrayTemplate ("MFRotation", Fields_SFRotation, Fields_SFRotation, Float64Array, 4), + MFString: MFString, + MFTime: TypedArrayTemplate ("MFTime", Fields_SFTime, Value, Float64Array, 1), + MFVec2d: TypedArrayTemplate ("MFVec2d", SFVec2d, SFVec2d, Float64Array, 2), + MFVec2f: TypedArrayTemplate ("MFVec2f", SFVec2f, SFVec2f, Float32Array, 2), + MFVec3d: TypedArrayTemplate ("MFVec3d", ArrayFields_SFVec3d, ArrayFields_SFVec3d, Float64Array, 3), + MFVec3f: TypedArrayTemplate ("MFVec3f", ArrayFields_SFVec3f, ArrayFields_SFVec3f, Float32Array, 3), + MFVec4d: TypedArrayTemplate ("MFVec4d", SFVec4d, SFVec4d, Float64Array, 4), + MFVec4f: TypedArrayTemplate ("MFVec4f", SFVec4f, SFVec4f, Float32Array, 4), +}; + +const ArrayFields_default_ = ArrayFields; +; + +x_ite_Namespace .add ("ArrayFields", "x_ite/Fields/ArrayFields", ArrayFields_default_); +/* harmony default export */ const Fields_ArrayFields = (ArrayFields_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields/SFImage.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +const MFInt32 = Fields_ArrayFields .MFInt32; + +/* + * Image + */ + +function Image (width, height, comp, array) +{ + this .width = Math .max (width|0, 0); + this .height = Math .max (height|0, 0); + this .comp = Math_Algorithm .clamp (comp|0, 0, 4); + this .array = new MFInt32 (); + this .array .setValue (array); + this .array .length = this .width * this .height; +} + +Object .assign (Image .prototype, +{ + copy () + { + return new Image (this .width, this .height, this .comp, this .array); + }, + equals (image) + { + return this .width === image .width && + this .height === image .height && + this .comp === image .comp && + this .array .equals (image .array); + }, + assign (image) + { + this .width = image .width; + this .height = image .height; + this .comp = image .comp; + this .array .assign (image .array); + }, + set (width, height, comp, array) + { + this .width = width|0; + this .height = height|0; + this .comp = comp|0; + this .array .assign (array); + }, + setWidth (value) + { + this .width = Math .max (value|0, 0); + this .array .length = this .width * this .height; + }, + getWidth () + { + return this .width; + }, + setHeight (value) + { + this .height = Math .max (value|0, 0); + this .array .length = this .width * this .height; + }, + getHeight () + { + return this .height; + }, + setComp (value) + { + this .comp = Math_Algorithm .clamp (value|0, 0, 4); + }, + getComp () + { + return this .comp; + }, + setArray (value) + { + this .array .setValue (value); + this .array .length = this .width * this .height; + }, + getArray () + { + return this .array; + }, +}); + +/* + * SFImage + */ + +const _set_size = Symbol (); + +function SFImage (width, height, comp, array) +{ + switch (arguments .length) + { + case 0: + Base_X3DField .call (this, new Image (0, 0, 0, new MFInt32 ())); + break; + + case 1: + Base_X3DField .call (this, arguments [0]); + break; + + case 3: + Base_X3DField .call (this, new Image (width, height, comp, new MFInt32 ())); + break; + + case 4: + Base_X3DField .call (this, new Image (width, height, comp, array)); + break; + + default: + throw new Error ("Invalid arguments."); + } + + this .getValue () .getArray () .addParent (this); + this .addInterest (_set_size, this); +} + +Object .assign (Object .setPrototypeOf (SFImage .prototype, Base_X3DField .prototype), +{ + [_set_size] () + { + this .getValue () .getArray () .length = this .width * this .height; + }, + *[Symbol .iterator] () + { + yield this .width; + yield this .height; + yield this .comp; + yield this .array; + }, + copy () + { + return new SFImage (this .getValue () .copy ()); + }, + equals (image) + { + return this .getValue () .equals (image .getValue ()); + }, + isDefaultValue () + { + return ( + this .width === 0 && + this .height === 0 && + this .comp === 0); + }, + set (image) + { + this .getValue () .assign (image); + }, + toStream (generator) + { + const array = this .array; + + generator .string += this .width; + generator .string += generator .Space (); + generator .string += this .height; + generator .string += generator .Space (); + generator .string += this .comp; + generator .string += generator .AttribBreak (); + + generator .IncIndent (); + + for (let y = 0, h = this .height; y < h; ++ y) + { + generator .string += generator .ListIndent (); + + const s = y * this .width; + + for (let x = 0, w = this .width; x < w; ++ x) + { + generator .string += "0x"; + generator .string += array [x + s] .toString (16); + + if (x !== w - 1) + generator .string += generator .Space (); + } + + if (y !== h - 1) + generator .string += generator .AttribBreak (); + } + + generator .DecIndent (); + }, + toVRMLStream (generator) + { + this .toStream (generator); + }, + toXMLStream (generator) + { + this .toStream (generator); + }, + toJSONStream (generator) + { + generator .string += '['; + generator .string += generator .ListBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .ListIndent (); + + this .toJSONStreamValue (generator); + + generator .string += generator .DecIndent (); + generator .string += generator .ListBreak (); + generator .string += generator .ListIndent (); + generator .string += ']'; + }, + toJSONStreamValue (generator) + { + const + array = this .array, + length = array .length; + + generator .string += this .width; + generator .string += ','; + generator .string += generator .TidySpace (); + generator .string += this .height; + generator .string += ','; + generator .string += generator .TidySpace (); + generator .string += this .comp; + generator .string += ','; + + if (this .width && this .height) + { + generator .string += generator .ListBreak (); + generator .string += generator .IncIndent (); + + for (let y = 0, h = this .height; y < h; ++ y) + { + generator .string += generator .ListIndent (); + + const s = y * this .width; + + for (let x = 0, w = this .width; x < w; ++ x) + { + generator .string += array [x + s]; + + if (x + s !== length - 1) + generator .string += ','; + + if (x !== w - 1) + generator .string += generator .TidySpace (); + } + + if (y !== h - 1) + generator .string += generator .ListBreak (); + } + + generator .string += generator .DecIndent (); + } + }, +}); + +for (const key of Object .keys (SFImage .prototype)) + Object .defineProperty (SFImage .prototype, key, { enumerable: false }); + +const width = { + get () + { + return this .getValue () .getWidth (); + }, + set (value) + { + this .getValue () .setWidth (value); + this .addEvent (); + }, +}; + +const height = { + get () + { + return this .getValue () .getHeight (); + }, + set (value) + { + this .getValue () .setHeight (value); + this .addEvent (); + }, +}; + +const comp = { + get () + { + return this .getValue () .getComp (); + }, + set (value) + { + this .getValue () .setComp (value); + this .addEvent (); + }, +}; + +const array = { + get () + { + return this .getValue () .getArray (); + }, + set (value) + { + this .getValue () .setArray (value); + this .addEvent (); + }, +}; + +Object .defineProperties (SFImage .prototype, +{ + x: width, + y: height, + width: Object .assign ({ enumerable: true }, width), + height: Object .assign ({ enumerable: true }, height), + comp: Object .assign ({ enumerable: true }, comp), + array: Object .assign ({ enumerable: true }, array), +}); + +Object .defineProperties (SFImage, +{ + typeName: + { + value: "SFImage", + enumerable: true, + }, +}); + +const SFImage_default_ = SFImage; +; + +x_ite_Namespace .add ("SFImage", "x_ite/Fields/SFImage", SFImage_default_); +/* harmony default export */ const Fields_SFImage = (SFImage_default_); +;// CONCATENATED MODULE: ./src/x_ite/Fields.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + + + + +const Fields = { + SFBool: Fields_SFBool, + SFColor: Fields_SFColor, + SFColorRGBA: Fields_SFColorRGBA, + SFDouble: Fields_SFDouble, + SFFloat: Fields_SFFloat, + SFImage: Fields_SFImage, + SFInt32: Fields_SFInt32, + ... Fields_SFMatrix3, + ... Fields_SFMatrix4, + SFNode: Fields_SFNode, + SFRotation: Fields_SFRotation, + SFString: Fields_SFString, + SFTime: Fields_SFTime, + ... Fields_SFVec2, + ... Fields_SFVec3, + ... Fields_SFVec4, + + ... Fields_ArrayFields, +}; + +const Fields_default_ = Fields; +; + +x_ite_Namespace .add ("Fields", "x_ite/Fields", Fields_default_); +/* harmony default export */ const x_ite_Fields = (Fields_default_); +;// CONCATENATED MODULE: ./src/x_ite/Parser/HTMLSupport.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This file is part of the X_ITE Project. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains "non-military use only" components. + * + * Copyright 2016 Andreas Plesch. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +const + nodeTypeNames = new Map (), // (TYPENAME -> TypeName) + fieldNames = new Map (); // (fieldname -> fieldName) + +const HTMLSupport = +{ + addConcreteNode ({ typeName, fieldDefinitions }) + { + if (nodeTypeNames .has (typeName)) + return; + + this .addNodeTypeName (typeName); + + for (const { name, accessType } of fieldDefinitions) + { + if (accessType & Base_X3DConstants .initializeOnly) + this .addFieldName (name) + } + }, + addNodeTypeName (typeName) + { + nodeTypeNames .set (typeName, typeName); + nodeTypeNames .set (typeName .toUpperCase (), typeName); + }, + getNodeTypeName (typeName) + { + return nodeTypeNames .get (typeName); + }, + addFieldName (name) + { + fieldNames .set (name, name); + fieldNames .set (name .toLowerCase (), name); + }, + getFieldName (name) + { + return fieldNames .get (name); + }, +}; + +const HTMLSupport_default_ = HTMLSupport; +; + +x_ite_Namespace .add ("HTMLSupport", "x_ite/Parser/HTMLSupport", HTMLSupport_default_); +/* harmony default export */ const Parser_HTMLSupport = (HTMLSupport_default_); +;// CONCATENATED MODULE: ./src/x_ite/Base/X3DBaseNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + +const + _browser = Symbol (), + _executionContext = Symbol (), + _type = Symbol (), + _fieldDefinitions = Symbol .for ("X_ITE.X3DBaseNode.fieldDefinitions"), + _predefinedFields = Symbol (), + _userDefinedFields = Symbol (), + _childObjects = Symbol (), + _initialized = Symbol (), + _live = Symbol (), + _set_live__ = Symbol (); + +function X3DBaseNode (executionContext, browser = executionContext .getBrowser ()) +{ + if (this [_executionContext]) + return; + + Base_X3DChildObject .call (this); + + this [_browser] = browser; + this [_executionContext] = executionContext; + this [_type] = [ Base_X3DConstants .X3DBaseNode ]; + this [_fieldDefinitions] = this .constructor .fieldDefinitions ?? this [_fieldDefinitions]; + this [_predefinedFields] = new Base_FieldArray (); + this [_userDefinedFields] = new Base_FieldArray (); + this [_childObjects] = [ ]; + this [_live] = true; + this [_initialized] = false; + + if (this .canUserDefinedFields ()) + this [_fieldDefinitions] = new Base_FieldDefinitionArray (this [_fieldDefinitions]); + + // Create fields. + + this .addChildObjects (Base_X3DConstants .outputOnly, "name_changed", new x_ite_Fields .SFTime (), + Base_X3DConstants .outputOnly, "typeName_changed", new x_ite_Fields .SFTime (), + Base_X3DConstants .outputOnly, "parents_changed", new x_ite_Fields .SFTime ()) + + for (const fieldDefinition of this [_fieldDefinitions]) + this .addPredefinedField (fieldDefinition); +} + +Object .assign (Object .setPrototypeOf (X3DBaseNode .prototype, Base_X3DChildObject .prototype), +{ + [_fieldDefinitions]: new Base_FieldDefinitionArray ([ ]), + setName (value) + { + Base_X3DChildObject .prototype .setName .call (this, value) + + this ._name_changed = this [_browser] .getCurrentTime (); + }, + getBrowser () + { + return this [_browser]; + }, + getMainScene () + { + let scene = this [_executionContext] .getScene (); + + while (!scene .isMainScene ()) + scene = scene .getScene (); + + return scene; + }, + getScene () + { + let executionContext = this [_executionContext]; + + while (!executionContext .isScene ()) + executionContext = executionContext .getExecutionContext (); + + return executionContext; + }, + getExecutionContext () + { + return this [_executionContext]; + }, + setExecutionContext (value) + { + // Currently only useful for Scene. + this [_executionContext] = value; + }, + addType (value) + { + this [_type] .push (value); + }, + getType () + { + return this [_type]; + }, + create (executionContext = this [_executionContext]) + { + return new (this .constructor) (executionContext); + }, + copy (executionContext) + { + const copy = this .create (executionContext); + + for (const field of this [_predefinedFields]) + copy .getPredefinedFields () .get (field .getName ()) .assign (field); + + if (this .canUserDefinedFields ()) + { + for (const field of this [_userDefinedFields]) + copy .addUserDefinedField (field .getAccessType (), field .getName (), field .copy ()); + } + + copy .setup (); + + return copy; + }, + // replaceWith (replacement, cache = false) + // { + // cache = cache && SFNodeCache .get (this); + + // for (const parent of new Set (this .getParents ())) + // { + // if (parent instanceof Fields .SFNode && parent !== cache) + // parent .setValue (replacement) + // } + // }, + setup () + { + Object .freeze (this [_type]); + + this [_fieldDefinitions] .addParent (this); + this [_predefinedFields] .addParent (this); + this [_userDefinedFields] .addParent (this); + + for (const field of this [_childObjects]) + field .setTainted (false); + + for (const field of this [_predefinedFields]) + field .setTainted (false); + + for (const field of this [_userDefinedFields]) + field .setTainted (false); + + this .initialize (); + + this [_initialized] = true; + }, + initialize () + { }, + isInitialized () + { + return this [_initialized]; + }, + getInnerNode () + { + return this; + }, + isLive () + { + /// Returns the own live state of this node. + + return this [_live]; + }, + setLive (value) + { + /// Sets the own live state of this node. Setting the live state to false + /// temporarily disables this node completely. + + this [_live] = value .valueOf (); + + this [_set_live__] (); + }, + getLive: (() => + { + function getLive () + { + return this ._live; + } + + return function () + { + /// Returns the live event of this node. + + // Change function. + + Object .defineProperty (this, "getLive", { value: getLive }); + + // Add isLive event. + + this .addChildObjects (Base_X3DConstants .outputOnly, "live", new x_ite_Fields .SFBool (this .getLiveState ())); + + // Event processing is done manually and immediately, so: + this ._live .removeParent (this); + + // Connect to execution context. + + if (this .getOuterNode ?.()) + this .getOuterNode () .getLive () .addInterest (_set_live__, this); + + else if (this [_executionContext] !== this) + this [_executionContext] .getLive () .addInterest (_set_live__, this); + + // Return field. + + return this ._live; + }; + })(), + getLiveState () + { + /// Determines the live state of this node. + + if (this .getOuterNode ?.()) + return this [_live] && this .getOuterNode () .getLive () .getValue (); + + else if (this !== this [_executionContext]) + return this [_live] && this [_executionContext] .getLive () .getValue (); + + return this [_live]; + }, + [_set_live__] () + { + const live = this ._live; + + if (!live) + return; + + if (this .getLiveState ()) + { + if (live .getValue ()) + return; + + live .set (true); + live .processEvent (); + } + else + { + if (live .getValue ()) + { + live .set (false); + live .processEvent (); + } + } + }, + addChildObjects (/* accessType, name, field, ... */) + { + for (let i = 0, length = arguments .length; i < length; i += 3) + this .addChildObject (arguments [i], arguments [i + 1], arguments [i + 2]); + }, + addChildObject (accessType, name, field) + { + this [_childObjects] .push (field); + + field .setTainted (true); + field .addParent (this); + field .setName (name); + field .setAccessType (accessType); + + Object .defineProperty (this, `_${name}`, + { + get () { return field; }, + set (value) { field .setValue (value); }, + }); + }, + getFieldDefinitions () + { + return this [_fieldDefinitions]; + }, + getField (name) + { + const field = getFieldFromArray (this [_userDefinedFields], name) + ?? getFieldFromArray (this [_predefinedFields], name); + + if (field) + return field; + + throw new Error (`Unknown field '${name}' in node class ${this .getTypeName ()}.`); + }, + getFields () + { + return [... this [_predefinedFields], ... this [_userDefinedFields]]; + }, + addPredefinedField ({ accessType, name, value }) + { + const field = value .copy (); + + field .setTainted (!this [_initialized]); + field .addParent (this); + field .setName (name); + field .setAccessType (accessType); + + this [_predefinedFields] .add (name, field); + + Object .defineProperty (this, `_${name}`, + { + get () { return field; }, + set (value) { field .setValue (value); }, + configurable: true, + }); + }, + addAlias (alias, field) + { + this [_predefinedFields] .alias (alias, field); + + if (field .isInitializable ()) + Parser_HTMLSupport .addFieldName (alias); + }, + removePredefinedField (name) + { + const field = this [_predefinedFields] .get (name); + + if (!field) + return; + + field .removeParent (this); + + this [_predefinedFields] .remove (name); + + delete this [`_${field .getName ()}`]; + }, + getPredefinedField (name) + { + const field = getFieldFromArray (this [_predefinedFields], name); + + if (field) + return field; + + throw new Error (`Unknown predefined field '${name}' in node class ${this .getTypeName ()}.`); + }, + getPredefinedFields () + { + return this [_predefinedFields]; + }, + canUserDefinedFields () + { + return false; + }, + addUserDefinedField (accessType, name, field) + { + if (!this .canUserDefinedFields ()) + throw new Error ("Couldn't add user-defined field, node does not support this."); + + if (this [_userDefinedFields] .has (name)) + this .removeUserDefinedField (name); + + field .setTainted (!this [_initialized]); + field .addParent (this); + field .setName (name); + field .setAccessType (accessType); + + this [_fieldDefinitions] .remove (name); + + this [_fieldDefinitions] .add (name, new Base_X3DFieldDefinition (accessType, name, field)); + this [_userDefinedFields] .add (name, field); + }, + removeUserDefinedField (name) + { + const field = this [_userDefinedFields] .get (name); + + if (!field) + return; + + field .removeParent (this); + + this [_fieldDefinitions] .remove (name); + this [_userDefinedFields] .remove (name); + }, + getUserDefinedField (name) + { + const field = getFieldFromArray (this [_userDefinedFields], name); + + if (field) + return field; + + throw new Error (`Unknown user-defined field '${name}' in node class ${this .getTypeName ()}.`); + }, + getUserDefinedFields () + { + return this [_userDefinedFields]; + }, + getChangedFields (extended) + { + /* param routes: also return fields with routes */ + + const changedFields = [ ]; + + if (extended) + { + for (const field of this [_userDefinedFields]) + changedFields .push (field); + } + + for (const field of this [_predefinedFields]) + { + if (extended) + { + if (field .getInputRoutes () .size || field .getOutputRoutes () .size) + { + changedFields .push (field); + continue; + } + } + + if (field .getReferences () .size === 0) + { + if (!field .isInitializable ()) + continue; + + if (this .isDefaultValue (field)) + continue; + } + + changedFields .push (field); + } + + return changedFields; + }, + isDefaultValue (field) + { + const f = this [_userDefinedFields] .get (field .getName ()) ?? this [_predefinedFields] .get (field .getName ()); + + if (f === field) + var fieldDefinition = this [_fieldDefinitions] .get (field .getName ()); + else if (this .constructor .fieldDefinitions) + var fieldDefinition = this .constructor .fieldDefinitions .get (field .getName ()); + + if (fieldDefinition) + { + // User-defined fields are their own field definition value. + if (fieldDefinition .value === field) + return false; + + return fieldDefinition .value .equals (field); + } + + return !field .getModificationTime (); + }, + hasRoutes () + { + /// Returns true if there are any routes from or to fields of this node, otherwise false. + + for (const field of this [_predefinedFields]) + { + if (field .getInputRoutes () .size || field .getOutputRoutes () .size) + return true; + } + + for (const field of this [_userDefinedFields]) + { + if (field .getInputRoutes () .size || field .getOutputRoutes () .size) + return true; + } + + for (const importedNode of this [_executionContext] .getImportedNodes ()) + { + if (importedNode .hasRoutes (this)) + return true; + } + + return false; + }, + getExtendedEventHandling () + { + // Whether initializeOnly field are treated like inputOnly and inputOutput fields. + return true; + }, + addEvent (field) + { + if (field .isTainted ()) + return; + + // if (this .getTypeName () === "IndexedQuadSet") + // { + // console .log (field .getName ()); + // console .trace (); + // } + + field .setTainted (true); + + this .addEventObject (field, Base_Events .create (field)); + }, + addEventObject (field, event) + { + const browser = this [_browser]; + + // Register for processEvent + + browser .addTaintedField (field, event); + browser .addBrowserEvent (); + + // Register for eventsProcessed + + if (this .isTainted ()) + return; + + if (field .isInput () || (this .getExtendedEventHandling () && field .isInitializable ())) + { + this .addNodeEvent (); + } + }, + addNodeEvent () + { + if (this .isTainted ()) + return; + + const browser = this [_browser]; + + this .setTainted (true); + browser .addTaintedNode (this); + browser .addBrowserEvent (); + }, + parentsChanged () + { + const time = this [_browser] .getCurrentTime (); + + this [_executionContext] ._sceneGraph_changed = time; + this ._parents_changed = time; + }, + dispose () + { + this .setLive (false); + + for (const field of this [_childObjects]) + field .dispose (); + + for (const field of this [_predefinedFields]) + field .dispose (); + + for (const field of this [_userDefinedFields]) + field .dispose (); + + Base_X3DChildObject .prototype .dispose .call (this); + }, +}); + +const getFieldFromArray = (() => +{ + const + set_field = /^set_(.*?)$/, + field_changed = /^(.*?)_changed$/; + + return function (array, name) + { + const field = array .get (name); + + if (field) + return field; + + const match = name .match (set_field); + + if (match) + { + const field = array .get (match [1]); + + if (field ?.getAccessType () === Base_X3DConstants .inputOutput) + return field; + } + else + { + const match = name .match (field_changed); + + if (match) + { + const field = array .get (match [1]); + + if (field ?.getAccessType () === Base_X3DConstants .inputOutput) + return field; + } + } + }; +})(); + +for (const key of Object .keys (X3DBaseNode .prototype)) + Object .defineProperty (X3DBaseNode .prototype, key, { enumerable: false }); + +Object .defineProperties (X3DBaseNode .prototype, +{ + name_changed: + { + get () { return this ._name_changed; }, + enumerable: false, + }, + typeName_changed: + { + get () { return this ._typeName_changed; }, + enumerable: false, + }, + parents_changed: + { + get () { return this ._parents_changed; }, + enumerable: false, + }, +}); + +const X3DBaseNode_default_ = X3DBaseNode; +; + +x_ite_Namespace .add ("X3DBaseNode", "x_ite/Base/X3DBaseNode", X3DBaseNode_default_); +/* harmony default export */ const Base_X3DBaseNode = (X3DBaseNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Legacy.js +/* provided dependency */ var $ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +const Legacy = +{ + elements (elements, X3DBrowser) + { + if (elements .length) + { + console .warn ("Use of element is depreciated, please use element instead. See https://create3000.github.io/x_ite/#embedding-x_ite-within-a-web-page."); + + $.map (elements, element => new X3DBrowser (element)); + } + }, + browser (browser) + { + const element = browser .getElement (); + + if (element .prop ("nodeName") .toUpperCase () !== "X3DCANVAS") + return; + + if (element .attr ("src")) + browser .attributeChangedCallback ("src", undefined, element .attr ("src")); + else if (element .attr ("url")) + browser .attributeChangedCallback ("url", undefined, element .attr ("url")); + + // Make element focusable. + element .attr ("tabindex", element .attr ("tabindex") ?? 0); + }, + error (elements, error) + { + console .error (error); + + // + elements .children (".x_ite-private-browser") .hide (); + elements .children (":not(.x_ite-private-browser)") .show (); + }, +}; + +const Legacy_default_ = Legacy; +; + +x_ite_Namespace .add ("Legacy", "x_ite/Browser/Legacy", Legacy_default_); +/* harmony default export */ const Browser_Legacy = (Legacy_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/VERSION.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +const VERSION_default_ = "8.12.4"; +; + +x_ite_Namespace .add ("VERSION", "x_ite/Browser/VERSION", VERSION_default_); +/* harmony default export */ const VERSION = (VERSION_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Core/X3DNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +const _private = Symbol () + +function X3DNode (executionContext) +{ + Base_X3DBaseNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DNode); + + this [_private] = false; +} + +Object .assign (Object .setPrototypeOf (X3DNode .prototype, Base_X3DBaseNode .prototype), +{ + getComponentName () + { + return this .constructor .componentName; + }, + getContainerField () + { + return this .constructor .containerField; + }, + getSpecificationRange () + { + return this .constructor .specificationRange; + }, + copy (instance) + { + if (!instance || instance .getType () .includes (Base_X3DConstants .X3DExecutionContext)) + { + return Base_X3DBaseNode .prototype .copy .call (this, instance); + } + else + { + const executionContext = instance .getBody (); + + // First try to get a named node with the node's name. + + if (this .getName () .length) + { + const namedNode = executionContext .getNamedNodes () .get (this .getName ()); + + if (namedNode) + return namedNode .getValue (); + } + + // Create copy. + + const copy = this .create (executionContext); + + if (this .getNeedsName ()) + this .getExecutionContext () .updateNamedNode (this .getExecutionContext () .getUniqueName (), this); + + if (this .getName () .length) + executionContext .updateNamedNode (this .getName (), copy); + + // Default fields + + for (const sourceField of this .getPredefinedFields ()) + { + try + { + const destinationField = copy .getPredefinedField (sourceField .getName ()); + + if (sourceField .hasReferences ()) + { + // IS relationship + + for (const originalReference of sourceField .getReferences ()) + { + try + { + destinationField .addReference (instance .getField (originalReference .getName ())); + } + catch (error) + { + console .error (error); + } + } + } + else + { + if (sourceField .getAccessType () & Base_X3DConstants .initializeOnly) + { + switch (sourceField .getType ()) + { + case Base_X3DConstants .SFNode: + case Base_X3DConstants .MFNode: + destinationField .assign (sourceField .copy (instance)); + break; + default: + destinationField .assign (sourceField); + break; + } + } + } + + destinationField .setModificationTime (sourceField .getModificationTime ()); + } + catch (error) + { + console .error (error); + } + } + + // User-defined fields + + for (const sourceField of this .getUserDefinedFields ()) + { + const destinationField = sourceField .copy (instance); + + copy .addUserDefinedField (sourceField .getAccessType (), + sourceField .getName (), + destinationField); + + if (sourceField .hasReferences ()) + { + // IS relationship + + for (const originalReference of sourceField .getReferences ()) + { + try + { + destinationField .addReference (instance .getField (originalReference .getName ())); + } + catch (error) + { + console .error (`No reference '${originalReference .getName ()}' inside execution context ${instance .getTypeName ()} '${instance .getName ()}'.`); + } + } + } + + destinationField .setModificationTime (sourceField .getModificationTime ()); + } + + copy .setup (); + + return copy; + } + }, + getDisplayName () + { + return this .getName () .replace (/_\d+$/, ""); + }, + getNeedsName () + { + if (this .getName () .length) + return false; + + if (this .getCloneCount () > 1) + return true; + + if (this .hasRoutes ()) + return true; + + const executionContext = this .getExecutionContext () + + for (const importedNode of executionContext .getImportedNodes ()) + { + if (importedNode .getInlineNode () === this) + return true; + } + + if (executionContext .isScene ()) + { + for (const exportedNode of executionContext .getExportedNodes ()) + { + if (exportedNode .getLocalNode () === this) + return true; + } + } + + return false; + }, + isPrivate () + { + return this [_private]; + }, + setPrivate (value) + { + this [_private] = value; + }, + getCloneCount () + { + return Base_X3DBaseNode .prototype .collectCloneCount .call (this); + }, + collectCloneCount () + { + return this .isPrivate () ? 0 : 1; + }, + getSourceText () + { + return null; + }, + traverse () { }, + toStream (generator) + { + generator .string += this .getTypeName () + " { }"; + }, + toVRMLStream (generator) + { + generator .EnterScope (); + + const name = generator .Name (this); + + if (name .length) + { + if (generator .ExistsNode (this)) + { + generator .string += "USE"; + generator .string += generator .Space (); + generator .string += name; + + generator .LeaveScope (); + return; + } + } + + if (name .length) + { + generator .AddNode (this); + + generator .string += "DEF"; + generator .string += generator .Space (); + generator .string += name; + generator .string += generator .Space (); + } + + generator .string += this .getTypeName (); + generator .string += generator .TidySpace (); + generator .string += "{"; + + const + fields = this .getChangedFields (), + userDefinedFields = this .getUserDefinedFields (); + + if (this .canUserDefinedFields ()) + { + if (userDefinedFields .length) + { + let + fieldTypeLength = 0, + accessTypeLength = 0; + + for (const field of userDefinedFields) + { + fieldTypeLength = Math .max (fieldTypeLength, field .getTypeName () .length); + accessTypeLength = Math .max (accessTypeLength, generator .AccessType (field .getAccessType ()) .length); + } + + const last = userDefinedFields .at (-1); + + generator .string += generator .TidyBreak (); + generator .IncIndent (); + + for (const field of userDefinedFields) + { + this .toVRMLStreamUserDefinedField (generator, field, fieldTypeLength, accessTypeLength); + + if (field === last) + generator .string += generator .TidyBreak (); + else + generator .string += generator .Break (); + } + + generator .DecIndent (); + + if (fields .length !== 0) + generator .string += generator .TidyBreak (); + } + } + + if (fields .length === 0) + { + if (userDefinedFields .length) + generator .string += generator .Indent (); + else + generator .string += generator .TidySpace (); + } + else + { + const last = fields .at (-1); + + if (userDefinedFields .length === 0) + generator .string += generator .TidyBreak (); + + generator .IncIndent (); + + for (const field of fields) + { + this .toVRMLStreamField (generator, field); + + if (field === last) + generator .string += generator .TidyBreak (); + else + generator .string += generator .Break (); + } + + generator .DecIndent (); + generator .string += generator .Indent (); + } + + generator .string += "}"; + + generator .LeaveScope (); + }, + toVRMLStreamUserDefinedField (generator, field, fieldTypeLength, accessTypeLength) + { + const sharedNode = generator .IsSharedNode (this); + + if (field .getReferences () .size === 0 || !generator .ExecutionContext () || sharedNode) + { + generator .string += generator .Indent (); + generator .string += generator .AccessType (field .getAccessType ()) .padEnd (accessTypeLength, " "); + generator .string += generator .Space (); + generator .string += field .getTypeName () .padEnd (fieldTypeLength, " "); + generator .string += generator .Space (); + generator .string += field .getName (); + + if (field .isInitializable ()) + { + generator .string += generator .Space (); + + field .toVRMLStream (generator); + } + } + else + { + let + index = 0, + initializableReference = false; + + for (const reference of field .getReferences ()) + { + initializableReference = initializableReference || reference .isInitializable (); + + // Output user defined reference field + + generator .string += generator .Indent (); + generator .string += generator .AccessType (field .getAccessType ()) .padEnd (accessTypeLength, " "); + generator .string += generator .Space (); + generator .string += field .getTypeName () .padEnd (fieldTypeLength, " "); + generator .string += generator .Space (); + generator .string += field .getName (); + generator .string += generator .Space (); + generator .string += "IS"; + generator .string += generator .Space (); + generator .string += reference .getName (); + + ++ index; + + if (index !== field .getReferences () .size) + generator .string += generator .Break (); + } + + if (field .getAccessType () === Base_X3DConstants .inputOutput && !initializableReference && !field .isDefaultValue ()) + { + generator .string += generator .Break (); + generator .string += generator .Indent (); + generator .string += generator .AccessType (field .getAccessType ()) .padEnd (accessTypeLength, " "); + generator .string += generator .Space (); + generator .string += field .getTypeName () .padEnd (fieldTypeLength, " "); + generator .string += generator .Space (); + generator .string += field .getName (); + + if (field .isInitializable ()) + { + generator .string += generator .Space (); + + field .toVRMLStream (generator); + } + } + } + }, + toVRMLStreamField (generator, field) + { + const sharedNode = generator .IsSharedNode (this); + + if (field .getReferences () .size === 0 || !generator .ExecutionContext () || sharedNode) + { + if (field .isInitializable ()) + { + generator .string += generator .Indent (); + generator .string += field .getName (); + generator .string += generator .Space (); + + field .toVRMLStream (generator); + } + } + else + { + let + index = 0, + initializableReference = false; + + for (const reference of field .getReferences ()) + { + initializableReference = initializableReference || reference .isInitializable (); + + // Output build in reference field + + generator .string += generator .Indent (); + generator .string += field .getName (); + generator .string += generator .Space (); + generator .string += "IS"; + generator .string += generator .Space (); + generator .string += reference .getName (); + + ++ index; + + if (index !== field .getReferences () .size) + generator .string += generator .Break (); + } + + if (field .getAccessType () === Base_X3DConstants .inputOutput && !initializableReference && !this .isDefaultValue (field)) + { + // Output build in field + + generator .string += generator .Break (); + generator .string += generator .Indent (); + generator .string += field .getName (); + generator .string += generator .Space (); + + field .toVRMLStream (generator); + } + } + }, + toXMLStream (generator) + { + const sharedNode = generator .IsSharedNode (this); + + generator .EnterScope (); + + const name = generator .Name (this); + + if (name .length) + { + if (generator .ExistsNode (this)) + { + generator .string += generator .Indent (); + generator .string += "<"; + generator .string += this .getTypeName (); + + if (generator .html && this .getTypeName () === "Script") + { + generator .string += generator .Space (); + generator .string += "type='model/x3d+xml'"; + } + + generator .string += generator .Space (); + generator .string += "USE='"; + generator .string += generator .XMLEncode (name); + generator .string += "'"; + + const containerField = generator .ContainerField (); + + if (containerField) + { + if (containerField .getName () !== this .getContainerField ()) + { + generator .string += generator .Space (); + generator .string += "containerField='"; + generator .string += generator .XMLEncode (containerField .getName ()); + generator .string += "'"; + } + } + + if (generator .closingTags) + { + generator .string += ">"; + } + else + { + generator .string += "/>"; + } + + generator .LeaveScope (); + return; + } + } + + generator .string += generator .Indent (); + generator .string += "<"; + generator .string += this .getTypeName (); + + if (generator .html && this .getTypeName () === "Script") + { + generator .string += generator .Space (); + generator .string += "type='model/x3d+xml'"; + } + + if (name .length) + { + generator .AddNode (this); + + generator .string += generator .Space (); + generator .string += "DEF='"; + generator .string += generator .XMLEncode (name); + generator .string += "'"; + } + + const containerField = generator .ContainerField (); + + if (containerField) + { + if (containerField .getName () !== this .getContainerField ()) + { + generator .string += generator .Space (); + generator .string += "containerField='"; + generator .string += generator .XMLEncode (containerField .getName ()); + generator .string += "'"; + } + } + + const + fields = this .getChangedFields (), + userDefinedFields = this .getUserDefinedFields (); + + const + references = [ ], + childNodes = [ ]; + + let cdata = this .getSourceText (); + + if (cdata ?.length === 0 || (generator .html && this .getTypeName () !== "Script")) + cdata = null; + + generator .IncIndent (); + generator .IncIndent (); + + for (const field of fields) + { + // If the field is a inputOutput and we have as reference only inputOnly or outputOnly we must output the value + // for this field. + + let mustOutputValue = false; + + if (generator .ExecutionContext ()) + { + if (field .getAccessType () === Base_X3DConstants .inputOutput && field .getReferences () .size !== 0) + { + if (![... field .getReferences ()] .some (reference => reference .isInitializable ())) + mustOutputValue = !this .isDefaultValue (field); + } + } + + // If we have no execution context we are not in a proto and must not generate IS references the same is true + // if the node is a shared node as the node does not belong to the execution context. + + if (field .getReferences () .size === 0 || !generator .ExecutionContext () || sharedNode || mustOutputValue) + { + if (mustOutputValue) + references .push (field); + + if (field .isInitializable ()) + { + switch (field .getType ()) + { + case Base_X3DConstants .SFNode: + case Base_X3DConstants .MFNode: + { + childNodes .push (field); + break; + } + default: + { + if (field === cdata) + break; + + generator .string += generator .AttribBreak (); + generator .string += generator .ListIndent (); + generator .string += field .getName (); + generator .string += "='"; + + field .toXMLStream (generator, field === this .getSourceText ()); + + generator .string += "'"; + break; + } + } + } + } + else + { + references .push (field); + } + } + + generator .DecIndent (); + generator .DecIndent (); + + if ((!this .canUserDefinedFields () || !userDefinedFields .length) && (!references .length || sharedNode) && !childNodes .length && !cdata) + { + if (generator .closingTags) + { + generator .string += ">"; + } + else + { + generator .string += "/>"; + } + } + else + { + generator .string += ">"; + generator .string += generator .TidyBreak (); + + generator .IncIndent (); + + if (this .canUserDefinedFields ()) + { + for (const field of userDefinedFields) + { + generator .string += generator .Indent (); + generator .string += " reference .isInitializable ())) + mustOutputValue = true; + } + } + + if ((field .getReferences () .size === 0 || !generator .ExecutionContext ()) || sharedNode || mustOutputValue) + { + if (mustOutputValue && generator .ExecutionContext ()) + references .push (field); + + if (!field .isInitializable () || field .isDefaultValue ()) + { + generator .string += generator .closingTags ? ">" : "/>"; + generator .string += generator .TidyBreak (); + } + else + { + // Output value + + switch (field .getType ()) + { + case Base_X3DConstants .SFNode: + case Base_X3DConstants .MFNode: + { + generator .PushContainerField (null); + + generator .string += ">"; + generator .string += generator .TidyBreak (); + + generator .IncIndent (); + + field .toXMLStream (generator); + + generator .string += generator .TidyBreak (); + + generator .DecIndent (); + + generator .string += generator .Indent (); + generator .string += ""; + generator .string += generator .TidyBreak (); + + generator .PopContainerField (); + break; + } + default: + { + generator .string += generator .Space (); + generator .string += "value='"; + + field .toXMLStream (generator); + + generator .string += "'"; + generator .string += generator .closingTags ? ">" : "/>"; + generator .string += generator .TidyBreak (); + break; + } + } + } + } + else + { + if (generator .ExecutionContext ()) + references .push (field); + + generator .string += generator .closingTags ? ">" : "/>"; + generator .string += generator .TidyBreak (); + } + } + } + + if (references .length && !sharedNode) + { + generator .string += generator .Indent (); + generator .string += ""; + generator .string += generator .TidyBreak (); + + generator .IncIndent (); + + for (const field of references) + { + const protoFields = field .getReferences (); + + for (const protoField of protoFields) + { + generator .string += generator .Indent (); + generator .string += "" : "/>"; + generator .string += generator .TidyBreak (); + } + } + + generator .DecIndent (); + + generator .string += generator .Indent (); + generator .string += ""; + generator .string += generator .TidyBreak (); + } + + for (const field of childNodes) + { + generator .PushContainerField (field); + + field .toXMLStream (generator); + + generator .string += generator .TidyBreak (); + + generator .PopContainerField (); + } + + if (cdata) + { + for (const value of cdata) + { + generator .string += ""; + generator .string += generator .TidyBreak (); + } + } + + generator .DecIndent (); + + generator .string += generator .Indent (); + generator .string += ""; + } + + generator .LeaveScope (); + }, + toJSONStream (generator) + { + const sharedNode = generator .IsSharedNode (this); + + generator .EnterScope (); + + const name = generator .Name (this); + + // USE name + + if (name .length) + { + if (generator .ExistsNode (this)) + { + generator .string += '{'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += this .getTypeName (); + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@USE"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (name); + generator .string += '"'; + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + + generator .LeaveScope (); + return; + } + } + + // Type name + + generator .string += '{'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += this .getTypeName (); + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + + // DEF name + + if (name .length) + { + generator .AddNode (this); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@DEF"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (name); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + } + + + // Fields + + const + fields = this .getChangedFields (), + userDefinedFields = this .getUserDefinedFields (); + + const references = [ ]; + + let sourceText = this .getSourceText (); + + // Source text + + if (sourceText) + { + if (sourceText .length !== 1) + sourceText = null; + } + + + // Predefined fields + + if (fields .length) + { + const outputFields = [ ]; + + for (const field of fields) + { + // If the field is a inputOutput and we have as reference only inputOnly or outputOnly we must output the value + // for this field. + + let mustOutputValue = false; + + if (generator .ExecutionContext ()) + { + if (field .getAccessType () === Base_X3DConstants .inputOutput && field .getReferences () .size !== 0) + { + if (![... field .getReferences ()] .some (reference => reference .isInitializable ())) + mustOutputValue = !this .isDefaultValue (field); + } + } + + // If we have no execution context we are not in a proto and must not generate IS references the same is true + // if the node is a shared node as the node does not belong to the execution context. + + if (field .getReferences () .size === 0 || !generator .ExecutionContext () || sharedNode || mustOutputValue) + { + if (mustOutputValue) + references .push (field); + + if (field !== sourceText) + outputFields .push (field); + } + else + { + references .push (field); + } + } + + for (const field of outputFields) + { + if (field .isInitializable ()) + { + switch (field .getType ()) + { + case Base_X3DConstants .SFNode: + case Base_X3DConstants .MFNode: + { + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += '-'; + generator .string += field .getName (); + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + + field .toJSONStream (generator); + break; + } + default: + { + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += '@'; + generator .string += field .getName (); + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + + field .toJSONStream (generator); + break; + } + } + + generator .string += ','; + generator .string += generator .TidyBreak (); + } + } + } + + // User defined fields + + if (! this .canUserDefinedFields () || ! userDefinedFields .length) + ; + else + { + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "field"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '['; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + for (const field of userDefinedFields) + { + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@accessType"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .AccessType (field .getAccessType ()); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@type"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += field .getTypeName (); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@name"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (field .getName ()); + generator .string += '"'; + + // If the field is a inputOutput and we have as reference only inputOnly or outputOnly we must output the value + // for this field. + + let mustOutputValue = false; + + if (generator .ExecutionContext ()) + { + if (field .getAccessType () === Base_X3DConstants .inputOutput && field .getReferences () .size !== 0) + { + if (![... field .getReferences ()] .some (reference => reference .isInitializable ())) + mustOutputValue = true; + } + } + + if ((field .getReferences () .size === 0 || !generator .ExecutionContext ()) || sharedNode || mustOutputValue) + { + if (mustOutputValue && generator .ExecutionContext ()) + references .push (field); + + if (!field .isInitializable () || field .isDefaultValue ()) + ; + else + { + // Output value + + generator .string += ','; + generator .string += generator .TidyBreak (); + + switch (field .getType ()) + { + case Base_X3DConstants .SFNode: + { + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "-children"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '['; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + + field .toJSONStream (generator); + + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += ']'; + break; + } + case Base_X3DConstants .MFNode: + { + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "-children"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + + field .toJSONStream (generator); + break; + } + default: + { + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@value"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + + field .toJSONStream (generator); + break; + } + } + } + } + else + { + if (generator .ExecutionContext ()) + references .push (field); + } + + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + + if (field !== userDefinedFields .at (-1)) + generator .string += ','; + + generator .string += generator .TidyBreak (); + } + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += ']'; + generator .string += ','; + generator .string += generator .TidyBreak (); + } + + // Source text + + if (sourceText) + { + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "#sourceCode"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '['; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + const sourceTextLines = sourceText [0] .split ("\n"); + + for (let i = 0, length = sourceTextLines .length; i < length; ++ i) + { + generator .string += generator .ListIndent (); + generator .string += '"'; + generator .string += generator .JSONEncode (sourceTextLines [i]); + generator .string += '"'; + + if (i !== length - 1) + generator .string += ','; + + generator .string += generator .TidyBreak (); + } + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += ']'; + generator .string += ','; + generator .string += generator .TidyBreak (); + } + + + // IS references + + if (references .length && !sharedNode) + { + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "IS"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "connect"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '['; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + for (const field of references) + { + const protoFields = [... field .getReferences ()]; + + for (const protoField of protoFields) + { + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@nodeField"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (field .getName ()); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@protoField"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (protoField .getName ()); + generator .string += '"'; + generator .string += generator .TidyBreak (); + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + + if (field === references .at (-1) && protoField === protoFields .at (-1)) + ; + else + { + generator .string += ','; + } + + generator .string += generator .TidyBreak (); + } + } + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += ']'; + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + generator .string += generator .TidyBreak (); + } + + generator .JSONRemoveComma (); + + // End + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + + generator .LeaveScope (); + }, + dispose () + { + const executionContext = this .getExecutionContext (); + + // Remove named node if any. + + if (this .getName ()) + executionContext .removeNamedNode (this .getName ()) + + if (executionContext .isScene ()) + { + // Remove imported node if any. + + if (!executionContext .isMainScene ()) + { + const parentContext = executionContext .getExecutionContext (); + + for (const importedNode of [... parentContext .getImportedNodes ()]) + { + try + { + if (importedNode .getExportedNode () === this) + parentContext .removeImportedNode (importedNode .getImportedName ()); + } + catch (error) + { + //console .error (error); + } + } + } + + // Remove exported node if any. + + for (const exportedNode of [... executionContext .getExportedNodes ()]) + { + if (exportedNode .getLocalNode () === this) + executionContext .removeExportedNode (exportedNode .getExportedName ()); + } + } + + // Remove node from entire scene graph. + + for (const firstParent of new Set (this .getParents ())) + { + if (!(firstParent instanceof x_ite_Fields .SFNode)) + continue; + + for (const secondParent of new Set (firstParent .getParents ())) + { + if (!(secondParent instanceof x_ite_Fields .MFNode)) + continue; + + secondParent .setValue ([... secondParent] .filter (node => node ?.getValue () !== this)) + } + } + + for (const firstParent of new Set (this .getParents ())) + { + if (!(firstParent instanceof x_ite_Fields .SFNode)) + continue; + + firstParent .setValue (null); + } + + // Call super.dispose, where fields get disposed. + + Base_X3DBaseNode .prototype .dispose .call (this); + }, +}); + +for (const key of Object .keys (X3DNode .prototype)) + Object .defineProperty (X3DNode .prototype, key, { enumerable: false }); + +Object .defineProperties (X3DNode, +{ + typeName: + { + value: "X3DNode", + enumerable: true, + }, + componentName: + { + value: "Core", + enumerable: true, + }, +}); + +const X3DNode_default_ = X3DNode; +; + +x_ite_Namespace .add ("X3DNode", "x_ite/Components/Core/X3DNode", X3DNode_default_); +/* harmony default export */ const Core_X3DNode = (X3DNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Core/X3DMetadataObject.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function X3DMetadataObject (executionContext) +{ + this .addType (Base_X3DConstants .X3DMetadataObject); +} + +Object .assign (X3DMetadataObject .prototype, +{ + initialize () { }, + dispose () { }, +}); + +Object .defineProperties (X3DMetadataObject, +{ + typeName: + { + value: "X3DMetadataObject", + enumerable: true, + }, + componentName: + { + value: "Core", + enumerable: true, + }, +}); + +const X3DMetadataObject_default_ = X3DMetadataObject; +; + +x_ite_Namespace .add ("X3DMetadataObject", "x_ite/Components/Core/X3DMetadataObject", X3DMetadataObject_default_); +/* harmony default export */ const Core_X3DMetadataObject = (X3DMetadataObject_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Core/MetadataBoolean.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function MetadataBoolean (executionContext) +{ + Core_X3DNode .call (this, executionContext); + Core_X3DMetadataObject .call (this, executionContext); + + this .addType (Base_X3DConstants .MetadataBoolean); +} + +Object .assign (Object .setPrototypeOf (MetadataBoolean .prototype, Core_X3DNode .prototype), + Core_X3DMetadataObject .prototype, +{ + initialize () + { + Core_X3DNode .prototype .initialize .call (this); + Core_X3DMetadataObject .prototype .initialize .call (this); + }, + getContainerField (parser = false) + { + if (parser && this .getExecutionContext () .getSpecificationVersion () <= 3.3) + return "metadata"; + + return Core_X3DNode .prototype .getContainerField .call (this); + }, + dispose () + { + Core_X3DMetadataObject .prototype .dispose .call (this); + Core_X3DNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (MetadataBoolean, +{ + typeName: + { + value: "MetadataBoolean", + enumerable: true, + }, + componentName: + { + value: "Core", + enumerable: true, + }, + containerField: + { + value: "value", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.3", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "name", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "reference", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "value", new x_ite_Fields .MFBool ()), + ]), + enumerable: true, + }, +}); + +const MetadataBoolean_default_ = MetadataBoolean; +; + +x_ite_Namespace .add ("MetadataBoolean", "x_ite/Components/Core/MetadataBoolean", MetadataBoolean_default_); +/* harmony default export */ const Core_MetadataBoolean = (MetadataBoolean_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Core/MetadataDouble.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function MetadataDouble (executionContext) +{ + Core_X3DNode .call (this, executionContext); + Core_X3DMetadataObject .call (this, executionContext); + + this .addType (Base_X3DConstants .MetadataDouble); +} + +Object .assign (Object .setPrototypeOf (MetadataDouble .prototype, Core_X3DNode .prototype), + Core_X3DMetadataObject .prototype, +{ + initialize () + { + Core_X3DNode .prototype .initialize .call (this); + Core_X3DMetadataObject .prototype .initialize .call (this); + }, + getContainerField (parser = false) + { + if (parser && this .getExecutionContext () .getSpecificationVersion () <= 3.3) + return "metadata"; + + return Core_X3DNode .prototype .getContainerField .call (this); + }, + dispose () + { + Core_X3DMetadataObject .prototype .dispose .call (this); + Core_X3DNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (MetadataDouble, +{ + typeName: + { + value: "MetadataDouble", + enumerable: true, + }, + componentName: + { + value: "Core", + enumerable: true, + }, + containerField: + { + value: "value", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "name", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "reference", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "value", new x_ite_Fields .MFDouble ()), + ]), + enumerable: true, + }, +}); + +const MetadataDouble_default_ = MetadataDouble; +; + +x_ite_Namespace .add ("MetadataDouble", "x_ite/Components/Core/MetadataDouble", MetadataDouble_default_); +/* harmony default export */ const Core_MetadataDouble = (MetadataDouble_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Core/MetadataFloat.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function MetadataFloat (executionContext) +{ + Core_X3DNode .call (this, executionContext); + Core_X3DMetadataObject .call (this, executionContext); + + this .addType (Base_X3DConstants .MetadataFloat); +} + +Object .assign (Object .setPrototypeOf (MetadataFloat .prototype, Core_X3DNode .prototype), + Core_X3DMetadataObject .prototype, +{ + initialize () + { + Core_X3DNode .prototype .initialize .call (this); + Core_X3DMetadataObject .prototype .initialize .call (this); + }, + getContainerField (parser = false) + { + if (parser && this .getExecutionContext () .getSpecificationVersion () <= 3.3) + return "metadata"; + + return Core_X3DNode .prototype .getContainerField .call (this); + }, + dispose () + { + Core_X3DMetadataObject .prototype .dispose .call (this); + Core_X3DNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (MetadataFloat, +{ + typeName: + { + value: "MetadataFloat", + enumerable: true, + }, + componentName: + { + value: "Core", + enumerable: true, + }, + containerField: + { + value: "value", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "name", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "reference", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "value", new x_ite_Fields .MFFloat ()), + ]), + enumerable: true, + }, +}); + +const MetadataFloat_default_ = MetadataFloat; +; + +x_ite_Namespace .add ("MetadataFloat", "x_ite/Components/Core/MetadataFloat", MetadataFloat_default_); +/* harmony default export */ const Core_MetadataFloat = (MetadataFloat_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Core/MetadataInteger.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function MetadataInteger (executionContext) +{ + Core_X3DNode .call (this, executionContext); + Core_X3DMetadataObject .call (this, executionContext); + + this .addType (Base_X3DConstants .MetadataInteger); +} + +Object .assign (Object .setPrototypeOf (MetadataInteger .prototype, Core_X3DNode .prototype), + Core_X3DMetadataObject .prototype, +{ + initialize () + { + Core_X3DNode .prototype .initialize .call (this); + Core_X3DMetadataObject .prototype .initialize .call (this); + }, + getContainerField (parser = false) + { + if (parser && this .getExecutionContext () .getSpecificationVersion () <= 3.3) + return "metadata"; + + return Core_X3DNode .prototype .getContainerField .call (this); + }, + dispose () + { + Core_X3DMetadataObject .prototype .dispose .call (this); + Core_X3DNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (MetadataInteger, +{ + typeName: + { + value: "MetadataInteger", + enumerable: true, + }, + componentName: + { + value: "Core", + enumerable: true, + }, + containerField: + { + value: "value", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "name", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "reference", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "value", new x_ite_Fields .MFInt32 ()), + ]), + enumerable: true, + }, +}); + +const MetadataInteger_default_ = MetadataInteger; +; + +x_ite_Namespace .add ("MetadataInteger", "x_ite/Components/Core/MetadataInteger", MetadataInteger_default_); +/* harmony default export */ const Core_MetadataInteger = (MetadataInteger_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Core/MetadataSet.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function MetadataSet (executionContext) +{ + Core_X3DNode .call (this, executionContext); + Core_X3DMetadataObject .call (this, executionContext); + + this .addType (Base_X3DConstants .MetadataSet); +} + +Object .assign (Object .setPrototypeOf (MetadataSet .prototype, Core_X3DNode .prototype), + Core_X3DMetadataObject .prototype, +{ + initialize () + { + Core_X3DNode .prototype .initialize .call (this); + Core_X3DMetadataObject .prototype .initialize .call (this); + }, + getContainerField (parser = false) + { + if (parser && this .getExecutionContext () .getSpecificationVersion () <= 3.3) + return "metadata"; + + return Core_X3DNode .prototype .getContainerField .call (this); + }, + dispose () + { + Core_X3DMetadataObject .prototype .dispose .call (this); + Core_X3DNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (MetadataSet, +{ + typeName: + { + value: "MetadataSet", + enumerable: true, + }, + componentName: + { + value: "Core", + enumerable: true, + }, + containerField: + { + value: "value", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "name", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "reference", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "value", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const MetadataSet_default_ = MetadataSet; +; + +x_ite_Namespace .add ("MetadataSet", "x_ite/Components/Core/MetadataSet", MetadataSet_default_); +/* harmony default export */ const Core_MetadataSet = (MetadataSet_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Core/MetadataString.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function MetadataString (executionContext) +{ + Core_X3DNode .call (this, executionContext); + Core_X3DMetadataObject .call (this, executionContext); + + this .addType (Base_X3DConstants .MetadataString); +} + +Object .assign (Object .setPrototypeOf (MetadataString .prototype, Core_X3DNode .prototype), + Core_X3DMetadataObject .prototype, +{ + initialize () + { + Core_X3DNode .prototype .initialize .call (this); + Core_X3DMetadataObject .prototype .initialize .call (this); + }, + getContainerField (parser = false) + { + if (parser && this .getExecutionContext () .getSpecificationVersion () <= 3.3) + return "metadata"; + + return Core_X3DNode .prototype .getContainerField .call (this); + }, + dispose () + { + Core_X3DMetadataObject .prototype .dispose .call (this); + Core_X3DNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (MetadataString, +{ + typeName: + { + value: "MetadataString", + enumerable: true, + }, + componentName: + { + value: "Core", + enumerable: true, + }, + containerField: + { + value: "value", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "name", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "reference", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "value", new x_ite_Fields .MFString ()), + ]), + enumerable: true, + }, +}); + +const MetadataString_default_ = MetadataString; +; + +x_ite_Namespace .add ("MetadataString", "x_ite/Components/Core/MetadataString", MetadataString_default_); +/* harmony default export */ const Core_MetadataString = (MetadataString_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Core/X3DChildNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function X3DChildNode (executionContext) +{ + if (this .getExecutionContext ()) + return; + + Core_X3DNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DChildNode); + + this .addChildObjects (Base_X3DConstants .outputOnly, "isCameraObject", new x_ite_Fields .SFBool (), + Base_X3DConstants .outputOnly, "isPickableObject", new x_ite_Fields .SFBool ()); +} + +Object .assign (Object .setPrototypeOf (X3DChildNode .prototype, Core_X3DNode .prototype), +{ + setCameraObject (value) + { + if (value !== this ._isCameraObject .getValue ()) + this ._isCameraObject = value; + }, + isCameraObject () + { + return this ._isCameraObject .getValue (); + }, + setPickableObject (value) + { + if (value !== this ._isPickableObject .getValue ()) + this ._isPickableObject = value; + }, + isPickableObject () + { + return this ._isPickableObject .getValue (); + }, + getMustDisplay () + { + return false + }, +}); + +Object .defineProperties (X3DChildNode, +{ + typeName: + { + value: "X3DChildNode", + enumerable: true, + }, + componentName: + { + value: "Core", + enumerable: true, + }, +}); + +const X3DChildNode_default_ = X3DChildNode; +; + +x_ite_Namespace .add ("X3DChildNode", "x_ite/Components/Core/X3DChildNode", X3DChildNode_default_); +/* harmony default export */ const Core_X3DChildNode = (X3DChildNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Core/X3DInfoNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function X3DInfoNode (executionContext) +{ + Core_X3DChildNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DInfoNode); +} + +Object .setPrototypeOf (X3DInfoNode .prototype, Core_X3DChildNode .prototype); + +Object .defineProperties (X3DInfoNode, +{ + typeName: + { + value: "X3DInfoNode", + enumerable: true, + }, + componentName: + { + value: "Core", + enumerable: true, + }, +}); + +const X3DInfoNode_default_ = X3DInfoNode; +; + +x_ite_Namespace .add ("X3DInfoNode", "x_ite/Components/Core/X3DInfoNode", X3DInfoNode_default_); +/* harmony default export */ const Core_X3DInfoNode = (X3DInfoNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Core/WorldInfo.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function WorldInfo (executionContext) +{ + Core_X3DInfoNode .call (this, executionContext); + + this .addType (Base_X3DConstants .WorldInfo); +} + +Object .assign (Object .setPrototypeOf (WorldInfo .prototype, Core_X3DInfoNode .prototype), +{ + initialize () + { + Core_X3DInfoNode .prototype .initialize .call (this); + + this .getExecutionContext () .addWorldInfo (this); + }, + dispose () + { + this .getExecutionContext () .removeWorldInfo (this); + + Core_X3DInfoNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (WorldInfo, +{ + typeName: + { + value: "WorldInfo", + enumerable: true, + }, + componentName: + { + value: "Core", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "title", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "info", new x_ite_Fields .MFString ()), + ]), + enumerable: true, + }, +}); + +const WorldInfo_default_ = WorldInfo; +; + +x_ite_Namespace .add ("WorldInfo", "x_ite/Components/Core/WorldInfo", WorldInfo_default_); +/* harmony default export */ const Core_WorldInfo = (WorldInfo_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Core/X3DBindableNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +let modificationCount = 0; + +function X3DBindableNode (executionContext) +{ + Core_X3DChildNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DBindableNode); + + this .modificationCount = 0; +} + +Object .assign (Object .setPrototypeOf (X3DBindableNode .prototype, Core_X3DChildNode .prototype), +{ + initialize () + { + Core_X3DChildNode .prototype .initialize .call (this); + + this ._set_bind .addInterest ("set_bind__", this); + }, + isCameraObject () + { + return true; + }, + getModificationCount () + { + return this .modificationCount; + }, + transitionStart () + { }, + set_bind__ () + { + this .modificationCount = ++ modificationCount; + } +}); + +Object .defineProperties (X3DBindableNode, +{ + typeName: + { + value: "X3DBindableNode", + enumerable: true, + }, + componentName: + { + value: "Core", + enumerable: true, + }, + getModificationCount: + { + value: function () + { + return modificationCount; + }, + enumerable: false, + }, +}); + +const X3DBindableNode_default_ = X3DBindableNode; +; + +x_ite_Namespace .add ("X3DBindableNode", "x_ite/Components/Core/X3DBindableNode", X3DBindableNode_default_); +/* harmony default export */ const Core_X3DBindableNode = (X3DBindableNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Execution/NamedNodesHandling.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +const getUniqueName = function (array, name = "", number = false) +{ + name = String (name) .replace (/_\d+$/, ""); + + let + newName = number ? `${name}_1` : name, + lo = 1, + hi = 1; + + while (array .has (newName) || newName .length === 0) + { + lo = hi; + hi <<= 1; + + newName = `${name}_${lo}`; + } + + lo >>>= 1; + hi >>>= 1; + + if (lo && hi) + { + while (lo < hi) + { + const m = (lo + hi) >>> 1; + + if (array .has (`${name}_${m}`)) + lo = m + 1; + else + hi = m; + } + + newName = `${name}_${lo}`; + } + + return newName; +}; + +;// CONCATENATED MODULE: ./src/x_ite/Execution/NamedNodesArray.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function NamedNodesArray (values = [ ]) +{ + return Base_X3DInfoArray .call (this, Array .from (values, value => [value .getNodeName (), value]), Fields_SFNode); +} + +Object .setPrototypeOf (NamedNodesArray .prototype, Base_X3DInfoArray .prototype); + +for (const key of Object .keys (NamedNodesArray .prototype)) + Object .defineProperty (NamedNodesArray .prototype, key, { enumerable: false }); + +Object .defineProperties (NamedNodesArray, +{ + typeName: + { + value: "NamedNodesArray", + enumerable: true, + }, +}); + +const NamedNodesArray_default_ = NamedNodesArray; +; + +x_ite_Namespace .add ("NamedNodesArray", "x_ite/Execution/NamedNodesArray", NamedNodesArray_default_); +/* harmony default export */ const Execution_NamedNodesArray = (NamedNodesArray_default_); +;// CONCATENATED MODULE: ./src/x_ite/Execution/X3DImportedNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + +const + _inlineNode = Symbol (), + _exportedName = Symbol (), + _importedName = Symbol (), + _routes = Symbol (); + +function X3DImportedNode (executionContext, inlineNode, exportedName, importedName) +{ + Core_X3DNode .call (this, executionContext); + + this [_inlineNode] = inlineNode; + this [_exportedName] = exportedName; + this [_importedName] = importedName; + this [_routes] = new Set (); + + this [_inlineNode] ._loadState .addInterest ("set_loadState__", this); +} + +// Must be of type X3DNode, to get routes work. +Object .assign (Object .setPrototypeOf (X3DImportedNode .prototype, Core_X3DNode .prototype), +{ + getInlineNode () + { + return this [_inlineNode]; + }, + getExportedName () + { + return this [_exportedName]; + }, + getExportedNode () + { + return this [_inlineNode] .getInternalScene () .getExportedNode (this [_exportedName]) .getValue (); + }, + getImportedName () + { + return this [_importedName]; + }, + hasRoutes (baseNode) + { + for (const route of this [_routes]) + { + if (route .sourceNode === baseNode) + return true; + + if (route .destinationNode === baseNode) + return true; + } + + return false; + }, + addRoute (sourceNode, sourceField, destinationNode, destinationField) + { + // Add route. + + const route = { + sourceNode: sourceNode, + sourceField: sourceField, + destinationNode: destinationNode, + destinationField: destinationField, + }; + + this [_routes] .add (route); + + // Try to resolve source or destination node routes. + + if (this [_inlineNode] .checkLoadState () === Base_X3DConstants .COMPLETE_STATE) + this .resolveRoute (route); + }, + resolveRoute (route) + { + try + { + const + sourceField = route .sourceField, + destinationField = route .destinationField; + + let + sourceNode = route .sourceNode, + destinationNode = route .destinationNode; + + if (route .real) + route .real .dispose (); + + if (sourceNode instanceof X3DImportedNode) + sourceNode = sourceNode .getExportedNode (); + + if (destinationNode instanceof X3DImportedNode) + destinationNode = destinationNode .getExportedNode (); + + route .real = this .getExecutionContext () .addSimpleRoute (sourceNode, sourceField, destinationNode, destinationField); + } + catch (error) + { + console .error (error .message); + } + }, + deleteRoute (real) + { + for (const route of this [_routes]) + { + if (route .real === real) + this [_routes] .delete (route); + } + }, + deleteRoutes () + { + for (const route of this [_routes]) + { + const real = route .real + + if (real) + { + delete route .real; + this .getExecutionContext () .deleteSimpleRoute (real); + } + } + }, + set_loadState__ () + { + switch (this [_inlineNode] .checkLoadState ()) + { + case Base_X3DConstants .NOT_STARTED_STATE: + case Base_X3DConstants .FAILED_STATE: + { + this .deleteRoutes (); + break; + } + case Base_X3DConstants .COMPLETE_STATE: + { + this .deleteRoutes (); + + for (const route of this [_routes]) + this .resolveRoute (route); + + break; + } + } + }, + toStream (generator) + { + Base_X3DObject .prototype .toStream .call (this, generator); + }, + toVRMLStream (generator) + { + if (generator .ExistsNode (this .getInlineNode ())) + { + generator .string += generator .Indent (); + generator .string += "IMPORT"; + generator .string += generator .Space (); + generator .string += generator .Name (this .getInlineNode ()); + generator .string += "."; + generator .string += this .getExportedName (); + + if (this .getImportedName () !== this .getExportedName ()) + { + generator .string += generator .Space (); + generator .string += "AS"; + generator .string += generator .Space (); + generator .string += this .getImportedName (); + } + + try + { + generator .AddRouteNode (this); + generator .AddImportedNode (this .getExportedNode (), this .getImportedName ()); + } + catch + { + // Output unresolved routes. + + for (const route of this [_routes]) + { + const + sourceNode = route .sourceNode, + sourceField = route .sourceField, + destinationNode = route .destinationNode, + destinationField = route .destinationField; + + if (generator .ExistsRouteNode (sourceNode) && generator .ExistsRouteNode (destinationNode)) + { + const sourceNodeName = sourceNode instanceof X3DImportedNode + ? sourceNode .getImportedName () + : generator .Name (sourceNode); + + const destinationNodeName = destinationNode instanceof X3DImportedNode + ? destinationNode .getImportedName () + : generator .Name (destinationNode); + + generator .string += generator .TidyBreak (); + generator .string += generator .Indent (); + generator .string += "ROUTE"; + generator .string += generator .Space (); + generator .string += sourceNodeName; + generator .string += "."; + generator .string += sourceField; + generator .string += generator .Space (); + generator .string += "TO"; + generator .string += generator .Space (); + generator .string += destinationNodeName; + generator .string += "."; + generator .string += destinationField; + } + } + } + } + else + { + throw new Error ("X3DImportedNode.toXMLStream: Inline node does not exist."); + } + }, + toXMLStream (generator) + { + if (generator .ExistsNode (this .getInlineNode ())) + { + generator .string += generator .Indent (); + generator .string += "" : "/>"; + + try + { + generator .AddRouteNode (this); + generator .AddImportedNode (this .getExportedNode (), this .getImportedName ()); + } + catch + { + // Output unresolved routes. + + for (const route of this [_routes]) + { + const + sourceNode = route .sourceNode, + sourceField = route .sourceField, + destinationNode = route .destinationNode, + destinationField = route .destinationField; + + if (generator .ExistsRouteNode (sourceNode) && generator .ExistsRouteNode (destinationNode)) + { + const sourceNodeName = sourceNode instanceof X3DImportedNode + ? sourceNode .getImportedName () + : generator .Name (sourceNode); + + const destinationNodeName = destinationNode instanceof X3DImportedNode + ? destinationNode .getImportedName () + : generator .Name (destinationNode); + + generator .string += generator .TidyBreak (); + generator .string += generator .Indent (); + generator .string += "" : "/>"; + } + } + } + } + else + { + throw new Error ("X3DImportedNode.toXMLStream: Inline node does not exist."); + } + }, + toJSONStream (generator) + { + if (generator .ExistsNode (this .getInlineNode ())) + { + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += "IMPORT"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@inlineDEF"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (generator .Name (this .getInlineNode ())); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@importedDEF"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (this .getExportedName ()); + generator .string += '"'; + + if (this .getImportedName () !== this .getExportedName ()) + { + generator .string += ','; + generator .string += generator .TidyBreak (); + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@AS"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (this .getImportedName ()); + generator .string += '"'; + generator .string += generator .TidyBreak (); + } + else + { + generator .string += generator .TidyBreak (); + } + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + + try + { + generator .AddRouteNode (this); + generator .AddImportedNode (this .getExportedNode (), this .getImportedName ()); + } + catch + { + // Output unresolved routes. + + for (const route of this [_routes]) + { + const + sourceNode = route .sourceNode, + sourceField = route .sourceField, + destinationNode = route .destinationNode, + destinationField = route .destinationField; + + if (generator .ExistsRouteNode (sourceNode) && generator .ExistsRouteNode (destinationNode)) + { + const sourceNodeName = sourceNode instanceof X3DImportedNode + ? sourceNode .getImportedName () + : generator .Name (sourceNode); + + const destinationNodeName = destinationNode instanceof X3DImportedNode + ? destinationNode .getImportedName () + : generator .Name (destinationNode); + + generator .string += ','; + generator .string += generator .TidyBreak (); + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += "ROUTE"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@fromNode"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (sourceNodeName); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@fromField"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (sourceField); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@toNode"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (destinationNodeName); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@toField"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (destinationField); + generator .string += '"'; + generator .string += generator .TidyBreak (); + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + } + } + } + } + else + { + throw new Error ("X3DImportedNode.toJSONStream: Inline node does not exist."); + } + }, + dispose () + { + this [_inlineNode] ._loadState .removeInterest ("set_loadState__", this); + + this .deleteRoutes (); + + Core_X3DNode .prototype .dispose .call (this); + }, +}); + +for (const key of Object .keys (X3DImportedNode .prototype)) + Object .defineProperty (X3DImportedNode .prototype, key, { enumerable: false }); + +Object .defineProperties (X3DImportedNode .prototype, +{ + inlineNode: + { + get () + { + return Fields_SFNodeCache .get (this [_inlineNode]); + }, + enumerable: true, + }, + exportedName: + { + get () + { + return this [_exportedName]; + }, + enumerable: true, + }, + exportedNode: + { + get () + { + return this [_inlineNode] .getInternalScene () .getExportedNode (this [_exportedName]); + }, + enumerable: true, + }, + importedName: + { + get () + { + return this [_importedName]; + }, + enumerable: true, + }, +}); + +Object .defineProperties (X3DImportedNode, +{ + typeName: + { + value: "X3DImportedNode", + enumerable: true, + }, +}); + +const X3DImportedNode_default_ = X3DImportedNode; +; + +x_ite_Namespace .add ("X3DImportedNode", "x_ite/Execution/X3DImportedNode", X3DImportedNode_default_); +/* harmony default export */ const Execution_X3DImportedNode = (X3DImportedNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Execution/ImportedNodesArray.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function ImportedNodesArray (values = [ ]) +{ + return Base_X3DInfoArray .call (this, Array .from (values, value => [value .getImportedName (), value]), Execution_X3DImportedNode); +} + +Object .setPrototypeOf (ImportedNodesArray .prototype, Base_X3DInfoArray .prototype); + +for (const key of Object .keys (ImportedNodesArray .prototype)) + Object .defineProperty (ImportedNodesArray .prototype, key, { enumerable: false }); + +Object .defineProperties (ImportedNodesArray, +{ + typeName: + { + value: "ImportedNodesArray", + enumerable: true, + }, +}); + +const ImportedNodesArray_default_ = ImportedNodesArray; +; + +x_ite_Namespace .add ("ImportedNodesArray", "x_ite/Execution/ImportedNodesArray", ImportedNodesArray_default_); +/* harmony default export */ const Execution_ImportedNodesArray = (ImportedNodesArray_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Networking/X3DUrlObject.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +const + X3DUrlObject_cache = Symbol (), + _autoRefreshStartTime = Symbol (), + _autoRefreshCompleteTime = Symbol (), + _autoRefreshId = Symbol (); + +function X3DUrlObject (executionContext) +{ + this .addType (Base_X3DConstants .X3DUrlObject); + + this .addChildObjects (Base_X3DConstants .outputOnly, "loadState", new x_ite_Fields .SFInt32 (Base_X3DConstants .NOT_STARTED_STATE), + Base_X3DConstants .inputOutput, "loadData", new x_ite_Fields .SFTime ()); + + this [X3DUrlObject_cache] = true; + this [_autoRefreshStartTime] = Date .now (); +} + +Object .assign (X3DUrlObject .prototype, +{ + initialize () + { + this .getLive () .addInterest ("set_live__", this); + + this ._load .addInterest ("set_load__", this); + this ._url .addInterest ("set_url__", this); + this ._loadData .addInterest ("loadData", this); + this ._autoRefresh .addInterest ("set_autoRefresh__", this); + this ._autoRefreshTimeLimit .addInterest ("set_autoRefresh__", this); + }, + setLoadState (value, notify = true) + { + this ._loadState = value; + + if (value === Base_X3DConstants .COMPLETE_STATE) + { + this [_autoRefreshCompleteTime] = Date .now (); + this .setAutoRefreshTimer (this ._autoRefresh .getValue ()); + } + + if (!notify) + return; + + switch (value) + { + case Base_X3DConstants .NOT_STARTED_STATE: + break; + case Base_X3DConstants .IN_PROGRESS_STATE: + { + this .getScene () .addLoadingObject (this); + break; + } + case Base_X3DConstants .COMPLETE_STATE: + case Base_X3DConstants .FAILED_STATE: + { + this .getScene () .removeLoadingObject (this); + break; + } + } + }, + checkLoadState () + { + return this ._loadState .getValue (); + }, + getLoadState () + { + return this ._loadState; + }, + setCache (value) + { + this [X3DUrlObject_cache] = value; + }, + getCache () + { + return this [X3DUrlObject_cache] && this .getBrowser () .getBrowserOption ("Cache"); + }, + requestImmediateLoad (cache = true) + { + return new Promise ((resolve, reject) => + { + const loading = () => + { + const _loading = Symbol (); + + this ._loadState .addFieldCallback (_loading, () => + { + switch (this .checkLoadState ()) + { + case Base_X3DConstants .COMPLETE_STATE: + this ._loadState .removeFieldCallback (_loading); + resolve (); + break; + case Base_X3DConstants .FAILED_STATE: + this ._loadState .removeFieldCallback (_loading); + reject (); + break; + } + }) + }; + + const loadState = this .checkLoadState (); + + switch (loadState) + { + case Base_X3DConstants .IN_PROGRESS_STATE: + { + loading (); + return; + } + case Base_X3DConstants .COMPLETE_STATE: + { + resolve (); + return; + } + case Base_X3DConstants .FAILED_STATE: + { + reject (); + return; + } + } + + const browser = this .getBrowser (); + + if (!browser .getBrowserOption ("LoadUrlObjects") && this .getExecutionContext () !== browser .getPrivateScene () && !this .isExternProto) + { + resolve (); + return; + } + + if (!this ._load .getValue ()) + { + reject (); + return; + } + + if (this ._url .length === 0) + { + resolve (); + return; + } + + this .setCache (cache); + this .setLoadState (Base_X3DConstants .IN_PROGRESS_STATE); + + if (this .isInitialized ()) + // Buffer prevents double load of the scene if load and url field are set at the same time. + this ._loadData = this .getBrowser () .getCurrentTime (); + else + this .loadData (); + + loading (); + }); + }, + loadNow () + { + this .setLoadState (Base_X3DConstants .NOT_STARTED_STATE); + + return this .requestImmediateLoad (); + }, + loadData () + { }, + requestUnload () + { + const loadState = this .checkLoadState (); + + if (loadState === Base_X3DConstants .NOT_STARTED_STATE || loadState === Base_X3DConstants .FAILED_STATE) + return; + + this .setLoadState (Base_X3DConstants .NOT_STARTED_STATE); + this .unloadData (); + }, + unloadNow () + { + this .requestUnload (); + }, + unloadData () + { }, + setAutoRefreshTimer (autoRefreshInterval) + { + clearTimeout (this [_autoRefreshId]); + + if (this ._autoRefresh .getValue () <= 0) + return; + + const autoRefreshTimeLimit = this ._autoRefreshTimeLimit .getValue (); + + if (autoRefreshTimeLimit !== 0) + { + if ((Date .now () - this [_autoRefreshStartTime]) / 1000 > autoRefreshTimeLimit - autoRefreshInterval) + return; + } + + this [_autoRefreshId] = setTimeout (this .performAutoRefresh .bind (this), autoRefreshInterval * 1000); + }, + performAutoRefresh () + { + this .setLoadState (Base_X3DConstants .NOT_STARTED_STATE); + this .requestImmediateLoad (false) .catch (Function .prototype); + }, + set_live__ () + { + if (this .getLive () .getValue ()) + this .set_autoRefresh__ (); + else + clearTimeout (this [_autoRefreshId]); + }, + set_load__ () + { + if (this ._load .getValue ()) + this .requestImmediateLoad () .catch (Function .prototype); + else + this .requestUnload (); + }, + set_url__ () + { + if (!this ._load .getValue ()) + return; + + this .setLoadState (Base_X3DConstants .NOT_STARTED_STATE); + this .requestImmediateLoad () .catch (Function .prototype); + }, + set_autoRefresh__ () + { + if (this .checkLoadState () !== Base_X3DConstants .COMPLETE_STATE) + return; + + const + elapsedTime = (Date .now () - this [_autoRefreshCompleteTime]) / 1000, + autoRefresh = this ._autoRefresh .getValue (); + + let autoRefreshInterval = autoRefresh - elapsedTime; + + if (autoRefreshInterval < 0) + autoRefreshInterval = Math .ceil (elapsedTime / autoRefresh) * autoRefresh - elapsedTime; + + this .setAutoRefreshTimer (autoRefreshInterval); + }, + dispose () { }, +}); + +Object .defineProperties (X3DUrlObject, +{ + typeName: + { + value: "X3DUrlObject", + enumerable: true, + }, + componentName: + { + value: "Networking", + enumerable: true, + }, +}); + +const X3DUrlObject_default_ = X3DUrlObject; +; + +x_ite_Namespace .add ("X3DUrlObject", "x_ite/Components/Networking/X3DUrlObject", X3DUrlObject_default_); +/* harmony default export */ const Networking_X3DUrlObject = (X3DUrlObject_default_); +;// CONCATENATED MODULE: ./src/x_ite/Prototype/X3DProtoDeclarationNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function X3DProtoDeclarationNode (executionContext) +{ + Base_X3DBaseNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DProtoDeclarationNode); + + this .addChildObjects (Base_X3DConstants .outputOnly, "updateInstances", new x_ite_Fields .SFTime ()); +} + +Object .assign (Object .setPrototypeOf (X3DProtoDeclarationNode .prototype, Base_X3DBaseNode .prototype), +{ + canUserDefinedFields () + { + return true; + }, + createInstance (executionContext, setup = true /* non-public argument */) + { + if (setup === false) + { + return new Core_X3DPrototypeInstance (executionContext, this); + } + else + { + const instance = new Core_X3DPrototypeInstance (executionContext, this); + + instance .setup (); + + return Fields_SFNodeCache .get (instance); + } + }, + newInstance () + { + return this .createInstance (this .getExecutionContext ()); + }, + requestUpdateInstances () + { + this ._updateInstances = this .getBrowser () .getCurrentTime (); + }, + updateInstances () + { + this ._updateInstances .processEvent (); + }, +}); + +for (const key of Object .keys (X3DProtoDeclarationNode .prototype)) + Object .defineProperty (X3DProtoDeclarationNode .prototype, key, { enumerable: false }); + +Object .defineProperties (X3DProtoDeclarationNode, +{ + typeName: + { + value: "X3DProtoDeclarationNode", + enumerable: true, + }, +}); + +Base_X3DConstants .addNode (X3DProtoDeclarationNode); + +const X3DProtoDeclarationNode_default_ = X3DProtoDeclarationNode; +; + +x_ite_Namespace .add ("X3DProtoDeclarationNode", "x_ite/Prototype/X3DProtoDeclarationNode", X3DProtoDeclarationNode_default_); +/* harmony default export */ const Prototype_X3DProtoDeclarationNode = (X3DProtoDeclarationNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Parser/X3DParser.js +/* provided dependency */ var X3DParser_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +function X3DParser (scene) +{ + this .scene = scene; + this .executionContexts = [ scene ]; + this .prototypes = [ ]; +} + +Object .assign (X3DParser .prototype, +{ + getBrowser () + { + return this .scene .getBrowser (); + }, + getScene () + { + return this .scene; + }, + getExecutionContext () + { + return this .executionContexts .at (-1); + }, + pushExecutionContext (executionContext) + { + return this .executionContexts .push (executionContext); + }, + popExecutionContext () + { + this .executionContexts .pop (); + }, + getPrototype () + { + return this .prototypes .at (-1); + }, + pushPrototype (prototype) + { + return this .prototypes .push (prototype); + }, + popPrototype () + { + this .prototypes .pop (); + }, + isInsideProtoDefinition () + { + return !! this .prototypes .length; + }, + loadComponents () + { + const + browser = this .getBrowser (), + scene = this .getScene (); + + return Promise .all ([ + browser .loadComponents (scene .getProfile () || browser .getProfile ("Full")), + browser .loadComponents (scene .getComponents ()), + ]); + }, + setUnits (units) + { + if (units) + delete this .fromUnit; + else + this .fromUnit = function (category, value) { return value; }; + }, + fromUnit (category, value) + { + return this .scene .fromUnit (category, value); + }, + convertColor (value, defaultColor = "white") + { + const + wrap = X3DParser_$("
") .hide () .css ("color", defaultColor) .appendTo (X3DParser_$("body")), + div = X3DParser_$("
").css ("color", value) .appendTo (wrap), + rgb = window .getComputedStyle (div [0]) .color, + values = rgb .replace (/^rgba?\(|\)$/g, "") .split (/[\s,]+/) .map (s => parseFloat (s)); + + wrap .remove (); + + values [0] /= 255; + values [1] /= 255; + values [2] /= 255; + + if (typeof values [3] !== "number") + values [3] = 1; + + return values; + }, + sanitizeName (name = "") + { + // NonIdFirstChar + name = name .replace (/^[\x30-\x39\x00-\x20\x22\x23\x27\x2b\x2c\x2d\x2e\x5b\x5c\x5d\x7b\x7d\x7f]*/, ""); + + // NonIdChars + name = name .replace (/[\x00-\x20\x22\x23\x27\x2c\x2e\x5b\x5c\x5d\x7b\x7d\x7f]+/g, "-"); + + // Spaces + name = name .trim () .replace (/[\s_-]+/g, "-"); + + // Trim + name = name .replace (/^-+|-+$/g, ""); + + return name; + }, +}); + +const X3DParser_default_ = X3DParser; +; + +x_ite_Namespace .add ("X3DParser", "x_ite/Parser/X3DParser", X3DParser_default_); +/* harmony default export */ const Parser_X3DParser = (X3DParser_default_); +;// CONCATENATED MODULE: ./src/x_ite/Parser/Expressions.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +function parse (parser) +{ + this .lastIndex = parser .lastIndex; + + parser .result = this .exec (parser .input); + + if (parser .result) + { + parser .lastIndex = this .lastIndex; + return true; + } + + return false; +} + +function lookahead (parser) +{ + const + lastIndex = parser .lastIndex, + result = this .parse (parser); + + parser .lastIndex = lastIndex; + + return result; +} + +function Expressions (Grammar) +{ + for (const value of Object .values (Grammar)) + { + value .parse = parse; + value .lookahead = lookahead; + } + + return Grammar; +} + +const Expressions_default_ = Expressions; +; + +x_ite_Namespace .add ("Expressions", "x_ite/Parser/Expressions", Expressions_default_); +/* harmony default export */ const Parser_Expressions = (Expressions_default_); +;// CONCATENATED MODULE: ./src/x_ite/Prototype/X3DProtoDeclaration.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +const + _body = Symbol (); + +function X3DProtoDeclaration (executionContext) +{ + Prototype_X3DProtoDeclarationNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DProtoDeclaration) + + this [_body] = new Execution_X3DExecutionContext (executionContext, this); + this [_body] .setLive (false); + this .setLive (false); +} + +Object .assign (Object .setPrototypeOf (X3DProtoDeclaration .prototype, Prototype_X3DProtoDeclarationNode .prototype), +{ + initialize () + { + Prototype_X3DProtoDeclarationNode .prototype .initialize .call (this); + + this [_body] .setup (); + }, + getProtoDeclaration () + { + return this; + }, + getBody () + { + return this [_body]; + }, + canUserDefinedFields () + { + return true; + }, + toVRMLStream (generator) + { + generator .string += generator .Indent (); + generator .string += "PROTO"; + generator .string += generator .Space (); + generator .string += this .getName (); + generator .string += generator .TidySpace (); + generator .string += "["; + + generator .EnterScope (); + + const userDefinedFields = this .getUserDefinedFields (); + + if (userDefinedFields .length === 0) + { + generator .string += generator .TidySpace (); + } + else + { + let + fieldTypeLength = 0, + accessTypeLength = 0; + + for (const field of userDefinedFields) + { + fieldTypeLength = Math .max (fieldTypeLength, field .getTypeName () .length); + accessTypeLength = Math .max (accessTypeLength, generator .AccessType (field .getAccessType ()) .length); + } + + generator .string += generator .TidyBreak (); + + generator .IncIndent (); + + for (const field of userDefinedFields) + { + this .toVRMLStreamUserDefinedField (generator, field, fieldTypeLength, accessTypeLength); + + generator .string += generator .Break (); + } + + generator .DecIndent (); + + generator .string += generator .Indent (); + } + + generator .LeaveScope (); + + generator .string += "]"; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += "{"; + generator .string += generator .TidyBreak (); + + generator .IncIndent (); + + this [_body] .toVRMLStream (generator); + + generator .DecIndent (); + + generator .string += generator .Indent (); + generator .string += "}"; + }, + toVRMLStreamUserDefinedField (generator, field, fieldTypeLength, accessTypeLength) + { + generator .string += generator .Indent (); + generator .string += generator .AccessType (field .getAccessType ()) .padEnd (accessTypeLength, " "); + generator .string += generator .Space (); + generator .string += field .getTypeName () .padEnd (fieldTypeLength, " "); + generator .string += generator .Space (); + generator .string += field .getName (); + + if (field .isInitializable ()) + { + generator .string += generator .Space (); + + field .toVRMLStream (generator); + } + }, + toXMLStream (generator) + { + generator .string += generator .Indent (); + generator .string += " + + generator .EnterScope (); + + const userDefinedFields = this .getUserDefinedFields (); + + if (userDefinedFields .length !== 0) + { + generator .IncIndent (); + + generator .string += generator .Indent (); + generator .string += ""; + generator .string += generator .TidyBreak (); + + generator .IncIndent (); + + for (const field of userDefinedFields) + { + generator .string += generator .Indent (); + generator .string += "" : "/>"; + generator .string += generator .TidyBreak (); + } + else + { + switch (field .getType ()) + { + case Base_X3DConstants .SFNode: + case Base_X3DConstants .MFNode: + { + generator .PushContainerField (field); + + generator .string += ">"; + generator .string += generator .TidyBreak (); + + generator .IncIndent (); + + field .toXMLStream (generator); + + generator .string += generator .TidyBreak (); + + generator .DecIndent (); + + generator .string += generator .Indent (); + generator .string += ""; + generator .string += generator .TidyBreak (); + + generator .PopContainerField (); + break; + } + default: + { + generator .string += generator .Space (); + generator .string += "value='"; + + field .toXMLStream (generator); + + generator .string += "'"; + generator .string += generator .closingTags ? ">" : "/>"; + generator .string += generator .TidyBreak (); + break; + } + } + } + } + + generator .DecIndent (); + + generator .string += generator .Indent (); + generator .string += ""; + generator .string += generator .TidyBreak (); + + generator .DecIndent (); + } + + generator .LeaveScope (); + + // + + // + + generator .IncIndent (); + + generator .string += generator .Indent (); + generator .string += ""; + generator .string += generator .TidyBreak (); + + generator .IncIndent (); + + this [_body] .toXMLStream (generator); + + generator .DecIndent (); + + generator .string += generator .Indent (); + generator .string += ""; + generator .string += generator .TidyBreak (); + + generator .DecIndent (); + + // + + generator .string += generator .Indent (); + generator .string += ""; + }, + toJSONStream (generator) + { + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += "ProtoDeclare"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@name"; + generator .string += '"'; + generator .string += ':'; + generator .string += '"'; + generator .string += generator .JSONEncode (this .getName ()); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "ProtoInterface"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + + // Fields + + generator .EnterScope (); + + const userDefinedFields = this .getUserDefinedFields (); + + if (userDefinedFields .length) + { + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "field"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '['; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + for (const field of userDefinedFields) + { + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@accessType"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .AccessType (field .getAccessType ()); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@type"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += field .getTypeName (); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@name"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (field .getName ()); + generator .string += '"'; + + if (field .isDefaultValue ()) + { + generator .string += generator .TidyBreak (); + } + else + { + generator .string += ','; + generator .string += generator .TidyBreak (); + + // Output value + + switch (field .getType ()) + { + case Base_X3DConstants .SFNode: + { + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "-children"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '['; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + + field .toJSONStream (generator); + + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += ']'; + generator .string += generator .TidyBreak (); + break; + } + case Base_X3DConstants .MFNode: + { + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "-children"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + + field .toJSONStream (generator); + + generator .string += generator .TidyBreak (); + break; + } + default: + { + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@value"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + + field .toJSONStream (generator); + + generator .string += generator .TidyBreak (); + break; + } + } + } + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + + if (field !== userDefinedFields .at (-1)) + generator .string += ','; + + generator .string += generator .TidyBreak (); + } + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += ']'; + } + + generator .string += generator .DecIndent (); + generator .string += generator .TidyBreak (); + generator .string += generator .Indent (); + generator .string += '}'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .LeaveScope (); + + + // ProtoBody + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "ProtoBody"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "-children"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '['; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + this [_body] .toJSONStream (generator); + + generator .JSONRemoveComma (); + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += ']'; + generator .string += generator .TidyBreak (); + + // End + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + }, +}); + +for (const key of Object .keys (X3DProtoDeclaration .prototype)) + Object .defineProperty (X3DProtoDeclaration .prototype, key, { enumerable: false }); + +Object .defineProperties (X3DProtoDeclaration .prototype, +{ + name: + { + get: X3DProtoDeclaration .prototype .getName, + enumerable: true, + }, + fields: + { + get: X3DProtoDeclaration .prototype .getFieldDefinitions, + enumerable: true, + }, + isExternProto: + { + value: false, + enumerable: true, + }, +}); + +Object .defineProperties (X3DProtoDeclaration, +{ + typeName: + { + value: "X3DProtoDeclaration", + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +Base_X3DConstants .addNode (X3DProtoDeclaration); + +const X3DProtoDeclaration_default_ = X3DProtoDeclaration; +; + +x_ite_Namespace .add ("X3DProtoDeclaration", "x_ite/Prototype/X3DProtoDeclaration", X3DProtoDeclaration_default_); +/* harmony default export */ const Prototype_X3DProtoDeclaration = (X3DProtoDeclaration_default_); +;// CONCATENATED MODULE: ./src/x_ite/Parser/VRMLParser.js +/* provided dependency */ var VRMLParser_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + + +/* + * Grammar + */ + +// VRML lexical elements +const Grammar = Parser_Expressions ({ + // General + Whitespaces: /([\x20\n,\t\r]+)/gy, + Comment: /#(.*?)(?=[\n\r])/gy, + Break: /\r?\n/g, + + // Header + Header: /^#(VRML|X3D) V(.*?) (utf8)(?:[ \t]+(.*?))?[ \t]*[\n\r]/gy, + + // Keywords + AS: /AS/gy, + COMPONENT: /COMPONENT/gy, + DEF: /DEF/gy, + EXPORT: /EXPORT/gy, + EXTERNPROTO: /EXTERNPROTO/gy, + FALSE: /FALSE|false/gy, + IMPORT: /IMPORT/gy, + IS: /IS/gy, + META: /META/gy, + NULL: /NULL/gy, + TRUE: /TRUE|true/gy, + PROFILE: /PROFILE/gy, + PROTO: /PROTO/gy, + ROUTE: /ROUTE/gy, + TO: /TO/gy, + UNIT: /UNIT/gy, + USE: /USE/gy, + + // Terminal symbols + OpenBrace: /\{/gy, + CloseBrace: /\}/gy, + OpenBracket: /\[/gy, + CloseBracket: /\]/gy, + Period: /\./gy, + Colon: /\:/gy, + + Id: /([^\x30-\x39\x00-\x20\x22\x23\x27\x2b\x2c\x2d\x2e\x5b\x5c\x5d\x7b\x7d\x7f]{1}[^\x00-\x20\x22\x23\x27\x2c\x2e\x5b\x5c\x5d\x7b\x7d\x7f]*)/gy, + ComponentNameId: /([^\x30-\x39\x00-\x20\x22\x23\x27\x2b\x2c\x2d\x2e\x5b\x5c\x5d\x7b\x7d\x7f\x3a]{1}[^\x00-\x20\x22\x23\x27\x2c\x2e\x5b\x5c\x5d\x7b\x7d\x7f\x3a]*)/gy, + + initializeOnly: /initializeOnly/gy, + inputOnly: /inputOnly/gy, + outputOnly: /outputOnly/gy, + inputOutput: /inputOutput/gy, + + field: /field/gy, + eventIn: /eventIn/gy, + eventOut: /eventOut/gy, + exposedField: /exposedField/gy, + + FieldType: /([SM]F(?:Bool|ColorRGBA|Color|Double|Float|Image|Int32|Matrix3d|Matrix3f|Matrix4d|Matrix4f|Node|Rotation|String|Time|Vec2d|Vec2f|Vec3d|Vec3f|Vec4d|Vec4f))/gy, + + // Values + int32: /((?:0[xX][\da-fA-F]+)|(?:[+-]?\d+))/gy, + double: /([+-]?(?:(?:(?:\d*\.\d+)|(?:\d+(?:\.)?))(?:[eE][+-]?\d+)?))/gy, + string: /"((?:[^\\"]|\\\\|\\")*)"/gy, + + CONSTANTS: /([+-]?)\b(NAN|INFINITY|INF|PI|PI2|PI1_4|PI2_4|PI3_4|PI4_4|PI5_4|PI6_4|PI7_4|PI8_4|PI1_2|PI2_2|PI3_2|PI4_2|PI1_3|PI2_3|PI3_3|PI4_3|PI5_3|PI6_3|SQRT1_2|SQRT2)\b/igy, + HTMLColor: /([a-zA-Z]+|0[xX][\da-fA-F]+|rgba?\(.*?\))/gy, +}); + +/* + * Parser + */ + +function VRMLParser (scene) +{ + Parser_X3DParser .call (this, scene); +} + +Object .assign (Object .setPrototypeOf (VRMLParser .prototype, Parser_X3DParser .prototype), +{ + accessTypes: + { + field: Base_X3DConstants .initializeOnly, + eventIn: Base_X3DConstants .inputOnly, + eventOut: Base_X3DConstants .outputOnly, + exposedField: Base_X3DConstants .inputOutput, + initializeOnly: Base_X3DConstants .initializeOnly, + inputOnly: Base_X3DConstants .inputOnly, + outputOnly: Base_X3DConstants .outputOnly, + inputOutput: Base_X3DConstants .inputOutput, + }, + SFImage: new x_ite_Fields .SFImage (), + SFNode: new x_ite_Fields .SFNode (), + MFString: new x_ite_Fields .MFString (), + Color3: new Numbers_Color3 (0, 0, 0), + Color4: new Numbers_Color4 (0, 0, 0, 0), + Matrix3: new Numbers_Matrix3 (), + Matrix4: new Numbers_Matrix4 (), + Rotation4: new Numbers_Rotation4 (), + Vector2: new Numbers_Vector2 (0, 0), + Vector3: new Numbers_Vector3 (0, 0, 0), + Vector4: new Numbers_Vector4 (0, 0, 0, 0), + CONSTANTS: { + NAN: Number .NaN, + INFINITY: Number .POSITIVE_INFINITY, + INF: Number .POSITIVE_INFINITY, + PI: Math .PI, + PI2: Math .PI * 2, + PI1_4: Math .PI * 1/4, + PI2_4: Math .PI * 2/4, + PI3_4: Math .PI * 3/4, + PI4_4: Math .PI * 4/4, + PI5_4: Math .PI * 5/4, + PI6_4: Math .PI * 6/4, + PI7_4: Math .PI * 7/4, + PI8_4: Math .PI * 8/4, + PI1_2: Math .PI * 1/2, + PI2_2: Math .PI * 2/2, + PI3_2: Math .PI * 3/2, + PI4_2: Math .PI * 4/2, + PI1_3: Math .PI * 1/3, + PI2_3: Math .PI * 2/3, + PI3_3: Math .PI * 3/3, + PI4_3: Math .PI * 4/3, + PI5_3: Math .PI * 5/3, + PI6_3: Math .PI * 6/3, + SQRT1_2: Math .SQRT1_2, + SQRT2: Math .SQRT2, + }, + getEncoding () + { + return "STRING"; + }, + setInput (vrmlSyntax) + { + this .input = vrmlSyntax; + this .lineNumber = 1; + this .lastIndex = 0; + }, + isValid () + { + if (!(typeof this .input === "string")) + return false; + + return !! this .input .match (/^(?:#X3D|#VRML|(?:[\x20\n,\t\r]*|#.*?[\r\n])*(PROFILE|COMPONENT|META|UNIT|EXTERNPROTO|PROTO|DEF|NULL|IMPORT|EXPORT|ROUTE|\w+(?:[\x20\n,\t\r]*|#.*?[\r\n])\{|$))/); + }, + parseIntoScene (resolve, reject) + { + try + { + this .resolve = resolve; + this .reject = reject; + + this .getScene () .setEncoding ("VRML"); + this .getScene () .setProfile (this .getBrowser () .getProfile ("Full")); + this .x3dScene (); + } + catch (error) + { + //console .error (error); + throw new Error (this .getError (error)); + } + }, + throwOrWarn (string) + { + if (this .getBrowser () .isStrict ()) + throw new Error (string); + + console .warn (string); + }, + getError (error) + { + //console .error (error); + + const + string = error .message, + unexpected = this .lastIndex === this .input .length ? "Unexpected end of file. " : ""; + + let + rest = this .getLine (), + line = this .getLastLine (), + lastLine = this .getLastLine (), + linePos = line .length - rest .length + 1; + + if (line .length > 80) + { + line = line .substr (linePos - 40, 80); + lastLine = ""; + linePos = 40; + } + + // Format error + + const message = "\n" + + `********************************************************************************\n` + + `Parser error at line ${this .lineNumber}:${linePos}\n` + + `in '${this .getExecutionContext () .getWorldURL ()}'\n` + + `\n` + + `${lastLine}\n` + + `${line}\n` + + `${Array (linePos) .join (" ")}^\n` + + `${unexpected}${string}\n` + + `********************************************************************************\n` + ; + + return message; + }, + getLine () + { + let + input = this .input, + lastIndex = this .lastIndex, + line = ""; + + while (lastIndex < input .length && input [lastIndex] !== "\n" && input [lastIndex] !== "\r") + line += input [lastIndex ++]; + + this .lastIndex = lastIndex; + + return line; + }, + getLastLine () + { + let + input = this .input, + lastIndex = Math .min (this .lastIndex, this .input .length - 1), + line = ""; + + if (lastIndex < input .length && (input [lastIndex] !== "\n" || input [lastIndex] !== "\r")) + -- lastIndex; + + while (lastIndex >= 0 && input [lastIndex] !== "\n" && input [lastIndex] !== "\r") + line = input [lastIndex --] + line; + + this .lastIndex = lastIndex; + + return line; + }, + comments () + { + while (this .comment ()) + ; + }, + comment () + { + if (this .whitespaces ()) + return true; + + return Grammar .Comment .parse (this); + }, + whitespaces () + { + if (Grammar .Whitespaces .parse (this)) + { + this .lines (this .result [1]); + + return true; + } + + return false; + }, + lines (string) + { + const match = string .match (Grammar .Break); + + if (match) + this .lineNumber += match .length; + }, + x3dScene: (() => + { + const VRML = + [ + "EnvironmentalSensor", + "PointingDeviceSensor", + "Scripting", + "Sound", + "Text", + ]; + + return function () + { + const + browser = this .getBrowser (), + scene = this .getScene (); + + this .headerStatement (); + this .profileStatement (); + this .componentStatements (); + this .unitStatements (); + this .metaStatements (); + + if (scene .getSpecificationVersion () === "2.0") + { + scene .setProfile (browser .getProfile ("Interchange")); + + for (const componentName of VRML) + scene .updateComponent (browser .getComponent (componentName)); + } + + if (this .resolve) + { + this .loadComponents () .then (() => + { + try + { + this .statements (this .getExecutionContext () .rootNodes); + + if (this .lastIndex < this .input .length) + throw new Error ("Unknown statement."); + + this .resolve (scene); + } + catch (error) + { + throw new Error (this .getError (error)); + } + }) + .catch (this .reject); + } + else + { + this .statements (this .getExecutionContext () .rootNodes); + + if (this .lastIndex < this .input .length) + throw new Error ("Unknown statement."); + } + }; + })(), + headerStatement () + { + Grammar .Header .lastIndex = 0; + + const result = Grammar .Header .exec (this .input); + + if (result) + { + this .getScene () .setSpecificationVersion (result [2]); + this .getScene () .setEncoding ("VRML"); + return true; + } + + return false; + }, + profileStatement () + { + this .comments (); + + if (Grammar .PROFILE .parse (this)) + { + if (this .profileNameId ()) + { + const profile = this .getBrowser () .getProfile (this .result [1]); + + this .getScene () .setProfile (profile); + return; + } + + throw new Error ("Expected a profile name."); + } + }, + componentStatements () + { + let component; + + while (component = this .componentStatement ()) + this .getScene () .updateComponent (component); + }, + componentStatement () + { + this .comments (); + + if (Grammar .COMPONENT .parse (this)) + { + if (this .componentNameId ()) + { + const componentNameIdCharacters = this .result [1]; + + this .comments (); + + if (Grammar .Colon .parse (this)) + { + if (this .componentSupportLevel ()) + { + const componentSupportLevel = this .value; + + return this .getBrowser () .getComponent (componentNameIdCharacters, componentSupportLevel); + } + + throw new Error ("Expected a component support level."); + } + + throw new Error ("Expected a ':' after component name."); + } + + throw new Error ("Expected a component name."); + } + + return null; + }, + componentSupportLevel () + { + return this .int32 (); + }, + unitStatements () + { + while (this .unitStatement ()) + ; + }, + unitStatement () + { + this .comments (); + + if (Grammar .UNIT .parse (this)) + { + if (this .categoryNameId ()) + { + const categoryNameId = this .result [1]; + + if (this .unitNameId ()) + { + const unitNameId = this .result [1]; + + if (this .unitConversionFactor ()) + { + const unitConversionFactor = this .value; + + try + { + this .getScene () .updateUnit (categoryNameId, unitNameId, unitConversionFactor); + return true; + } + catch (error) + { + console .warn (error .message); + return true; + } + } + + throw new Error ("Expected unit conversion factor."); + } + + throw new Error ("Expected unit name identifier."); + } + + throw new Error ("Expected category name identifier after UNIT statement."); + } + + return false; + }, + unitConversionFactor () + { + return this .double (); + }, + metaStatements () + { + while (this .metaStatement ()) + ; + }, + metaStatement () + { + this .comments (); + + if (Grammar .META .parse (this)) + { + if (this .metaKey ()) + { + const metaKey = this .value; + + if (this .metaValue ()) + { + const metaValue = this .value; + + this .getScene () .addMetaData (metaKey, metaValue); + return true; + } + + throw new Error ("Expected metadata value."); + } + + throw new Error ("Expected metadata key."); + } + + return false; + }, + metaKey () + { + return this .string (); + }, + metaValue () + { + return this .string (); + }, + exportStatement () + { + this .comments (); + + if (Grammar .EXPORT .parse (this)) + { + if (this .nodeNameId ()) + { + const localNodeNameId = this .result [1]; + + this .comments (); + + const node = this .getScene () .getLocalNode (localNodeNameId); + + if (Grammar .AS .parse (this)) + { + if (this .exportedNodeNameId ()) + var exportedNodeNameId = this .result [1]; + else + throw new Error ("No name given after AS."); + } + else + { + var exportedNodeNameId = localNodeNameId; + } + + if (this .getScene () === this .getExecutionContext ()) + { + this .getScene () .updateExportedNode (exportedNodeNameId, node); + return true; + } + + throw new Error ("Export statement not allowed here."); + } + + throw new Error ("No name given after EXPORT."); + } + + return false; + }, + importStatement () + { + this .comments (); + + if (Grammar .IMPORT .parse (this)) + { + if (this .nodeNameId ()) + { + const + inlineNodeNameId = this .result [1], + namedNode = this .getExecutionContext () .getNamedNode (inlineNodeNameId); + + this .comments (); + + if (Grammar .Period .parse (this)) + { + if (this .exportedNodeNameId ()) + { + const exportedNodeNameId = this .result [1]; + + this .comments (); + + if (Grammar .AS .parse (this)) + { + if (this .nodeNameId ()) + var nodeNameId = this .result [1]; + + else + throw new Error ("No name given after AS."); + } + else + { + var nodeNameId = exportedNodeNameId; + } + + this .getExecutionContext () .updateImportedNode (namedNode, exportedNodeNameId, nodeNameId); + return true; + } + + throw new Error ("Expected exported node name."); + } + + throw new Error ("Expected a '.' after exported node name."); + } + + throw new Error ("No name given after IMPORT statement."); + } + return false; + }, + statements (field) + { + while (this .statement (field)) + ; + }, + statement (field) + { + if (this .protoStatement ()) + return true; + + if (this .routeStatement ()) + return true; + + if (this .importStatement ()) + return true; + + if (this .exportStatement ()) + return true; + + const node = this .nodeStatement (); + + if (node !== false) + { + field .push (node); + return true; + } + + return false; + }, + nodeStatement () + { + this .comments (); + + if (Grammar .DEF .parse (this)) + { + if (this .nodeNameId ()) + return this .node (this .result [1]); + + throw new Error ("No name given after DEF."); + } + + if (Grammar .USE .parse (this)) + { + if (this .nodeNameId ()) + return this .getExecutionContext () .getNamedNode (this .result [1]) .getValue (); + + throw new Error ("No name given after USE."); + } + + if (Grammar .NULL .parse (this)) + return null; + + return this .node (""); + }, + protoStatement () + { + if (this .proto ()) + return true; + + if (this .externproto ()) + return true; + + return false; + }, + protoStatements () + { + while (this .protoStatement ()) + ; + }, + proto () + { + this .comments (); + + if (Grammar .PROTO .parse (this)) + { + if (this .nodeTypeId ()) + { + const nodeTypeId = this .result [1]; + + this .comments (); + + if (Grammar .OpenBracket .parse (this)) + { + const interfaceDeclarations = this .interfaceDeclarations (); + + this .comments (); + + if (Grammar .CloseBracket .parse (this)) + { + this .comments (); + + if (Grammar .OpenBrace .parse (this)) + { + const proto = new Prototype_X3DProtoDeclaration (this .getExecutionContext ()); + + for (const field of interfaceDeclarations) + proto .addUserDefinedField (field .getAccessType (), field .getName (), field); + + this .pushPrototype (proto); + this .pushExecutionContext (proto .getBody ()); + + this .protoBody (proto .getBody () .rootNodes); + + this .popExecutionContext (); + this .popPrototype (); + + this .comments (); + + if (Grammar .CloseBrace .parse (this)) + { + proto .setup (); + + try + { + const existingProto = this .getExecutionContext () .getProtoDeclaration (nodeTypeId); + + this .getExecutionContext () .updateProtoDeclaration (this .getExecutionContext () .getUniqueProtoName (nodeTypeId), existingProto); + } + catch + { } + + this .getExecutionContext () .updateProtoDeclaration (nodeTypeId, proto); + + return true; + } + + throw new Error ("Expected a '}' at the end of PROTO body."); + } + + throw new Error ("Expected a '{' at the beginning of PROTO body."); + } + + throw new Error ("Expected a ']' at the end of PROTO interface declaration."); + } + + throw new Error ("Expected a '[' at the beginning of PROTO interface declaration."); + } + + throw new Error ("Invalid PROTO definition name."); + } + + return false; + }, + protoBody (rootNodes) + { + this .protoStatements (); + + const rootNodeStatement = this .rootNodeStatement (); + + if (rootNodeStatement !== false) + rootNodes .push (rootNodeStatement); + + this .statements (rootNodes); + }, + rootNodeStatement () + { + this .comments (); + + if (Grammar .DEF .parse (this)) + { + if (this .nodeNameId ()) + { + const + nodeNameId = this .result [0], + baseNode = this .node (nodeNameId); + + if (baseNode !== false) + return baseNode; + + throw new Error ("Expected node type name after DEF."); + } + + throw new Error ("No name given after DEF."); + } + + const baseNode = this .node (""); + + if (baseNode !== false) + return baseNode; + + return false; + }, + interfaceDeclarations () + { + const interfaceDeclarations = [ ]; + + let field; + + while (field = this .interfaceDeclaration ()) + interfaceDeclarations .push (field); + + return interfaceDeclarations; + }, + restrictedInterfaceDeclaration () + { + this .comments (); + + if (Grammar .inputOnly .parse (this) || Grammar .eventIn .parse (this)) + { + if (this .fieldType ()) + { + const fieldType = this .result [1]; + + if (this .inputOnlyId ()) + { + const + fieldId = this .result [1], + field = new (x_ite_Fields [fieldType]) (); + + field .setAccessType (Base_X3DConstants .inputOnly); + field .setName (fieldId); + return field; + } + + throw new Error ("Expected a name for field."); + } + + this .Id () + + throw new Error (`Unknown event or field type: '${this .result [1]}'.`); + } + + if (Grammar .outputOnly .parse (this) || Grammar .eventOut .parse (this)) + { + if (this .fieldType ()) + { + const fieldType = this .result [1]; + + if (this .outputOnlyId ()) + { + const + fieldId = this .result [1], + field = new (x_ite_Fields [fieldType]) (); + + field .setAccessType (Base_X3DConstants .outputOnly); + field .setName (fieldId); + return field; + } + + throw new Error ("Expected a name for field."); + } + + this .Id () + + throw new Error (`Unknown event or field type: '${this .result [1]}'.`); + } + + if (Grammar .initializeOnly .parse (this) || Grammar .field .parse (this)) + { + if (this .fieldType ()) + { + const fieldType = this .result [1]; + + if (this .initializeOnlyId ()) + { + const + fieldId = this .result [1], + field = new (x_ite_Fields [fieldType]) (); + + if (this .fieldValue (field)) + { + field .setAccessType (Base_X3DConstants .initializeOnly); + field .setName (fieldId); + return field; + } + + throw new Error (`Couldn't read value for field '${fieldId}'.`); + } + + throw new Error ("Expected a name for field."); + } + + this .Id () + + throw new Error (`Unknown event or field type: '${this .result [1]}'.`); + } + + return null; + }, + interfaceDeclaration () + { + const field = this .restrictedInterfaceDeclaration (); + + if (field) + return field; + + this .comments (); + + if (Grammar .inputOutput .parse (this) || Grammar .exposedField .parse (this)) + { + if (this .fieldType ()) + { + const fieldType = this .result [1]; + + if (this .inputOutputId ()) + { + const + fieldId = this .result [1], + field = new (x_ite_Fields [fieldType]) (); + + if (this .fieldValue (field)) + { + field .setAccessType (Base_X3DConstants .inputOutput); + field .setName (fieldId); + return field; + } + + throw new Error (`Couldn't read value for field '${fieldId}'.`); + } + + throw new Error ("Expected a name for field."); + } + + this .Id (); + + throw new Error (`Unknown event or field type: '${this .result [1]}'.`); + } + + return null; + }, + externproto () + { + this .comments (); + + if (Grammar .EXTERNPROTO .parse (this)) + { + if (this .nodeTypeId ()) + { + const nodeTypeId = this .result [1]; + + this .comments (); + + if (Grammar .OpenBracket .parse (this)) + { + const externInterfaceDeclarations = this .externInterfaceDeclarations (); + + this .comments (); + + if (Grammar .CloseBracket .parse (this)) + { + if (this .URLList (this .MFString)) + { + const externproto = new Prototype_X3DExternProtoDeclaration (this .getExecutionContext (), this .MFString); + + for (const field of externInterfaceDeclarations) + externproto .addUserDefinedField (field .getAccessType (), field .getName (), field); + + externproto .setup (); + + try + { + const existingExternProto = this .getExecutionContext () .getExternProtoDeclaration (nodeTypeId); + + this .getExecutionContext () .updateExternProtoDeclaration (this .getExecutionContext () .getUniqueExternProtoName (nodeTypeId), existingExternProto); + } + catch + { } + + this .getExecutionContext () .updateExternProtoDeclaration (nodeTypeId, externproto); + return true; + } + + throw new Error (`Expected a URL list after EXTERNPROTO interface declaration '${nodeTypeId}'.`); + } + + throw new Error ("Expected a ']' at the end of EXTERNPROTO interface declaration."); + } + + throw new Error ("Expected a '[' at the beginning of EXTERNPROTO interface declaration."); + } + + throw new Error ("Invalid EXTERNPROTO definition name."); + } + + return false; + }, + externInterfaceDeclarations () + { + const externInterfaceDeclarations = [ ]; + + let field; + + while (field = this .externInterfaceDeclaration ()) + externInterfaceDeclarations .push (field); + + return externInterfaceDeclarations; + }, + externInterfaceDeclaration () + { + this .comments (); + + if (Grammar .inputOnly .parse (this) || Grammar .eventIn .parse (this)) + { + if (this .fieldType ()) + { + const fieldType = this .result [1]; + + if (this .inputOnlyId ()) + { + const + fieldId = this .result [1], + field = new (x_ite_Fields [fieldType]) (); + + field .setAccessType (Base_X3DConstants .inputOnly); + field .setName (fieldId); + return field; + } + + throw new Error ("Expected a name for field."); + } + + this .Id () + + throw new Error (`Unknown event or field type: '${this .result [1]}'.`); + } + + if (Grammar .outputOnly .parse (this) || Grammar .eventOut .parse (this)) + { + if (this .fieldType ()) + { + const fieldType = this .result [1]; + + if (this .outputOnlyId ()) + { + const + fieldId = this .result [1], + field = new (x_ite_Fields [fieldType]) (); + + field .setAccessType (Base_X3DConstants .outputOnly); + field .setName (fieldId); + return field; + } + + throw new Error ("Expected a name for field."); + } + + this .Id () + + throw new Error (`Unknown event or field type: '${this .result [1]}'.`); + } + + if (Grammar .initializeOnly .parse (this) || Grammar .field .parse (this)) + { + if (this .fieldType ()) + { + const fieldType = this .result [1]; + + if (this .initializeOnlyId ()) + { + const + fieldId = this .result [1], + field = new (x_ite_Fields [fieldType]) (); + + field .setAccessType (Base_X3DConstants .initializeOnly); + field .setName (fieldId); + return field; + } + + throw new Error ("Expected a name for field."); + } + + this .Id () + + throw new Error (`Unknown event or field type: '${this .result [1]}'.`); + } + + if (Grammar .inputOutput .parse (this) || Grammar .exposedField .parse (this)) + { + if (this .fieldType ()) + { + const fieldType = this .result [1]; + + if (this .inputOutputId ()) + { + const + fieldId = this .result [1], + field = new (x_ite_Fields [fieldType]) (); + + field .setAccessType (Base_X3DConstants .inputOutput); + field .setName (fieldId); + return field; + } + + throw new Error ("Expected a name for field."); + } + + this .Id () + + throw new Error (`Unknown event or field type: '${this .result [1]}'.`); + } + + return null; + }, + URLList (field) + { + return this .mfstringValue (field); + }, + routeStatement () + { + this .comments (); + + if (Grammar .ROUTE .parse (this)) + { + if (this .nodeNameId ()) + { + const + fromNodeId = this .result [1], + fromNode = this .getExecutionContext () .getLocalNode (fromNodeId); + + this .comments (); + + if (Grammar .Period .parse (this)) + { + if (this .outputOnlyId ()) + { + const eventOutId = this .result [1]; + + this .comments (); + + if (Grammar .TO .parse (this)) + { + if (this .nodeNameId ()) + { + const + toNodeId = this .result [1], + toNode = this .getExecutionContext () .getLocalNode (toNodeId); + + this .comments (); + + if (Grammar .Period .parse (this)) + { + if (this .inputOnlyId ()) + { + try + { + const eventInId = this .result [1]; + + this .getExecutionContext () .addRoute (fromNode, eventOutId, toNode, eventInId); + return true; + } + catch (error) + { + this .throwOrWarn (error .message); + + return true; + } + } + + throw new Error ("Bad ROUTE specification: Expected a field name."); + } + + throw new Error ("Bad ROUTE specification: Expected a '.' after node name."); + } + + throw new Error ("Bad ROUTE specification: Expected a node name."); + } + + throw new Error ("Bad ROUTE specification: Expected a 'TO'."); + } + + throw new Error ("Bad ROUTE specification: Expected a field name."); + } + + throw new Error ("Bad ROUTE specification: Expected a '.' after node name."); + } + + throw new Error ("Bad ROUTE specification: Expected a node name."); + } + + return false; + }, + node (nodeNameId) + { + if (this .nodeTypeId ()) + { + const nodeTypeId = this .result [1]; + + const baseNode = this .getExecutionContext () .createNode (nodeTypeId, false) + ?? this .getExecutionContext () .createProto (nodeTypeId, false); + + if (!baseNode) + throw new Error (`Unknown node type or proto '${nodeTypeId}', you probably have insufficient component/profile statements, and/or an inappropriate specification version.`); + + if (nodeNameId .length) + { + try + { + const namedNode = this .getExecutionContext () .getNamedNode (nodeNameId); + + this .getExecutionContext () .updateNamedNode (this .getExecutionContext () .getUniqueName (nodeNameId), namedNode); + } + catch + { } + + this .getExecutionContext () .updateNamedNode (nodeNameId, baseNode); + } + + this .comments (); + + if (Grammar .OpenBrace .parse (this)) + { + if (baseNode .canUserDefinedFields ()) + this .scriptBody (baseNode); + + else + this .nodeBody (baseNode); + + this .comments (); + + if (Grammar .CloseBrace .parse (this)) + { + if (!this .isInsideProtoDefinition ()) + baseNode .setup (); + + return baseNode; + } + + throw new Error ("Expected '}' at the end of node body."); + } + + throw new Error ("Expected '{' at the beginning of node body."); + } + + return false; + }, + scriptBody (baseNode) + { + while (this .scriptBodyElement (baseNode)) + ; + }, + scriptBodyElement (baseNode) + { + const + lastIndex = this .lastIndex, + lineNumber = this .lineNumber; + + if (this .Id ()) + { + const accessType = this .accessTypes [this .result [1]]; + + if (accessType) + { + if (this .fieldType ()) + { + const fieldType = this .result [1]; + + if (this .Id ()) + { + const fieldId = this .result [1]; + + this .comments (); + + if (Grammar .IS .parse (this)) + { + if (this .isInsideProtoDefinition ()) + { + if (this .Id ()) + { + const isId = this .result [1]; + + try + { + var reference = this .getPrototype () .getField (isId); + } + catch + { + this .throwOrWarn (`No such event or field '${isId}' inside PROTO ${this .getPrototype () .getName ()} interface declaration.`); + + return true; + } + + if (Base_X3DConstants [fieldType] === reference .getType ()) + { + if (reference .isReference (accessType)) + { + let field = VRMLParser_$.try (() => baseNode .getUserDefinedField (fieldId)); + + if (!field) + { + field = new (x_ite_Fields [fieldType]) (); + + baseNode .addUserDefinedField (accessType, fieldId, field); + } + + if (accessType === field .getAccessType () && reference .getType () === field .getType ()) + { + field .addReference (reference); + return true; + } + + throw new Error (`Couldn't add field '${fieldId}', field already exists with different access type or data type.`); + } + + throw new Error (`Field '${fieldId}' and '${reference .getName ()}' in PROTO '${this .getPrototype () .getName ()}' are incompatible as an IS mapping.`); + } + + throw new Error (`Field '${fieldId}' and '${reference .getName ()}' in PROTO '${this .getPrototype () .getName ()}' have different types.`); + } + + throw new Error ("No name give after IS statement."); + } + + throw new Error ("IS statement outside PROTO definition."); + } + } + } + } + } + + this .lastIndex = lastIndex; + this .lineNumber = lineNumber; + + const field = this .interfaceDeclaration (); + + if (field) + { + const existingField = VRMLParser_$.try (() => baseNode .getUserDefinedField (field .getName ())); + + if (existingField) + { + if (existingField .getAccessType () === field .getAccessType () && existingField .getType () === field .getType ()) + { + existingField .assign (field); + return true; + } + + throw new Error (`Couldn't set value for field '${field .getName ()}', field already exists with different access type or data type.`); + } + + baseNode .addUserDefinedField (field .getAccessType (), field .getName (), field); + return true; + } + + return this .nodeBodyElement (baseNode); + }, + nodeBody (baseNode) + { + while (this .nodeBodyElement (baseNode)) + ; + }, + nodeBodyElement (baseNode) + { + if (this .protoStatement ()) + return true; + + if (this .routeStatement ()) + return true; + + if (this .Id ()) + { + const fieldId = this .result [1]; + + try + { + var field = baseNode .getPredefinedField (fieldId); + } + catch + { + throw new Error (`Unknown field '${fieldId}' in class '${baseNode .getTypeName ()}'.`); + } + + this .comments (); + + if (Grammar .IS .parse (this)) + { + if (this .isInsideProtoDefinition ()) + { + if (this .Id ()) + { + const isId = this .result [1]; + + try + { + var reference = this .getPrototype () .getField (isId); + } + catch + { + this .throwOrWarn (`No such event or field '${isId}' inside PROTO ${this .getPrototype () .getName ()}`); + + return true; + } + + if (field .getType () === reference .getType ()) + { + if (reference .isReference (field .getAccessType ())) + { + field .addReference (reference); + return true; + } + + throw new Error (`Field '${field .getName ()}' and '${reference .getName ()}' in PROTO ${this .getPrototype () .getName ()} are incompatible as an IS mapping.`); + } + + throw new Error (`Field '${field .getName ()}' and '${reference .getName ()}' in PROTO ${this .getPrototype () .getName ()} have different types.`); + } + + throw new Error("No name give after IS statement."); + } + + throw new Error ("IS statement outside PROTO definition."); + } + + if (field .isInitializable ()) + { + if (this .fieldValue (field)) + return true; + + throw new Error (`Couldn't read value for field '${fieldId}'.`); + } + + throw new Error (`Couldn't assign value to ${this .accessTypeToString (field .getAccessType ())} field '${fieldId}'.`); + } + + return false; + }, + profileNameId () { return this .Id (); }, + componentNameId () + { + this .comments (); + + return Grammar .ComponentNameId .parse (this); + }, + categoryNameId () { return this .Id (); }, + unitNameId () { return this .Id (); }, + exportedNodeNameId () { return this .Id (); }, + nodeNameId () { return this .Id (); }, + nodeTypeId () { return this .Id (); }, + initializeOnlyId () { return this .Id (); }, + inputOnlyId () { return this .Id (); }, + outputOnlyId () { return this .Id (); }, + inputOutputId () { return this .Id (); }, + Id () + { + this .comments (); + + return Grammar .Id .parse (this); + }, + fieldType () + { + this .comments (); + + return Grammar .FieldType .parse (this); + }, + fieldValue (field) + { + return this [field .getType ()] (field, field .getUnit ()); + }, + bool () + { + this .comments (); + + if (Grammar .TRUE .parse (this)) + { + this .value = true; + return true; + } + + if (Grammar .FALSE .parse (this)) + { + this .value = false; + return true; + } + + return false; + }, + double () + { + this .comments (); + + if (Grammar .double .parse (this)) + { + this .value = parseFloat (this .result [1]); + return true; + } + + // Constants + + if (Grammar .CONSTANTS .parse (this)) + { + this .value = this .CONSTANTS [this .result [2] .toUpperCase ()]; + + if (this .result [1] === "-") + this .value = - this .value; + + return true; + } + + return false; + }, + int32 () + { + this .comments (); + + if (Grammar .int32 .parse (this)) + { + this .value = parseInt (this .result [1]); + return true; + } + + return false; + }, + string () + { + this .comments (); + + if (Grammar .string .parse (this)) + { + this .value = x_ite_Fields .SFString .unescape (this .result [1]); + + this .lines (this .value); + + return true; + } + + return false; + }, + sfboolValue (field) + { + if (this .bool ()) + { + field .setValue (this .value); + return true; + } + + return false; + }, + mfboolValue (field) + { + field .length = 0; + + if (this .bool ()) + { + field .push (this .value); + return true; + } + + if (Grammar .OpenBracket .parse (this)) + { + this .sfboolValues (field); + + if (Grammar .CloseBracket .parse (this)) + return true; + + throw new Error ("Expected ']'."); + } + + return false; + }, + sfboolValues (field) + { + field .length = 0; + field = field .getTarget (); + + while (this .bool ()) + field .push (this .value); + }, + sfcolorValue (field) + { + const lastIndex = this .lastIndex; + + if (this .double ()) + { + const r = this .value; + + if (this .double ()) + { + const g = this .value; + + if (this .double ()) + { + const b = this .value; + + field .r = r; + field .g = g; + field .b = b; + + return true; + } + } + } + + this .lastIndex = lastIndex; + + this .comments (); + + if (Grammar .HTMLColor .parse (this)) + { + const color = this .convertColor (this .result [1] .replace (/0x/i, "#")); + + field .r = color [0]; + field .g = color [1]; + field .b = color [2]; + + return true; + } + + return false; + }, + mfcolorValue (field) + { + field .length = 0; + + if (this .sfcolorValue (this .Color3)) + { + field .push (this .Color3); + return true; + } + + if (Grammar .OpenBracket .parse (this)) + { + this .sfcolorValues (field); + + if (Grammar .CloseBracket .parse (this)) + return true; + + throw new Error ("Expected ']'."); + } + + return false; + }, + sfcolorValues (field) + { + field .length = 0; + field = field .getTarget (); + + const value = this .Color3; + + while (this .sfcolorValue (value)) + field .push (value); + }, + sfcolorrgbaValue (field) + { + const lastIndex = this .lastIndex; + + if (this .double ()) + { + const r = this .value; + + if (this .double ()) + { + const g = this .value; + + if (this .double ()) + { + const b = this .value; + + if (this .double ()) + { + const a = this .value; + + field .r = r; + field .g = g; + field .b = b; + field .a = a; + + return true; + } + } + } + } + + this .lastIndex = lastIndex; + + this .comments (); + + if (Grammar .HTMLColor .parse (this)) + { + const color = this .convertColor (this .result [1] .replace (/0x/i, "#")); + + field .r = color [0]; + field .g = color [1]; + field .b = color [2]; + field .a = color [3]; + + return true; + } + + return false; + }, + mfcolorrgbaValue (field) + { + field .length = 0; + + if (this .sfcolorrgbaValue (this .Color4)) + { + field .push (this .Color4); + return true; + } + + if (Grammar .OpenBracket .parse (this)) + { + this .sfcolorrgbaValues (field); + + if (Grammar .CloseBracket .parse (this)) + return true; + + throw new Error ("Expected ']'."); + } + + return false; + }, + sfcolorrgbaValues (field) + { + field .length = 0; + field = field .getTarget (); + + const value = this .Color4; + + while (this .sfcolorrgbaValue (value)) + field .push (value); + }, + sfdoubleValue (field) + { + if (this .double ()) + { + field .setValue (this .fromUnit (field .getUnit (), this .value)); + return true; + } + + return false; + }, + mfdoubleValue (field) + { + field .length = 0; + + if (this .double ()) + { + field .push (this .fromUnit (field .getUnit (), this .value)); + return true; + } + + if (Grammar .OpenBracket .parse (this)) + { + this .sfdoubleValues (field); + + if (Grammar .CloseBracket .parse (this)) + return true; + + throw new Error ("Expected ']'."); + } + + return false; + }, + sfdoubleValues (field) + { + field .length = 0; + field = field .getTarget (); + + const unit = field .getUnit (); + + while (this .double ()) + field .push (this .fromUnit (unit, this .value)); + }, + sfimageValue (field) + { + if (this .int32 ()) + { + const width = this .value; + + if (this .int32 ()) + { + const height = this .value; + + if (this .int32 ()) + { + const + comp = this .value, + size = width * height; + + field .width = width; + field .height = height; + field .comp = comp; + + const array = field .array; + + for (let i = 0; i < size; ++ i) + { + if (this .int32 ()) + { + array [i] = this .value; + continue; + } + + return false; + } + + return true; + } + } + } + + return false; + }, + mfimageValue (field) + { + field .length = 0; + + if (this .sfimageValue (this .SFImage)) + { + field .push (this .SFImage); + return true; + } + + if (Grammar .OpenBracket .parse (this)) + { + this .sfimageValues (field); + + if (Grammar .CloseBracket .parse (this)) + return true; + + throw new Error ("Expected ']'."); + } + + return false; + }, + sfimageValues (field) + { + field .length = 0; + field = field .getTarget (); + + const value = this .SFImage; + + while (this .sfimageValue (value)) + field .push (value); + }, + sfint32Value (field) + { + if (this .int32 ()) + { + field .setValue (this .value); + return true; + } + + return false; + }, + mfint32Value (field) + { + field .length = 0; + + if (this .int32 ()) + { + field .push (this .value); + return true; + } + + if (Grammar .OpenBracket .parse (this)) + { + this .sfint32Values (field); + + if (Grammar .CloseBracket .parse (this)) + return true; + + throw new Error ("Expected ']'."); + } + + return false; + }, + sfint32Values (field) + { + field .length = 0; + field = field .getTarget (); + + while (this .int32 ()) + field .push (this .value); + }, + sfmatrix3Value (field) + { + if (this .double ()) + { + const m00 = this .value; + + if (this .double ()) + { + const m01 = this .value; + + if (this .double ()) + { + const m02 = this .value; + + if (this .double ()) + { + const m10 = this .value; + + if (this .double ()) + { + const m11 = this .value; + + if (this .double ()) + { + const m12 = this .value; + + if (this .double ()) + { + const m20 = this .value; + + if (this .double ()) + { + const m21 = this .value; + + if (this .double ()) + { + const m22 = this .value; + + field [0] = m00; + field [1] = m01; + field [2] = m02; + field [3] = m10; + field [4] = m11; + field [5] = m12; + field [6] = m20; + field [7] = m21; + field [8] = m22; + + return true; + } + } + } + } + } + } + } + } + } + + return false; + }, + mfmatrix3Value (field) + { + field .length = 0; + + if (this .sfmatrix3Value (this .Matrix3)) + { + field .push (this .Matrix3); + return true; + } + + if (Grammar .OpenBracket .parse (this)) + { + this .sfmatrix3Values (field); + + if (Grammar .CloseBracket .parse (this)) + return true; + + throw new Error ("Expected ']'."); + } + + return false; + }, + sfmatrix3Values (field) + { + field .length = 0; + field = field .getTarget (); + + const value = this .Matrix3; + + while (this .sfmatrix3Value (value)) + field .push (value); + }, + sfmatrix4Value (field) + { + if (this .double ()) + { + const m00 = this .value; + + if (this .double ()) + { + const m01 = this .value; + + if (this .double ()) + { + const m02 = this .value; + + if (this .double ()) + { + const m03 = this .value; + + if (this .double ()) + { + const m10 = this .value; + + if (this .double ()) + { + const m11 = this .value; + + if (this .double ()) + { + const m12 = this .value; + + if (this .double ()) + { + const m13 = this .value; + + if (this .double ()) + { + const m20 = this .value; + + if (this .double ()) + { + const m21 = this .value; + + if (this .double ()) + { + const m22 = this .value; + + if (this .double ()) + { + const m23 = this .value; + + if (this .double ()) + { + const m30 = this .value; + + if (this .double ()) + { + const m31 = this .value; + + if (this .double ()) + { + const m32 = this .value; + + if (this .double ()) + { + const m33 = this .value; + + field [ 0] = m00; + field [ 1] = m01; + field [ 2] = m02; + field [ 3] = m03; + field [ 4] = m10; + field [ 5] = m11; + field [ 6] = m12; + field [ 7] = m13; + field [ 8] = m20; + field [ 9] = m21; + field [10] = m22; + field [11] = m23; + field [12] = m30; + field [13] = m31; + field [14] = m32; + field [15] = m33; + + return true; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + + return false; + }, + mfmatrix4Value (field) + { + field .length = 0; + + if (this .sfmatrix4Value (this .Matrix4)) + { + field .push (this .Matrix4); + return true; + } + + if (Grammar .OpenBracket .parse (this)) + { + this .sfmatrix4Values (field); + + if (Grammar .CloseBracket .parse (this)) + return true; + + throw new Error ("Expected ']'."); + } + + return false; + }, + sfmatrix4Values (field) + { + field .length = 0; + field = field .getTarget (); + + const value = this .Matrix4; + + while (this .sfmatrix4Value (value)) + field .push (value); + }, + sfnodeValue (field) + { + const baseNode = this .nodeStatement (); + + if (baseNode !== false) + { + field .setValue (baseNode); + return true; + } + + return false; + }, + mfnodeValue (field) + { + field .length = 0; + + const node = this .nodeStatement (); + + if (node !== false) + { + field .push (node); + return true; + } + + if (Grammar .OpenBracket .parse (this)) + { + this .nodeStatements (field); + + if (Grammar .CloseBracket .parse (this)) + return true; + + throw new Error ("Expected ']'."); + } + + return false; + }, + nodeStatements (field) + { + this .statements (field); + + // let node = this .nodeStatement (); + + // while (node !== false) + // { + // field .push (node); + + // node = this .nodeStatement (); + // } + }, + sfrotationValue (field) + { + if (this .double ()) + { + const x = this .value; + + if (this .double ()) + { + const y = this .value; + + if (this .double ()) + { + const z = this .value; + + if (this .double ()) + { + const angle = this .value; + + field .x = x; + field .y = y; + field .z = z; + field .angle = this .fromUnit ("angle", angle); + + return true; + } + } + } + } + + return false; + }, + mfrotationValue (field) + { + field .length = 0; + + if (this .sfrotationValue (this .Rotation4)) + { + field .push (this .Rotation4); + return true; + } + + if (Grammar .OpenBracket .parse (this)) + { + this .sfrotationValues (field); + + if (Grammar .CloseBracket .parse (this)) + return true; + + throw new Error ("Expected ']'."); + } + + return false; + }, + sfrotationValues (field) + { + field .length = 0; + field = field .getTarget (); + + const value = this .Rotation4; + + while (this .sfrotationValue (value)) + field .push (value); + }, + sfstringValue (field) + { + if (this .string ()) + { + field .setValue (this .value); + return true; + } + + return false; + }, + mfstringValue (field) + { + field .length = 0; + + if (this .string ()) + { + field .push (this .value); + return true; + } + + if (Grammar .OpenBracket .parse (this)) + { + this .sfstringValues (field); + + if (Grammar .CloseBracket .parse (this)) + return true; + + throw new Error ("Expected ']'."); + } + + return false; + }, + sfstringValues (field) + { + field .length = 0; + field = field .getTarget (); + + while (this .string ()) + field .push (this .value); + }, + sfvec2Value (field, unit) + { + if (this .double ()) + { + const x = this .value; + + if (this .double ()) + { + const y = this .value; + + field .x = this .fromUnit (unit, x); + field .y = this .fromUnit (unit, y); + + return true; + } + } + + return false; + }, + mfvec2Value (field) + { + field .length = 0; + + if (this .sfvec2Value (this .Vector2, field .getUnit ())) + { + field .push (this .Vector2); + return true; + } + + if (Grammar .OpenBracket .parse (this)) + { + this .sfvec2Values (field); + + if (Grammar .CloseBracket .parse (this)) + return true; + + throw new Error ("Expected ']'."); + } + + return false; + }, + sfvec2Values (field) + { + field .length = 0; + field = field .getTarget (); + + const + value = this .Vector2, + unit = field .getUnit (); + + while (this .sfvec2Value (value, unit)) + field .push (value); + }, + sfvec3Value (field, unit) + { + if (this .double ()) + { + const x = this .value; + + if (this .double ()) + { + const y = this .value; + + if (this .double ()) + { + const z = this .value; + + field .x = this .fromUnit (unit, x); + field .y = this .fromUnit (unit, y); + field .z = this .fromUnit (unit, z); + + return true; + } + } + } + + return false; + }, + mfvec3Value (field) + { + field .length = 0; + + if (this .sfvec3Value (this .Vector3, field .getUnit ())) + { + field .push (this .Vector3); + return true; + } + + if (Grammar .OpenBracket .parse (this)) + { + this .sfvec3Values (field); + + if (Grammar .CloseBracket .parse (this)) + return true; + + throw new Error ("Expected ']'."); + } + + return false; + }, + sfvec3Values (field) + { + field .length = 0; + field = field .getTarget (); + + const + value = this .Vector3, + unit = field .getUnit (); + + while (this .sfvec3Value (value, unit)) + field .push (value); + }, + sfvec4Value (field, unit) + { + if (this .double ()) + { + const x = this .value; + + if (this .double ()) + { + const y = this .value; + + if (this .double ()) + { + const z = this .value; + + if (this .double ()) + { + const w = this .value; + + field .x = this .fromUnit (unit, x); + field .y = this .fromUnit (unit, y); + field .z = this .fromUnit (unit, z); + field .w = this .fromUnit (unit, w); + + return true; + } + } + } + } + + return false; + }, + mfvec4Value (field) + { + field .length = 0; + + if (this .sfvec4Value (this .Vector4, field .getUnit ())) + { + field .push (this .Vector4); + return true; + } + + if (Grammar .OpenBracket .parse (this)) + { + this .sfvec4Values (field); + + if (Grammar .CloseBracket .parse (this)) + return true; + + throw new Error ("Expected ']'."); + } + + return false; + }, + sfvec4Values (field) + { + field .length = 0; + field = field .getTarget (); + + const + value = this .Vector4, + unit = field .getUnit (); + + while (this .sfvec4Value (value, unit)) + field .push (value); + }, + accessTypeToString (accessType) + { + switch (accessType) + { + case Base_X3DConstants .initializeOnly: + return "initializeOnly"; + case Base_X3DConstants .inputOnly: + return "inputOnly"; + case Base_X3DConstants .outputOnly: + return "outputOnly"; + case Base_X3DConstants .inputOutput: + return "inputOutput"; + } + }, +}); + +Object .assign (VRMLParser .prototype, +{ + [Base_X3DConstants .SFBool]: VRMLParser .prototype .sfboolValue, + [Base_X3DConstants .SFColor]: VRMLParser .prototype .sfcolorValue, + [Base_X3DConstants .SFColorRGBA]: VRMLParser .prototype .sfcolorrgbaValue, + [Base_X3DConstants .SFDouble]: VRMLParser .prototype .sfdoubleValue, + [Base_X3DConstants .SFFloat]: VRMLParser .prototype .sfdoubleValue, + [Base_X3DConstants .SFImage]: VRMLParser .prototype .sfimageValue, + [Base_X3DConstants .SFInt32]: VRMLParser .prototype .sfint32Value, + [Base_X3DConstants .SFMatrix3f]: VRMLParser .prototype .sfmatrix3Value, + [Base_X3DConstants .SFMatrix3d]: VRMLParser .prototype .sfmatrix3Value, + [Base_X3DConstants .SFMatrix4f]: VRMLParser .prototype .sfmatrix4Value, + [Base_X3DConstants .SFMatrix4d]: VRMLParser .prototype .sfmatrix4Value, + [Base_X3DConstants .SFNode]: VRMLParser .prototype .sfnodeValue, + [Base_X3DConstants .SFRotation]: VRMLParser .prototype .sfrotationValue, + [Base_X3DConstants .SFString]: VRMLParser .prototype .sfstringValue, + [Base_X3DConstants .SFTime]: VRMLParser .prototype .sfdoubleValue, + [Base_X3DConstants .SFVec2d]: VRMLParser .prototype .sfvec2Value, + [Base_X3DConstants .SFVec2f]: VRMLParser .prototype .sfvec2Value, + [Base_X3DConstants .SFVec3d]: VRMLParser .prototype .sfvec3Value, + [Base_X3DConstants .SFVec3f]: VRMLParser .prototype .sfvec3Value, + [Base_X3DConstants .SFVec4d]: VRMLParser .prototype .sfvec4Value, + [Base_X3DConstants .SFVec4f]: VRMLParser .prototype .sfvec4Value, + + [Base_X3DConstants .MFBool]: VRMLParser .prototype .mfboolValue, + [Base_X3DConstants .MFColor]: VRMLParser .prototype .mfcolorValue, + [Base_X3DConstants .MFColorRGBA]: VRMLParser .prototype .mfcolorrgbaValue, + [Base_X3DConstants .MFDouble]: VRMLParser .prototype .mfdoubleValue, + [Base_X3DConstants .MFFloat]: VRMLParser .prototype .mfdoubleValue, + [Base_X3DConstants .MFImage]: VRMLParser .prototype .mfimageValue, + [Base_X3DConstants .MFInt32]: VRMLParser .prototype .mfint32Value, + [Base_X3DConstants .MFMatrix3d]: VRMLParser .prototype .mfmatrix3Value, + [Base_X3DConstants .MFMatrix3f]: VRMLParser .prototype .mfmatrix3Value, + [Base_X3DConstants .MFMatrix4d]: VRMLParser .prototype .mfmatrix4Value, + [Base_X3DConstants .MFMatrix4f]: VRMLParser .prototype .mfmatrix4Value, + [Base_X3DConstants .MFNode]: VRMLParser .prototype .mfnodeValue, + [Base_X3DConstants .MFRotation]: VRMLParser .prototype .mfrotationValue, + [Base_X3DConstants .MFString]: VRMLParser .prototype .mfstringValue, + [Base_X3DConstants .MFTime]: VRMLParser .prototype .mfdoubleValue, + [Base_X3DConstants .MFVec2d]: VRMLParser .prototype .mfvec2Value, + [Base_X3DConstants .MFVec2f]: VRMLParser .prototype .mfvec2Value, + [Base_X3DConstants .MFVec3d]: VRMLParser .prototype .mfvec3Value, + [Base_X3DConstants .MFVec3f]: VRMLParser .prototype .mfvec3Value, + [Base_X3DConstants .MFVec4d]: VRMLParser .prototype .mfvec4Value, + [Base_X3DConstants .MFVec4f]: VRMLParser .prototype .mfvec4Value, +}); + +Base_X3DField .prototype .fromString = function (string, scene) +{ + const parser = new VRMLParser (scene); + + parser .setUnits (!!scene); + parser .setInput (string); + + if (parser .fieldValue (this)) + return; + + throw new Error (`Couldn't read value for field '${this .getName ()}'.`); +}; + +const VRMLParser_default_ = VRMLParser; +; + +x_ite_Namespace .add ("VRMLParser", "x_ite/Parser/VRMLParser", VRMLParser_default_); +/* harmony default export */ const Parser_VRMLParser = (VRMLParser_default_); +;// CONCATENATED MODULE: ./src/x_ite/Parser/XMLParser.js +/* provided dependency */ var XMLParser_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + +const AccessType = +{ + initializeOnly: Base_X3DConstants .initializeOnly, + inputOnly: Base_X3DConstants .inputOnly, + outputOnly: Base_X3DConstants .outputOnly, + inputOutput: Base_X3DConstants .inputOutput, +}; + +function XMLParser (scene) +{ + Parser_X3DParser .call (this, scene); + + this .protoDeclarations = [ ]; + this .parents = [ ]; + this .parser = new Parser_VRMLParser (scene); + this .url = new x_ite_Fields .MFString (); + this .protoNames = new Map (); + this .protoFields = new WeakMap (); +} + +Object .assign (Object .setPrototypeOf (XMLParser .prototype, Parser_X3DParser .prototype), +{ + getEncoding () + { + return "XML"; + }, + setInput (xmlElement) + { + try + { + if (typeof xmlElement === "string") + xmlElement = XMLParser_$.parseXML (xmlElement); + + this .input = xmlElement; + this .xml = this .isXML (xmlElement); + + if (!this .xml) + Object .assign (this, HTMLParser); + } + catch + { + this .input = undefined; + } + }, + isValid () + { + return (this .input instanceof XMLDocument) || (this .input instanceof HTMLElement) || (this .input === null); + }, + isXML (element) + { + if (element instanceof HTMLElement) + return false; + else + return true; + }, + parseIntoScene (resolve, reject) + { + this .resolve = resolve; + this .reject = reject; + + this .getScene () .setEncoding ("XML"); + this .getScene () .setProfile (this .getBrowser () .getProfile ("Full")); + + this .xmlElement (this .input); + }, + xmlElement (xmlElement) + { + if (xmlElement === null) + return this .resolve ?.(this .getScene ()); + + switch (xmlElement .nodeName) + { + case "#document": + { + const X3D = XMLParser_$(xmlElement) .children ("X3D"); + + if (X3D .length) + { + for (const xmlElement of X3D) + this .x3dElement (xmlElement); + } + else + { + if (this .resolve) + { + this .loadComponents () .then (() => + { + this .childrenElements (xmlElement); + this .resolve (this .getScene ()); + }) + .catch (this .reject); + } + else + { + this .childrenElements (xmlElement); + } + } + + break; + } + case "X3D": + { + this .x3dElement (xmlElement); + break; + } + case "Scene": + case "SCENE": + { + if (this .resolve) + { + this .loadComponents () .then (() => + { + this .sceneElement (xmlElement); + this .resolve (this .getScene ()); + }) + .catch (this .reject); + } + else + { + this .sceneElement (xmlElement); + } + + break; + } + default: + { + if (this .resolve) + { + this .loadComponents () .then (() => + { + this .childrenElements (xmlElement); + this .resolve (this .getScene ()); + }) + .catch (this .reject); + } + else + { + this .childrenElements (xmlElement); + } + + break; + } + } + }, + x3dElement (xmlElement) + { + try + { + // Profile + + const + profileNameId = xmlElement .getAttribute ("profile"), + profile = this .getBrowser () .getProfile (profileNameId || "Full"); + + XMLParser_$.data (this .scene, "X3D", xmlElement); + + this .getScene () .setProfile (profile); + } + catch (error) + { + console .error (error); + } + + // Specification version + + const specificationVersion = xmlElement .getAttribute ("version"); + + if (specificationVersion) + this .getScene () .setSpecificationVersion (specificationVersion); + + // Process child nodes + + for (const childNode of xmlElement .childNodes) + this .x3dElementChildHead (childNode) + + if (!this .xml) + this .headElement (xmlElement); + + if (this .resolve) + { + this .loadComponents () .then (() => + { + for (const childNode of xmlElement .childNodes) + this .x3dElementChildScene (childNode) + + this .resolve (this .getScene ()); + }) + .catch (this .reject); + } + else + { + for (const childNode of xmlElement .childNodes) + this .x3dElementChildScene (childNode) + } + }, + x3dElementChildHead (xmlElement) + { + switch (xmlElement .nodeName) + { + case "head": + case "HEAD": + this .headElement (xmlElement); + return; + } + }, + x3dElementChildScene (xmlElement) + { + switch (xmlElement .nodeName) + { + case "Scene": + case "SCENE": + this .sceneElement (xmlElement); + return; + } + }, + headElement (xmlElement) + { + for (const childNode of xmlElement .childNodes) + this .headElementChild (childNode); + }, + headElementChild (xmlElement) + { + switch (xmlElement .nodeName) + { + case "component": + case "COMPONENT": + this .componentElement (xmlElement); + return; + case "unit": + case "UNIT": + this .unitElement (xmlElement); + return; + case "meta": + case "META": + this .metaElement (xmlElement); + return; + } + }, + componentElement (xmlElement) + { + try + { + const + componentNameIdCharacters = xmlElement .getAttribute ("name"), + componentSupportLevel = parseInt (xmlElement .getAttribute ("level")); + + if (componentNameIdCharacters === null) + return console .warn ("XML Parser Error: Bad component statement. Expected name attribute."); + + if (componentSupportLevel === null) + return console .warn ("XML Parser Error: Bad component statement. Expected level attribute."); + + const component = this .getBrowser () .getComponent (componentNameIdCharacters, componentSupportLevel); + + this .getScene () .updateComponent (component); + } + catch (error) + { + console .log (error .message); + } + }, + unitElement (xmlElement) + { + const + category = xmlElement .getAttribute ("category"), + name = xmlElement .getAttribute ("name"), + conversionFactor = xmlElement .getAttribute ("conversionFactor"); //works for html5 as well + + if (category === null) + return console .warn ("XML Parser Error: Bad unit statement. Expected category attribute."); + + if (name === null) + return console .warn ("XML Parser Error: Bad unit statement. Expected name attribute."); + + if (conversionFactor === null) + return console .warn ("XML Parser Error: Bad unit statement. Expected conversionFactor attribute."); + + this .getScene () .updateUnit (category, name, parseFloat (conversionFactor)); + }, + metaElement (xmlElement) + { + const + metakey = xmlElement .getAttribute ("name"), + metavalue = xmlElement .getAttribute ("content"); + + if (metakey === null) + return console .warn ("XML Parser Error: Bad meta statement. Expected name attribute."); + + if (metavalue === null) + return console .warn ("XML Parser Error: Bad meta statement. Expected content attribute."); + + this .getScene () .addMetaData (metakey, metavalue); + }, + sceneElement (xmlElement) + { + XMLParser_$.data (xmlElement, "node", this .scene); + + this .childrenElements (xmlElement); + }, + childrenElements (xmlElement) + { + for (const childNode of xmlElement .childNodes) + this .childElement (childNode); + }, + childElement (xmlElement) + { + switch (xmlElement .nodeName) + { + case "#comment": + case "#text": + return; + + case "#cdata-section": + this .cdataNode (xmlElement); + return; + + case "ExternProtoDeclare": + case "EXTERNPROTODECLARE": + this .externProtoDeclareElement (xmlElement); + return; + + case "ProtoDeclare": + case "PROTODECLARE": + this .protoDeclareElement (xmlElement); + return; + + case "IS": + this .isElement (xmlElement); + return; + + case "ProtoInstance": + case "PROTOINSTANCE": + this .protoInstanceElement (xmlElement); + return; + + case "fieldValue": + case "FIELDVALUE": + this .fieldValueElement (xmlElement); + return; + + case "field": + case "FIELD": + this .fieldElement (xmlElement); + return; + + case "ROUTE": + this .routeElement (xmlElement); + return; + + case "IMPORT": + this .importElement (xmlElement); + return; + + case "EXPORT": + this .exportElement (xmlElement); + return; + + default: + this .nodeElement (xmlElement); + return; + } + }, + externProtoDeclareElement (xmlElement) + { + const name = xmlElement .getAttribute ("name"); + + if (this .id (name)) + { + const url = xmlElement .getAttribute ("url"); + + this .parser .setInput (url ?? ""); + this .parser .sfstringValues (this .url); + + if (!this .url .length) + console .warn ("XML Parser Error: Bad ExternProtoDeclare statement. Expected url attribute with value."); + + const externproto = new Prototype_X3DExternProtoDeclaration (this .getExecutionContext (), this .url); + + this .pushParent (externproto); + this .protoInterfaceElement (xmlElement); + this .popParent (); + this .addProtoFieldNames (externproto); + + externproto .setup (); + + try + { + const existingExternProto = this .getExecutionContext () .getExternProtoDeclaration (name); + + this .getExecutionContext () .updateExternProtoDeclaration (this .getExecutionContext () .getUniqueExternProtoName (name), existingExternProto); + } + catch + { } + + this .getExecutionContext () .updateExternProtoDeclaration (name, externproto); + + this .addProtoName (name); + } + }, + protoDeclareElement (xmlElement) + { + const name = xmlElement .getAttribute ("name"); + + if (this .id (name)) + { + const proto = new Prototype_X3DProtoDeclaration (this .getExecutionContext ()); + + for (const childNode of xmlElement .childNodes) + { + switch (childNode .nodeName) + { + case "ProtoInterface": + case "PROTOINTERFACE": + { + this .pushParent (proto); + this .protoInterfaceElement (childNode); + this .popParent (); + this .addProtoFieldNames (proto); + break; + } + default: + continue; + } + + break; + } + + for (const childNode of xmlElement .childNodes) + { + switch (childNode .nodeName) + { + case "ProtoBody": + case "PROTOBODY": + { + this .pushPrototype (proto); + this .pushExecutionContext (proto .getBody ()); + this .pushParent (proto); + this .protoBodyElement (childNode); + this .popParent (); + this .popExecutionContext (); + this .popPrototype (); + break; + } + default: + continue; + } + + break; + } + + proto .setup (); + + try + { + const existingProto = this .getExecutionContext () .getProtoDeclaration (name); + + this .getExecutionContext () .updateProtoDeclaration (this .getExecutionContext () .getUniqueProtoName (name), existingProto); + } + catch + { } + + this .getExecutionContext () .updateProtoDeclaration (name, proto); + + this .addProtoName (name); + } + }, + protoInterfaceElement (xmlElement) + { + for (const childNode of xmlElement .childNodes) + this .protoInterfaceElementChild (childNode); + }, + protoInterfaceElementChild (xmlElement) + { + switch (xmlElement .nodeName) + { + case "field": // User-defined field + case "FIELD": // User-defined field + this .fieldElement (xmlElement); + return; + } + }, + fieldElement (xmlElement) + { + try + { + if (this .getParents () .length === 0) + return; + + const node = this .getParent (); + + if (!(node instanceof Base_X3DBaseNode)) + return; + + if (!node .canUserDefinedFields ()) + return; + + const + accessType = AccessType [xmlElement .getAttribute ("accessType")] || Base_X3DConstants .initializeOnly, + Field = x_ite_Fields [xmlElement .getAttribute ("type")]; + + if (!Field) + return; + + const name = xmlElement .getAttribute ("name"); + + if (!this .id (name)) + return; + + const field = new Field (); + + if (accessType & Base_X3DConstants .initializeOnly) + { + this .fieldValue (field, xmlElement .getAttribute ("value")); + + this .pushParent (field); + this .childrenElements (xmlElement); + this .popParent (); + } + + node .addUserDefinedField (accessType, name, field); + } + catch (error) + { + console .error (error); + } + }, + protoBodyElement (xmlElement) + { + this .childrenElements (xmlElement); + }, + isElement (xmlElement) + { + if (this .isInsideProtoDefinition ()) + { + for (const childNode of xmlElement .childNodes) + this .isElementChild (childNode); + } + }, + isElementChild (xmlElement) + { + switch (xmlElement .nodeName) + { + case "connect": + case "CONNECT": + this .connectElement (xmlElement); + return; + } + }, + connectElement (xmlElement) + { + const + nodeFieldName = xmlElement .getAttribute ("nodeField"), + protoFieldName = xmlElement .getAttribute ("protoField"); + + if (nodeFieldName === null) + return console .warn ("XML Parser Error: Bad connect statement. Expected nodeField attribute."); + + if (protoFieldName === null) + return console .warn ("XML Parser Error: Bad connect statement. Expected protoField attribute."); + + try + { + if (this .getParents () .length === 0) + return; + + const + node = this .getParent (), + proto = this .getPrototype (); + + if (!(node instanceof Core_X3DNode)) + return; + + const + nodeField = node .getField (nodeFieldName), + protoField = proto .getField (protoFieldName); + + if (nodeField .getType () === protoField .getType ()) + { + if (protoField .isReference (nodeField .getAccessType ())) + nodeField .addReference (protoField); + else + throw new Error (`Field '${nodeField .getName ()}' and '${protoField .getName ()}' in PROTO ${proto .getName ()} are incompatible as an IS mapping.`); + } + else + throw new Error (`Field '${nodeField .getName ()}' and '${protoField .getName ()}' in PROTO ${this .proto .getName()} have different types.`); + } + catch (error) + { + console .warn (`XML Parser Error: Couldn't create IS reference. ${error .message}`); + } + }, + protoInstanceElement (xmlElement) + { + try + { + if (this .useAttribute (xmlElement)) + return; + + const name = xmlElement .getAttribute ("name"); + + if (this .id (name)) + { + const node = this .getExecutionContext () .createProto (name, false); + + if (!node) + throw new Error (`Unknown proto or externproto type '${name}'.`); + + ///DOMIntegration: attach node to DOM xmlElement for access from DOM. + XMLParser_$.data (xmlElement, "node", node); + + this .defAttribute (xmlElement, node); + this .addNode (xmlElement, node); + this .pushParent (node); + this .childrenElements (xmlElement); + + if (!this .isInsideProtoDefinition ()) + node .setup (); + + this .popParent (); + } + } + catch (error) + { + console .warn ("XML Parser Error: ", error .message); + + if (DEVELOPMENT) + console .error (error); + } + }, + fieldValueElement (xmlElement) + { + try + { + if (this .getParents () .length === 0) + return; + + const + node = this .getParent (), + name = xmlElement .getAttribute ("name"); + + if (!(node instanceof Core_X3DPrototypeInstance)) + return; + + if (!this .id (name)) + return; + + const + field = node .getField (name), + accessType = field .getAccessType (); + + if (accessType & Base_X3DConstants .initializeOnly) + { + if (field .getType () === Base_X3DConstants .MFNode) + { + field .length = 0 + } + + this .fieldValue (field, xmlElement .getAttribute ("value")); + + this .pushParent (field); + this .childrenElements (xmlElement); + this .popParent (); + } + } + catch (error) + { + console .warn (`XML Parser Error: Couldn't assign field value. ${error .message}`); + } + }, + nodeElement (xmlElement) + { + try + { + if (this .useAttribute (xmlElement)) + return; + + const node = this .getExecutionContext () .createNode (this .nodeNameToCamelCase (xmlElement .nodeName), false) + ?? this .getExecutionContext () .createProto (this .protoNameToCamelCase (xmlElement .nodeName), false); + + if (!node) + throw new Error (`Unknown node type '${xmlElement .nodeName}', you probably have insufficient component/profile statements and/or an inappropriate specification version.`); + + ///DOMIntegration: attach node to DOM xmlElement for access from DOM. + XMLParser_$.data (xmlElement, "node", node); + + //DOMIntegration: Script node support for HTML. + if (xmlElement .nodeName === "SCRIPT") + this .scriptElement (xmlElement); + + this .defAttribute (xmlElement, node); + this .addNode (xmlElement, node); + this .pushParent (node); + this .nodeAttributes (xmlElement, node); + this .childrenElements (xmlElement); + + if (!this .isInsideProtoDefinition ()) + node .setup (); + + this .popParent (); + } + catch (error) + { + // NULL + + if (xmlElement .nodeName == "NULL") + { + this .addNode (xmlElement, null); + return; + } + + if (DEVELOPMENT) + console .error (error); + else + console .error (`XML Parser Error: ${error .message}`); + } + }, + scriptElement (element) + { + const + domParser = new DOMParser (), + scriptDocument = domParser .parseFromString (element .outerHTML, "application/xml"), + childNodes = scriptDocument .children [0] .childNodes; + + element .textContent = "// Content moved into childNodes."; + + for (const childNode of childNodes) + { + // Add elements and cdata. + if (childNode .nodeType === 1 || childNode .nodeType === 4) + element .appendChild (childNode); + } + }, + routeElement (xmlElement) + { + try + { + const + sourceNodeName = xmlElement .getAttribute ("fromNode"), + sourceField = xmlElement .getAttribute ("fromField"), + destinationNodeName = xmlElement .getAttribute ("toNode"), + destinationField = xmlElement .getAttribute ("toField"); + + if (sourceNodeName === null) + throw new Error ("Bad ROUTE statement: Expected fromNode attribute."); + + if (sourceField === null) + throw new Error ("Bad ROUTE statement: Expected fromField attribute."); + + if (destinationNodeName === null) + throw new Error ("Bad ROUTE statement: Expected toNode attribute."); + + if (destinationField === null) + throw new Error ("Bad ROUTE statement: Expected toField attribute."); + + const + executionContext = this .getExecutionContext (), + sourceNode = executionContext .getLocalNode (sourceNodeName), + destinationNode = executionContext .getLocalNode (destinationNodeName), + route = executionContext .addRoute (sourceNode, sourceField, destinationNode, destinationField); + + ///DOMIntegration: attach node to DOM xmlElement for access from DOM. + XMLParser_$.data (xmlElement, "node", route); + } + catch (error) + { + console .warn (`XML Parser Error: ${error .message}`); + + if (DEVELOPMENT) + console .error (error); + } + }, + importElement (xmlElement) + { + try + { + const + inlineNodeName = xmlElement .getAttribute ("inlineDEF"), + exportedNodeName = xmlElement .getAttribute ("importedDEF") || xmlElement .getAttribute ("exportedDEF"), + localNodeName = xmlElement .getAttribute ("AS") || exportedNodeName; + + if (inlineNodeName === null) + throw new Error ("Bad IMPORT statement: Expected inlineDEF attribute."); + + if (exportedNodeName === null) + throw new Error ("Bad IMPORT statement: Expected importedDEF attribute."); + + const inlineNode = this .getExecutionContext () .getNamedNode (inlineNodeName); + + this .getExecutionContext () .updateImportedNode (inlineNode, exportedNodeName, localNodeName); + } + catch (error) + { + console .warn (`XML Parser Error: ${error .message}`); + } + }, + exportElement (xmlElement) + { + try + { + if (this .getScene () !== this .getExecutionContext ()) + { + console .warn ("XML Parser Error: Export statement not allowed here."); + return; + } + + const + localNodeName = xmlElement .getAttribute ("localDEF"), + exportedNodeName = xmlElement .getAttribute ("AS") || localNodeName; + + if (localNodeName === null) + throw new Error ("Bad EXPORT statement: Expected localDEF attribute."); + + const localNode = this .getExecutionContext () .getLocalNode (localNodeName); + + this .getScene () .updateExportedNode (exportedNodeName, localNode); + } + catch (error) + { + console .warn (`XML Parser Error: ${error .message}`); + } + }, + cdataNode (xmlElement) + { + if (this .getParents () .length === 0) + return; + + const node = this .getParent (); + + if (node instanceof Core_X3DNode) + node .getSourceText () ?.push (xmlElement .data); + }, + useAttribute (xmlElement) + { + try + { + const name = xmlElement .getAttribute ("USE"); + + if (this .id (name)) + { + const node = this .getExecutionContext () .getNamedNode (name); + + this .addNode (xmlElement, node .getValue ()); + return true; + } + } + catch (error) + { + console .warn (`Invalid USE name: ${error .message}`); + } + + return false; + }, + defAttribute (xmlElement, node) + { + try + { + const name = xmlElement .getAttribute ("DEF"); + + if (name) + { + try + { + const namedNode = this .getExecutionContext () .getNamedNode (name); + + this .getExecutionContext () .updateNamedNode (this .getExecutionContext () .getUniqueName (name), namedNode); + } + catch + { } + + this .getExecutionContext () .updateNamedNode (name, node); + } + } + catch (error) + { + console .warn (`Invalid DEF name: ${error .message}`); + } + }, + nodeAttributes (xmlElement, node) + { + for (const xmlAttribute of xmlElement .attributes) + this .nodeAttribute (xmlAttribute, node); + }, + nodeAttribute (xmlAttribute, node) + { + try + { + const field = node .getPredefinedField (this .attributeToCamelCase (node, xmlAttribute .name)); + + if (field .isInitializable ()) + this .fieldValue (field, xmlAttribute .value); + } + catch (error) + { + //console .error (error); + } + }, + fieldValue (field, value) + { + if (value === null) + return; + + this .parser .pushExecutionContext (this .getExecutionContext ()); + + this .parser .setInput (value); + this [field .getType ()] .call (this .parser, field, field .getUnit ()); + + this .parser .popExecutionContext (); + }, + id (string) + { + if (string === null) + return false; + + if (string .length === 0) + return false; + + return true; + }, + getParents () + { + return this .parents; + }, + getParent () + { + return this .parents .at (-1); + }, + pushParent (parent) + { + return this .parents .push (parent); + }, + popParent () + { + this .parents .pop (); + }, + addNode (xmlElement, node) + { + if (this .parents .length === 0 || this .getParent () instanceof Prototype_X3DProtoDeclaration) + { + this .getExecutionContext () .rootNodes .push (node); + return; + } + + const parent = this .getParent (); + + if (parent instanceof Base_X3DField) + { + switch (parent .getType ()) + { + case Base_X3DConstants .SFNode: + parent .setValue (node); + return; + + case Base_X3DConstants .MFNode: + parent .push (node); + return; + } + + return; + } + + // parent is a node. + + try + { + const containerField = xmlElement .getAttribute ("containerField") || node ?.getContainerField (true); + + if (!containerField) + { + console .warn ("Node must have a container field attribute."); + return; + } + + const field = parent .getField (containerField); + + switch (field .getType ()) + { + case Base_X3DConstants .SFNode: + field .setValue (node); + return; + + case Base_X3DConstants .MFNode: + field .push (node); + return; + } + } + catch (error) + { + // console .error (error); + + if (node ?.getType () .includes (Base_X3DConstants .X3DMetadataObject)) + { + xmlElement .setAttribute ("containerField", "metadata"); + + this .addNode (xmlElement, node); + } + } + }, + // Overloaded by HTMLParser. + addProtoName (name) + { }, + addProtoFieldNames (protoNode) + { }, + protoNameToCamelCase (typeName) + { + return typeName; + }, + nodeNameToCamelCase (typeName) + { + return typeName; + }, + attributeToCamelCase (node, name) + { + return name; + }, +}); + +Object .assign (XMLParser .prototype, +{ + [Base_X3DConstants .SFBool]: Parser_VRMLParser .prototype .sfboolValue, + [Base_X3DConstants .SFColor]: Parser_VRMLParser .prototype .sfcolorValue, + [Base_X3DConstants .SFColorRGBA]: Parser_VRMLParser .prototype .sfcolorrgbaValue, + [Base_X3DConstants .SFDouble]: Parser_VRMLParser .prototype .sfdoubleValue, + [Base_X3DConstants .SFFloat]: Parser_VRMLParser .prototype .sfdoubleValue, + [Base_X3DConstants .SFImage]: Parser_VRMLParser .prototype .sfimageValue, + [Base_X3DConstants .SFInt32]: Parser_VRMLParser .prototype .sfint32Value, + [Base_X3DConstants .SFMatrix3f]: Parser_VRMLParser .prototype .sfmatrix3Value, + [Base_X3DConstants .SFMatrix3d]: Parser_VRMLParser .prototype .sfmatrix3Value, + [Base_X3DConstants .SFMatrix4f]: Parser_VRMLParser .prototype .sfmatrix4Value, + [Base_X3DConstants .SFMatrix4d]: Parser_VRMLParser .prototype .sfmatrix4Value, + [Base_X3DConstants .SFNode] (field) { field .setValue (null); }, + [Base_X3DConstants .SFRotation]: Parser_VRMLParser .prototype .sfrotationValue, + [Base_X3DConstants .SFString] (field) { field .setValue (x_ite_Fields .SFString .unescape (this .input)); }, + [Base_X3DConstants .SFTime]: Parser_VRMLParser .prototype .sfdoubleValue, + [Base_X3DConstants .SFVec2d]: Parser_VRMLParser .prototype .sfvec2Value, + [Base_X3DConstants .SFVec2f]: Parser_VRMLParser .prototype .sfvec2Value, + [Base_X3DConstants .SFVec3d]: Parser_VRMLParser .prototype .sfvec3Value, + [Base_X3DConstants .SFVec3f]: Parser_VRMLParser .prototype .sfvec3Value, + [Base_X3DConstants .SFVec4d]: Parser_VRMLParser .prototype .sfvec4Value, + [Base_X3DConstants .SFVec4f]: Parser_VRMLParser .prototype .sfvec4Value, + + [Base_X3DConstants .MFBool]: Parser_VRMLParser .prototype .sfboolValues, + [Base_X3DConstants .MFColor]: Parser_VRMLParser .prototype .sfcolorValues, + [Base_X3DConstants .MFColorRGBA]: Parser_VRMLParser .prototype .sfcolorrgbaValues, + [Base_X3DConstants .MFDouble]: Parser_VRMLParser .prototype .sfdoubleValues, + [Base_X3DConstants .MFFloat]: Parser_VRMLParser .prototype .sfdoubleValues, + [Base_X3DConstants .MFImage]: Parser_VRMLParser .prototype .sfimageValues, + [Base_X3DConstants .MFInt32]: Parser_VRMLParser .prototype .sfint32Values, + [Base_X3DConstants .MFMatrix3d]: Parser_VRMLParser .prototype .sfmatrix3Values, + [Base_X3DConstants .MFMatrix3f]: Parser_VRMLParser .prototype .sfmatrix3Values, + [Base_X3DConstants .MFMatrix4d]: Parser_VRMLParser .prototype .sfmatrix4Values, + [Base_X3DConstants .MFMatrix4f]: Parser_VRMLParser .prototype .sfmatrix4Values, + [Base_X3DConstants .MFNode] (field) { field .length = 0; }, + [Base_X3DConstants .MFRotation]: Parser_VRMLParser .prototype .sfrotationValues, + [Base_X3DConstants .MFString]: Parser_VRMLParser .prototype .sfstringValues, + [Base_X3DConstants .MFTime]: Parser_VRMLParser .prototype .sfdoubleValues, + [Base_X3DConstants .MFVec2d]: Parser_VRMLParser .prototype .sfvec2Values, + [Base_X3DConstants .MFVec2f]: Parser_VRMLParser .prototype .sfvec2Values, + [Base_X3DConstants .MFVec3d]: Parser_VRMLParser .prototype .sfvec3Values, + [Base_X3DConstants .MFVec3f]: Parser_VRMLParser .prototype .sfvec3Values, + [Base_X3DConstants .MFVec4d]: Parser_VRMLParser .prototype .sfvec4Values, + [Base_X3DConstants .MFVec4f]: Parser_VRMLParser .prototype .sfvec4Values, +}); + +// HTML Support + +const HTMLParser = +{ + addProtoName (name) + { + //DOMIntegration: add uppercase versions of proto name. + + this .protoNames .set (name, name); + this .protoNames .set (name .toUpperCase (), name); + }, + addProtoFieldNames: (() => + { + const reservedAttributes = new Set (); + + for (const reservedAttribute of [ + "DEF", + "USE", + "containerField", + ]) + { + reservedAttributes + .add (reservedAttribute) + .add (reservedAttribute .toLowerCase ()); + } + + return function (protoNode) + { + //DOMIntegration: handle lowercase versions of field names. + + const fields = new Map (); + + this .protoFields .set (protoNode, fields); + + for (const { name } of protoNode .getFieldDefinitions ()) + { + if (reservedAttributes .has (name)) + continue; + + fields .set (name, name); + fields .set (name .toLowerCase (), name); + } + }; + })(), + protoNameToCamelCase (typeName) + { + //DOMIntegration: handle uppercase versions of node names. + return this .protoNames .get (typeName); + }, + nodeNameToCamelCase (typeName) + { + //DOMIntegration: handle uppercase versions of node names. + return Parser_HTMLSupport .getNodeTypeName (typeName); + }, + attributeToCamelCase (node, name) + { + //DOMIntegration: handle lowercase versions of field names. + + if (node instanceof Core_X3DPrototypeInstance) + return this .protoFields .get (node .getProtoNode ()) .get (name); + + return Parser_HTMLSupport .getFieldName (name); + }, +}; + +const XMLParser_default_ = XMLParser; +; + +x_ite_Namespace .add ("XMLParser", "x_ite/Parser/XMLParser", XMLParser_default_); +/* harmony default export */ const Parser_XMLParser = (XMLParser_default_); +;// CONCATENATED MODULE: ./src/x_ite/Parser/JSONParser.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * X3DJSONLD Copyright John Carlson, USA 2016-2017, https://coderextreme.net/X3DJSONLD + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function JSONParser (scene) +{ + Parser_X3DParser .call (this, scene); + + this .namespace = "http://www.web3d.org/specifications/x3d-namespace"; +} + +Object .assign (Object .setPrototypeOf (JSONParser .prototype, Parser_X3DParser .prototype), +{ + getEncoding () + { + return "JSON"; + }, + setInput (json) + { + try + { + if (typeof json === "string") + json = JSON .parse (json); + + this .input = json; + } + catch + { + this .input = undefined; + } + }, + isValid () + { + return this .input instanceof Object; + }, + parseIntoScene (resolve, reject) + { + /** + * Load X3D JSON into an element. + * json - the JavaScript object to convert to DOM. + */ + + const child = this .createElement ("X3D"); + + this .convertToDOM (this .input, "", child); + + // Call the DOM parser. + + const parser = new Parser_XMLParser (this .getScene ()); + + parser .setInput (child); + parser .parseIntoScene (resolve, reject); + + this .getScene () .setEncoding ("JSON"); + }, + elementSetAttribute (element, key, value) + { + /** + * Yet another way to set an attribute on an element. does not allow you to + * set JSON schema or encoding. + */ + + switch (key) + { + case "SON schema": + { + // JSON Schema + break; + } + case "ncoding": + { + // encoding, UTF-8, UTF-16 or UTF-32 + break; + } + default: + { + if (typeof element .setAttribute === "function") + element .setAttribute (key, value); + + break; + } + } + }, + convertChildren (parentkey, object, element) + { + /** + * converts children of object to DOM. + */ + + for (const key in object) + { + if (typeof object [key] === "object") + { + if (isNaN (parseInt (key))) + this .convertObject (key, object, element, parentkey .substr (1)); + + else + this .convertToDOM (object[ key], key, element, parentkey .substr (1)); + } + } + }, + createElement (key, containerField) + { + /** + * a method to create and element with tagnam key to DOM in a namespace. If + * containerField is set, then the containerField is set in the elemetn. + */ + + if (typeof this .namespace === "undefined") + { + var child = document .createElement (key); + } + else + { + var child = document .createElementNS (this .namespace, key); + + if (child === null || typeof child === "undefined") + { + console .error ("Trouble creating element for", key); + + child = document .createElement (key); + } + } + + if (typeof containerField !== "undefined") + this .elementSetAttribute (child, "containerField", containerField); + + return child; + }, + createCDATA (document, element, str) + { + const + docu = new DOMParser () .parseFromString ("", "application/xml"), + cdata = docu .createCDATASection (str); + + element .appendChild (cdata); + }, + convertObject (key, object, element, containerField) + { + /** + * convert the object at object[key] to DOM. + */ + + if (object !== null && typeof object [key] === "object") + { + if (key .substr (0, 1) === "@") + { + this .convertToDOM (object [key], key, element); + } + else if (key .substr (0, 1) === "-") + { + this .convertChildren (key, object [key], element); + } + else if (key === "#comment") + { + for (const c in object [key]) + { + const child = document .createComment (this .commentStringToXML (object [key] [c])); + + element .appendChild (child); + } + } + else if (key === "#sourceCode" || key === "@sourceCode" || key === "#sourceText") + { + this .createCDATA (document, element, object [key] .join ("\n")); + } + else + { + if (key === "connect" || key === "fieldValue" || key === "field" || key === "meta" || key === "component" || key === "unit") + { + for (const childkey in object [key]) + { + // for each field + if (typeof object [key] [childkey] === "object") + { + const child = this .createElement (key, containerField); + + this .convertToDOM (object [key] [childkey], childkey, child); + + element .appendChild (child); + element .appendChild (document .createTextNode ("\n")); + } + } + } + else + { + const child = this .createElement (key, containerField); + + this .convertToDOM (object [key], key, child); + + element .appendChild (child); + element .appendChild (document .createTextNode ("\n")); + } + } + } + }, + commentStringToXML (str) + { + /** + * convert a comment string in JavaScript to XML. Pass the string + */ + + return str .replace (/\\\\/g, "\\"); + }, + SFStringToXML (str) + { + /** + * convert an SFString to XML. + */ + + return str .replace (/([\\"])/g, "\\$1"); + }, + JSONStringToXML (str) + { + /** + * convert a JSON String to XML. + */ + + str = str .replace (/\\/g, "\\\\"); + str = str .replace (/\n/g, "\\n"); + + return str; + }, + convertToDOM(object, parentkey, element, containerField) + { + /** + * main routine for converting a JavaScript object to DOM. + * object is the object to convert. + * parentkey is the key of the object in the parent. + * element is the parent element. + * containerField is a possible containerField. + */ + + let + isArray = false, + localArray = [ ], + arrayOfStrings = false; + + for (const key in object) + { + isArray = !isNaN (parseInt (key)); + + if (isArray) + { + switch (typeof object [key]) + { + case "number": + { + localArray .push (object [key]); + break; + } + case "string": + { + localArray .push (object [key]); + + arrayOfStrings = true; + break; + } + case "boolean": + { + localArray .push (object [key]); + break; + } + case "object": + { + /* + if (object[key] != null && typeof object[key].join === "function") { + localArray.push(object[key].join(" ")); + } + */ + this .convertToDOM (object [key], key, element); + break; + } + case "undefined": + { + break; + } + default: + { + console .error (`Unknown type found in array ${typeof object [key]}`); + } + } + } + else + { + switch (typeof object [key]) + { + case "object": + { + // This is where the whole thing starts + + if (key === "X3D") + this .convertToDOM (object [key], key, element); + + else + this .convertObject (key, object, element, containerField); + + break; + } + case "number": + { + this .elementSetAttribute (element, key .substr (1), object [key]); + break; + } + case "string": + { + if (key !== "#comment") + { + // ordinary string attributes + this .elementSetAttribute (element, key .substr (1), this .JSONStringToXML (object [key])); + } + else + { + const child = document .createComment (this .commentStringToXML (object [key])); + + element .appendChild (child); + } + + break; + } + case "boolean": + { + this .elementSetAttribute (element, key .substr (1), object [key]); + break; + } + case "undefined": + { + break; + } + default: + { + console .error (`Unknown type found in object ${typeof object [key]}`); + console .error (object); + } + } + } + } + + if (isArray) + { + if (parentkey .substr (0,1) === "@") + { + if (arrayOfStrings) + { + arrayOfStrings = false; + + for (const str in localArray) + localArray [str] = this .SFStringToXML (localArray [str]); + + this .elementSetAttribute (element, parentkey .substr (1), '"' + localArray .join ('" "') + '"'); + } + else + { + // if non string array + this .elementSetAttribute (element, parentkey .substr (1), localArray .join (" ")); + } + } + + isArray = false; + } + + return element; + }, +}); + +const JSONParser_default_ = JSONParser; +; + +x_ite_Namespace .add ("JSONParser", "x_ite/Parser/JSONParser", JSONParser_default_); +/* harmony default export */ const Parser_JSONParser = (JSONParser_default_); +;// CONCATENATED MODULE: ./src/x_ite/Parser/X3DOptimizer.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + +function X3DOptimizer () { } + +Object .assign (X3DOptimizer .prototype, +{ + removeGroups: false, + removeEmptyGroups: false, + combineGroupingNodes: false, + optimizeInterpolators: false, + optimizeSceneGraph (nodes) + { + const removedNodes = [ ]; + + nodes .setValue (this .optimizeNodes (nodes, true, removedNodes)); + + removedNodes .forEach (node => node .dispose ()); + }, + optimizeNodes (nodes, combine, removedNodes) + { + return [... nodes] .flatMap (node => this .optimizeNode (node, combine, removedNodes)); + }, + optimizeNode (node, combine, removedNodes) + { + if (!node) + return [ ]; + + if (this .optimizeInterpolators) + this .removeInterpolatorsWithOnlyOneValue (node, removedNodes); + + switch (node .getNodeTypeName ()) + { + case "Transform": + { + node .children = this .optimizeNodes (node .children, true, removedNodes); + break; + } + case "Anchor": + case "Group": + { + node .children = this .optimizeNodes (node .children, true, removedNodes); + + if (this .removeEmptyGroups) + { + if (node .children .length === 0) + return [ ]; + } + + if (this .removeGroups) + break; + + return node; + } + case "Collision": + case "LOD": + case "Switch": + { + this .optimizeNodes (node .children, false, removedNodes); + return node; + } + case "HAnimJoint": + case "HAnimSegment": + case "HAnimSite": + { + node .children = this .optimizeNodes (node .children, true, removedNodes); + return node; + } + case "HAnimHumanoid": + { + node .skeleton = this .optimizeNodes (node .skeleton, true, removedNodes); + node .skin = this .optimizeNodes (node .skin, true, removedNodes); + return node; + } + default: + { + return node; + } + } + + if (!combine) + return node; + + if (this .removeEmptyGroups) + { + if (node .children .length === 0) + return [ ]; + } + + if (!this .combineGroupingNodes) + return node; + + if (node .getValue () .hasRoutes ()) + return node; + + if (node .getNodeTypeName () === "Transform") + { + node = this .combineSingleChild (node, removedNodes); + + if (!node .translation .getValue () .equals (Numbers_Vector3 .Zero)) + return node; + + if (!node .rotation .getValue () .equals (Numbers_Rotation4 .Identity)) + return node; + + if (!node .scale .getValue () .equals (Numbers_Vector3 .One)) + return node; + } + + if (node .children) + { + removedNodes .push (node); + + return [... node .children]; + } + + return node; + }, + removeInterpolatorsWithOnlyOneValue (node, removedNodes) + { + for (const field of node .getValue () .getFields ()) + { + if (field .getInputRoutes () .size !== 1) + continue; + + const + route = Array .from (field .getInputRoutes ()) [0], + sourceNode = route .sourceNode; + + if (!sourceNode .getNodeType () .includes (Base_X3DConstants .X3DInterpolatorNode)) + continue; + + if (sourceNode .key .length !== 1) + continue; + + node [route .destinationField] = sourceNode .keyValue [0]; + + removedNodes .push (sourceNode); + + route .dispose (); + } + }, + combineSingleChild (node, removedNodes) + { + if (node .children .length !== 1) + return node; + + const child = node .children [0]; + + if (!child .getNodeTypeName () .match (/^(?:Transform|HAnimHumanoid)$/)) + return node; + + if (child .getValue () .hasRoutes ()) + return node; + + // Combine single Transform nodes. + + const + translation = new Numbers_Vector3 (0, 0, 0), + rotation = new Numbers_Rotation4 (), + scale = new Numbers_Vector3 (1, 1, 1), + scaleOrientation = new Numbers_Rotation4 (), + nodeMatrix = new Numbers_Matrix4 (), + childMatrix = new Numbers_Matrix4 (); + + nodeMatrix .set (node .translation .getValue (), + node .rotation .getValue (), + node .scale .getValue (), + node .scaleOrientation .getValue (), + node .center .getValue ()); + + childMatrix .set (child .translation .getValue (), + child .rotation .getValue (), + child .scale .getValue (), + child .scaleOrientation .getValue (), + child .center .getValue ()); + + nodeMatrix .multLeft (childMatrix); + + nodeMatrix .get (translation, rotation, scale, scaleOrientation, child .center .getValue ()); + + child .translation = translation; + child .rotation = rotation; + child .scale = scale; + child .scaleOrientation = scaleOrientation; + + if (!child .getNodeTypeName () && node .getNodeTypeName ()) + { + const executionContext = child .getExecutionContext (); + + executionContext .addNamedNode (executionContext .getUniqueName (node .getNodeTypeName ()), child); + } + + removedNodes .push (node); + + return child; + }, +}); + +const X3DOptimizer_default_ = X3DOptimizer; +; + +x_ite_Namespace .add ("X3DOptimizer", "x_ite/Parser/X3DOptimizer", X3DOptimizer_default_); +/* harmony default export */ const Parser_X3DOptimizer = (X3DOptimizer_default_); +;// CONCATENATED MODULE: ./src/x_ite/Features.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +const MODULE = true; + +const Features = +{ + get ENVIRONMENT () + { + if (DEVELOPMENT) + return "BROWSER"; + + if (MODULE) + return "MODULE"; + + if ((typeof process === "object") && (process .release .name .search (/node|io.js/) !== -1)) + return "NODE"; + + return "BROWSER"; + }, +}; + +const Features_default_ = Features; +; + +x_ite_Namespace .add ("Features", "x_ite/Features", Features_default_); +/* harmony default export */ const x_ite_Features = (Features_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Networking/URLs.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +const URLs = +{ + getScriptURL: (() => + { + switch (x_ite_Features .ENVIRONMENT) + { + case "NODE": + { + var src = __webpack_require__.g .require ("url") .pathToFileURL (__filename) .href; + break; + } + case "BROWSER": + { + var src = document .currentScript ?.src ?? document .location .href; + break; + } + case "MODULE": + { + var src = import .meta .url; + break; + } + } + + return function () + { + return src; + }; + })(), + getProviderURL (component) + { + if (component) + { + if (this .getScriptURL () .match (/\.min\.js$/)) + component += ".min"; + + return new URL ("assets/components/" + component + ".js", this .getScriptURL ()) .href; + } + + return "https://create3000.github.io/x_ite/"; + }, + getFontsURL (file) + { + return new URL ("assets/fonts/" + file, this .getScriptURL ()) .href; + }, + getLinetypeURL () + { + return new URL ("assets/linetype/linetypes.png", this .getScriptURL ()) .href; + }, + getHatchingURL (index) + { + return new URL ("assets/hatching/" + index + ".png", this .getScriptURL ()) .href; + }, + getLibraryURL (file) + { + return new URL ("assets/lib/" + file, this .getScriptURL ()) .href; + }, +}; + +const URLs_default_ = URLs; +; + +x_ite_Namespace .add ("URLs", "x_ite/Browser/Networking/URLs", URLs_default_); +/* harmony default export */ const Networking_URLs = (URLs_default_); +;// CONCATENATED MODULE: ./src/x_ite/Parser/GLTF2Parser.js +/* provided dependency */ var GLTF2Parser_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + +// https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html +// https://github.com/KhronosGroup/glTF-Sample-Models + +const SAMPLES_PER_SECOND = 30; // in 1/s + +function GLTF2Parser (scene) +{ + Parser_X3DParser .call (this, scene); + Parser_X3DOptimizer .call (this); + + // Optimizer + + this .removeGroups = false; + this .removeEmptyGroups = true; + this .combineGroupingNodes = true; + this .optimizeInterpolators = true; + + // Globals + + this .extensions = new Set (); + this .lights = [ ]; + this .usedLights = 0; + this .buffers = [ ]; + this .bufferViews = [ ]; + this .accessors = [ ]; + this .samplers = [ ]; + this .materials = [ ]; + this .defaultAppearance = [ ]; + this .textureTransformNodes = [ ]; + this .meshes = [ ]; + this .cameras = [ ]; + this .viewpoints = 0; + this .nodes = [ ]; + this .skins = [ ]; + this .joints = new Set (); + this .animations = 0; +} + +Object .assign (Object .setPrototypeOf (GLTF2Parser .prototype, Parser_X3DParser .prototype), + Parser_X3DOptimizer .prototype, +{ + getEncoding () + { + return "JSON"; + }, + setInput (json) + { + try + { + if (typeof json === "string") + json = JSON .parse (json); + + this .input = json; + } + catch + { + this .input = undefined; + } + }, + isValid: (() => + { + const keys = new Set ([ + "asset", + "extra", + "extensions", + "extensionsRequired", + "extensionsUsed", + "buffers", + "bufferViews", + "accessors", + "samplers", + "images", + "textures", + "materials", + "meshes", + "cameras", + "skins", + "nodes", + "scenes", + "scene", + "animations", + ]); + + return function () + { + if (!(this .input instanceof Object)) + return false; + + if (!Object .keys (this .input) .every (key => keys .has (key))) + return false; + + const asset = this .input .asset; + + if (!(asset instanceof Object && asset .version === "2.0")) + return false; + + return true; + }; + })(), + setBuffers (buffers) + { + this .buffers = buffers; + }, + parseIntoScene (resolve, reject) + { + this .rootObject (this .input) + .then (resolve) + .catch (reject); + }, + rootObject: async function (glTF) + { + if (!(glTF instanceof Object)) + return; + + // Set profile and components. + + const + browser = this .getBrowser (), + scene = this .getScene (); + + scene .setEncoding ("GLTF"); + scene .setProfile (browser .getProfile ("Interchange")); + + if (glTF .skins) + scene .addComponent (browser .getComponent ("HAnim")); + + // Parse root objects. + + this .assetObject (glTF .asset); + this .extensionsArray (glTF .extensionsUsed, this .extensions); + this .extensionsArray (glTF .extensionsRequired, this .extensions); + this .extensionsObject (glTF .extensions); + + await this .loadComponents (); + await this .buffersArray (glTF .buffers); + + if (this .extensions .has ("KHR_draco_mesh_compression")) + this .draco = await this .createDraco (); + + this .bufferViewsArray (glTF .bufferViews); + this .accessorsArray (glTF .accessors); + this .samplersArray (glTF .samplers); + + await this .imagesArray (glTF .images); + + this .texturesArray (glTF .textures); + this .materialsArray (glTF .materials); + this .meshesArray (glTF .meshes); + this .camerasArray (glTF .cameras); + this .skinsArray (glTF .skins); + this .nodesArray (glTF .nodes); + this .scenesArray (glTF .scenes, glTF .scene); + this .animationsArray (glTF .animations); + + try + { + this .optimizeSceneGraph (this .getExecutionContext () .getRootNodes ()); + } + catch (error) + { + console .error (error) + } + + return this .getScene (); + }, + assetObject (asset) + { + if (!(asset instanceof Object)) + return; + + const + scene = this .getExecutionContext (), + worldURL = scene .getWorldURL (), + worldInfoNode = scene .createNode ("WorldInfo", false); + + for (const [key, value] of Object .entries (asset)) + { + if (typeof value !== "string") + continue; + + worldInfoNode ._info .push (`${key}: ${value}`); + } + + if (asset .extras instanceof Object) + { + for (const [key, value] of Object .entries (asset .extras)) + { + if (typeof value !== "string") + continue; + + if (key === "title") + worldInfoNode ._title = value; + else + worldInfoNode ._info .push (`${key}: ${value}`); + } + } + + worldInfoNode ._info .sort (); + + if (!worldInfoNode ._title .getValue ()) + worldInfoNode ._title = decodeURI (new URL (worldURL) .pathname .split ("/") .at (-1) || worldURL); + + worldInfoNode .setup (); + + scene .getRootNodes () .push (worldInfoNode); + }, + extensionsArray (extensions, set) + { + if (!(extensions instanceof Array)) + return; + + const + browser = this .getBrowser (), + scene = this .getExecutionContext (); + + for (const extension of extensions) + { + set .add (extension); + + switch (extension) + { + case "KHR_texture_transform": + { + const component = browser .getComponent ("Texturing3D", 2); + + if (!scene .hasComponent (component)) + scene .addComponent (component); + + break; + } + } + } + }, + extensionsObject (extensions) + { + if (!(extensions instanceof Object)) + return; + + for (const [key, value] of Object .entries (extensions)) + { + switch (key) + { + case "KHR_lights_punctual": + return this .khrLightsPunctualObject (value); + } + } + }, + khrLightsPunctualObject (khrLightsPunctual) + { + if (!(khrLightsPunctual instanceof Object)) + return; + + this .lightsArray (khrLightsPunctual .lights); + }, + lightsArray (lights) + { + if (!(lights instanceof Array)) + return; + + this .lights = lights; + }, + lightObject (light) + { + if (!(light instanceof Object)) + return null; + + const lightNode = this .lightType (light); + + if (!lightNode) + return null; + + const + scene = this .getExecutionContext (), + name = this .sanitizeName (light .name); + + const color = new Numbers_Color3 (1, 1, 1); + + if (this .vectorValue (light .color, color)) + lightNode ._color = color; + + lightNode ._global = true; + lightNode ._intensity = this .numberValue (light .intensity, 1); + + lightNode .setup (); + + if (name) + { + scene .addNamedNode (scene .getUniqueName (name), lightNode); + scene .addExportedNode (scene .getUniqueExportName (name), lightNode); + } + + return lightNode; + }, + lightType (light) + { + switch (light .type) + { + case "directional": + return this .directionalLight (light); + case "spot": + return this .spotLight (light); + case "point": + return this .pointLight (light); + } + }, + directionalLight (light) + { + const + scene = this .getExecutionContext (), + lightNode = scene .createNode ("DirectionalLight", false); + + return lightNode; + }, + spotLight (light) + { + const + scene = this .getExecutionContext (), + lightNode = scene .createNode ("SpotLight", false); + + lightNode ._radius = this .numberValue (light .range, 0) || 1_000_000_000; + lightNode ._cutOffAngle = this .numberValue (light .outerConeAngle, Math .PI / 4); + lightNode ._beamWidth = this .numberValue (light .innerConeAngle, 0); + lightNode ._attenuation = new Numbers_Vector3 (0, 0, 1); + + return lightNode; + }, + pointLight (light) + { + const + scene = this .getExecutionContext (), + lightNode = scene .createNode ("PointLight", false); + + lightNode ._radius = this .numberValue (light .range, 0) || 1_000_000_000; + lightNode ._attenuation = new Numbers_Vector3 (0, 0, 1); + + return lightNode; + }, + buffersArray: async function (buffers) + { + if (!(buffers instanceof Array)) + return; + + this .buffers = await Promise .all (buffers .map ((buffer, i) => this .bufferObject (buffer, i))); + }, + bufferObject: async function (buffer, i) + { + if (!(buffer instanceof Object)) + return; + + if (!buffer .uri) + return this .buffers [i]; + + const + url = new URL (buffer .uri, this .getExecutionContext () .getBaseURL ()), + response = await fetch (url), + blob = await response .blob (), + arrayBuffer = await blob .arrayBuffer (); + + return GLTF2Parser_$.ungzip (arrayBuffer); + }, + bufferViewsArray (bufferViews) + { + if (!(bufferViews instanceof Array)) + return; + + this .bufferViews = bufferViews; + + for (const bufferView of bufferViews) + bufferView .buffer = this .bufferViewObject (bufferView); + }, + bufferViewObject (bufferView) + { + if (!(bufferView instanceof Object)) + return; + + const buffer = this .buffers [bufferView .buffer]; + + if (!buffer) + return; + + const + byteOffset = bufferView .byteOffset || 0, + byteLength = bufferView .byteLength; + + return buffer .slice (byteOffset, byteOffset + byteLength); + }, + accessorsArray (accessors) + { + if (!(accessors instanceof Array)) + return; + + this .accessors = accessors; + + for (const accessor of accessors) + this .accessorObject (accessor); + }, + accessorObject: (() => + { + const TypedArrays = new Map ([ + [5120, Int8Array], + [5121, Uint8Array], + [5122, Int16Array], + [5123, Uint16Array], + [5124, Int32Array], + [5125, Uint32Array], + [5126, Float32Array], + ]); + + const Components = new Map ([ + ["SCALAR", 1], + ["VEC2", 2], + ["VEC3", 3], + ["VEC4", 4], + ["MAT2", 4], + ["MAT3", 9], + ["MAT4", 16], + ]); + + return function (accessor) + { + if (!(accessor instanceof Object)) + return; + + Object .defineProperty (accessor, "array", + { + get: () => + { + const + TypedArray = TypedArrays .get (accessor .componentType), + bufferView = this .bufferViews [accessor .bufferView || 0], + byteOffset = accessor .byteOffset || 0, + byteStride = bufferView .byteStride || 0, + components = Components .get (accessor .type), + count = accessor .count || 0, + stride = byteStride ? byteStride / TypedArray .BYTES_PER_ELEMENT : components, + length = Math .min (stride * count, (bufferView .byteLength - byteOffset) / TypedArray .BYTES_PER_ELEMENT), + array = new TypedArray (bufferView .buffer, byteOffset, length); + + if (stride === components) + { + const value = this .sparseObject (accessor .sparse, array, components); + + Object .defineProperty (accessor, "array", { value: value }); + + return value; + } + else + { + const + length = count * components, + dense = new TypedArray (length); + + for (let i = 0, j = 0; i < length; j += stride) + { + for (let c = 0; c < components; ++ c, ++ i) + dense [i] = array [j + c]; + } + + const value = this .sparseObject (accessor .sparse, dense, components); + + Object .defineProperty (accessor, "array", { value: value }); + + return value; + } + }, + configurable: true, + }); + }; + })(), + sparseObject: (() => + { + const TypedArrays = new Map ([ + [5121, Uint8Array], + [5123, Uint16Array], + [5125, Uint32Array], + ]); + + return function (sparse, array, components) + { + if (!(sparse instanceof Object)) + return array; + + if (!(sparse .indices instanceof Object)) + return array; + + if (!(sparse .values instanceof Object)) + return array; + + const + IndicesTypedArray = TypedArrays .get (sparse .indices .componentType), + indicesBufferView = this .bufferViews [sparse .indices .bufferView], + indicesByteOffset = sparse .indices .byteOffset, + indices = new IndicesTypedArray (indicesBufferView .buffer, indicesByteOffset, sparse .count); + + const + ValuesTypedArray = array .constructor, + valuesBufferView = this .bufferViews [sparse .values .bufferView], + valuesByteOffset = sparse .values .byteOffset, + values = new ValuesTypedArray (valuesBufferView .buffer, valuesByteOffset, sparse .count * components); + + array = array .slice (); + + let v = 0; + + for (const i of indices) + { + for (let c = 0; c < components; ++ c, ++ v) + array [i * components + c] = values [v]; + } + + return array; + }; + })(), + samplersArray (samplers) + { + if (!(samplers instanceof Array)) + return; + + this .samplers = samplers; + + for (const sampler of samplers) + this .samplerObject (sampler); + }, + samplerObject: (() => + { + const MinificationFilters = new Map ([ + [9728, ["NEAREST_PIXEL", false]], + [9729, ["AVG_PIXEL", false]], + [9984, ["NEAREST_PIXEL_NEAREST_MIPMAP", true]], + [9985, ["AVG_PIXEL_NEAREST_MIPMAP", true]], + [9986, ["NEAREST_PIXEL_AVG_MIPMAP", true]], + [9987, ["AVG_PIXEL_AVG_MIPMAP", true]], + ]); + + const MagnificationFilters = new Map ([ + [9728, "NEAREST_PIXEL"], + [9729, "AVG_PIXEL"], + ]); + + const BoundaryModes = new Map ([ + [33071, "CLAMP_TO_EDGE"], + [33648, "MIRRORED_REPEAT"], + [10497, "REPEAT"], + ]); + + return function (sampler) + { + if (!(sampler instanceof Object)) + return; + + Object .defineProperty (sampler, "texturePropertiesNode", + { + get: () => + { + const + scene = this .getExecutionContext (), + texturePropertiesNode = scene .createNode ("TextureProperties", false), + name = this .sanitizeName (sampler .name); + + if (name) + { + scene .addNamedNode (scene .getUniqueName (name), texturePropertiesNode); + scene .addExportedNode (scene .getUniqueExportName (name), texturePropertiesNode); + } + + // minFilter + + const minificationFilter = MinificationFilters .get (sampler .minFilter) ?? ["AVG_PIXEL", false]; + + texturePropertiesNode ._minificationFilter = minificationFilter [0]; + texturePropertiesNode ._generateMipMaps = minificationFilter [1]; + + // magFilter + + texturePropertiesNode ._magnificationFilter = MagnificationFilters .get (sampler .magFilter) ?? "AVG_PIXEL"; + + // boundaryMode + + texturePropertiesNode ._boundaryModeS = BoundaryModes .get (sampler .wrapS) ?? "REPEAT"; + texturePropertiesNode ._boundaryModeT = BoundaryModes .get (sampler .wrapT) ?? "REPEAT"; + + // setup + + texturePropertiesNode .setup (); + + Object .defineProperty (sampler, "texturePropertiesNode", { value: texturePropertiesNode }); + + return texturePropertiesNode; + }, + configurable: true, + }); + }; + })(), + imagesArray: async function (images) + { + if (!(images instanceof Array)) + return; + + this .images = await Promise .all (images .map (image => this .imageObject (image))); + }, + imageObject: async function (image) + { + if (!(image instanceof Object)) + return; + + if (image .uri) + return image; + + const bufferView = this .bufferViews [image .bufferView]; + + if (!bufferView) + return image; + + const + buffer = bufferView .buffer, + blob = new Blob ([new Uint8Array (buffer)], { type: image .mimeType }), + uri = await this .blobToDataUrl (blob); + + image .uri = uri; + + return image; + }, + blobToDataUrl (blob) + { + return new Promise ((resolve, reject) => + { + const fileReader = new FileReader (); + + fileReader .onload = resolve; + fileReader .onerror = reject; + + fileReader .readAsDataURL (blob); + }) + .then (event => event .target .result); + }, + texturesArray (textures) + { + if (!(textures instanceof Array)) + return; + + this .textures = textures; + }, + textureObject (texture) + { + if (!(texture instanceof Object)) + return; + + const images = this .textureImageObject (texture); + + if (!images .length) + return null; + + if (texture .textureNode) + return texture .textureNode; + + const + scene = this .getExecutionContext (), + textureNode = scene .createNode ("ImageTexture", false), + name = this .sanitizeName (texture .name || images [0] .name); + + if (name) + { + scene .addNamedNode (scene .getUniqueName (name), textureNode); + scene .addExportedNode (scene .getUniqueExportName (name), textureNode); + } + + textureNode ._url = images .map (image => image .uri); + textureNode ._colorSpaceConversion = false; + + const sampler = this .samplers [texture .sampler]; + + if (sampler instanceof Object) + textureNode ._textureProperties = sampler .texturePropertiesNode; + + textureNode .setup (); + + return texture .textureNode = textureNode; + }, + textureImageObject (texture) + { + const images = [this .images [texture .source]]; + + if (this .extensions .has ("EXT_texture_webp")) + images .unshift (this .images [texture .extensions ?.EXT_texture_webp ?.source]); + + return images .filter (image => image); + }, + materialsArray (materials) + { + if (!(materials instanceof Array)) + return; + + this .materials = materials; + }, + materialObject ({ material, mode = 4 }) + { + if (!(material instanceof Object)) + return this .getDefaultAppearance (mode); + + if (material .appearanceNode) + return material .appearanceNode; + + const texCoordIndices = this .texCoordIndices ("", material); + + this .texCoordIndex = [... texCoordIndices] .reduce (Math .max, -1); + this .textureTransformNodes = [ ]; + this .texCoordMappings = new Map (); + material .texCoordMappings = this .texCoordMappings; + + const + scene = this .getExecutionContext (), + appearanceNode = scene .createNode ("Appearance", false), + materialNode = this .refineMaterial (mode, this .createMaterial (material, mode)), + name = this .sanitizeName (material .name); + + const emissiveFactor = new Numbers_Color3 (0, 0, 0); + + if (this .vectorValue (material .emissiveFactor, emissiveFactor)) + materialNode ._emissiveColor = emissiveFactor; + + materialNode ._emissiveTexture = this .textureInfo (material .emissiveTexture); + materialNode ._emissiveTextureMapping = this .textureMapping (material .emissiveTexture); + + this .occlusionTextureInfo (material .occlusionTexture, materialNode); + this .normalTextureInfo (material .normalTexture, materialNode); + this .materialExtensions (material .extensions, materialNode); + + materialNode .setup (); + + for (const i of texCoordIndices) + { + const mapping = `TEXCOORD_${i}`; + + if (this .textureTransformNodes .length) + { + const textureTransformNode = scene .createNode ("TextureTransform", false); + + textureTransformNode ._mapping = mapping; + textureTransformNode ._translation .y = -1; + textureTransformNode ._scale .y = -1; + + textureTransformNode .setup (); + + this .textureTransformNodes .push (textureTransformNode); + } + + this .texCoordMappings .set (mapping, i); + } + + if (name) + { + scene .addNamedNode (scene .getUniqueName (name), appearanceNode); + scene .addExportedNode (scene .getUniqueExportName (name), appearanceNode); + } + + appearanceNode ._alphaMode = this .stringValue (material .alphaMode, "OPAQUE"); + appearanceNode ._alphaCutoff = this .numberValue (material .alphaCutoff, 0.5); + appearanceNode ._material = materialNode; + appearanceNode ._textureTransform = this .createMultiTextureTransform (materialNode); + + appearanceNode .setup (); + + return material .appearanceNode = appearanceNode; + }, + refineMaterial (mode, materialNode) + { + if (mode > 3) + return materialNode + + switch (materialNode .getTypeName ()) + { + default: + { + return materialNode; + } + case "Material": + { + const + scene = this .getExecutionContext (), + unlitMaterialNode = scene .createNode ("UnlitMaterial", false); + + unlitMaterialNode ._emissiveColor = materialNode ._diffuseColor; + unlitMaterialNode ._emissiveTextureMapping = materialNode ._diffuseTextureMapping; + unlitMaterialNode ._emissiveTexture = materialNode ._diffuseTexture; + + materialNode .dispose (); + + return unlitMaterialNode; + } + case "PhysicalMaterial": + { + const + scene = this .getExecutionContext (), + unlitMaterialNode = scene .createNode ("UnlitMaterial", false); + + unlitMaterialNode ._emissiveColor = materialNode ._baseColor; + unlitMaterialNode ._emissiveTextureMapping = materialNode ._baseTextureMapping; + unlitMaterialNode ._emissiveTexture = materialNode ._baseTexture; + + materialNode .dispose (); + + return unlitMaterialNode; + } + } + }, + texCoordIndices (key, object, indices = new Set ()) + { + if (!(object instanceof Object)) + return indices; + + if (key .endsWith ("Texture") && !object ?.extensions ?.KHR_texture_transform) + indices .add (object .texCoord || 0); + + for (const [key, value] of Object .entries (object)) + this .texCoordIndices (key, value, indices); + + return indices; + }, + createMaterial (material, mode) + { + const materials = [ + this .pbrMetallicRoughnessObject .bind (this, material .pbrMetallicRoughness), + this .pbrSpecularGlossinessObject .bind (this, material .extensions ?.KHR_materials_pbrSpecularGlossiness), + this .pbrMetallicRoughnessObject .bind (this, { }), + ]; + + for (const material of materials) + { + const materialNode = material (mode); + + if (materialNode) + return materialNode; + } + }, + pbrMetallicRoughnessObject (pbrMetallicRoughness, mode) + { + if (!(pbrMetallicRoughness instanceof Object)) + return null; + + const + scene = this .getExecutionContext (), + materialNode = scene .createNode ("PhysicalMaterial", false); + + const + baseColorFactor = new Numbers_Color4 (0, 0, 0, 0), + baseColor = new Numbers_Color3 (0, 0, 0); + + if (this .vectorValue (pbrMetallicRoughness .baseColorFactor, baseColorFactor)) + { + materialNode ._baseColor = baseColor .set (... baseColorFactor); + materialNode ._transparency = 1 - baseColorFactor .a; + } + + materialNode ._metallic = this .numberValue (pbrMetallicRoughness .metallicFactor, 1); + materialNode ._roughness = this .numberValue (pbrMetallicRoughness .roughnessFactor, 1); + + materialNode ._baseTexture = this .textureInfo (pbrMetallicRoughness .baseColorTexture); + materialNode ._baseTextureMapping = this .textureMapping (pbrMetallicRoughness .baseColorTexture); + materialNode ._metallicRoughnessTexture = this .textureInfo (pbrMetallicRoughness .metallicRoughnessTexture); + materialNode ._metallicRoughnessTextureMapping = this .textureMapping (pbrMetallicRoughness .metallicRoughnessTexture); + + return materialNode; + }, + pbrSpecularGlossinessObject (pbrSpecularGlossiness) + { + if (!(pbrSpecularGlossiness instanceof Object)) + return null; + + const + scene = this .getExecutionContext (), + materialNode = scene .createNode ("Material", false); + + const + diffuseFactor = new Numbers_Color4 (0, 0, 0, 0), + diffuseColor = new Numbers_Color3 (0, 0, 0), + specularFactor = new Numbers_Color3 (0, 0, 0); + + if (this .vectorValue (pbrSpecularGlossiness .diffuseFactor, diffuseFactor)) + { + materialNode ._diffuseColor = diffuseColor .set (... diffuseFactor); + materialNode ._transparency = 1 - diffuseFactor .a; + } + else + { + materialNode ._diffuseColor = Numbers_Color3 .White; + } + + if (this .vectorValue (pbrSpecularGlossiness .specularFactor, specularFactor)) + materialNode ._specularColor = specularFactor; + else + materialNode ._specularColor = Numbers_Color3 .White; + + materialNode ._shininess = this .numberValue (pbrSpecularGlossiness .glossinessFactor, 1); + + materialNode ._diffuseTexture = this .textureInfo (pbrSpecularGlossiness .diffuseTexture); + materialNode ._diffuseTextureMapping = this .textureMapping (pbrSpecularGlossiness .diffuseTexture); + materialNode ._specularTexture = this .textureInfo (pbrSpecularGlossiness .specularGlossinessTexture); + materialNode ._specularTextureMapping = this .textureMapping (pbrSpecularGlossiness .specularGlossinessTexture); + materialNode ._shininessTexture = this .textureInfo (pbrSpecularGlossiness .specularGlossinessTexture); + materialNode ._shininessTextureMapping = this .textureMapping (pbrSpecularGlossiness .specularGlossinessTexture); + + return materialNode; + }, + occlusionTextureInfo (occlusionTexture, materialNode) + { + if (!(occlusionTexture instanceof Object)) + return null; + + materialNode ._occlusionStrength = this .numberValue (occlusionTexture .strength, 1); + materialNode ._occlusionTexture = this .textureInfo (occlusionTexture); + materialNode ._occlusionTextureMapping = this .textureMapping (occlusionTexture); + }, + normalTextureInfo (normalTexture, materialNode) + { + if (!(normalTexture instanceof Object)) + return null; + + materialNode ._normalScale = this .numberValue (normalTexture .scale, 1); + materialNode ._normalTexture = this .textureInfo (normalTexture); + materialNode ._normalTextureMapping = this .textureMapping (normalTexture); + }, + textureInfo (texture) + { + if (!(texture instanceof Object)) + return null; + + if (texture .extensions instanceof Object) + texture .mapping = this .textureTransformObject (texture .extensions .KHR_texture_transform, texture .texCoord || 0); + else + texture .mapping = `TEXCOORD_${texture .texCoord || 0}`; + + return this .textureObject (this .textures [texture .index]); + }, + textureMapping (texture) + { + if (!(texture instanceof Object)) + return ""; + + return texture .mapping; + }, + materialExtensions (extensions, materialNode) + { + if (!(extensions instanceof Object)) + return; + + for (const [key, value] of Object .entries (extensions)) + { + switch (key) + { + case "KHR_materials_unlit": + this .khrMaterialsUnlitObject (materialNode); + break; + case "KHR_materials_emissive_strength": + this .khrMaterialsEmissiveStrengthObject (value, materialNode); + break; + } + } + }, + khrMaterialsUnlitObject (materialNode) + { + switch (materialNode .getTypeName ()) + { + case "PhysicalMaterial": + { + materialNode ._emissiveColor = materialNode ._baseColor; + materialNode ._emissiveTextureMapping = materialNode ._baseTextureMapping; + materialNode ._emissiveTexture = materialNode ._baseTexture; + materialNode ._baseColor = Numbers_Color3 .Black; + materialNode ._baseTextureMapping = ""; + materialNode ._baseTexture = null; + break; + } + case "Material": + { + materialNode ._emissiveColor = materialNode ._diffuseColor; + materialNode ._emissiveTextureMapping = materialNode ._diffuseTextureMapping; + materialNode ._emissiveTexture = materialNode ._diffuseTexture; + materialNode ._diffuseColor = Numbers_Color3 .Black; + materialNode ._diffuseTextureMapping = ""; + materialNode ._diffuseTexture = null; + break; + } + } + }, + khrMaterialsEmissiveStrengthObject (KHR_materials_emissive_strength, materialNode) + { + if (!(KHR_materials_emissive_strength instanceof Object)) + return; + + const emissiveStrength = this .numberValue (KHR_materials_emissive_strength .emissiveStrength, 1); + + materialNode ._emissiveColor .r *= emissiveStrength; + materialNode ._emissiveColor .g *= emissiveStrength; + materialNode ._emissiveColor .b *= emissiveStrength; + }, + textureTransformObject (KHR_texture_transform, texCoord) + { + if (!(KHR_texture_transform instanceof Object)) + return; + + if (!this .extensions .has ("KHR_texture_transform")) + return; + + const + scene = this .getExecutionContext (), + textureTransformNode = scene .createNode ("TextureTransformMatrix3D", false), + mapping = `TEXCOORD_${this .texCoordIndex + this .textureTransformNodes .length + 1}`; + + const + translation = new Numbers_Vector2 (0, 0), + scale = new Numbers_Vector2 (1, 1), + matrix = new Numbers_Matrix4 (); + + matrix .scale (new Numbers_Vector3 (1, -1, 1)); + matrix .translate (new Numbers_Vector3 (0, -1, 0)); + + if (this .vectorValue (KHR_texture_transform .offset, translation)) + matrix .translate (new Numbers_Vector3 (... translation, 0)); + + matrix .rotate (new Numbers_Rotation4 (0, 0, -1, this .numberValue (KHR_texture_transform .rotation, 0))); + + if (this .vectorValue (KHR_texture_transform .scale, scale)) + matrix .scale (new Numbers_Vector3 (... scale, 1)); + + textureTransformNode ._mapping = mapping; + textureTransformNode ._matrix = matrix; + + textureTransformNode .setup (); + + this .textureTransformNodes .push (textureTransformNode); + this .texCoordMappings .set (mapping, KHR_texture_transform .texCoord ?? texCoord); + + return mapping; + }, + meshesArray (meshes) + { + if (!(meshes instanceof Array)) + return; + + this .meshes = meshes; + }, + meshObject (mesh, skin) + { + if (!(mesh instanceof Object)) + return; + + if (mesh .shapeNodes) + { + const primitives = mesh .primitives; + + if (!(primitives instanceof Array)) + return mesh .shapeNodes; + + for (const primitive of primitives) + this .attributesJointsArray (skin, primitive .attributes ?.JOINTS, primitive .attributes ?.WEIGHTS); + + return mesh .shapeNodes; + } + + const shapeNodes = this .primitivesArray (mesh, skin); + + // Name Shape nodes. + + const + scene = this .getExecutionContext (), + name = this .sanitizeName (mesh .name); + + if (name) + { + for (const shapeNode of shapeNodes) + { + scene .addNamedNode (scene .getUniqueName (name), shapeNode); + scene .addExportedNode (scene .getUniqueExportName (name), shapeNode); + } + } + + return mesh .shapeNodes = shapeNodes; + }, + primitivesArray ({ primitives, weights }, skin) + { + if (!(primitives instanceof Array)) + return [ ]; + + const shapeNodes = [ ]; + + for (const primitive of primitives) + this .primitiveObject (primitive, weights, skin, shapeNodes); + + return shapeNodes; + }, + primitiveObject (primitive, weights, skin, shapeNodes) + { + if (!(primitive instanceof Object)) + return; + + this .attributesObject (primitive .attributes); + this .targetsArray (primitive .targets); + + primitive .indices = this .accessors [primitive .indices]; + primitive .material = this .materials [primitive .material]; + + this .primitiveExtensionsObject (primitive .extensions, primitive) + + shapeNodes .push (primitive .shapeNode = this .createShape (primitive, weights, skin)); + }, + attributesObject (attributes) + { + if (!(attributes instanceof Object)) + return; + + for (const key in attributes) + attributes [key] = this .accessors [attributes [key]]; + + attributes .TEXCOORD = [ ]; + attributes .COLOR = [ ]; + attributes .JOINTS = [ ]; + attributes .WEIGHTS = [ ]; + + for (let i = 0; attributes ["TEXCOORD_" + i]; ++ i) + attributes .TEXCOORD .push (attributes ["TEXCOORD_" + i]); + + for (let i = 0; attributes ["COLOR_" + i]; ++ i) + attributes .COLOR .push (attributes ["COLOR_" + i]); + + for (let i = 0; attributes ["JOINTS_" + i]; ++ i) + attributes .JOINTS .push (attributes ["JOINTS_" + i]); + + for (let i = 0; attributes ["WEIGHTS_" + i]; ++ i) + attributes .WEIGHTS .push (attributes ["WEIGHTS_" + i]); + }, + targetsArray (targets) + { + if (!(targets instanceof Array)) + return; + }, + primitiveExtensionsObject (extensions, primitive) + { + if (!(extensions instanceof Object)) + return; + + for (const [key, value] of Object .entries (extensions)) + { + switch (key) + { + case "KHR_draco_mesh_compression": + return this .khrDracoMeshCompressionObject (value, primitive); + } + } + }, + khrDracoMeshCompressionObject (draco, primitive) + { + if (!(draco instanceof Object)) + return; + + if (!this .draco) + return; + + function indicesCallback (array) + { + Object .defineProperty (primitive .indices, "array", { value: array }); + } + + function attributeCallback (key, array) + { + if (attributes [key]) + Object .defineProperty (attributes [key], "array", { value: array }); + } + + const + attributes = primitive .attributes, + dataView = new Uint8Array (this .bufferViews [draco .bufferView] .buffer); + + this .dracoDecodeMesh (this .draco, dataView, draco .attributes, indicesCallback, attributeCallback); + }, + dracoDecodeMesh (draco, dataView, attributes, indicesCallback, attributeCallback) + { + const + buffer = new draco .DecoderBuffer (), + decoder = new draco .Decoder (); + + buffer .Init (dataView, dataView .byteLength); + + let geometry, status; + + try + { + const type = decoder .GetEncodedGeometryType (buffer); + + switch (type) + { + case draco .TRIANGULAR_MESH: + geometry = new draco .Mesh (); + status = decoder .DecodeBufferToMesh (buffer, geometry); + break; + case draco .POINT_CLOUD: + geometry = new draco .PointCloud (); + status = decoder .DecodeBufferToPointCloud (buffer, geometry); + break; + default: + throw new Error (`Invalid geometry type ${type}.`); + } + + if (!status .ok () || !geometry .ptr) + throw new Error (status .error_msg ()); + + if (type === draco .TRIANGULAR_MESH) + { + const + numFaces = geometry .num_faces (), + numIndices = numFaces * 3, + byteLength = numIndices * 4, + ptr = draco ._malloc (byteLength); + + try + { + const indices = new Uint32Array (numIndices); + + decoder .GetTrianglesUInt32Array (geometry, byteLength, ptr); + + indices .set (new Uint32Array (draco .HEAPF32 .buffer, ptr, numIndices)); + + indicesCallback (indices); + } + finally + { + draco ._free (ptr); + } + } + + for (const [key, id] of Object .entries (attributes)) + { + const + attribute = decoder .GetAttributeByUniqueId (geometry, id), + numComponents = attribute .num_components (), + numPoints = geometry .num_points (), + numValues = numPoints * numComponents, + byteLength = numValues * Float32Array .BYTES_PER_ELEMENT, + ptr = draco ._malloc (byteLength); + + try + { + const array = new Float32Array (numValues); + + decoder .GetAttributeDataArrayForAllPoints (geometry, attribute, draco .DT_FLOAT32, byteLength, ptr); + + array .set (new Float32Array (draco .HEAPF32 .buffer, ptr, numValues)); + + attributeCallback (key, array); + } + finally + { + draco ._free (ptr); + } + } + } + finally + { + if (geometry) + draco .destroy (geometry); + + draco .destroy (decoder); + draco .destroy (buffer); + } + }, + createDraco: async function () + { + if (this .constructor .draco) + { + return this .constructor .draco; + } + else + { + const + response = await fetch (Networking_URLs .getLibraryURL ("draco_decoder_gltf.js")), + text = await response .text (), + draco = await new Function (text) () (); + + return this .constructor .draco = draco; + } + }, + camerasArray (cameras) + { + if (!(cameras instanceof Array)) + return; + + this .cameras = cameras; + }, + cameraObject (camera) + { + if (!(camera instanceof Object)) + return null; + + if (camera .viewpointNode !== undefined) + return camera .viewpointNode; + + const viewpointNode = this .cameraType (camera); + + if (!viewpointNode) + return camera .viewpointNode = null; + + const + scene = this .getExecutionContext (), + name = this .sanitizeName (camera .name); + + // Name + + if (name) + { + scene .addNamedNode (scene .getUniqueName (name), viewpointNode); + scene .addExportedNode (scene .getUniqueExportName (name), viewpointNode); + } + + viewpointNode ._description = camera .name ? this .description (camera .name) : `Viewpoint ${++ this .viewpoints}`; + viewpointNode ._position = Numbers_Vector3 .Zero; + viewpointNode ._centerOfRotation = new Numbers_Vector3 (0, 0, -10); + + return camera .viewpointNode = viewpointNode; + }, + cameraType (camera) + { + switch (camera .type) + { + case "orthographic": + return this .orthographicCamera (camera .orthographic); + case "perspective": + return this .perspectiveCamera (camera .perspective); + default: + return null; + } + }, + orthographicCamera (camera) + { + const + scene = this .getExecutionContext (), + viewpointNode = scene .createNode ("OrthoViewpoint", false); + + if (typeof camera .xmag === "number") + { + viewpointNode ._fieldOfView [0] = -camera .xmag / 2; + viewpointNode ._fieldOfView [2] = +camera .xmag / 2; + } + + if (typeof camera .ymag === "number") + { + viewpointNode ._fieldOfView [1] = -camera .ymag / 2; + viewpointNode ._fieldOfView [3] = +camera .ymag / 2; + } + + if (typeof camera .znear === "number") + viewpointNode ._nearDistance = camera .znear; + + if (typeof camera .zfar === "number") + viewpointNode ._farDistance = camera .zfar; + + viewpointNode .setup (); + + return viewpointNode; + }, + perspectiveCamera (camera) + { + const + scene = this .getExecutionContext (), + viewpointNode = scene .createNode ("Viewpoint", false); + + if (typeof camera .yfov === "number") + viewpointNode ._fieldOfView = camera .yfov + + if (typeof camera .znear === "number") + viewpointNode ._nearDistance = camera .znear; + + if (typeof camera .zfar === "number") + viewpointNode ._farDistance = camera .zfar; + + viewpointNode .setup (); + + return viewpointNode; + }, + nodesArray (nodes) + { + if (!(nodes instanceof Array)) + return; + + this .nodes = nodes .map ((node, index) => this .nodeObject (node, index)); + + // 1. Replace skeleton nodes with humanoid. + // 2. Add children. + + this .nodes .forEach (node => this .nodeSkeleton (node)); + this .nodes .forEach (node => this .nodeChildren (node)); + }, + nodeObject (node, index) + { + if (!(node instanceof Object)) + return { }; + + if (node .transformNode) + return node; + + // Create Transform or HAnimJoint. + + const + scene = this .getExecutionContext (), + typeName = this .joints .has (index) ? "HAnimJoint" : "Transform", + transformNode = scene .createNode (typeName, false); + + node .transformNode = transformNode; + + // Create humanoid. + + const skin = this .skins [node .skin]; + + if (skin) + { + // Skins can be cloned. + + if (!skin .humanoidNode) + skin .humanoidNode = scene .createNode ("HAnimHumanoid", false); + + node .humanoidNode = skin .humanoidNode; + } + + node .childNode = node .humanoidNode ?? node .transformNode; + + return node; + }, + nodeSkeleton (node) + { + const skin = this .skins [node .skin]; + + if (!skin) + return; + + const + skeleton = this .nodes [skin .skeleton], + humanoidNode = skin .humanoidNode; + + if (!skeleton) + return; + + skeleton .humanoidNode = humanoidNode; + skeleton .childNode = humanoidNode; + }, + nodeChildren (node) + { + const + scene = this .getExecutionContext (), + transformNode = node .transformNode, + name = this .sanitizeName (node .name); + + // Name + + if (name) + { + scene .addNamedNode (scene .getUniqueName (name), transformNode); + scene .addExportedNode (scene .getUniqueExportName (name), transformNode); + + if (transformNode .getTypeName () === "HAnimJoint") + transformNode ._name = node .name; + } + + // Set transformation matrix. + + const + translation = new Numbers_Vector3 (0, 0, 0), + rotation = new Numbers_Rotation4 (), + scale = new Numbers_Vector3 (1, 1, 1), + scaleOrientation = new Numbers_Rotation4 (), + quaternion = new Numbers_Quaternion (0, 0, 0, 1), + matrix = new Numbers_Matrix4 (); + + if (this .vectorValue (node .matrix, matrix)) + { + matrix .get (translation, rotation, scale, scaleOrientation); + + transformNode ._translation = translation; + transformNode ._rotation = rotation; + transformNode ._scale = scale; + transformNode ._scaleOrientation = scaleOrientation; + } + else + { + if (this .vectorValue (node .translation, translation)) + transformNode ._translation = translation; + + if (this .vectorValue (node .rotation, quaternion)) + transformNode ._rotation = new Numbers_Rotation4 (quaternion); + + if (this .vectorValue (node .scale, scale)) + transformNode ._scale = scale; + } + + // Add mesh. + + const + skin = this .skins [node .skin], + shapeNodes = this .meshObject (this .meshes [node .mesh], skin); + + // Add camera. + + const viewpointNode = this .cameraObject (this .cameras [node .camera]); + + if (viewpointNode) + transformNode ._children .push (viewpointNode); + + // Add light. + + this .nodeExtensions (node .extensions, transformNode); + + // Add children. + + transformNode ._children .push (... this .nodeChildrenArray (node .children)); + + // Add Shape nodes. + + if (shapeNodes) + transformNode ._children .push (... shapeNodes); + + transformNode .setup (); + + // Skin + + if (!skin) + return; + + const humanoidNode = skin .humanoidNode; + + if (!humanoidNode .isInitialized ()) + { + const name = this .sanitizeName (skin .name) || transformNode .getName (); + + if (name) + { + scene .addNamedNode (scene .getUniqueName (name), humanoidNode); + scene .addExportedNode (scene .getUniqueExportName (name), humanoidNode); + } + + humanoidNode ._name = skin .name ?? node .name ?? ""; + humanoidNode ._version = "2.0"; + humanoidNode ._skeletalConfiguration = "GLTF"; + + const skeletonNode = this .nodes [skin .skeleton] ?.transformNode; + + if (skeletonNode) + humanoidNode ._skeleton .push (skeletonNode); + + for (const [i, joint] of skin .joints .entries ()) + { + const + jointNode = this .nodes [joint] ?.transformNode, + inverseBindMatrix = skin .inverseBindMatrices [i] ?? Numbers_Matrix4 .Identity; + + if (!jointNode) + continue; + + inverseBindMatrix .get (translation, rotation, scale); + + humanoidNode ._joints .push (jointNode); + humanoidNode ._jointBindingPositions .push (translation); + humanoidNode ._jointBindingRotations .push (rotation); + humanoidNode ._jointBindingScales .push (scale); + } + + humanoidNode .setup (); + } + + if (shapeNodes ?.length) + { + humanoidNode ._skinNormal = shapeNodes [0] ._geometry .normal; + humanoidNode ._skinCoord = shapeNodes [0] ._geometry .coord; + } + + humanoidNode ._skin .push (transformNode); + }, + nodeExtensions (extensions, transformNode) + { + if (!(extensions instanceof Object)) + return; + + this .nodeLight (extensions .KHR_lights_punctual, transformNode); + }, + nodeLight (khrLightsPunctual, transformNode) + { + if (!(khrLightsPunctual instanceof Object)) + return; + + const lightNode = this .lightObject (this .lights [khrLightsPunctual .light]); + + if (!lightNode) + return; + + ++ this .usedLights; + + transformNode ._children .push (lightNode); + }, + nodeChildrenArray (children) + { + if (!(children instanceof Array)) + return [ ]; + + const nodes = [... new Set (children + .map (index => this .nodes [index] ?.childNode) + .filter (node => node) + .filter (node => node .getTypeName () !== "HAnimHumanoid" || !node .getCloneCount ()) + )]; + + return nodes; + }, + skinsArray (skins) + { + if (!(skins instanceof Array)) + return; + + this .skins = skins; + + for (const skin of skins) + this .skinObject (skin); + }, + skinObject: function (skin) + { + if (!(skin instanceof Object)) + return; + + const scene = this .getScene (); + + skin .joints = this .jointsArray (skin .joints); + skin .skeleton = skin .skeleton ?? this .skeleton (skin .joints); + skin .inverseBindMatrices = this .inverseBindMatricesAccessors (this .accessors [skin .inverseBindMatrices]); + + skin .textureCoordinateNode = scene .createNode ("TextureCoordinate", false); + skin .multiTextureCoordinateNode = scene .createNode ("MultiTextureCoordinate", false); + skin .normalNode = scene .createNode ("Normal", false); + skin .coordinateNode = scene .createNode ("Coordinate", false); + + skin .textureCoordinateNode ._mapping = "TEXCOORD_0"; + + skin .textureCoordinateNode .setup (); + skin .multiTextureCoordinateNode .setup (); + skin .normalNode .setup (); + skin .coordinateNode .setup (); + }, + jointsArray: function (joints) + { + if (!(joints instanceof Array)) + return [ ]; + + joints .forEach (index => this .joints .add (index)); + + return joints; + }, + skeleton: function (joints) + { + const children = new Set (joints + .map (index => this .nodes [index]) + .filter (node => node instanceof Object) + .filter (node => node .children instanceof Array) + .flatMap (node => node .children)); + + return joints .filter (index => !children .has (index)) [0]; + }, + inverseBindMatricesAccessors: function (inverseBindMatrices) + { + if (!inverseBindMatrices) + return [ ]; + + const + array = inverseBindMatrices .array, + length = array .length, + matrices = [ ]; + + for (let i = 0; i < length; i += 16) + matrices .push (new Numbers_Matrix4 (... array .subarray (i, i + 16))); + + return matrices; + }, + scenesArray (scenes, sceneNumber = 0) + { + if (!(scenes instanceof Array)) + return; + + const + scene = this .getExecutionContext (), + children = scenes .map (scene => this .sceneObject (scene)) .filter (node => node); + + switch (children .length) + { + case 0: + { + return; + } + case 1: + { + if (sceneNumber === 0) + { + if (this .usedLights) + scene .getRootNodes () .push (this .createNavigationInfo ()); + + scene .getRootNodes () .push (children [0]); + return; + } + + // Proceed with next case: + } + default: + { + // Root + + if (this .usedLights) + scene .getRootNodes () .push (this .createNavigationInfo ()); + + const switchNode = scene .createNode ("Switch", false); + + scene .addNamedNode (scene .getUniqueName ("Scenes"), switchNode); + scene .addExportedNode (scene .getUniqueExportName ("Scenes"), switchNode); + + // Scenes. + + switchNode ._whichChoice = sceneNumber; + switchNode ._children = children; + + switchNode .setup (); + + scene .getRootNodes () .push (switchNode); + return; + } + } + }, + sceneObject (scene) + { + if (!(scene instanceof Object)) + return null; + + const nodes = this .sceneNodesArray (scene .nodes); + + switch (nodes .length) + { + case 0: + { + return null; + } + case 1: + { + return nodes [0]; + } + default: + { + const + scene = this .getExecutionContext (), + groupNode = scene .createNode ("Group", false), + name = this .sanitizeName (scene .name); + + if (name) + { + scene .addNamedNode (scene .getUniqueName (name), groupNode); + scene .addExportedNode (scene .getUniqueExportName (name), groupNode); + } + + groupNode ._children = nodes; + + groupNode .setup (); + + return groupNode; + } + } + }, + sceneNodesArray (nodes) + { + return this .nodeChildrenArray (nodes); + }, + animationsArray (animations) + { + if (!(animations instanceof Array)) + return; + + const animationNodes = animations + .map (animation => this .animationObject (animation)) + .filter (node => node); + + if (!animationNodes .length) + return; + + const + scene = this .getExecutionContext (), + groupNode = scene .createNode ("Group", false); + + scene .addNamedNode (scene .getUniqueName ("Animations"), groupNode); + scene .addExportedNode (scene .getUniqueExportName ("Animations"), groupNode); + + groupNode ._children = animationNodes; + + groupNode .setup (); + + scene .getRootNodes () .push (groupNode); + }, + animationObject (animation) + { + if (!(animation instanceof Object)) + return null; + + const + scene = this .getExecutionContext (), + timeSensorNode = scene .createNode ("TimeSensor", false), + channelNodes = this .animationChannelsArray (animation .channels, animation .samplers, timeSensorNode); + + if (!channelNodes .length) + return null; + + const + groupNode = scene .createNode ("Group", false), + name = this .sanitizeName (animation .name); + + ++ this .animations; + + scene .addNamedNode (scene .getUniqueName (name || `Animation${this .animations}`), groupNode); + scene .addNamedNode (scene .getUniqueName (`Timer${this .animations}`), timeSensorNode); + scene .addExportedNode (scene .getUniqueExportName (name || `Animation${this .animations}`), groupNode); + scene .addExportedNode (scene .getUniqueExportName (`Timer${this .animations}`), timeSensorNode); + + timeSensorNode ._description = this .description (animation .name) || `Animation ${this .animations}`; + groupNode ._children .push (timeSensorNode, ... channelNodes); + + timeSensorNode .setup (); + groupNode .setup (); + + return groupNode; + }, + animationChannelsArray (channels, samplers, timeSensorNode) + { + if (!(channels instanceof Array)) + return [ ]; + + if (!(samplers instanceof Array)) + return [ ]; + + const cycleInterval = samplers + .map (sampler => this .accessors [sampler .input]) + .filter (input => input ?.array .length) + .reduce ((value, input) => Math .max (value, input .array .at (-1)), 0); + + timeSensorNode ._cycleInterval = cycleInterval; + + return channels + .flatMap (channel => this .animationChannelObject (channel, samplers, timeSensorNode)); + }, + animationChannelObject (channel, samplers, timeSensorNode) + { + if (!(channel instanceof Object)) + return [ ]; + + const target = channel .target; + + if (!(target instanceof Object)) + return [ ]; + + const node = this .nodes [target .node] ?.transformNode; + + if (!node) + return [ ]; + + const sampler = samplers [channel .sampler]; + + if (!sampler) + return [ ]; + + const input = this .accessors [sampler .input]; + + if (!input) + return [ ]; + + if (!input .array .length) + return [ ]; + + const output = this .accessors [sampler .output]; + + if (!output) + return [ ]; + + if (!output .array .length) + return [ ]; + + return this .createInterpolator (timeSensorNode, node, target, sampler .interpolation, input .array, output .array, timeSensorNode ._cycleInterval .getValue ()); + }, + createNavigationInfo () + { + const + scene = this .getExecutionContext (), + navigationInfoNode = scene .createNode ("NavigationInfo", false); + + navigationInfoNode ._headlight = false; + + navigationInfoNode .setup (); + + return navigationInfoNode; + }, + createShape (primitive, weights, skin) + { + const + scene = this .getExecutionContext (), + shapeNode = scene .createNode ("Shape", false), + appearanceNode = this .materialObject (primitive), + geometryNode = this .createGeometry (primitive, weights, skin); + + shapeNode ._appearance = appearanceNode; + shapeNode ._geometry = geometryNode; + + shapeNode .setup (); + + return shapeNode; + }, + getDefaultAppearance (mode) + { + mode = mode > 3; + + if (this .defaultAppearance [mode]) + return this .defaultAppearance [mode]; + + const + scene = this .getExecutionContext (), + appearanceNode = scene .createNode ("Appearance", false), + materialNode = scene .createNode (mode ? "PhysicalMaterial" : "UnlitMaterial", false); + + appearanceNode ._alphaMode = "OPAQUE"; + appearanceNode ._material = materialNode; + + materialNode .setup (); + appearanceNode .setup (); + + return this .defaultAppearance [mode] = appearanceNode; + }, + createMultiTextureTransform (materialNode) + { + if (!+materialNode .getTextureBits ()) + return null; + + const textureTransformNodes = this .textureTransformNodes + .sort ((a, b) => Math_Algorithm .cmp (a ._mapping .getValue (), b ._mapping .getValue ())); + + switch (textureTransformNodes .length) + { + case 0: + { + if (this .textureTransformNode) + return this .textureTransformNode; + + const + scene = this .getExecutionContext (), + textureTransformNode = scene .createNode ("TextureTransform", false); + + textureTransformNode ._translation .y = -1; + textureTransformNode ._scale .y = -1; + + textureTransformNode .setup (); + + return this .textureTransformNode = textureTransformNode; + } + case 1: + { + return textureTransformNodes [0]; + } + default: + { + const + scene = this .getExecutionContext (), + textureTransformNode = scene .createNode ("MultiTextureTransform", false); + + textureTransformNode ._textureTransform = textureTransformNodes; + + textureTransformNode .setup (); + + return textureTransformNode; + } + } + }, + createGeometry (primitive, weights, skin) + { + switch (primitive .mode) + { + case 0: // POINTS + { + return this .createPointSet (primitive, weights, skin); + } + case 1: // LINES + { + if (primitive .indices) + return this .createIndexedLineSet (primitive, weights, skin, 1); + + return this .createLineSet (primitive, weights, skin); + } + case 2: // LINE_LOOP + { + return this .createIndexedLineSet (primitive, weights, skin, 2); + } + case 3: // LINE_STRIP + { + return this .createIndexedLineSet (primitive, weights, skin, 3); + } + default: + case 4: // TRIANGLES + { + if (primitive .indices) + return this .createIndexedTriangleSet (primitive, weights, skin); + + return this .createTriangleSet (primitive, weights, skin); + } + case 5: // TRIANGLE_STRIP + { + if (primitive .indices) + return this .createIndexedTriangleStripSet (primitive, weights, skin); + + return this .createTriangleStripSet (primitive, weights, skin); + } + case 6: // TRIANGLE_FAN + { + if (primitive .indices) + return this .createIndexedTriangleFanSet (primitive, weights, skin); + + return this .createTriangleFanSet (primitive, weights, skin); + } + } + }, + createPointSet ({ attributes, material, targets }, weights, skin) + { + const + scene = this .getExecutionContext (), + geometryNode = scene .createNode ("PointSet", false); + + geometryNode ._color = this .createColor (attributes .COLOR [0], material); + geometryNode ._normal = this .createNormal (attributes .NORMAL, targets, weights); + geometryNode ._coord = this .createCoordinate (attributes .POSITION, targets, weights); + + this .attributesJointsArray (skin, attributes .JOINTS, attributes .WEIGHTS); + this .skinGeometry (skin, geometryNode); + + geometryNode .setup (); + + return geometryNode; + }, + createIndexedLineSet ({ attributes, indices, material, targets }, weights, skin, mode) + { + const + scene = this .getExecutionContext (), + geometryNode = scene .createNode ("IndexedLineSet", false); + + geometryNode ._color = this .createColor (attributes .COLOR [0], material); + geometryNode ._normal = this .createNormal (attributes .NORMAL, targets, weights); + geometryNode ._coord = this .createCoordinate (attributes .POSITION, targets, weights); + + switch (mode) + { + case 1: // LINES + { + const + coordIndex = geometryNode ._coordIndex, + array = indices .array, + length = array .length; + + for (let i = 0; i < length; i += 2) + coordIndex .push (array [i], array [i + 1], -1); + + break; + } + case 2: // LINE_LOOP + { + const coordIndex = geometryNode ._coordIndex; + + if (indices) + { + for (const i of indices .array) + coordIndex .push (i); + + if (coordIndex .length) + coordIndex .push (coordIndex [0], -1); + } + else + { + const coord = geometryNode ._coord; + + if (coord ?.point .length) + { + for (const i of coord .point .keys ()) + coordIndex .push (i); + + coordIndex .push (0, -1); + } + } + + break; + } + case 3: // LINE_STRIP + { + const coordIndex = geometryNode ._coordIndex; + + if (indices) + { + for (const i of indices .array) + coordIndex .push (i); + + if (coordIndex .length) + coordIndex .push (-1); + } + else + { + const coord = geometryNode ._coord; + + if (coord ?.point .length) + { + for (const i of coord .point .keys ()) + coordIndex .push (i); + + coordIndex .push (-1); + } + } + + break; + } + } + + this .attributesJointsArray (skin, attributes .JOINTS, attributes .WEIGHTS); + this .skinGeometry (skin, geometryNode); + + geometryNode .setup (); + + return geometryNode; + }, + createLineSet ({ attributes, material, targets }, weights, skin) + { + const + scene = this .getExecutionContext (), + geometryNode = scene .createNode ("LineSet", false); + + geometryNode ._color = this .createColor (attributes .COLOR [0], material); + geometryNode ._normal = this .createNormal (attributes .NORMAL, targets, weights); + geometryNode ._coord = this .createCoordinate (attributes .POSITION, targets, weights); + + this .attributesJointsArray (skin, attributes .JOINTS, attributes .WEIGHTS); + this .skinGeometry (skin, geometryNode); + + geometryNode .setup (); + + return geometryNode; + }, + createIndexedTriangleSet ({ attributes, indices, material, targets }, weights, skin) + { + const + scene = this .getExecutionContext (), + geometryNode = scene .createNode ("IndexedTriangleSet", false); + + geometryNode ._solid = !material ?.doubleSided; + geometryNode ._index = indices .array; + geometryNode ._color = this .createColor (attributes .COLOR [0], material); + geometryNode ._texCoord = this .createMultiTextureCoordinate (attributes .TEXCOORD, material); + geometryNode ._normal = this .createNormal (attributes .NORMAL, targets, weights); + geometryNode ._coord = this .createCoordinate (attributes .POSITION, targets, weights); + geometryNode ._normalPerVertex = !! geometryNode ._normal .getValue (); + + this .attributesJointsArray (skin, attributes .JOINTS, attributes .WEIGHTS); + this .skinGeometry (skin, geometryNode); + + geometryNode .setup (); + + return geometryNode; + }, + createTriangleSet ({ attributes, material, targets }, weights, skin) + { + const + scene = this .getExecutionContext (), + geometryNode = scene .createNode ("TriangleSet", false); + + geometryNode ._solid = !material ?.doubleSided; + geometryNode ._color = this .createColor (attributes .COLOR [0], material); + geometryNode ._texCoord = this .createMultiTextureCoordinate (attributes .TEXCOORD, material); + geometryNode ._normal = this .createNormal (attributes .NORMAL, targets, weights); + geometryNode ._coord = this .createCoordinate (attributes .POSITION, targets, weights); + geometryNode ._normalPerVertex = !! geometryNode ._normal .getValue (); + + this .attributesJointsArray (skin, attributes .JOINTS, attributes .WEIGHTS); + this .skinGeometry (skin, geometryNode); + + geometryNode .setup (); + + return geometryNode; + }, + createIndexedTriangleStripSet ({ attributes, indices, material, targets }, weights, skin) + { + const + scene = this .getExecutionContext (), + geometryNode = scene .createNode ("IndexedTriangleStripSet", false); + + geometryNode ._solid = !material ?.doubleSided; + geometryNode ._index = indices .array; + geometryNode ._color = this .createColor (attributes .COLOR [0], material); + geometryNode ._texCoord = this .createMultiTextureCoordinate (attributes .TEXCOORD, material); + geometryNode ._normal = this .createNormal (attributes .NORMAL, targets, weights); + geometryNode ._coord = this .createCoordinate (attributes .POSITION, targets, weights); + geometryNode ._normalPerVertex = !! geometryNode ._normal .getValue (); + + this .attributesJointsArray (skin, attributes .JOINTS, attributes .WEIGHTS); + this .skinGeometry (skin, geometryNode); + + geometryNode .setup (); + + return geometryNode; + }, + createTriangleStripSet ({ attributes, material, targets }, weights, skin) + { + const + scene = this .getExecutionContext (), + geometryNode = scene .createNode ("TriangleStripSet", false); + + geometryNode ._solid = !material ?.doubleSided; + geometryNode ._color = this .createColor (attributes .COLOR [0], material); + geometryNode ._texCoord = this .createMultiTextureCoordinate (attributes .TEXCOORD, material); + geometryNode ._normal = this .createNormal (attributes .NORMAL, targets, weights); + geometryNode ._coord = this .createCoordinate (attributes .POSITION, targets, weights); + geometryNode ._normalPerVertex = !! geometryNode ._normal .getValue (); + + const coord = geometryNode ._coord; + + if (coord) + { + if (coord .point .length) + geometryNode ._stripCount = [coord .point .length]; + } + + this .attributesJointsArray (skin, attributes .JOINTS, attributes .WEIGHTS); + this .skinGeometry (skin, geometryNode); + + geometryNode .setup (); + + return geometryNode; + }, + createIndexedTriangleFanSet ({ attributes, indices, material, targets }, weights, skin) + { + const + scene = this .getExecutionContext (), + geometryNode = scene .createNode ("IndexedTriangleFanSet", false); + + geometryNode ._solid = !material ?.doubleSided; + geometryNode ._index = indices .array; + geometryNode ._color = this .createColor (attributes .COLOR [0], material); + geometryNode ._texCoord = this .createMultiTextureCoordinate (attributes .TEXCOORD, material); + geometryNode ._normal = this .createNormal (attributes .NORMAL, targets, weights); + geometryNode ._coord = this .createCoordinate (attributes .POSITION, targets, weights); + geometryNode ._normalPerVertex = !! geometryNode ._normal .getValue (); + + this .attributesJointsArray (skin, attributes .JOINTS, attributes .WEIGHTS); + this .skinGeometry (skin, geometryNode); + + geometryNode .setup (); + + return geometryNode; + }, + createTriangleFanSet ({ attributes, material, targets }, weights, skin) + { + const + scene = this .getExecutionContext (), + geometryNode = scene .createNode ("TriangleFanSet", false); + + geometryNode ._solid = !material ?.doubleSided; + geometryNode ._color = this .createColor (attributes .COLOR [0], material); + geometryNode ._texCoord = this .createMultiTextureCoordinate (attributes .TEXCOORD, material); + geometryNode ._normal = this .createNormal (attributes .NORMAL, targets, weights); + geometryNode ._coord = this .createCoordinate (attributes .POSITION, targets, weights); + geometryNode ._normalPerVertex = !! geometryNode ._normal .getValue (); + + const coord = geometryNode ._coord; + + if (coord) + { + if (coord .point .length) + geometryNode ._fanCount = [coord .point .length]; + } + + this .attributesJointsArray (skin, attributes .JOINTS, attributes .WEIGHTS); + this .skinGeometry (skin, geometryNode); + + geometryNode .setup (); + + return geometryNode; + }, + createColor: (() => + { + const TypeNames = new Map ([ + ["VEC3", "Color"], + ["VEC4", "ColorRGBA"], + ]); + + return function (color, material) + { + if (!(color instanceof Object)) + return null; + + const typeName = TypeNames .get (color .type); + + if (!typeName) + return null; + + if (color .colorNode) + return color .colorNode; + + const + scene = this .getExecutionContext (), + appearanceNode = this .materialObject ({ material }), + opaque = appearanceNode ._alphaMode .getValue () === "OPAQUE", + colorNode = scene .createNode (opaque ? "Color" : typeName, false); + + const array = opaque && typeName !== "Color" + ? color .array .filter ((_, i) => (i + 1) % 4) + : color .array; + + switch (color .componentType) + { + case 5120: // Int8Array + case 5122: // Int16Array + case 5124: // Int32Array + break; + case 5121: // Uint8Array + colorNode ._color = array .map (v => v / 0xff); + break; + case 5123: // Uint16Array + colorNode ._color = array .map (v => v / 0xffff); + break; + case 5125: // Uint32Array + colorNode ._color = array .map (v => v / 0xffffffff); + break; + case 5126: // Float32Array + colorNode ._color = array; + break; + } + + colorNode .setup (); + + return color .colorNode = colorNode; + }; + })(), + createMultiTextureCoordinate (texCoords, material) + { + const appearanceNode = this .materialObject ({ material }); + + if (!+appearanceNode ._material .getValue () .getTextureBits ()) + return null; + + if (texCoords .textureCoordinateNode) + return texCoords .textureCoordinateNode; + + switch (material .texCoordMappings .size) + { + case 0: + { + return null; + } + case 1: + { + return texCoords .textureCoordinateNode = [... material .texCoordMappings .entries ()] + .map (([mapping, i]) => this .createTextureCoordinate (texCoords [i], mapping)) [0]; + } + default: + { + const textureCoordinateNodes = [... material .texCoordMappings .entries ()] + .map (([mapping, i]) => this .createTextureCoordinate (texCoords [i], mapping)) + .filter (node => node) + .sort ((a, b) => Math_Algorithm .cmp (a ._mapping .getValue (), b ._mapping .getValue ())); + + if (!textureCoordinateNodes .length) + return null; + + const + scene = this .getExecutionContext (), + textureCoordinateNode = scene .createNode ("MultiTextureCoordinate", false); + + textureCoordinateNode ._texCoord = textureCoordinateNodes; + + textureCoordinateNode .setup (); + + return texCoords .textureCoordinateNode = textureCoordinateNode; + } + } + }, + createTextureCoordinate (texCoord, mapping) + { + if (texCoord ?.type !== "VEC2") + return null; + + if (texCoord [mapping]) + return texCoord [mapping]; + + const + scene = this .getExecutionContext (), + textureCoordinateNode = scene .createNode ("TextureCoordinate", false); + + textureCoordinateNode ._mapping = mapping; + textureCoordinateNode ._point = texCoord .array; + + textureCoordinateNode .setup (); + + return texCoord [mapping] = textureCoordinateNode; + }, + createNormal (normal, targets, weights) + { + if (normal ?.type !== "VEC3") + return null; + + if (normal .normalNode) + return normal .normalNode; + + const + scene = this .getExecutionContext (), + normalNode = scene .createNode ("Normal", false); + + normalNode ._vector = normal .array; + + if ((targets instanceof Array) && (weights instanceof Array)) + { + normal .field = normalNode ._vector .copy (); + + const vectors = this .applyMorphTargets (normalNode ._vector, targets, "NORMAL", weights); + + normalNode ._vector .length = 0; + + for (const vector of vectors) + normalNode ._vector .push (vector); + } + else + { + normal .field = normalNode ._vector; + } + + normalNode .setup (); + + return normal .normalNode = normalNode; + }, + createCoordinate (position, targets, weights) + { + if (position ?.type !== "VEC3") + return null; + + if (position .coordinateNode) + return position .coordinateNode; + + const + scene = this .getExecutionContext (), + coordinateNode = scene .createNode ("Coordinate", false); + + coordinateNode ._point = position .array; + + if ((targets instanceof Array) && (weights instanceof Array)) + { + position .field = coordinateNode ._point .copy (); + + const points = this .applyMorphTargets (coordinateNode ._point, targets, "POSITION", weights); + + coordinateNode ._point .length = 0; + + for (const point of points) + coordinateNode ._point .push (point); + } + else + { + position .field = coordinateNode ._point; + } + + coordinateNode .setup (); + + return position .coordinateNode = coordinateNode; + }, + attributesJointsArray: function (skin, joints, weights) + { + if (!(skin instanceof Object)) + return; + + if (!(joints instanceof Array)) + return; + + if (!(weights instanceof Array)) + return; + + for (let i = 0, length = joints .length; i < length; ++ i) + this .attributesJointsObject (skin, joints [i], weights [i]); + }, + attributesJointsObject: function (skin, joints, weights) + { + if (joints ?.type !== "VEC4") + return; + + if (weights ?.type !== "VEC4") + return; + + const + start = skin .coordinateNode ._point .length, + jointsArray = joints .array, + weightsArray = weights .array, + numVertices = jointsArray .length / 4; + + for (let v = 0; v < numVertices; ++ v) + { + for (let i = 0; i < 4; ++ i) + { + const w = weightsArray [v * 4 + i]; + + if (w === 0) + continue; + + const + index = skin .joints [jointsArray [v * 4 + i]], + jointNode = this .nodes [index] ?.transformNode; + + if (!jointNode) + continue; + + jointNode ._skinCoordIndex .push (v + start); + jointNode ._skinCoordWeight .push (w); + } + } + }, + skinGeometry: function (skin, geometryNode) + { + if (!(skin instanceof Object)) + return; + + const + skinCoordinateNode = skin .coordinateNode, + start = skinCoordinateNode ._point .length, + textureCoordinateNode = geometryNode ._texCoord ?.getValue (), + normalNode = geometryNode ._normal ?.getValue (), + coordinateNode = geometryNode ._coord ?.getValue (); + + if (geometryNode ._coordIndex) + geometryNode ._coordIndex = geometryNode ._coordIndex .map (index => index < 0 ? -1 : index + start); + + if (geometryNode ._index) + geometryNode ._index = geometryNode ._index .map (index => index < 0 ? -1 : index + start); + + if (textureCoordinateNode) + { + switch (textureCoordinateNode .getTypeName ()) + { + case "TextureCoordinate": + { + const + skinTextureCoordinateNode = skin .textureCoordinateNode, + point = skinTextureCoordinateNode ._point; + + textureCoordinateNode ._point .forEach ((p, i) => point [i + start] = p); + geometryNode ._texCoord = skinTextureCoordinateNode; + + break; + } + case "MultiTextureCoordinate": + { + const skinMultiTextureCoordinateNode = skin .multiTextureCoordinateNode; + + for (const t of textureCoordinateNode ._texCoord) + { + let s = skinMultiTextureCoordinateNode ._texCoord .find (s => s .mapping === t .mapping) ?.getValue (); + + if (!s) + { + if (t .mapping === "TEXCOORD_0") + { + s = skin .textureCoordinateNode; + } + else + { + s = this .getScene () .createNode ("TextureCoordinate", false); + s ._mapping = t .mapping; + + s .setup (); + } + + skinMultiTextureCoordinateNode ._texCoord .push (s); + } + + const point = s ._point; + + t .point .forEach ((p, i) => point [i + start] = p); + } + + geometryNode ._texCoord = skinMultiTextureCoordinateNode; + break; + } + } + } + + if (normalNode) + { + const + skinNormalNode = skin .normalNode, + vector = skinNormalNode ._vector; + + normalNode ._vector .forEach ((v, i) => vector [i + start] = v); + geometryNode ._normal = skinNormalNode; + } + + if (coordinateNode) + { + const point = skinCoordinateNode ._point; + coordinateNode ._point .forEach ((p, i) => point [i + start] = p); + geometryNode ._coord = skinCoordinateNode; + } + }, + createInterpolator (timeSensorNode, node, target, interpolation, times, keyValues, cycleInterval) + { + const scene = this .getExecutionContext (); + + switch (target .path) + { + case "translation": + { + const interpolatorNode = this .createPositionInterpolator (interpolation, times, keyValues, cycleInterval); + + scene .addNamedNode (scene .getUniqueName ("TranslationInterpolator"), interpolatorNode); + + scene .addRoute (timeSensorNode, "fraction_changed", interpolatorNode, "set_fraction"); + scene .addRoute (interpolatorNode, "value_changed", node, "set_translation"); + + return interpolatorNode; + } + case "rotation": + { + const interpolatorNode = this .createOrientationInterpolator (interpolation, times, keyValues, cycleInterval); + + scene .addNamedNode (scene .getUniqueName ("RotationInterpolator"), interpolatorNode); + + scene .addRoute (timeSensorNode, "fraction_changed", interpolatorNode, "set_fraction"); + scene .addRoute (interpolatorNode, "value_changed", node, "set_rotation"); + + return interpolatorNode; + } + case "scale": + { + const interpolatorNode = this .createPositionInterpolator (interpolation, times, keyValues, cycleInterval); + + scene .addNamedNode (scene .getUniqueName ("ScaleInterpolator"), interpolatorNode); + + scene .addRoute (timeSensorNode, "fraction_changed", interpolatorNode, "set_fraction"); + scene .addRoute (interpolatorNode, "value_changed", node, "set_scale"); + + return interpolatorNode; + } + case "weights": + { + const + node = this .nodes [target .node], + mesh = this .meshes [node .mesh], + primitives = mesh ?.primitives, + interpolatorNodes = [ ]; + + if (!(primitives instanceof Array)) + return null; + + for (const { shapeNode, targets, attributes } of primitives) + { + const geometryNode = shapeNode ._geometry .getValue (); + + if (!geometryNode) + continue; + + const coordinateInterpolatorNode = this .createArrayInterpolator ("Coordinate", interpolation, times, keyValues, cycleInterval, targets, attributes, "POSITION"); + + if (coordinateInterpolatorNode) + { + interpolatorNodes .push (coordinateInterpolatorNode); + + scene .addRoute (timeSensorNode, "fraction_changed", coordinateInterpolatorNode, "set_fraction"); + scene .addRoute (coordinateInterpolatorNode, "value_changed", geometryNode ._coord, "set_point"); + } + + const normalInterpolatorNode = this .createArrayInterpolator ("Normal", interpolation, times, keyValues, cycleInterval, targets, attributes, "NORMAL"); + + if (normalInterpolatorNode) + { + interpolatorNodes .push (normalInterpolatorNode); + + scene .addRoute (timeSensorNode, "fraction_changed", normalInterpolatorNode, "set_fraction"); + scene .addRoute (normalInterpolatorNode, "value_changed", geometryNode ._normal, "set_vector"); + } + } + + return interpolatorNodes; + } + default: + { + return [ ]; + } + } + }, + createPositionInterpolator (interpolation, times, keyValues, cycleInterval) + { + const scene = this .getExecutionContext (); + + switch (interpolation) + { + case "STEP": + { + const interpolatorNode = scene .createNode ("PositionInterpolator", false); + + // Key + + interpolatorNode ._key .push (times [0] / cycleInterval); + + for (let i = 1, length = times .length; i < length; ++ i) + interpolatorNode ._key .push (times [i] / cycleInterval, times [i] / cycleInterval); + + // KeyValue + + interpolatorNode ._keyValue .push (new Numbers_Vector3 (keyValues [0], keyValues [1], keyValues [2])); + + for (let i = 0, length = keyValues .length - 3; i < length; i += 3) + { + interpolatorNode ._keyValue .push (new Numbers_Vector3 (keyValues [i + 0], keyValues [i + 1], keyValues [i + 2]), + new Numbers_Vector3 (keyValues [i + 3], keyValues [i + 4], keyValues [i + 5])); + } + + // Finish + + interpolatorNode .setup (); + + return interpolatorNode; + } + default: + case "LINEAR": + { + const interpolatorNode = scene .createNode ("PositionInterpolator", false); + + interpolatorNode ._key = times .map (t => t / cycleInterval); + interpolatorNode ._keyValue = keyValues; + + interpolatorNode .setup (); + + return interpolatorNode; + } + case "CUBICSPLINE": + { + const + interpolatorNode = scene .createNode ("PositionInterpolator", false), + vectors = [ ]; + + for (let i = 0, length = keyValues .length; i < length; i += 3) + { + vectors .push (new Numbers_Vector3 (keyValues [i + 0], + keyValues [i + 1], + keyValues [i + 2])); + } + + const samples = [... Array (Math .floor (times .at (-1) * SAMPLES_PER_SECOND)) .keys ()] + .map ((_, i, array) => i / (array .length - 1) * times .at (-1)); + + for (const t of samples) + { + interpolatorNode ._key .push (t / cycleInterval); + interpolatorNode ._keyValue .push (this .cubicSplineVector (t, times, vectors)); + } + + interpolatorNode .setup (); + + return interpolatorNode; + } + } + }, + createOrientationInterpolator (interpolation, times, keyValues, cycleInterval) + { + const scene = this .getExecutionContext (); + + switch (interpolation) + { + case "STEP": + { + const interpolatorNode = scene .createNode ("OrientationInterpolator", false); + + // Key + + interpolatorNode ._key .push (times [0] / cycleInterval); + + for (let i = 1, length = times .length; i < length; ++ i) + interpolatorNode ._key .push (times [i] / cycleInterval, times [i] / cycleInterval); + + // KeyValue + + interpolatorNode ._keyValue .push (new Numbers_Rotation4 (new Numbers_Quaternion (keyValues [0], + keyValues [1], + keyValues [2], + keyValues [3]))); + + for (let i = 0, length = keyValues .length - 4; i < length; i += 4) + { + interpolatorNode ._keyValue .push (new Numbers_Rotation4 (new Numbers_Quaternion (keyValues [i + 0], + keyValues [i + 1], + keyValues [i + 2], + keyValues [i + 3])), + new Numbers_Rotation4 (new Numbers_Quaternion (keyValues [i + 4], + keyValues [i + 5], + keyValues [i + 6], + keyValues [i + 7]))); + } + + // Finish + + interpolatorNode .setup (); + + return interpolatorNode; + } + default: + case "LINEAR": + { + const interpolatorNode = scene .createNode ("OrientationInterpolator", false); + + interpolatorNode ._key = times .map (t => t / cycleInterval); + + for (let i = 0, length = keyValues .length; i < length; i += 4) + { + interpolatorNode ._keyValue .push (new Numbers_Rotation4 (new Numbers_Quaternion (keyValues [i + 0], + keyValues [i + 1], + keyValues [i + 2], + keyValues [i + 3]))); + } + + interpolatorNode .setup (); + + return interpolatorNode; + } + case "CUBICSPLINE": + { + const + interpolatorNode = scene .createNode ("OrientationInterpolator", false), + quaternions = [ ]; + + for (let i = 0, length = keyValues .length; i < length; i += 4) + { + quaternions .push (new Numbers_Quaternion (keyValues [i + 0], + keyValues [i + 1], + keyValues [i + 2], + keyValues [i + 3])); + } + + const samples = [... Array (Math .floor (times .at (-1) * SAMPLES_PER_SECOND)) .keys ()] + .map ((_, i, array) => i / (array .length - 1) * times .at (-1)); + + for (const t of samples) + { + const q = this .cubicSplineVector (t, times, quaternions) .normalize (); + + interpolatorNode ._key .push (t / cycleInterval); + interpolatorNode ._keyValue .push (new Numbers_Rotation4 (q)); + } + + interpolatorNode .setup (); + + return interpolatorNode; + } + } + }, + createArrayInterpolator (Type, interpolation, times, weights, cycleInterval, targets, accessors, key) + { + const + scene = this .getExecutionContext (), + accessor = accessors [key]; + + if (!accessor) + return null; + + switch (interpolation) + { + case "STEP": + { + const interpolatorNode = scene .createNode (`${Type}Interpolator`, false); + + // Key + + interpolatorNode ._key .push (times [0] / cycleInterval); + + for (let i = 1, length = times .length; i < length; ++ i) + interpolatorNode ._key .push (times [i] / cycleInterval, times [i] / cycleInterval); + + // KeyValue + + const w = Array .from (targets .keys (), i => weights [i]); + + for (const value of this .applyMorphTargets (accessor .field, targets, key, w)) + interpolatorNode ._keyValue .push (value); + + for (let t = 1, length = times .length; t < length; ++ t) + { + const + w = Array .from (targets .keys (), i => weights [t * targets .length + i]), + values = this .applyMorphTargets (accessor .field, targets, key, w); + + for (const value of values) + interpolatorNode ._keyValue .push (value); + + for (const value of values) + interpolatorNode ._keyValue .push (value); + } + + // Finish + + interpolatorNode .setup (); + + return interpolatorNode; + } + default: + case "LINEAR": + { + const interpolatorNode = scene .createNode (`${Type}Interpolator`, false); + + // Key + + interpolatorNode ._key = times .map (t => t / cycleInterval); + + // KeyValue + + for (const t of times .keys ()) + { + const w = Array .from (targets .keys (), i => weights [t * targets .length + i]); + + for (const value of this .applyMorphTargets (accessor .field, targets, key, w)) + interpolatorNode ._keyValue .push (value); + } + + // Finish + + interpolatorNode .setup (); + + return interpolatorNode; + } + case "CUBICSPLINE": + { + const interpolatorNode = scene .createNode (`${Type}Interpolator`, false); + + // Key + + const samples = [... Array (Math .floor (times .at (-1) * SAMPLES_PER_SECOND)) .keys ()] + .map ((_, i, array) => i / (array .length - 1) * times .at (-1)); + + // KeyValue + + for (const t of samples) + { + interpolatorNode ._key .push (t / cycleInterval); + + const w = Array .from (targets .keys (), i => this .cubicSplineScalarArray (t, times, weights, targets .length, i)); + + for (const value of this .applyMorphTargets (accessor .field, targets, key, w)) + interpolatorNode ._keyValue .push (value); + } + + // Finish + + interpolatorNode .setup (); + + return interpolatorNode; + } + } + }, + applyMorphTargets: (function () + { + const value = new Numbers_Vector3 (0, 0, 0); + + return function (array, targets, key, weights) + { + const vectors = Array .from (array, v => v .getValue () .copy ()); + + for (const [i, target] of targets .entries ()) + { + const weight = weights [i]; + + if (!weight) + continue; + + const accessor = this .accessors [target [key]]; + + if (accessor ?.type !== "VEC3") + continue; + + const + array = accessor .array, + length = array .length; + + for (let a = 0, p = 0; a < length; a += 3, ++ p) + vectors [p] .add (value .set (array [a], array [a + 1], array [a + 2]) .multiply (weight)); + } + + return vectors; + }; + })(), + cubicSplineVector (time, times, values) + { + const + index1 = Math_Algorithm .clamp (Math_Algorithm .upperBound (times, 0, times .length, time), 1, times .length - 1), + index0 = index1 - 1, + td = times [index1] - times [index0], + t1 = (time - times [index0]) / td, + t2 = t1 * t1, + t3 = t2 * t1, + v0 = values [index0 * 3 + 1] .copy (), + b0 = values [index0 * 3 + 2] .copy (), + v1 = values [index1 * 3 + 1] .copy (), + a1 = values [index1 * 3 + 0] .copy (); + + v0 .multiply (2 * t3 - 3 * t2 + 1); + b0 .multiply (td * (t3 - 2 * t2 + t1)); + v1 .multiply (-2 * t3 + 3 * t2); + a1 .multiply (td * (t3 - t2)); + + return v0 .add (b0) .add (v1) .add (a1); + }, + cubicSplineScalarArray (time, times, values, length, i) + { + const + index1 = Math_Algorithm .clamp (Math_Algorithm .upperBound (times, 0, times .length, time), 1, times .length - 1), + index0 = index1 - 1, + td = times [index1] - times [index0], + t1 = (time - times [index0]) / td, + t2 = t1 * t1, + t3 = t2 * t1, + v0 = values [(index0 + 1) * length + i], + b0 = values [(index0 + 2) * length + i], + v1 = values [(index1 + 1) * length + i], + a1 = values [(index1 + 0) * length + i]; + + v0 *= 2 * t3 - 3 * t2 + 1; + b0 *= td * (t3 - 2 * t2 + t1); + v1 *= -2 * t3 + 3 * t2; + a1 *= td * (t3 - t2); + + return v0 + b0 + v1 + a1; + }, + vectorValue (array, vector) + { + if (!(array instanceof Array)) + return false; + + if (array .length !== vector .length) + return false; + + vector .set (... array); + + return true; + }, + numberValue (value, defaultValue) + { + if (typeof value !== "number") + return defaultValue; + + return value; + }, + stringValue (value, defaultValue) + { + if (typeof value !== "string") + return defaultValue; + + return value; + }, + description (string) + { + return string ?.replace (/_+/g, " ") .trim () ?? ""; + }, +}); + +const GLTF2Parser_default_ = GLTF2Parser; +; + +x_ite_Namespace .add ("GLTF2Parser", "x_ite/Parser/GLTF2Parser", GLTF2Parser_default_); +/* harmony default export */ const Parser_GLTF2Parser = (GLTF2Parser_default_); +;// CONCATENATED MODULE: ./src/x_ite/Parser/GLB2Parser.js +/* provided dependency */ var GLB2Parser_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function GLB2Parser (scene) +{ + Parser_X3DParser .call (this, scene); + + this .json = [ ]; + this .buffers = [ ]; +} + +Object .assign (Object .setPrototypeOf (GLB2Parser .prototype, Parser_X3DParser .prototype), +{ + getEncoding () + { + return "ARRAY_BUFFER"; + }, + setInput (input) + { + this .arrayBuffer = input; + this .dataView = new DataView (input); + }, + isValid () + { + if (!(this .arrayBuffer instanceof ArrayBuffer)) + return false; + + if (this .dataView .byteLength < 12) + return false; + + if (this .dataView .getUint32 (0, true) !== 0x46546C67) + return false; + + if (this .dataView .getUint32 (4, true) !== 2) + return false; + + if (this .dataView .getUint32 (8, true) !== this .dataView .byteLength) + return false; + + return true; + }, + parseIntoScene (resolve, reject) + { + this .glb () + .then (resolve) + .catch (reject); + }, + glb: async function () + { + this .chunks (); + + const parser = new Parser_GLTF2Parser (this .getScene ()); + + parser .setBuffers (this .buffers); + + for (const json of this .json) + { + parser .setInput (json); + + if (!parser .isValid ()) + continue; + + await parser .rootObject (parser .input); + } + + return this .getScene (); + }, + chunks () + { + for (let i = 12; i < this .dataView .byteLength;) + { + const + length = this .dataView .getUint32 (i, true), + type = this .dataView .getUint32 (i + 4, true); + + i += 8; + + switch (type) + { + case 0x4e4f534a: // Structured JSON content + { + this .json .push (GLB2Parser_$.decodeText (this .arrayBuffer .slice (i, i + length))); + break; + } + case 0x004e4942: // Binary buffer + { + this .buffers .push (this .arrayBuffer .slice (i, i + length)); + break; + } + } + + i += length; + } + + return this .getScene (); + }, +}); + +const GLB2Parser_default_ = GLB2Parser; +; + +x_ite_Namespace .add ("GLB2Parser", "x_ite/Parser/GLB2Parser", GLB2Parser_default_); +/* harmony default export */ const Parser_GLB2Parser = (GLB2Parser_default_); +;// CONCATENATED MODULE: ./src/x_ite/Parser/OBJParser.js +/* provided dependency */ var OBJParser_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +// http://paulbourke.net/dataformats/obj/ +// https://people.sc.fsu.edu/~jburkardt/data/obj/obj.html + +/* + * Grammar + */ + +// Lexical elements +const OBJParser_Grammar = Parser_Expressions ({ + // General + whitespaces: /[\x20\n\t\r]+/gy, + whitespacesNoLineTerminator: /[\x20\t]+/gy, + comment: /#.*?(?=[\n\r])/gy, + untilEndOfLine: /([^\r\n]+)/gy, + + // Keywords + mtllib: /\bmtllib\b/gy, + usemtl: /\busemtl\b/gy, + newmtl: /\bnewmtl\b/gy, + Ka: /\bKa\b/gy, + Kd: /\bKd\b/gy, + Ks: /\bKs\b/gy, + Ns: /\bNs\b/gy, + d: /\bd\b/gy, + Tr: /\bTr\b/gy, + illum: /\billum\b/gy, + map_Kd: /\bmap_Kd\b/gy, + o: /\bo\b/gy, + v: /\bv\b/gy, + vt: /\bvt\b/gy, + vn: /\bvn\b/gy, + g: /\bg\b/gy, + s: /\bs\b/gy, + off: /\boff\b/gy, + f: /\bf\b/gy, + slash: /\//gy, + + // Values + int32: /((?:0[xX][\da-fA-F]+)|(?:[+-]?\d+))/gy, + double: /([+-]?(?:(?:(?:\d*\.\d+)|(?:\d+(?:\.)?))(?:[eE][+-]?\d+)?))/gy, + constants: /([+-])((?:NAN|INF|INFINITY))/igy, +}); + +/* + * Parser + */ + +function OBJParser (scene) +{ + Parser_X3DParser .call (this, scene); + Parser_X3DOptimizer .call (this); + + // Optimizer + + this .removeGroups = true; + this .removeEmptyGroups = true; + this .combineGroupingNodes = false; + + // Globals + + this .smoothingGroup = 0; + this .smoothingGroups = new Map (); + this .groups = new Map (); + this .materials = new Map (); + this .textures = new Map (); + this .point2 = new Numbers_Vector2 (); + this .point3 = new Numbers_Vector3 (); + this .lastIndex = 0; +} + +Object .assign (Object .setPrototypeOf (OBJParser .prototype, Parser_X3DParser .prototype), + Parser_X3DOptimizer .prototype, +{ + CONSTANTS: new Map ([ + ["NAN", NaN], + ["INF", Infinity], + ["INFINITY", Infinity], + ]), + getEncoding () + { + return "STRING"; + }, + setInput (string) + { + this .input = string; + }, + isValid () + { + if (!(typeof this .input === "string")) + return false; + + return !! this .input .match (/^(?:[\x20\n\t\r]+|#.*?[\r\n])*\b(?:mtllib|usemtl|o|g|s|vt|vn|v|f)\b/); + }, + parseIntoScene (resolve, reject) + { + this .obj () + .then (resolve) + .catch (reject); + }, + obj: async function () + { + // Set profile and components. + + const + browser = this .getBrowser (), + scene = this .getScene (); + + scene .setEncoding ("OBJ"); + scene .setProfile (browser .getProfile ("Interchange")); + + await this .loadComponents (); + + // Init nodes. + + this .object = scene .createNode ("Transform"); + this .group = scene .createNode ("Group"); + this .defaultMaterial = scene .createNode ("Material"); + this .texCoord = scene .createNode ("TextureCoordinate"); + this .normal = scene .createNode ("Normal"); + this .coord = scene .createNode ("Coordinate"); + + this .object .children .push (this .group); + + scene .getRootNodes () .push (this .object); + + // Parse scene. + + await this .statements (); + + this .optimizeSceneGraph (scene .getRootNodes ()); + + return this .getScene (); + }, + comments () + { + while (this .comment ()) + ; + }, + comment () + { + this .whitespaces (); + + if (OBJParser_Grammar .comment .parse (this)) + return true; + + return false; + }, + whitespaces () + { + OBJParser_Grammar .whitespaces .parse (this); + }, + whitespacesNoLineTerminator () + { + OBJParser_Grammar .whitespacesNoLineTerminator .parse (this); + }, + statements: async function () + { + while (await this .statement ()) + ; + }, + statement: async function () + { + if (await this .mtllibs ()) + return true; + + if (this .usemtl ()) + return true; + + if (this .o ()) + return true; + + if (this .g ()) + return true; + + if (this .s ()) + return true; + + if (this .vts ()) + return true; + + if (this .vns ()) + return true; + + if (this .vs ()) + return true; + + if (this .fs ()) + return true; + + // Skip empty and unknown lines. + + if (OBJParser_Grammar .untilEndOfLine .parse (this)) + return true; + + return false; + }, + mtllibs: async function () + { + this .comments (); + + if (OBJParser_Grammar .mtllib .parse (this)) + { + this .whitespacesNoLineTerminator (); + + if (OBJParser_Grammar .untilEndOfLine .parse (this)) + { + const mtllibs = this .result [1] .trim () .split (/\s+/); + + await Promise .all (mtllibs .map (path => this .mtllib (path))); + } + + return true; + } + + return false; + }, + mtllib: async function (path) + { + try + { + const + scene = this .getExecutionContext (), + url = new URL (path, scene .getBaseURL ()), + response = await fetch (url), + arrayBuffer = await response .arrayBuffer (), + input = OBJParser_$.decodeText (OBJParser_$.ungzip (arrayBuffer)), + parser = new MaterialParser (scene, input); + + parser .parse (); + + for (const [id, material] of parser .materials) + { + const name = this .sanitizeName (id); + + if (name) + { + scene .addNamedNode (scene .getUniqueName (name), material); + scene .addExportedNode (scene .getUniqueExportName (name), material); + } + + this .materials .set (id, material); + } + + for (const [id, texture] of parser .textures) + { + const name = this .sanitizeName (id); + + if (name) + { + scene .addNamedNode (scene .getUniqueName (name), texture); + scene .addExportedNode (scene .getUniqueExportName (name), texture); + } + + this .textures .set (id, texture); + } + } + catch (error) + { + console .warn (error); + } + }, + usemtl () + { + this .comments (); + + if (OBJParser_Grammar .usemtl .parse (this)) + { + this .whitespacesNoLineTerminator (); + + if (OBJParser_Grammar .untilEndOfLine .parse (this)) + { + const id = this .result [1]; + + this .material = this .materials .get (id) || this .defaultMaterial; + this .texture = this .textures .get (id); + + const smoothingGroup = this .smoothingGroups .get (this .group .getNodeName ()); + + if (smoothingGroup) + smoothingGroup .delete (this .smoothingGroup); + } + + return true; + } + + return false; + }, + o () + { + this .comments (); + + if (OBJParser_Grammar .o .parse (this)) + { + this .whitespacesNoLineTerminator (); + + if (OBJParser_Grammar .untilEndOfLine .parse (this)) + { + const + scene = this .getExecutionContext (), + name = this .sanitizeName (this .result [1]); + + if (this .group .children .length) + { + this .object = scene .createNode("Transform"); + this .group = scene .createNode ("Group"); + + this .object .children .push (this .group); + scene .getRootNodes () .push (this .object); + } + + if (name) + { + scene .addNamedNode (scene .getUniqueName (name), this .object); + scene .addExportedNode (scene .getUniqueExportName (name), this .object); + } + } + + return true; + } + + return false; + }, + g () + { + this .comments (); + + if (OBJParser_Grammar .g .parse (this)) + { + this .whitespacesNoLineTerminator (); + + if (OBJParser_Grammar .untilEndOfLine .parse (this)) + { + const + scene = this .getExecutionContext (), + id = this .result [1], + name = this .sanitizeName (id), + group = this .groups .get (id); + + if (group) + { + this .group = group; + } + else + { + if (this .group .children .length) + { + this .group = scene .createNode ("Group"); + + this .object .children .push (this .group); + } + } + + this .groups .set (id, this .group); + + if (name) + { + scene .addNamedNode (scene .getUniqueName (name), this .group); + scene .addExportedNode (scene .getUniqueExportName (name), this .group); + } + + this .smoothingGroup = 0; + } + + return true; + } + + return false; + }, + s () + { + this .comments (); + + if (OBJParser_Grammar .s .parse (this)) + { + this .whitespacesNoLineTerminator (); + + if (OBJParser_Grammar .off .parse (this)) + { + this .smoothingGroup = 0; + return true; + } + + if (this .int32 ()) + { + this .smoothingGroup = this .value; + return true; + } + + return true; + } + + return false; + }, + vts () + { + const point = this .texCoord .point; + + let result = false; + + while (this .vt (point)) + result = true; + + return result; + }, + vt (point) + { + this .comments (); + + if (OBJParser_Grammar .vt .parse (this)) + { + if (this .vec2 ()) + { + point .push (this .point2); + + return true; + } + + throw new Error ("Expected a texture coordinate."); + } + + return false; + }, + vns () + { + const vector = this .normal .vector; + + let result = false; + + while (this .vn (vector)) + result = true; + + return result; + }, + vn (vector) + { + this .comments (); + + if (OBJParser_Grammar .vn .parse (this)) + { + if (this .vec3 ()) + { + vector .push (this .point3); + + return true; + } + + throw new Error ("Expected a normal vector."); + } + + return false; + }, + vs () + { + const point = this .coord .point; + + let result = false; + + while (this .v (point)) + result = true; + + return result; + }, + v (point) + { + this .comments (); + + if (OBJParser_Grammar .v .parse (this)) + { + if (this .vec3 ()) + { + point .push (this .point3); + + return true; + } + + throw new Error ("Expected a vertex coordinate."); + } + + return false; + }, + fs () + { + this .comments (); + + if (OBJParser_Grammar .f .lookahead (this)) + { + try + { + this .shape = this .smoothingGroups .get (this .group .getNodeName ()) .get (this .smoothingGroup); + this .geometry = this .shape .geometry; + } + catch + { + const + scene = this .getExecutionContext (), + appearance = scene .createNode ("Appearance"); + + this .geometry = scene .createNode ("IndexedFaceSet"); + this .shape = scene .createNode ("Shape"); + + appearance .material = this .material; + appearance .texture = this .texture; + this .geometry .creaseAngle = this .smoothingGroup ? Math .PI : 0; + this .shape .appearance = appearance; + this .shape .geometry = this .geometry; + + this .group .children .push (this .shape); + + if (!this .smoothingGroups .has (this .group .getNodeName ())) + this .smoothingGroups .set (this .group .getNodeName (), new Map ()); + + this .smoothingGroups .get (this .group .getNodeName ()) .set (this .smoothingGroup, this .shape); + } + + while (this .f ()) + ; + + if (this .geometry .texCoordIndex .length) + this .geometry .texCoord = this .texCoord; + + if (this .geometry .normalIndex .length) + this .geometry .normal = this .normal; + + this .geometry .coord = this .coord; + + return true; + } + + return false; + }, + f () + { + this .comments (); + + if (OBJParser_Grammar .f .parse (this)) + { + const + geometry = this .geometry, + texCoordIndex = geometry .texCoordIndex, + normalIndex = geometry .normalIndex, + coordIndex = geometry .coordIndex, + numTexCoordIndices = texCoordIndex .length, + numNormalIndices = normalIndex .length, + numTexCoords = this .texCoord .point .length, + numNormals = this .normal .vector .length, + numCoords = this .coord .point .length; + + while (this .indices (texCoordIndex, normalIndex, coordIndex, numTexCoords, numNormals, numCoords)) + ; + + if (texCoordIndex .length !== numTexCoordIndices) + texCoordIndex .push (-1); + + if (normalIndex .length !== numNormalIndices) + normalIndex .push (-1); + + coordIndex .push (-1); + + return true; + } + + return false; + }, + indices (texCoordIndex, normalIndex, coordIndex, numTexCoords, numNormals, numCoords) + { + if (this .int32 ()) + { + coordIndex .push (this .index (this .value, numCoords)); + + if (OBJParser_Grammar .slash .parse (this)) + { + if (this .int32 ()) + { + texCoordIndex .push (this .index (this .value, numTexCoords)); + } + + if (OBJParser_Grammar .slash .parse (this)) + { + if (this .int32 ()) + { + normalIndex .push (this .index (this .value, numNormals)); + } + } + } + + return true; + } + + return false; + }, + index (index, length) + { + if (index === 0) + throw new Error ("Invalid index."); + + if (index < 0) + return length + index; + + return index - 1; + }, + int32 () + { + this .whitespaces (); + + if (OBJParser_Grammar .int32 .parse (this)) + { + this .value = parseInt (this .result [1]); + + return true; + } + + return false; + }, + double () + { + this .whitespaces (); + + if (OBJParser_Grammar .double .parse (this)) + { + this .value = parseFloat (this .result [1]); + + return true; + } + + if (OBJParser_Grammar .constants .parse (this)) + { + this .value = this .CONSTANTS .get (this .result [2] .toUpperCase ()); + + if (this .result [1] === "-") + this .value = - this .value; + + return true; + } + + return false; + }, + vec2 () + { + if (this .double ()) + { + this .point2 .x = this .value; + + if (this .double ()) + { + this .point2 .y = this .value; + + return true; + } + } + + return false; + }, + vec3 () + { + if (this .double ()) + { + this .point3 .x = this .value; + + if (this .double ()) + { + this .point3 .y = this .value; + + if (this .double ()) + { + this .point3 .z = this .value; + + return true; + } + } + } + + return false; + }, +}); + +function MaterialParser (scene, input) +{ + this .executionContext = scene; + this .input = input; + this .material = scene .createNode ("Material"); + this .materials = new Map (); + this .textures = new Map (); + this .color3 = new Numbers_Color3 (0, 0, 0); + this .id = ""; +} + +Object .assign (MaterialParser .prototype, +{ + CONSTANTS: new Map ([ + ["NAN", NaN], + ["INF", Infinity], + ["INFINITY", Infinity], + ]), + parse () + { + try + { + this .statements (); + } + catch (error) + { + if (DEVELOPMENT) + console .log (error); + } + }, + comments () + { + while (this .comment ()) + ; + }, + comment () + { + this .whitespaces (); + + if (OBJParser_Grammar .comment .parse (this)) + return true; + + return false; + }, + whitespaces () + { + OBJParser_Grammar .whitespaces .parse (this); + }, + whitespacesNoLineTerminator () + { + OBJParser_Grammar .whitespacesNoLineTerminator .parse (this); + }, + statements () + { + while (this .statement ()) + ; + }, + statement () + { + if (this .newmtl ()) + return true; + + if (this .Ka ()) + return true; + + if (this .Kd ()) + return true; + + if (this .Ks ()) + return true; + + if (this .Ns ()) + return true; + + if (this .d ()) + return true; + + if (this .Tr ()) + return true; + + if (this .illum ()) + return true; + + if (this .map_Kd ()) + return true; + + // Skip empty and unknown lines. + + if (OBJParser_Grammar .untilEndOfLine .parse (this)) + return true; + + return false; + }, + newmtl () + { + this .comments (); + + if (OBJParser_Grammar .newmtl .parse (this)) + { + this .whitespacesNoLineTerminator (); + + this .id = ""; + + if (OBJParser_Grammar .untilEndOfLine .parse (this)) + { + this .id = this .result [1]; + + this .material = this .executionContext .createNode ("Material"); + + this .materials .set (this .id, this .material); + + return true; + } + + OBJParser_Grammar .untilEndOfLine .parse (this); + + return true; + } + + return false; + }, + Ka () + { + this .comments (); + + if (OBJParser_Grammar .Ka .parse (this)) + { + if (this .col3 ()) + { + const hsv = this .color3 .getHSV ([ ]); + + this .material .ambientIntensity = hsv [2]; + + return true; + } + + OBJParser_Grammar .untilEndOfLine .parse (this); + + return true; + } + + return false; + }, + Kd () + { + this .comments (); + + if (OBJParser_Grammar .Kd .parse (this)) + { + if (this .col3 ()) + { + this .material .diffuseColor = this .color3; + + return true; + } + + OBJParser_Grammar .untilEndOfLine .parse (this); + + return true; + } + + return false; + }, + Ks () + { + this .comments (); + + if (OBJParser_Grammar .Ks .parse (this)) + { + if (this .col3 ()) + { + this .material .specularColor = this .color3; + + return true; + } + + OBJParser_Grammar .untilEndOfLine .parse (this); + + return true; + } + + return false; + }, + Ns () + { + this .comments (); + + if (OBJParser_Grammar .Ns .parse (this)) + { + if (this .double ()) + { + this .material .shininess = this .value / 1000; + + return true; + } + + OBJParser_Grammar .untilEndOfLine .parse (this); + + return true; + } + + return false; + }, + d () + { + this .comments (); + + if (OBJParser_Grammar .d .parse (this)) + { + if (this .double ()) + { + this .material .transparency = 1 - this .value; + + return true; + } + + OBJParser_Grammar .untilEndOfLine .parse (this); + + return true; + } + + return false; + }, + Tr () + { + this .comments (); + + if (OBJParser_Grammar .Tr .parse (this)) + { + if (this .double ()) + { + this .material .transparency = this .value; + + return true; + } + + OBJParser_Grammar .untilEndOfLine .parse (this); + + return true; + } + + return false; + }, + illum () + { + this .comments (); + + if (OBJParser_Grammar .illum .parse (this)) + { + if (this .int32 ()) + { + // Don't know what to do with illum value in X3D. + return true; + } + + OBJParser_Grammar .untilEndOfLine .parse (this); + + return true; + } + + return false; + }, + map_Kd () + { + this .comments (); + + if (OBJParser_Grammar .map_Kd .parse (this)) + { + this .whitespacesNoLineTerminator (); + + if (OBJParser_Grammar .untilEndOfLine .parse (this)) + { + const string = this .result [1]; + + if (string .length && this .id .length) + { + const paths = string .trim () .split (/\s+/); + + if (paths .length) + { + const + scene = this .executionContext, + texture = scene .createNode ("ImageTexture"), + path = paths .at (-1) .replace (/\\/g, "/"); + + texture .url = [path]; + + this .textures .set (this .id, texture); + } + } + + return true; + } + + OBJParser_Grammar .untilEndOfLine .parse (this); + + return true; + } + + return false; + }, + int32 () + { + this .whitespaces (); + + if (OBJParser_Grammar .int32 .parse (this)) + { + this .value = parseInt (this .result [1]); + + return true; + } + + return false; + }, + double () + { + this .whitespaces (); + + if (OBJParser_Grammar .double .parse (this)) + { + this .value = parseFloat (this .result [1]); + + return true; + } + + if (OBJParser_Grammar .constants .parse (this)) + { + this .value = this .CONSTANTS .get (this .result [2] .toUpperCase ()); + + if (this .result [1] === "-") + this .value = - this .value; + + return true; + } + + return false; + }, + col3 () + { + if (this .double ()) + { + this .color3 .r = this .value; + + if (this .double ()) + { + this .color3 .g = this .value; + + if (this .double ()) + { + this .color3 .b = this .value; + + return true; + } + } + } + + return false; + }, +}); + +const OBJParser_default_ = OBJParser; +; + +x_ite_Namespace .add ("OBJParser", "x_ite/Parser/OBJParser", OBJParser_default_); +/* harmony default export */ const Parser_OBJParser = (OBJParser_default_); +;// CONCATENATED MODULE: ./src/x_ite/Parser/STLAParser.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +// http://paulbourke.net/dataformats/stl/ +// https://people.sc.fsu.edu/~jburkardt/data/obj/obj.html + +/* + * Grammar + */ + +// Lexical elements +const STLAParser_Grammar = Parser_Expressions ({ + // General + whitespaces: /[\x20\n\t\r]+/gy, + whitespacesNoLineTerminator: /[\x20\t]+/gy, + comment: /;.*?(?=[\n\r])/gy, + untilEndOfLine: /([^\r\n]+)/gy, + + // Keywords + solid: /solid/gy, + facet: /facet/gy, + normal: /normal/gy, + outer: /outer/gy, + loop: /loop/gy, + vertex: /vertex/gy, + endloop: /endloop/gy, + endfacet: /endfacet/gy, + endsolid: /endsolid/gy, + + // Values + name: /(\w+)/gy, + double: /([+-]?(?:(?:(?:\d*\.\d+)|(?:\d+(?:\.)?))(?:[eE][+-]?\d+)?))/gy, + constants: /([+-])((?:NAN|INF|INFINITY))/igy, +}); + +/* + * Parser + */ + +function STLAParser (scene) +{ + Parser_X3DParser .call (this, scene); + + // Globals + + this .vector = [ ]; + this .point = [ ]; +} + +Object .assign (Object .setPrototypeOf (STLAParser .prototype, Parser_X3DParser .prototype), +{ + CONSTANTS: new Map ([ + ["NAN", NaN], + ["INF", Infinity], + ["INFINITY", Infinity], + ]), + getEncoding () + { + return "STRING"; + }, + setInput (string) + { + this .input = string; + }, + isValid () + { + if (!(typeof this .input === "string")) + return false; + + return !! this .input .match (/^(?:[\x20\n\t\r]+|;.*?[\r\n])*\b(?:solid)\b/); + }, + parseIntoScene (resolve, reject) + { + this .stl () + .then (resolve) + .catch (reject); + }, + stl: async function () + { + // Set profile and components. + + const + browser = this .getBrowser (), + scene = this .getScene (); + + scene .setEncoding ("STL"); + scene .setProfile (browser .getProfile ("Interchange")); + + await this .loadComponents (); + + // Create nodes. + + this .material = scene .createNode ("Material"); + this .appearance = scene .createNode ("Appearance"); + + this .material .diffuseColor = Numbers_Color3 .White; + this .appearance .material = this .material; + + // Parse scene. + + this .statements (); + + return this .getScene (); + }, + comments () + { + while (this .comment ()) + ; + }, + comment () + { + this .whitespaces (); + + if (STLAParser_Grammar .comment .parse (this)) + return true; + + return false; + }, + whitespaces () + { + STLAParser_Grammar .whitespaces .parse (this); + }, + whitespacesNoLineTerminator () + { + STLAParser_Grammar .whitespacesNoLineTerminator .parse (this); + }, + statements () + { + while (this .solid ()) + ; + }, + solid () + { + this .comments (); + + if (STLAParser_Grammar .solid .parse (this)) + { + this .whitespacesNoLineTerminator (); + + const + scene = this .getExecutionContext (), + shape = scene .createNode ("Shape"), + geometry = scene .createNode ("TriangleSet"), + normal = scene .createNode ("Normal"), + coordinate = scene .createNode ("Coordinate"), + name = this .sanitizeName (STLAParser_Grammar .name .parse (this) ? this .result [1] : ""); + + STLAParser_Grammar .untilEndOfLine .parse (this); + + this .facets (); + + shape .appearance = this .appearance; + shape .geometry = geometry; + geometry .normalPerVertex = false; + geometry .normal = normal; + geometry .coord = coordinate; + normal .vector = this .vector; + coordinate .point = this .point; + + if (name) + { + scene .addNamedNode (scene .getUniqueName (name), shape); + scene .addExportedNode (scene .getUniqueExportName (name), shape); + } + + scene .getRootNodes () .push (shape); + + this .comments (); + + if (STLAParser_Grammar .endsolid .parse (this)) + return true; + + throw new Error ("Expected 'endsolid' statement."); + } + + return false; + }, + facets () + { + this .vector .length = 0; + this .point .length = 0; + + while (this .facet ()) + ; + }, + facet () + { + this .comments () + + if (STLAParser_Grammar .facet .parse (this)) + { + if (this .normal ()) + { + if (this .loop ()) + { + this .comments (); + + if (STLAParser_Grammar .endfacet .parse (this)) + return true; + + throw new Error ("Expected 'endfacet' statement."); + } + } + } + + return false; + }, + normal () + { + this .whitespacesNoLineTerminator (); + + if (STLAParser_Grammar .normal .parse (this)) + { + if (this .double ()) + { + this .vector .push (this .value); + + if (this .double ()) + { + this .vector .push (this .value); + + if (this .double ()) + { + this .vector .push (this .value); + + return true; + } + + throw new Error ("Expected a double."); + } + + throw new Error ("Expected a double."); + } + + throw new Error ("Expected a double."); + } + + throw new Error ("Expected 'normal' statement."); + }, + loop () + { + this .comments (); + + if (STLAParser_Grammar .outer .parse (this)) + { + this .whitespacesNoLineTerminator (); + + if (STLAParser_Grammar .loop .parse (this)) + { + if (this .vertex ()) + { + if (this .vertex ()) + { + if (this .vertex ()) + { + this .comments (); + + if (STLAParser_Grammar .endloop .parse (this)) + return true; + + throw new Error ("Expected 'endloop' statement."); + } + } + } + } + + throw new Error ("Expected 'loop' statement."); + } + + throw new Error ("Expected 'outer' statement."); + }, + vertex () + { + this .comments (); + + if (STLAParser_Grammar .vertex .parse (this)) + { + if (this .double ()) + { + this .point .push (this .value); + + if (this .double ()) + { + this .point .push (this .value); + + if (this .double ()) + { + this .point .push (this .value); + + return true; + } + + throw new Error ("Expected a double."); + } + + throw new Error ("Expected a double."); + } + + throw new Error ("Expected a double."); + } + + throw new Error ("Expected 'vertex' statement."); + }, + double () + { + this .whitespacesNoLineTerminator (); + + if (STLAParser_Grammar .double .parse (this)) + { + this .value = parseFloat (this .result [1]); + + return true; + } + + if (STLAParser_Grammar .constants .parse (this)) + { + this .value = this .CONSTANTS .get (this .result [2] .toUpperCase ()); + + if (this .result [1] === "-") + this .value = - this .value; + + return true; + } + + return false; + }, +}); + +const STLAParser_default_ = STLAParser; +; + +x_ite_Namespace .add ("STLAParser", "x_ite/Parser/STLAParser", STLAParser_default_); +/* harmony default export */ const Parser_STLAParser = (STLAParser_default_); +;// CONCATENATED MODULE: ./src/x_ite/Parser/STLBParser.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +// http://paulbourke.net/dataformats/stl/ +// https://people.sc.fsu.edu/~jburkardt/data/obj/obj.html + +/* + * Parser + */ + +function STLBParser (scene) +{ + Parser_X3DParser .call (this, scene); +} + +Object .assign (Object .setPrototypeOf (STLBParser .prototype, Parser_X3DParser .prototype), +{ + getEncoding () + { + return "ARRAY_BUFFER"; + }, + setInput (input) + { + this .arrayBuffer = input; + this .dataView = new DataView (input); + }, + isValid () + { + if (!(this .arrayBuffer instanceof ArrayBuffer)) + return false; + + if (this .dataView .byteLength < 84) + return false; + + const + numFaces = this .dataView .getUint32 (80, true), + byteLength = numFaces * 50 + 84; + + return byteLength === this .dataView .byteLength; + }, + parseIntoScene (resolve, reject) + { + this .stl () + .then (resolve) + .catch (reject); + }, + stl: async function () + { + // Set profile and components. + + const + browser = this .getBrowser (), + scene = this .getScene (); + + scene .setEncoding ("STL"); + scene .setProfile (browser .getProfile ("Interchange")); + + await this .loadComponents (); + + // Create nodes. + + this .material = scene .createNode ("Material"); + this .appearance = scene .createNode ("Appearance"); + + this .material .diffuseColor = Numbers_Color3 .White; + this .appearance .material = this .material; + + // Parse scene. + + this .shape (); + + return this .getScene (); + }, + shape () + { + const + scene = this .getExecutionContext (), + shape = scene .createNode ("Shape"), + geometry = scene .createNode ("TriangleSet"), + normal = scene .createNode ("Normal"), + coordinate = scene .createNode ("Coordinate"), + dataView = this .dataView, + byteLength = this .dataView .byteLength, + vector = [ ], + point = [ ]; + + for (let i = 84; i < byteLength; i += 50) + { + for (let f = 0; f < 3; ++ f) + vector .push (dataView .getFloat32 (i + f * 4, true)); + + for (let f = 3; f < 12; ++ f) + point .push (dataView .getFloat32 (i + f * 4, true)); + } + + shape .appearance = this .appearance; + shape .geometry = geometry; + geometry .normalPerVertex = false; + geometry .normal = normal; + geometry .coord = coordinate; + normal .vector = vector; + coordinate .point = point; + + scene .getRootNodes () .push (shape); + }, +}); + +const STLBParser_default_ = STLBParser; +; + +x_ite_Namespace .add ("STLBParser", "x_ite/Parser/STLBParser", STLBParser_default_); +/* harmony default export */ const Parser_STLBParser = (STLBParser_default_); +;// CONCATENATED MODULE: ./src/x_ite/Parser/PLYAParser.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +/* + * Grammar + */ + +// Lexical elements +const PLYAParser_Grammar = Parser_Expressions ({ + // General + whitespaces: /[\x20\n\t\r]+/gy, + whitespacesNoLineTerminator: /[\x20\t]+/gy, + untilEndOfLine: /([^\r\n]+)/gy, + line: /.*?\r?\n/gy, + + // Keywords + ply: /ply/gy, + format: /format ascii 1.0/gy, + comment: /\bcomment\b/gy, + element: /\belement\b/gy, + elementName: /\b(\S+)\b/gy, + property: /\bproperty\b/gy, + propertyList: /\blist\b/gy, + propertyType: /\b(char|uchar|short|ushort|int|uint|float|double|int8|uint8|int16|uint16|int32|uint32|float32|float64)\b/gy, + propertyName: /\b(\S+)\b/gy, + endHeader: /\bend_header\b/gy, + + double: /([+-]?(?:(?:(?:\d*\.\d+)|(?:\d+(?:\.)?))(?:[eE][+-]?\d+)?))/gy, + int32: /((?:0[xX][\da-fA-F]+)|(?:[+-]?\d+))/gy, +}); + +/* + * Parser + */ + +function PLYAParser (scene) +{ + Parser_X3DParser .call (this, scene); + + this .comments = [ ]; + this .attrib = [ ]; + + this .typeMapping = new Map ([ + ["char", this .int32], + ["uchar", this .int32], + ["short", this .int32], + ["ushort", this .int32], + ["int", this .int32], + ["uint", this .int32], + ["float", this .double], + ["double", this .double], + ["int8", this .int32], + ["uint8", this .int32], + ["int16", this .int32], + ["uint16", this .int32], + ["int32", this .int32], + ["uint32", this .int32], + ["float32", this .double], + ["float64", this .double], + ]); +} + +Object .assign (Object .setPrototypeOf (PLYAParser .prototype, Parser_X3DParser .prototype), +{ + getEncoding () + { + return "STRING"; + }, + setInput (input) + { + this .input = input; + }, + isValid () + { + return this .input .match (/^ply\r?\nformat ascii 1.0/); + }, + parseIntoScene (resolve, reject) + { + this .ply () + .then (resolve) + .catch (reject); + }, + ply: async function () + { + // Set profile and components. + + const + browser = this .getBrowser (), + scene = this .getScene (); + + scene .setEncoding ("PLY"); + scene .setProfile (browser .getProfile ("Interchange")); + + await this .loadComponents (); + await this .processElements (this .header ([ ])) + + // Create nodes. + + return this .getScene (); + }, + whitespacesOrComments () + { + while (this .whitespaces () || this .comment ()) + ; + }, + whitespaces () + { + return PLYAParser_Grammar .whitespaces .parse (this); + }, + whitespacesNoLineTerminator () + { + PLYAParser_Grammar .whitespacesNoLineTerminator .parse (this); + }, + comment () + { + if (PLYAParser_Grammar .comment .parse (this) && PLYAParser_Grammar .untilEndOfLine .parse (this)) + { + this .comments .push (this .result [1] .trim ()); + return true; + } + + return false; + }, + double () + { + this .whitespacesNoLineTerminator (); + + if (PLYAParser_Grammar .double .parse (this)) + { + this .value = parseFloat (this .result [1]); + + return true; + } + + return false; + }, + int32 () + { + this .whitespacesNoLineTerminator (); + + if (PLYAParser_Grammar .int32 .parse (this)) + { + this .value = parseInt (this .result [1]); + + return true; + } + + return false; + }, + convertColor (value, type) + { + switch (type) + { + case "uchar": + case "uint8": + return value / 0xff; + case "ushort": + case "uint16": + return value / 0xfffff; + case "uint": + case "uint32": + return value / 0xffffffff; + case "float": + case "float32": + case "double": + case "float64": + return value; + } + }, + header (elements) + { + PLYAParser_Grammar .ply .parse (this); + PLYAParser_Grammar .whitespaces .parse (this); + PLYAParser_Grammar .format .parse (this); + + this .headings (elements); + + const + scene = this .getScene (), + worldInfo = scene .createNode ("WorldInfo"); + + worldInfo .title = new URL (scene .worldURL) .pathname .split ('/') .at (-1); + worldInfo .info = this .comments; + + scene .rootNodes .push (worldInfo); + + return elements; + }, + headings (elements) + { + while (this .head (elements)) + ; + }, + head (elements) + { + if (this .element (elements)) + return true; + + if (PLYAParser_Grammar .endHeader .parse (this)) + return false; + + if (PLYAParser_Grammar .untilEndOfLine .parse (this)) + return true; + + return false; + }, + element (elements) + { + this .whitespacesOrComments (); + + if (PLYAParser_Grammar .element .parse (this)) + { + this .whitespacesNoLineTerminator (); + + if (PLYAParser_Grammar .elementName .parse (this)) + { + const name = this .result [1]; + + if (this .int32 ()) + { + const element = + { + name: name, + count: this .value, + properties: [ ], + }; + + this .properties (element .properties); + + elements .push (element); + return true; + } + } + } + + return false; + }, + properties (properties) + { + while (this .property (properties)) + ; + }, + property (properties) + { + this .whitespacesOrComments (); + + if (PLYAParser_Grammar .property .parse (this)) + { + this .whitespacesNoLineTerminator (); + + if (PLYAParser_Grammar .propertyType .parse (this)) + { + const + type = this .result [1], + value = this .typeMapping .get (type); + + this .whitespacesNoLineTerminator (); + + if (PLYAParser_Grammar .propertyName .parse (this)) + { + const name = this .result [1]; + + properties .push ({ type, value, name }); + return true; + } + } + + if (PLYAParser_Grammar .propertyList .parse (this)) + { + this .whitespacesNoLineTerminator (); + + if (PLYAParser_Grammar .propertyType .parse (this)) + { + const count = this .typeMapping .get (this .result [1]); + + this .whitespacesNoLineTerminator (); + + if (PLYAParser_Grammar .propertyType .parse (this)) + { + const + type = this .result [1], + value = this .typeMapping .get (type); + + this .whitespacesNoLineTerminator (); + + if (PLYAParser_Grammar .propertyName .parse (this)) + { + const name = this .result [1]; + + properties .push ({ count, type, value, name }); + return true; + } + } + } + } + } + + return false; + }, + async processElements (elements) + { + // console .log (elements) + + for (const element of elements) + await this .processElement (element); + + if (!this .coord) + return; + + const + scene = this .getScene (), + shape = scene .createNode ("Shape"), + appearance = scene .createNode ("Appearance"), + material = scene .createNode (this .geometry ? "Material" : "UnlitMaterial"), + geometry = this .geometry ?? scene .createNode ("PointSet"); + + appearance .material = material; + + if (this .texCoord) + { + const textureTransform = scene .createNode ("TextureTransform"); + + textureTransform .translation .y = -1; + textureTransform .scale .y = -1; + + appearance .textureTransform = textureTransform; + } + + if (geometry .getNodeTypeName () !== "PointSet") + { + geometry .solid = false; + geometry .texCoord = this .texCoord; + } + + geometry .attrib = this .attrib; + geometry .color = this .color; + geometry .normal = this .normal; + geometry .coord = this .coord; + + shape .appearance = appearance; + shape .geometry = geometry; + + scene .rootNodes .push (shape); + }, + async processElement (element) + { + switch (element .name) + { + case "vertex": + await this .parseVertices (element); + break; + case "face": + this .parseFaces (element); + break; + case "multi_texture_vertex": + this .parseMultiTextureVertices (element); + break; + case "multi_texture_face": + this .parseMultiTextureFaces (element); + break; + default: + this .parseUnknown (element); + break; + } + }, + async parseVertices ({ count, properties }) + { + const + scene = this .getScene (), + colors = [ ], + texCoord = scene .createNode ("TextureCoordinate"), + texCoords = [ ], + normal = scene .createNode ("Normal"), + normals = [ ], + coord = scene .createNode ("Coordinate"), + points = [ ], + attributes = new Map (); + + for (const { name } of properties) + { + if (name .match (/^(?:red|green|blue|alpha|r|g|b|a|s|t|u|v|nx|ny|nz|x|y|z)$/)) + continue; + + attributes .set (name, [ ]); + } + + // console .time ("vertices") + + for (let i = 0; i < count; ++ i) + { + this .whitespaces (); + + for (const { value, name, type } of properties) + { + if (!value .call (this)) + throw new Error (`Couldn't parse value for property ${name}.`); + + switch (name) + { + default: + attributes .get (name) .push (this .value); + break; + case "red": case "green": case "blue": case "alpha": + case "r": case "g": case "b": case "a": + colors .push (this .convertColor (this .value, type)); + break; + case "s": case "t": + case "u": case "v": + texCoords .push (this .value); + break; + case "nx": case "ny": case "nz": + normals .push (this .value); + break; + case "x": case "y": case "z": + points .push (this .value); + break; + } + } + } + + // console .timeEnd ("vertices") + + // Attributes + + if (attributes .size) + { + scene .addComponent (this .getBrowser () .getComponent ("Shaders", 1)); + + await this .loadComponents (); + + for (const [name, value] of attributes) + { + const floatVertexAttribute = scene .createNode ("FloatVertexAttribute"); + + floatVertexAttribute .name = name; + floatVertexAttribute .numComponents = 1; + floatVertexAttribute .value = value; + + this .attrib .push (floatVertexAttribute); + } + } + + // Geometric properties + + const + pAlpha = properties .some (p => p .name .match (/^(?:alpha|a)$/)), + alpha = pAlpha && colors .some ((v, i) => i % 4 === 3 && v < 1), + color = scene .createNode (alpha ? "ColorRGBA" : "Color"); + + color .color = alpha || !pAlpha ? colors : colors .filter ((v, i) => i % 4 !== 3); + texCoord .point = texCoords; + normal .vector = normals; + coord .point = points; + + this .color = colors .length ? color : null; + this .texCoord = texCoords .length ? texCoord : null; + this .normal = normals .length ? normal : null; + this .coord = coord; + }, + parseFaces ({ count, properties }) + { + const + scene = this .getScene (), + geometry = scene .createNode ("IndexedFaceSet"), + coordIndex = [ ]; + + for (let i = 0; i < count; ++ i) + { + this .whitespaces (); + + for (const { count, value, name } of properties) + { + if (!count .call (this)) + throw new Error (`Couldn't parse property count for ${name}.`); + + const length = this .value; + + for (let i = 0; i < length; ++ i) + { + if (!value .call (this)) + throw new Error (`Couldn't parse a property value for ${name}.`); + + coordIndex .push (this .value); + } + + coordIndex .push (-1); + } + } + + geometry .coordIndex = coordIndex; + this .geometry = geometry; + }, + parseMultiTextureVertices ({ count, properties }) + { + const + scene = this .getScene (), + texCoord = scene .createNode ("TextureCoordinate"), + texCoords = [ ]; + + for (let i = 0; i < count; ++ i) + { + this .whitespaces (); + + for (const { value, name } of properties) + { + if (!value .call (this)) + throw new Error (`Couldn't parse value for property ${name}.`); + + switch (name) + { + case "s": case "t": + case "u": case "v": + texCoords .push (this .value); + break; + } + } + } + + texCoord .point = texCoords; + + this .texCoord = texCoords .length ? texCoord : null; + }, + parseMultiTextureFaces ({ count, properties }) + { + const texCoordIndex = [ ]; + + for (let i = 0; i < count; ++ i) + { + for (const { count, value, name } of properties) + { + if (count) + { + if (!count .call (this)) + throw new Error (`Couldn't parse property count for ${name}.`); + + const length = this .value; + + for (let i = 0; i < length; ++ i) + { + if (!value .call (this)) + throw new Error (`Couldn't parse value for property ${name}.`); + + texCoordIndex .push (this .value); + } + + texCoordIndex .push (-1); + } + else + { + if (!value .call (this)) + throw new Error (`Couldn't parse value for property ${name}.`); + } + } + } + + if (this .geometry) + this .geometry .texCoordIndex = texCoordIndex; + }, + parseUnknown ({ count }) + { + this .whitespaces (); + + for (let i = 0; i < count; ++ i) + PLYAParser_Grammar .line .parse (this); + }, +}); + +const PLYAParser_default_ = PLYAParser; +; + +x_ite_Namespace .add ("PLYAParser", "x_ite/Parser/PLYAParser", PLYAParser_default_); +/* harmony default export */ const Parser_PLYAParser = (PLYAParser_default_); +;// CONCATENATED MODULE: ./src/x_ite/Parser/PLYBParser.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function PLYBParser (scene) +{ + Parser_PLYAParser .call (this, scene); + + this .typeMapping = new Map ([ + ["char", this .binaryInt8], + ["uchar", this .binaryUint8], + ["short", this .binaryInt16], + ["ushort", this .binaryUint16], + ["int", this .binaryInt32], + ["uint", this .binaryUint32], + ["float", this .binaryFloat32], + ["double", this .binaryFloat64], + ["int8", this .binaryInt8], + ["uint8", this .binaryUint8], + ["int16", this .binaryInt16], + ["uint16", this .binaryUint16], + ["int32", this .binaryInt32], + ["uint32", this .binaryUint32], + ["float32", this .binaryFloat32], + ["float64", this .binaryFloat64], + ]); + + this .binaryInt8 .bytes = 1; + this .binaryUint8 .bytes = 1; + this .binaryInt16 .bytes = 2; + this .binaryUint16 .bytes = 2; + this .binaryInt32 .bytes = 4; + this .binaryUint32 .bytes = 4; + this .binaryFloat32 .bytes = 4; + this .binaryFloat64 .bytes = 8; +} + +Object .assign (Object .setPrototypeOf (PLYBParser .prototype, Parser_PLYAParser .prototype), +{ + getEncoding () + { + return ["ARRAY_BUFFER", "STRING"]; + }, + setInput (inputs) + { + this .arrayBuffer = inputs [0]; + this .dataView = new DataView (this .arrayBuffer); + this .input = inputs [1]; + this .magic = this .input .match (/^ply\r?\nformat (binary_(?:little|big)_endian) 1.0.*?end_header\r?\n/s); + this .byteOffset = this .magic ?.[0] .length; + this .littleEndian = this .magic ?.[1] === "binary_little_endian"; + }, + isValid () + { + if (!(this .arrayBuffer instanceof ArrayBuffer)) + return false; + + return !! this .magic; + }, + binaryInt8 () + { + this .value = this .dataView .getInt8 (this .byteOffset, this .littleEndian); + this .byteOffset += 1; + + return true; + }, + binaryUint8 () + { + this .value = this .dataView .getUint8 (this .byteOffset, this .littleEndian); + this .byteOffset += 1; + + return true; + }, + binaryInt16 () + { + this .value = this .dataView .getInt16 (this .byteOffset, this .littleEndian); + this .byteOffset += 2; + + return true; + }, + binaryUint16 () + { + this .value = this .dataView .getUint16 (this .byteOffset, this .littleEndian); + this .byteOffset += 2; + + return true; + }, + binaryInt32 () + { + this .value = this .dataView .getInt32 (this .byteOffset, this .littleEndian); + this .byteOffset += 4; + + return true; + }, + binaryUint32 () + { + this .value = this .dataView .getUint32 (this .byteOffset, this .littleEndian); + this .byteOffset += 4; + + return true; + }, + binaryFloat32 () + { + this .value = this .dataView .getFloat32 (this .byteOffset, this .littleEndian); + this .byteOffset += 4; + + return true; + }, + binaryFloat64 () + { + this .value = this .dataView .getFloat64 (this .byteOffset, this .littleEndian); + this .byteOffset += 8; + + return true; + }, + processElements (elements) + { + this .whitespaces = Function .prototype; + + return Parser_PLYAParser .prototype .processElements .call (this, elements); + }, + parseUnknown ({ count, properties }) + { + for (let i = 0; i < count; ++ i) + { + for (const { count, type } of properties) + { + if (count) + { + count .call (this); + + this .byteOffset += this .value * this .typeMapping .get (type) .bytes; + } + else + { + this .byteOffset += this .typeMapping .get (type) .bytes; + } + } + } + }, + // parseUnknown ({ count, properties }) + // { + // let string = ""; + + // for (let i = 0; i < count; ++ i) + // { + // for (const { count, type, value } of properties) + // { + // if (count === undefined) + // { + // value .call (this); + + // string += this .value + " " + // } + // else + // { + // count .call (this); + + // string += this .value + " " + + // for (let i = 0, l = this .value; i < l; ++ i) + // { + // value .call (this); + + // string += this .value + " " + // } + // } + // } + + // string += "\n" + // } + + // console .log (string .substring (0, 1000)) + // }, +}); + +const PLYBParser_default_ = PLYBParser; +; + +x_ite_Namespace .add ("PLYBParser", "x_ite/Parser/PLYBParser", PLYBParser_default_); +/* harmony default export */ const Parser_PLYBParser = (PLYBParser_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Numbers/Complex.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +function Complex (real, imag) +{ + this .real = real; + this .imag = imag; +} + +Object .assign (Complex .prototype, +{ + *[Symbol .iterator] () + { + yield this .real; + yield this .imag; + }, + copy () + { + const copy = Object .create (Complex .prototype); + copy .real = this .real; + copy .imag = this .imag; + return copy; + }, + assign (complex) + { + this .real = complex .real; + this .imag = complex .imag; + return this; + }, + equals (complex) + { + return this .real === complex .real && + this .imag === complex .imag; + }, + set (real, imag) + { + this .real = real; + this .imag = imag; + return this; + }, + setPolar (magnitude, angle) + { + this .real = magnitude * Math .cos (angle); + this .imag = magnitude * Math .sin (angle); + return this; + }, + conjugate () + { + this .imag = -this .imag; + return this; + }, + negate () + { + this .real = -this .real; + this .imag = -this .imag; + return this; + }, + inverse () + { + const d = this .real * this .real + this .imag * this .imag; + + this .real /= d; + this .imag /= -d; + return this; + }, + add (value) + { + this .real += value .real; + this .imag += value .imag; + return this; + }, + subtract (value) + { + this .real -= value .real; + this .imag -= value .imag; + return this; + }, + multiply (value) + { + this .real *= value; + this .imag *= value; + return this; + }, + multComp (value) + { + const + { real: ar, imag: ai } = this, + { real: br, imag: bi } = value; + + this .real = ar * br - ai * bi; + this .imag = ar * bi + ai * br; + return this; + }, + divide (value) + { + this .real /= value; + this .imag /= value; + return this; + }, + divComp (value) + { + const + { real: ar, imag: ai } = this, + { real: br, imag: bi } = value, + d = br * br + bi * bi; + + this .real = (ar * br + ai * bi) / d; + this .imag = (ai * br - ar * bi) / d; + return this; + }, + toString () + { + let string = ""; + + string += this .real; + + if (this .imag < 0) + { + string += this .imag; + string += "i"; + } + else if (this .imag > 0) + { + string += "+"; + string += this .imag; + string += "i"; + } + + return string; + }, +}); + +Object .defineProperties (Complex .prototype, +{ + length: { value: 2 }, + 0: + { + get () + { + return this .real; + }, + set (value) + { + this .real = value; + }, + }, + 1: + { + get () + { + return this .imag; + }, + set (value) + { + this .imag = value; + }, + }, + magnitude: + { + get () + { + if (this .real) + { + if (this .imag) + return Math .hypot (this .real, this .imag); + + return Math .abs (this .real); + } + + return Math .abs (this .imag); + }, + set (magnitude) + { + this .setPolar (magnitude, this .angle); + }, + }, + angle: + { + get () + { + return Math .atan2 (this .imag, this .real); + }, + set (angle) + { + this .setPolar (this .magnitude, angle); + }, + }, +}); + +Object .assign (Complex, +{ + Polar (magnitude, angle) + { + return Object .create (Complex .prototype) .setPolar (magnitude, angle); + }, + multiply (lhs, rhs) + { + return lhs .copy () .multiply (rhs); + }, +}); + +const Complex_default_ = Complex; +; + +x_ite_Namespace .add ("Complex", "standard/Math/Numbers/Complex", Complex_default_); +/* harmony default export */ const Numbers_Complex = (Complex_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Geometry/Box2.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function Box2 (/* size, center */) +{ + this .matrix = new Numbers_Matrix3 (); + + this .set (... arguments); +} + +Object .assign (Box2 .prototype, +{ + copy () + { + const copy = Object .create (Box2 .prototype); + copy .matrix = this .matrix .copy (); + return copy; + }, + assign (box) + { + this .matrix .assign (box .matrix); + return this; + }, + equals (box) + { + return this .matrix .equals (box .matrix); + }, + set (size, center) + { + switch (arguments .length) + { + case 0: + { + this .matrix .set (0, 0, 0, + 0, 0, 0, + 0, 0, 0); + + return this; + } + case 2: + { + this .matrix .set (size .x / 2, 0, 0, + 0, size .y / 2, 0, + center .x, center .y, 1); + + return this; + } + // case 3: + // { + // console .trace () + // return this .setExtents (arguments [0], arguments [1]); + // } + } + }, + setExtents (min, max) + { + const + sx = (max .x - min .x) / 2, + sy = (max .y - min .y) / 2, + cx = (max .x + min .x) / 2, + cy = (max .y + min .y) / 2; + + this .matrix .set (sx, 0, 0, + 0, sy, 0, + cx, cy, 1); + + return this; + }, + isEmpty () + { + return this .matrix [8] === 0; + }, + add: (() => + { + const + lhs_min = new Numbers_Vector2 (0, 0), + lhs_max = new Numbers_Vector2 (0, 0), + rhs_min = new Numbers_Vector2 (0, 0), + rhs_max = new Numbers_Vector2 (0, 0); + + return function (box) + { + if (this .isEmpty ()) + return this .assign (box); + + if (box .isEmpty ()) + return this; + + this .getExtents (lhs_min, lhs_max); + box .getExtents (rhs_min, rhs_max); + + return this .setExtents (lhs_min .min (rhs_min), lhs_max .max (rhs_max)); + }; + })(), + multLeft (matrix) + { + this .matrix .multLeft (matrix); + return this; + }, + multRight (matrix) + { + this .matrix .multRight (matrix); + return this; + }, + getExtents (min, max) + { + this .getAbsoluteExtents (min, max); + + min .add (this .center); + max .add (this .center); + }, + getAbsoluteExtents: (() => + { + const p1 = new Numbers_Vector2 (0, 0); + + return function (min, max) + { + const + m = this .matrix, + x = m .xAxis, + y = m .yAxis; + + p1 .assign (x) .add (y); + + const p2 = y .subtract (x); + + min .assign (p1) .min (p2); + max .assign (p1) .max (p2); + + p1 .negate (); + p2 .negate (); + + min .min (p1, p2); + max .max (p1, p2); + }; + })(), + containsPoint: (() => + { + const + min = new Numbers_Vector2 (0, 0), + max = new Numbers_Vector2 (0, 0); + + return function (point) + { + this .getExtents (min, max); + + return min .x <= point .x && + max .x >= point .x && + min .y <= point .y && + max .y >= point .y; + }; + })(), + toString () + { + return `${this .size}, ${this .center}`; + }, +}); + +Object .assign (Box2, +{ + Extents (min, max) + { + return new Box2 () .setExtents (min, max); + }, + Points (points) + { + const + min = new Numbers_Vector2 (Number .POSITIVE_INFINITY, Number .POSITIVE_INFINITY), + max = new Numbers_Vector2 (Number .NEGATIVE_INFINITY, Number .NEGATIVE_INFINITY); + + for (const point of points) + { + min .min (point); + max .max (point); + } + + return new Box2 () .setExtents (min, max); + }, +}); + +Object .defineProperties (Box2 .prototype, +{ + size: + { + get: (() => + { + const + min = new Numbers_Vector2 (0, 0), + max = new Numbers_Vector2 (0, 0); + + return function () + { + this .getAbsoluteExtents (min, max); + + return max .subtract (min); + }; + })(), + enumerable: true, + }, + center: + { + get () + { + return this .matrix .origin; + }, + enumerable: true, + }, +}); + +const Box2_default_ = Box2; +; + +x_ite_Namespace .add ("Box2", "standard/Math/Geometry/Box2", Box2_default_); +/* harmony default export */ const Geometry_Box2 = (Box2_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Algorithms/Bezier.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +const { interval: Bezier_interval } = Math_Algorithm; + +// https://pomax.github.io/bezierinfo/ + +const Bezier = +{ + quadric: (() => + { + const + c = new Numbers_Matrix3 (1, 0, 0, -2, 2, 0, 1, -2, 1), + p = new Numbers_Matrix3 (); + + return function (x0, y0, z0, x1, y1, z1, x2, y2, z2, steps, points) + { + p .set (x0, y0, z0, x1, y1, z1, x2, y2, z2) + .multLeft (c); + + for (let i = 0, d = steps - 1; i < steps; ++ i) + { + const t = i / d; + + points .push (p .multVecMatrix (new Numbers_Vector3 (1, t, t * t))); + } + }; + })(), + cubic: (() => + { + const + v = new Numbers_Vector4 (0, 0, 0, 0), + c = new Numbers_Matrix4 (1, 0, 0, 0, -3, 3, 0, 0, 3, -6, 3, 0, -1, 3, -3, 1), + p = new Numbers_Matrix4 (); + + return function (x0, y0, z0, x1, y1, z1, x2, y2, z2, x3, y3, z3, steps, points) + { + p .set (x0, y0, z0, 0, x1, y1, z1, 0, x2, y2, z2, 0, x3, y3, z3, 0) + .multLeft (c); + + for (let i = 0, d = steps - 1; i < steps; ++ i) + { + const t = i / d; + + p .multVecMatrix (v .set (1, t, t * t, t * t * t)); + + points .push (new Numbers_Vector3 (v .x, v .y, v .z)); + } + }; + })(), + arc (ax, ay, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y, steps, points) + { + // https://ericeastwood.com/blog/25/curves-and-arcs-quadratic-cubic-elliptical-svg-implementations + // See https://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes. + + // If the endpoints are identical, then this is equivalent to omitting the elliptical arc segment entirely. + if (ax === x && ay === y) + { + points .push (new Numbers_Vector3 (x, y, 0)); + return; + } + + // In accordance to: http://www.w3.org/TR/SVG/implnote.html#ArcOutOfRangeParameters + + rx = Math .abs (rx); + ry = Math .abs (ry); + + // If rx = 0 or ry = 0 then this arc is treated as a straight line segment joining the endpoints. + if (rx === 0 || ry === 0) + { + points .push (new Numbers_Vector3 (ax, ay, 0), new Numbers_Vector3 (x, y, 0)); + return; + } + + const + rx2 = rx * rx, + ry2 = ry * ry; + + // In accordance to: http://www.w3.org/TR/SVG/implnote.html#ArcOutOfRangeParameters + + xAxisRotation = Bezier_interval (xAxisRotation, 0, 2 * Math .PI); + + const + sinRotation = Math .sin (xAxisRotation), + cosRotation = Math .cos (xAxisRotation); + + // Following "Conversion from endpoint to center parameterization" + // http://www.w3.org/TR/SVG/implnote.html#ArcConversionEndpointToCenter + + // Step #1: Compute transformedPoint + const d = new Numbers_Vector2 (ax - x, ay - y) .divide (2); + + const transformedPoint = new Numbers_Vector2 ( cosRotation * d .x + sinRotation * d .y, + -sinRotation * d .x + cosRotation * d .y); + + const transformedPoint2 = transformedPoint .copy () .multVec (transformedPoint); + + // Ensure radii are large enough + const radiiCheck = transformedPoint2 .x / rx2 + transformedPoint2 .y / ry2; + + if (radiiCheck > 1) + { + rx = Math .sqrt (radiiCheck) * rx; + ry = Math .sqrt (radiiCheck) * ry; + } + + // Step #2: Compute transformedCenter + const cSquareNumerator = rx2 * ry2 - rx2 * transformedPoint2 .y - ry2 * transformedPoint2 .x; + const cSquareRootDenom = rx2 * transformedPoint2 .y + ry2 * transformedPoint2 .x; + let cRadicand = cSquareNumerator / cSquareRootDenom; + + // Make sure this never drops below zero because of precision + cRadicand = Math .max (0, cRadicand); + + const cCoef = (largeArcFlag !== sweepFlag ? 1 : -1) * Math .sqrt (cRadicand); + + const transformedCenter = new Numbers_Vector2 ( cCoef * rx * transformedPoint .y / ry, + -cCoef * ry * transformedPoint .x / rx); + + // Step #3: Compute center + const center = new Numbers_Vector2 (cosRotation * transformedCenter .x - sinRotation * transformedCenter .y + ((ax + x) / 2), + sinRotation * transformedCenter .x + cosRotation * transformedCenter .y + ((ay + y) / 2)); + + // Step #4: Compute start/sweep angles + const startVector = new Numbers_Vector2 ((transformedPoint .x - transformedCenter .x) / rx, + (transformedPoint .y - transformedCenter .y) / ry); + + const endVector = new Numbers_Vector2 ((-transformedPoint .x - transformedCenter .x) / rx, + (-transformedPoint .y - transformedCenter .y) / ry); + + const get_angle = (x) => { return x > 0 ? x : 2 * Math .PI + x; }; // transform angle to range [0, 2pi] + const startAngle = get_angle (Math .atan2 (startVector .y, startVector .x)); + const endAngle = get_angle (Math .atan2 (endVector .y, endVector .x)); + + let sweepAngle = endAngle - startAngle; + + if (largeArcFlag) + { + // sweepAngle must be positive + if (sweepAngle < 0) + sweepAngle += 2 * Math .PI; + } + else + { + // sweepAngle must be negative + if (sweepAngle > 0) + sweepAngle -= 2 * Math .PI; + } + + if (sweepFlag && sweepAngle < 0) + sweepAngle += 2 *Math .PI; + + else if (!sweepFlag && sweepAngle > 0) + sweepAngle -= 2 * Math .PI; + + // Interpolate: + + const bezier_steps = Math .max (4, Math .abs (sweepAngle) * steps / (2 * Math .PI)); + const bezier_steps_1 = bezier_steps - 1; + + points .push (new Numbers_Vector3 (ax, ay, 0)); + + for (let i = 1; i < bezier_steps_1; ++ i) + { + const t = i / bezier_steps_1; + + // From http://www.w3.org/TR/SVG/implnote.html#ArcParameterizationAlternatives + const angle = startAngle + (sweepAngle * t); + const x = rx * Math .cos (angle); + const y = ry * Math .sin (angle); + + points .push (new Numbers_Vector3 (cosRotation * x - sinRotation * y + center .x, + sinRotation * x + cosRotation * y + center .y, + 0)); + } + + points .push (new Numbers_Vector3 (x, y, 0)); + }, +}; + +const Bezier_default_ = Bezier; +; + +x_ite_Namespace .add ("Bezier", "standard/Math/Algorithms/Bezier", Bezier_default_); +/* harmony default export */ const Algorithms_Bezier = (Bezier_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Utility/MatrixStack.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +function MatrixStack (Type) +{ + return Object .assign ([ new Type () ], + { + top: 0, + set (matrix) + { + this [this .top] .assign (matrix); + }, + get () + { + return this [this .top]; + }, + push () + { + const top = ++ this .top; + + if (top < this .length) + this [top] .assign (this [top - 1]); + else + this [top] = this [top - 1] .copy (); + }, + pushMatrix (matrix) + { + const top = ++ this .top; + + if (top < this .length) + this [top] .assign (matrix); + else + this [top] = matrix .copy (); + }, + pop () + { + -- this .top; + }, + clear () + { + this .top = 0; + }, + size () + { + return this .top + 1; + }, + identity () + { + this [this .top] .identity (); + }, + multLeft (matrix) + { + this [this .top] .multLeft (matrix); + }, + translate (vector) + { + this [this .top] .translate (vector); + }, + rotate (rotation) + { + this [this .top] .rotate (rotation); + }, + scale (vector) + { + this [this .top] .scale (vector); + }, + }); +} + +const MatrixStack_default_ = MatrixStack; +; + +x_ite_Namespace .add ("MatrixStack", "standard/Math/Utility/MatrixStack", MatrixStack_default_); +/* harmony default export */ const Utility_MatrixStack = (MatrixStack_default_); +;// CONCATENATED MODULE: ./src/x_ite/Parser/SVGParser.js +/* provided dependency */ var SVGParser_$ = __webpack_require__(864); +/* provided dependency */ var libtess = __webpack_require__(180); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + + + +/* + * Grammar + */ + +// Lexical elements +const SVGParser_Grammar = Parser_Expressions ({ + // General + whitespaces: /[\x20\n\t\r]+/gy, + comma: /,/gy, + openParenthesis: /\(/gy, + closeParenthesis: /\)/gy, + + // Units + length: /(em|ex|px|in|cm|mm|pt|pc|%)/gy, + percent: /%/gy, + + // Values + int32: /((?:0[xX][\da-fA-F]+)|(?:[+-]?\d+))/gy, + double: /([+-]?(?:(?:(?:\d*\.\d+)|(?:\d+(?:\.)?))(?:[eE][+-]?\d+)?))/gy, + constants: /([+-])((?:NAN|INF|INFINITY))/igy, + matrix: /matrix/gy, + translate: /translate/gy, + rotate: /rotate/gy, + scale: /scale/gy, + skewX: /skewX/gy, + skewY: /skewY/gy, + color: /([a-zA-Z]+|#[\da-fA-F]+|rgba?\(.*?\))/gy, + url: /url\("?(.*?)"?\)/gy, + path: /([mMlLhHvVqQtTcCsSaAzZ])/gy, +}); + +/* + * Constants + */ + +const + MM = 0.001, // One mm in meters. + CM = 0.01, // One cm in meters. + INCH = 0.0254, // One inch in meters. + POINT = INCH / 72, // One point in meters. + PICA = INCH / 6, // One pica in meters. + PIXEL = INCH / 90, // One pixel in meters. + EM = 16, // One em in pixels. + SPREAD = 16; // Spread factor, Integer. + +/* + * Parser + */ + +function SVGParser (scene) +{ + Parser_X3DParser .call (this, scene); + Parser_X3DOptimizer .call (this); + + // Optimizer + + this .removeGroups = true; + this .removeEmptyGroups = true; + this .combineGroupingNodes = false; + + // Options + + this .solid = false; // Are 2D primitives solid? + + // Globals + + this .viewBox = new Numbers_Vector4 (0, 0, 100, 100); + this .modelMatrix = new Utility_MatrixStack (Numbers_Matrix4); + this .fillGeometries = new Map (); + this .strokeGeometries = new Map (); + this .lineProperties = new Map (); + this .tessy = this .createTesselator (); + this .canvas = document .createElement ("canvas"); + this .context = this .canvas .getContext ("2d"); + + this .styles = [{ + display: "inline", + fillType: "COLOR", + fillColor: Numbers_Color4 .Black, + fillURL: "", + fillOpacity: 1, + fillRule: "nonzero", + strokeType: "none", + strokeColor: Numbers_Color4 .Black, + strokeURL: "", + strokeOpacity: 1, + strokeWidth: 1, + opacity: 1, + stopColor: Numbers_Color4 .Black, + stopOpacity: 1, + vectorEffect: "none", + }]; + + // Constants + + const browser = scene .getBrowser () + + switch (browser .getBrowserOption ("PrimitiveQuality")) + { + case "LOW": + this .BEZIER_STEPS = 6; // Subdivisions of a span. + this .CIRCLE_STEPS = 20; // Subdivisions of a circle, used for arc and rounded rect. + break; + case "HIGH": + this .BEZIER_STEPS = 10; // Subdivisions of a span. + this .CIRCLE_STEPS = 64; // Subdivisions of a circle, used for arc and rounded rect. + break; + default: + this .BEZIER_STEPS = 8; // Subdivisions of a span. + this .CIRCLE_STEPS = 32; // Subdivisions of a circle, used for arc and rounded rect. + break; + } + + switch (browser .getBrowserOption ("TextureQuality")) + { + case "LOW": + this .GRADIENT_SIZE = 128; // In pixels. + break; + case "HIGH": + this .GRADIENT_SIZE = 512; // In pixels. + break; + default: + this .GRADIENT_SIZE = 256; // In pixels. + break; + } + + this .canvas .width = this .GRADIENT_SIZE; + this .canvas .height = this .GRADIENT_SIZE; +} + +Object .assign (Object .setPrototypeOf (SVGParser .prototype, Parser_X3DParser .prototype), + Parser_X3DOptimizer .prototype, +{ + CONSTANTS: new Map ([ + ["NAN", NaN], + ["INF", Infinity], + ["INFINITY", Infinity], + ]), + getEncoding () + { + return "XML"; + }, + setInput (xmlElement) + { + try + { + if (typeof xmlElement === "string") + xmlElement = SVGParser_$.parseXML (xmlElement); + + this .input = xmlElement; + } + catch + { + this .input = undefined; + } + }, + isValid () + { + if (!(this .input instanceof XMLDocument)) + return false; + + if (SVGParser_$(this .input) .children ("svg") .length) + return true; + + if (this .input .nodeName === "svg") + return true; + + return false; + }, + parseIntoScene (resolve, reject) + { + this .xmlElement (this .input) + .then (resolve) + .catch (reject); + }, + xmlElement: async function (xmlElement) + { + switch (xmlElement .nodeName) + { + case "#document": + { + const svg = SVGParser_$(xmlElement) .children ("svg"); + + for (const xmlElement of svg) + await this .svgElement (xmlElement); + + break; + } + case "svg": + { + await this .svgElement (xmlElement); + break; + } + } + + return this .getScene (); + }, + svgElement: async function (xmlElement) + { + const + browser = this .getBrowser (), + scene = this .getScene (); + + scene .setEncoding ("SVG"); + scene .setProfile (browser .getProfile ("Interchange")); + scene .addComponent (browser .getComponent ("Geometry2D", 2)); + + await this .loadComponents (); + + // Init nodes. + + this .document = this .input; + this .rootTransform = scene .createNode ("Transform"); + this .groupNodes = [this .rootTransform]; + this .texturePropertiesNode = this .createTextureProperties (); + + // Create background. + + const background = scene .createNode ("Background"); + + background .skyColor = [1, 1, 1]; + + scene .getRootNodes () .push (background); + + // Create navigation info. + + const navigationInfo = scene .createNode ("NavigationInfo"); + + navigationInfo .type = ["PLANE_create3000.github.io", "PLANE", "EXAMINE", "ANY"]; + + scene .getRootNodes () .push (navigationInfo); + + // Get attributes of svg element. + + const + defaultWidth = this .lengthAttribute (xmlElement .getAttribute ("width"), 300, "width"), + defaultHeight = this .lengthAttribute (xmlElement .getAttribute ("height"), 150, "height"), + defaultViewBox = this .viewBox .set (0, 0, defaultWidth, defaultHeight), + viewBox = this .viewBoxAttribute (xmlElement .getAttribute ("viewBox"), defaultViewBox), + width = this .lengthAttribute (xmlElement .getAttribute ("width"), viewBox [2], "width"), + height = this .lengthAttribute (xmlElement .getAttribute ("height"), viewBox [3], "height"); + + if (true) // default + { + // preserveAspectRatio = "xMidYMid meet" + + const + r = width / height, + rv = viewBox [2] / viewBox [3]; + + if (rv > r) + viewBox [3] += viewBox [2] / r - viewBox [3]; + else + viewBox [2] += viewBox [3] * r - viewBox [2]; + } + + // Create viewpoint. + + const + viewpoint = scene .createNode ("OrthoViewpoint"), + x = (viewBox .x + width / 2) * PIXEL, + y = -(viewBox .y + height / 2) * PIXEL; + + viewpoint .position = new Numbers_Vector3 (x, y, 10); + viewpoint .centerOfRotation = new Numbers_Vector3 (x, y, 0); + + viewpoint .fieldOfView = [ + -width / 2 * PIXEL, + -height / 2 * PIXEL, + width / 2 * PIXEL, + height / 2 * PIXEL, + ]; + + scene .getRootNodes () .push (viewpoint); + + // Create view matrix. + + const + scale = new Numbers_Vector3 (width * PIXEL / viewBox [2], -height * PIXEL / viewBox [3], 1), + translation = new Numbers_Vector3 (-viewBox .x, viewBox .y, 0) .multVec (scale); + + this .rootTransform .translation = translation; + this .rootTransform .scale = scale; + + // Parse elements. + + this .elements (xmlElement); + + // Add root Transform node. + + scene .addNamedNode (scene .getUniqueName ("ViewBox"), this .rootTransform); + scene .addExportedNode (scene .getUniqueExportName ("ViewBox"), this .rootTransform); + scene .getRootNodes () .push (this .rootTransform); + + // Optimize scene graph. + + this .optimizeSceneGraph (scene .getRootNodes ()); + }, + elements (xmlElement) + { + for (const childNode of xmlElement .childNodes) + this .element (childNode); + }, + element (xmlElement) + { + switch (xmlElement .nodeName) + { + case "use": + return this .useElement (xmlElement); + case "g": + return this .gElement (xmlElement); + case "switch": + return this .switchElement (xmlElement); + case "a": + return this .aElement (xmlElement); + case "rect": + return this .rectElement (xmlElement); + case "circle": + return this .circleElement (xmlElement); + case "ellipse": + return this .ellipseElement (xmlElement); + case "text": + return this .textElement (xmlElement); + case "image": + return this .imageElement (xmlElement); + case "polyline": + return this .polylineElement (xmlElement); + case "polygon": + return this .polygonElement (xmlElement); + case "path": + return this .pathElement (xmlElement); + } + }, + useElement (xmlElement) + { + // Get href. + + const usedElement = this .hrefAttribute (xmlElement .getAttribute ("href") || xmlElement .getAttribute ("xlink:href")); + + if (!usedElement) + return; + + // Determine style. + + if (!this .styleAttributes (xmlElement)) + return; + + // Create Transform node. + + const + x = this .lengthAttribute (xmlElement .getAttribute ("x"), 0, "width"), + y = this .lengthAttribute (xmlElement .getAttribute ("y"), 0, "height"), + width = this .lengthAttribute (xmlElement .getAttribute ("width"), 0, "width"), + height = this .lengthAttribute (xmlElement .getAttribute ("height"), 0, "height"); + + const transformNode = this .createTransform (xmlElement, new Numbers_Vector2 (x, y)); + + this .groupNodes .push (transformNode); + + this .element (usedElement); + + this .popAll (); + }, + gElement (xmlElement) + { + // Determine style. + + if (!this .styleAttributes (xmlElement)) + return; + + // Create Transform node. + + const transformNode = this .createTransform (xmlElement); + + // Get child elements. + + this .groupNodes .push (transformNode); + + this .elements (xmlElement); + + this .popAll (); + }, + switchElement (xmlElement) + { + // Determine style. + + if (!this .styleAttributes (xmlElement)) + return; + + // Create Transform node. + + const + scene = this .getExecutionContext (), + transformNode = this .createTransform (xmlElement), + switchNode = scene .createNode ("Switch"); + + transformNode .children .push (switchNode); + switchNode .whichChoice = 0; + + // Get child elements. + + this .groupNodes .push (switchNode); + + this .elements (xmlElement); + + this .popAll (); + }, + aElement (xmlElement) + { + // Determine style. + + if (!this .styleAttributes (xmlElement)) + return; + + // Get attributes. + + const + href = xmlElement .getAttribute ("href") || xmlElement .getAttribute ("xlink:href"), + title = xmlElement .getAttribute ("title") || xmlElement .getAttribute ("xlink:title"), + target = xmlElement .getAttribute ("target"); + + // Create Transform node. + + const + scene = this .getExecutionContext (), + transformNode = this .createTransform (xmlElement), + anchorNode = scene .createNode ("Anchor"); + + transformNode .children .push (anchorNode); + + anchorNode .description = title; + anchorNode .url = [href]; + + if (target) + anchorNode .parameter = [`target=${target}`]; + + // Get child elements. + + this .groupNodes .push (anchorNode); + + this .elements (xmlElement); + + this .popAll (); + }, + rectElement (xmlElement) + { + // Create Transform node. + + const + x = this .lengthAttribute (xmlElement .getAttribute ("x"), 0, "width"), + y = this .lengthAttribute (xmlElement .getAttribute ("y"), 0, "height"), + width = this .lengthAttribute (xmlElement .getAttribute ("width"), 0, "width"), + height = this .lengthAttribute (xmlElement .getAttribute ("height"), 0, "height"); + + let + rx = Math .max (0, this .lengthAttribute (xmlElement .getAttribute ("rx"), 0, "width")), + ry = Math .max (0, this .lengthAttribute (xmlElement .getAttribute ("ry"), 0, "height")); + + if (rx === 0 && ry === 0) + { + // Determine style. + + if (!this .styleAttributes (xmlElement)) + return; + + // Create Transform node. + + const + scene = this .getExecutionContext (), + size = new Numbers_Vector2 (width, height), + center = new Numbers_Vector2 (x + width / 2, y + height / 2), + bbox = new Geometry_Box2 (size, center), + transformNode = this .createTransform (xmlElement, center); + + this .groupNodes .push (transformNode); + + // Create nodes. + + if (this .style .fillType !== "none") + { + const + shapeNode = scene .createNode ("Shape"), + rectangleNode = this .fillGeometries .get (xmlElement); + + transformNode .children .push (shapeNode); + shapeNode .appearance = this .createFillAppearance (bbox); + + if (rectangleNode) + { + shapeNode .geometry = rectangleNode; + } + else + { + const rectangleNode = scene .createNode ("Rectangle2D"); + + this .fillGeometries .set (xmlElement, rectangleNode); + + shapeNode .geometry = rectangleNode; + rectangleNode .solid = this .solid; + rectangleNode .size = size; + } + } + + if (this .style .strokeType !== "none") + { + const + shapeNode = scene .createNode ("Shape"), + polylineNode = this .strokeGeometries .get (xmlElement); + + transformNode .children .push (shapeNode); + shapeNode .appearance = this .createStrokeAppearance (); + + if (polylineNode) + { + shapeNode .geometry = polylineNode; + } + else + { + const + polylineNode = scene .createNode ("Polyline2D"), + width1_2 = width / 2, + height1_2 = height / 2; + + this .strokeGeometries .set (xmlElement, polylineNode); + + shapeNode .geometry = polylineNode; + + polylineNode .lineSegments = [ width1_2, height1_2, + -width1_2, height1_2, + -width1_2, -height1_2, + width1_2, -height1_2, + width1_2, height1_2]; + } + } + + this .popAll (); + } + else + { + // Create points. + + if (rx && !ry) ry = rx; + if (ry && !rx) rx = ry; + + rx = Math .min (rx, width / 2); + ry = Math .min (ry, height / 2); + + const + xOffsets = [x + width - rx, x + rx , x + rx, x + width - rx], + yOffsets = [y + height - ry, y + height - ry, y + ry, y + ry], + points = Object .assign ([ ], { closed: true }); + + for (let c = 0; c < 4; ++ c) + { + const s = c * Math .PI / 2; + + for (let i = 0, N = this .CIRCLE_STEPS / 4; i < N; ++ i) + { + const p = Numbers_Complex .Polar (1, s + Math .PI / 2 * i / (N - 1)); + + points .push (new Numbers_Vector3 (xOffsets [c] + p .real * rx, yOffsets [c] + p .imag * ry, 0)); + } + } + + points .pop (); + + // Create nodes. + + this .pathLikeElement (xmlElement, [points]); + } + }, + circleElement (xmlElement) + { + // Determine style. + + if (!this .styleAttributes (xmlElement)) + return; + + // Create Transform node. + + const + cx = this .lengthAttribute (xmlElement .getAttribute ("cx"), 0, "width"), + cy = this .lengthAttribute (xmlElement .getAttribute ("cy"), 0, "height"), + r = this .lengthAttribute (xmlElement .getAttribute ("r"), 0); + + const + scene = this .getExecutionContext (), + bbox = new Geometry_Box2 (new Numbers_Vector2 (r * 2, r * 2), new Numbers_Vector2 (cx, cy)), + transformNode = this .createTransform (xmlElement, new Numbers_Vector2 (cx, cy)); + + this .groupNodes .push (transformNode); + + // Create nodes. + + if (this .style .fillType !== "none") + { + const + shapeNode = scene .createNode ("Shape"), + diskNode = this .fillGeometries .get (xmlElement); + + transformNode .children .push (shapeNode); + shapeNode .appearance = this .createFillAppearance (bbox); + + if (diskNode) + { + shapeNode .geometry = diskNode; + } + else + { + const diskNode = scene .createNode ("Disk2D"); + + this .fillGeometries .set (xmlElement, diskNode); + + shapeNode .geometry = diskNode; + diskNode .solid = this .solid; + diskNode .outerRadius = r; + } + } + + if (this .style .strokeType !== "none") + { + const + shapeNode = scene .createNode ("Shape"), + circleNode = this .strokeGeometries .get (xmlElement); + + transformNode .children .push (shapeNode); + shapeNode .appearance = this .createStrokeAppearance (); + + if (circleNode) + { + shapeNode .geometry = circleNode; + } + else + { + const circleNode = scene .createNode ("Circle2D"); + + this .strokeGeometries .set (xmlElement, circleNode); + + shapeNode .geometry = circleNode; + circleNode .radius = r; + } + } + + this .popAll (); + }, + ellipseElement (xmlElement) + { + // Determine style. + + if (!this .styleAttributes (xmlElement)) + return; + + // Create Transform node. + + const + cx = this .lengthAttribute (xmlElement .getAttribute ("cx"), 0, "width"), + cy = this .lengthAttribute (xmlElement .getAttribute ("cy"), 0, "height"), + rx = this .lengthAttribute (xmlElement .getAttribute ("rx"), 0, "width"), + ry = this .lengthAttribute (xmlElement .getAttribute ("ry"), 0, "height"); + + const + scene = this .getExecutionContext (), + rMin = Math .min (rx, ry), + bbox = new Geometry_Box2 (new Numbers_Vector2 (rx * 2, ry * 2), new Numbers_Vector2 (cx, cy)), + transformNode = this .createTransform (xmlElement, new Numbers_Vector2 (cx, cy), new Numbers_Vector2 (rx / rMin, ry / rMin)); + + this .groupNodes .push (transformNode); + + // Create nodes. + + if (this .style .fillType !== "none") + { + const + shapeNode = scene .createNode ("Shape"), + diskNode = this .fillGeometries .get (xmlElement); + + transformNode .children .push (shapeNode); + shapeNode .appearance = this .createFillAppearance (bbox); + + if (diskNode) + { + shapeNode .geometry = diskNode; + } + else + { + const diskNode = scene .createNode ("Disk2D"); + + this .fillGeometries .set (xmlElement, diskNode); + + shapeNode .geometry = diskNode; + diskNode .solid = this .solid; + diskNode .outerRadius = rMin; + } + } + + if (this .style .strokeType !== "none") + { + const + shapeNode = scene .createNode ("Shape"), + circleNode = this .strokeGeometries .get (xmlElement); + + transformNode .children .push (shapeNode); + shapeNode .appearance = this .createStrokeAppearance (); + + if (circleNode) + { + shapeNode .geometry = circleNode; + } + else + { + const circleNode = scene .createNode ("Circle2D"); + + this .strokeGeometries .set (xmlElement, circleNode); + + shapeNode .geometry = circleNode; + circleNode .radius = rMin; + } + } + + this .popAll (); + }, + textElement (xmlElement) + { + + }, + imageElement (xmlElement) + { + const transformNode = this .fillGeometries .get (xmlElement); + + if (transformNode) + { + this .groupNodes .at (-1) .children .push (transformNode); + } + else + { + // Determine style. + + if (!this .styleAttributes (xmlElement)) + return; + + // Create Transform node. + + const + x = this .lengthAttribute (xmlElement .getAttribute ("x"), 0, "width"), + y = this .lengthAttribute (xmlElement .getAttribute ("y"), 0, "height"), + width = this .lengthAttribute (xmlElement .getAttribute ("width"), 0, "width"), + height = this .lengthAttribute (xmlElement .getAttribute ("height"), 0, "height"), + href = xmlElement .getAttribute ("href") || xmlElement .getAttribute ("xlink:href"); + + const + scene = this .getExecutionContext (), + transformNode = this .createTransform (xmlElement, new Numbers_Vector2 (x + width / 2, y + height / 2), new Numbers_Vector2 (1, -1)); + + this .fillGeometries .set (xmlElement, transformNode); + this .groupNodes .push (transformNode); + + // Create nodes. + + const + shapeNode = scene .createNode ("Shape"), + appearanceNode = scene .createNode ("Appearance"), + textureNode = scene .createNode ("ImageTexture"), + rectangleNode = scene .createNode ("Rectangle2D"); + + shapeNode .appearance = appearanceNode; + shapeNode .geometry = rectangleNode; + appearanceNode .texture = textureNode; + textureNode .url = [href]; + textureNode .textureProperties = this .texturePropertiesNode; + rectangleNode .solid = this .solid; + rectangleNode .size = new Numbers_Vector2 (width, height); + + transformNode .children .push (shapeNode); + + this .popAll (); + } + }, + polylineElement (xmlElement) + { + // Get points. + + const points = [ ]; + + if (!this .pointsAttribute (xmlElement .getAttribute ("points"), points)) + return; + + // Create nodes. + + this .pathLikeElement (xmlElement, [points]); + }, + polygonElement (xmlElement) + { + // Get points. + + const points = Object .assign ([ ], { closed: true }); + + if (!this .pointsAttribute (xmlElement .getAttribute ("points"), points)) + return; + + // Create nodes. + + this .pathLikeElement (xmlElement, [points]); + }, + pathElement (xmlElement) + { + // Get path points. + + const contours = [ ]; + + if (!this .dAttribute (xmlElement .getAttribute ("d"), contours)) + return; + + // Create nodes. + + this .pathLikeElement (xmlElement, contours); + }, + pathLikeElement (xmlElement, contours) + { + // Determine style. + + if (!this .styleAttributes (xmlElement)) + return; + + // Filter consecutive equal points. + + const EPSILON = 1e-9; // Min point distance. + + contours = contours .map (points => + { + if (points .closed) + { + return Object .assign (points .filter ((p, i, a) => p .distance (a [(i + 1) % a .length]) > EPSILON), + { + closed: true, + }); + } + else + { + return points .filter ((p, i, a) => !i || p .distance (a [i - 1]) > EPSILON); + } + }) + .filter (points => points .length > 2); + + // Add index property to points. + + contours .forEach ((points, i, a) => points .index = i ? a [i - 1] .index + a [i - 1] .length : 0); + + // Create Transform node. + + const + scene = this .getExecutionContext (), + transformNode = this .createTransform (xmlElement), + bbox = new Geometry_Box2 (); + + for (const points of contours) + bbox .add (Geometry_Box2 .Points (points)); + + this .groupNodes .push (transformNode); + + // Create nodes. + + const coordinateNode = scene .createNode ("Coordinate"); + + for (const points of contours) + coordinateNode .point .push (... points); + + if (this .style .fillType !== "none") + { + const + shapeNode = scene .createNode ("Shape"), + geometryNode = this .fillGeometries .get (xmlElement); + + transformNode .children .push (shapeNode); + shapeNode .appearance = this .createFillAppearance (bbox); + + if (geometryNode) + { + shapeNode .geometry = geometryNode; + } + else + { + const geometryNode = scene .createNode ("IndexedTriangleSet"); + + this .fillGeometries .set (xmlElement, geometryNode); + + shapeNode .geometry = geometryNode; + geometryNode .solid = this .solid; + geometryNode .index = this .triangulatePolygon (contours, coordinateNode); + geometryNode .texCoord = this .createTextureCoordinate (coordinateNode, bbox, shapeNode .appearance); + geometryNode .coord = coordinateNode; + } + } + + if (this .style .strokeType !== "none") + { + const + shapeNode = scene .createNode ("Shape"), + geometryNode = this .strokeGeometries .get (xmlElement); + + transformNode .children .push (shapeNode); + shapeNode .appearance = this .createStrokeAppearance (); + + if (geometryNode) + { + shapeNode .geometry = geometryNode; + } + else + { + const geometryNode = scene .createNode ("IndexedLineSet"); + + this .strokeGeometries .set (xmlElement, geometryNode); + + shapeNode .geometry = geometryNode; + geometryNode .coord = coordinateNode; + + // Create contour indices. + + const indices = geometryNode .coordIndex; + + for (const points of contours) + { + for (const i of points .keys ()) + indices .push (points .index + i); + + if (points .closed) + indices .push (points .index); + + indices .push (-1); + } + } + } + + this .popAll (); + }, + linearGradientElementUrl (xmlElement, bbox) + { + const + g = this .linearGradientElement (xmlElement, bbox, { stops: [ ] }), + gradient = this .context .createLinearGradient (g .x1, g .y1, g .x2, g .y2); + + return this .drawGradient (gradient, g, bbox); + }, + linearGradientElement (xmlElement, bbox, gradient) + { + if (xmlElement .nodeName !== "linearGradient") + return; + + // Attribute xlink:href + + const refElement = this .hrefAttribute (xmlElement .getAttribute ("href") || xmlElement .getAttribute ("xlink:href")); + + if (refElement) + this .gradientElement (refElement, bbox, gradient); + + // Attributes + + gradient .x1 = this .lengthAttribute (xmlElement .getAttribute ("x1"), gradient .x1 || 0, "width"); + gradient .y1 = this .lengthAttribute (xmlElement .getAttribute ("y1"), gradient .y1 || 0, "height"); + gradient .x2 = this .lengthAttribute (xmlElement .getAttribute ("x2"), gradient .x2 || 1, "width"); + gradient .y2 = this .lengthAttribute (xmlElement .getAttribute ("y2"), gradient .y2 || 0, "height"); + gradient .units = xmlElement .getAttribute ("gradientUnits") || "objectBoundingBox"; + gradient .transform = this .transformAttribute (xmlElement .getAttribute ("gradientTransform")); + + // Spread matrix + + const + s = new Numbers_Matrix3 (), + c = new Numbers_Vector2 (gradient .x1, gradient .y1); + + s .translate (c); + s .scale (new Numbers_Vector2 (SPREAD, SPREAD)); + s .translate (c .negate ()); + + gradient .spreadMatrix = s; + + // Stops + + for (const childNode of xmlElement .childNodes) + this .gradientChild (childNode, gradient); + + return gradient; + }, + radialGradientElementUrl (xmlElement, bbox) + { + const + g = this .radialGradientElement (xmlElement, bbox, { stops: [ ] }), + gradient = this .context .createRadialGradient (g .fx, g .fy, g. fr, g .cx, g .cy, g .r); + + return this .drawGradient (gradient, g, bbox); + }, + radialGradientElement (xmlElement, bbox, gradient) + { + // Attribute xlink:href + + const refElement = this .hrefAttribute (xmlElement .getAttribute ("href") || xmlElement .getAttribute ("xlink:href")); + + if (refElement) + this .gradientElement (refElement, bbox, gradient); + + // Attributes + + gradient .cx = this .lengthAttribute (xmlElement .getAttribute ("cx"), gradient .cx || 0.5, "width"), + gradient .cy = this .lengthAttribute (xmlElement .getAttribute ("cy"), gradient .cy || 0.5, "height"), + gradient .r = this .lengthAttribute (xmlElement .getAttribute ("r"), gradient .r || 0.5), + gradient .fx = this .lengthAttribute (xmlElement .getAttribute ("fx"), gradient .fx || gradient .cx, "width"), + gradient .fy = this .lengthAttribute (xmlElement .getAttribute ("fy"), gradient .fy || gradient .cy, "height"), + gradient .fr = this .lengthAttribute (xmlElement .getAttribute ("fr"), gradient .fr || 0), + gradient .units = xmlElement .getAttribute ("gradientUnits") || "objectBoundingBox"; + gradient .spreadMethod = xmlElement .getAttribute ("spreadMethod"); + gradient .transform = this .transformAttribute (xmlElement .getAttribute ("gradientTransform")); + + // Spread matrix + + const + s = new Numbers_Matrix3 (), + c = new Numbers_Vector2 (gradient .fx, gradient .fy); + + s .translate (c); + s .scale (new Numbers_Vector2 (SPREAD, SPREAD)); + s .translate (c .negate ()); + + gradient .spreadMatrix = s; + + // Stops + + for (const childNode of xmlElement .childNodes) + this .gradientChild (childNode, gradient); + + return gradient; + }, + gradientElement (xmlElement, bbox, gradient) + { + if (!xmlElement) + return; + + switch (xmlElement .nodeName) + { + case "linearGradient": + return this .linearGradientElement (xmlElement, bbox, gradient); + case "radialGradient": + return this .radialGradientElement (xmlElement, bbox, gradient); + } + }, + gradientChild (xmlElement, gradient) + { + if (xmlElement .nodeName === "stop") + return this .stopElement (xmlElement, gradient); + }, + stopElement (xmlElement, gradient) + { + if (!this .styleAttributes (xmlElement)) + return; + + const offset = this .percentAttribute (xmlElement .getAttribute ("offset"), 0); + + if (offset < 0 || offset > 1) + return; + + const { stopColor, stopOpacity } = this .style; + + gradient .stops .push ([offset, stopColor, stopOpacity]); + + this .styles .pop (); + }, + drawGradient (gradient, g, bbox) + { + // Add color stops. + + switch (g .spreadMethod) + { + default: // pad + { + g .spreadMatrix .identity (); + + for (const [o, c, a] of g .stops) + gradient .addColorStop (o, this .cssColor (c, a)); + + break; + } + case "repeat": + { + for (let i = 0; i < SPREAD; ++ i) + { + const s = i / SPREAD; + + for (const [o, c, a] of g .stops) + gradient .addColorStop (s + o / SPREAD, this .cssColor (c, a)); + } + + break; + } + case "reflect": + { + for (let i = 0; i < SPREAD; ++ i) + { + const s = i / SPREAD; + + for (const [o, c, a] of g .stops) + gradient .addColorStop (s + (i % 2 ? 1 - o : o) / SPREAD, this .cssColor (c, a)); + } + + break; + } + } + + // Create Matrix. + + const m = new Numbers_Matrix3 (); + + m .scale (new Numbers_Vector2 (this .GRADIENT_SIZE / 2, this .GRADIENT_SIZE / 2)); + m .translate (Numbers_Vector2 .One); + m .scale (new Numbers_Vector2 (1, -1)); + + if (g .units === "userSpaceOnUse") + m .multLeft (bbox .matrix .copy () .inverse ()); + else + m .multLeft (new Numbers_Matrix3 (2, 0, 0, 0, 2, 0, -1, -1, 1)); + + m .multLeft (g .transform); + m .multLeft (g .spreadMatrix); + + // Paint. + + const cx = this .context; + + cx .fillStyle = gradient; + cx .save (); + cx .clearRect (0, 0, this .GRADIENT_SIZE, this .GRADIENT_SIZE); + cx .rect (0, 0, this .GRADIENT_SIZE, this .GRADIENT_SIZE); + cx .transform (m [0], m [1], m [3], m [4], m [6], m [7]); + cx .fill (); + cx .restore (); + + // Use PNG because image can have alpha channel. + return this .canvas .toDataURL ("image/png"); + }, + patternUrl (xmlElement) + { + //console .debug ("pattern"); + }, + idAttribute (attribute, node) + { + if (attribute === null) + return; + + const + scene = this .getExecutionContext (), + name = this .sanitizeName (attribute); + + if (name) + { + scene .addNamedNode (scene .getUniqueName (name), node); + scene .addExportedNode (scene .getUniqueExportName (name), node); + } + }, + viewBoxAttribute (attribute, defaultValue) + { + if (attribute === null) + return defaultValue; + + this .parseValue (attribute); + + if (this .double ()) + { + const x = this .value; + + if (this .double ()) + { + const y = this .value; + + if (this .double ()) + { + const width = this .value; + + if (this .double ()) + { + const height = this .value; + + return new Numbers_Vector4 (x, y, width, height); + } + } + } + } + + return defaultValue; + }, + hrefAttribute (attribute) + { + if (!attribute) + return; + + const + scene = this .getExecutionContext (), + hash = new URL (attribute, scene .getBaseURL ()) .hash .slice (1); + + return this .document .getElementById (hash); + }, + lengthAttribute (attribute, defaultValue, percent) + { + // Returns length in pixel. + + if (attribute === null) + return defaultValue; + + this .parseValue (attribute); + + if (this .double ()) + { + let value = this .value; + + // Parse unit + + if (SVGParser_Grammar .length .parse (this)) + { + switch (this .result [1]) + { + case "em": + value *= EM; + break; + case "ex": + // TODO + break; + case "px": + // We are pixels :) + break; + case "in": + value *= INCH / PIXEL; + break; + case "cm": + value *= CM / PIXEL; + break; + case "mm": + value *= MM / PIXEL; + break; + case "pt": + value *= POINT / PIXEL; + break; + case "pc": + value *= PICA / PIXEL; + break; + case "%": + { + switch (percent) + { + case "width": + value *= this .viewBox [2] / 100; + break; + case "height": + value *= this .viewBox [3] / 100; + break; + default: + value *= Math .hypot (this .viewBox [2], this .viewBox [3]) / 100; + break; + } + + break; + } + } + } + + return value; + } + + return defaultValue; + }, + percentAttribute (attribute, defaultValue) + { + this .parseValue (attribute); + + if (this .double ()) + { + let value = this .value; + + // Parse unit + + if (SVGParser_Grammar .percent .parse (this)) + value /= 100; + + return Math_Algorithm .clamp (value, 0, 1); + } + + return defaultValue; + }, + pointsAttribute (attribute, points) + { + if (attribute === null) + return false; + + this .parseValue (attribute); + + while (true) + { + if (this .double ()) + { + const x = this .value; + + if (this .comma ()) + { + if (this .double ()) + { + const y = this .value; + + points .push (new Numbers_Vector3 (x, y, 0)); + + if (this .comma ()) + continue; + } + } + } + + break; + } + + return !! points .length; + }, + dAttribute (attribute, contours) + { + if (attribute === null) + return false; + + this .parseValue (attribute); + + let + points = [ ], + previous = "", + command = "", + relative = false, + ax = 0, + ay = 0, + px = 0, + py = 0; + + while (true) + { + this .whitespaces (); + + if (!SVGParser_Grammar .path .parse (this)) + break; + + previous = command; + command = this .result [1]; + relative = command === command .toLowerCase (); + + switch (command) + { + case "m": + case "M": + { + // moveto + + if (points .length > 2) + contours .push (Object .assign (points, { closed: false })); + + points = [ ]; + + while (true) + { + if (this .double ()) + { + let x = this .value; + + this .comma (); + + if (this .double ()) + { + let y = this .value; + + if (relative) + { + x += ax; + y += ay; + } + + points .push (new Numbers_Vector3 (x, y, 0)); + + ax = x; + ay = y; + + this .comma (); + continue; + } + } + + break; + } + + continue; + } + case "l": + case "L": + { + // lineto + + while (true) + { + if (this .double ()) + { + let x = this .value; + + this .comma (); + + if (this .double ()) + { + let y = this .value; + + if (relative) + { + x += ax; + y += ay; + } + + points .push (new Numbers_Vector3 (x, y, 0)); + + ax = x; + ay = y; + + this .comma (); + continue; + } + } + + break; + } + + continue; + } + case "h": + case "H": + { + // horizontal lineto + + while (true) + { + if (this .double ()) + { + let x = this .value; + + if (relative) + x += ax; + + points .push (new Numbers_Vector3 (x, ay, 0)); + + ax = x; + + this .comma (); + continue; + } + + break; + } + + continue; + } + case "v": + case "V": + { + // vertical lineto + + while (this) + { + if (this .double ()) + { + let y = this .value; + + if (relative) + y += ay; + + points .push (new Numbers_Vector3 (ax, y, 0)); + + ay = y; + + this .comma (); + continue; + } + + break; + } + + continue; + } + case "q": + case "Q": + { + // quadratic Bézier curveto + + while (true) + { + if (this .double ()) + { + let x1 = this .value; + + this .comma (); + + if (this .double ()) + { + let y1 = this .value; + + this .comma (); + + if (this .double ()) + { + let x = this .value; + + this .comma (); + + if (this .double ()) + { + let y = this .value; + + if (relative) + { + x1 += ax; + y1 += ay; + x += ax; + y += ay; + } + + Algorithms_Bezier .quadric (ax, ay, 0, x1, y1, 0, x, y, 0, this .BEZIER_STEPS, points); + + ax = x; + ay = y; + px = x1; + py = y1; + + this .comma (); + continue; + } + } + } + } + + break; + } + + continue; + } + case "t": + case "T": + { + // Shorthand/smooth quadratic Bézier curveto + + while (true) + { + if (this .double ()) + { + let x = this .value; + + this .comma (); + + if (this .double ()) + { + let y = this .value; + + if (relative) + { + x += ax; + y += ay; + } + + switch (previous) + { + case 'Q': + case 'q': + case 'T': + case 't': + { + x1 = ax + (ax - px); + y1 = ay + (ay - py); + break; + } + default: + { + x1 = ax; + y1 = ay; + break; + } + } + + Algorithms_Bezier .quadric (ax, ay, 0, x1, y1, 0, x, y, 0, this .BEZIER_STEPS, points); + + ax = x; + ay = y; + + this .comma (); + continue; + } + } + + break; + } + + continue; + } + case "c": + case "C": + { + // curveto, cubic Bézier curve + + while (true) + { + if (this .double ()) + { + let x1 = this .value; + + this .comma (); + + if (this .double ()) + { + let y1 = this .value; + + this .comma (); + + if (this .double ()) + { + let x2 = this .value; + + this .comma (); + + if (this .double ()) + { + let y2 = this .value; + + this .comma (); + + if (this .double ()) + { + let x = this .value; + + this .comma (); + + if (this .double ()) + { + let y = this .value; + + if (relative) + { + x1 += ax; + y1 += ay; + x2 += ax; + y2 += ay; + x += ax; + y += ay; + } + + Algorithms_Bezier .cubic (ax, ay, 0, x1, y1, 0, x2, y2, 0, x, y, 0, this .BEZIER_STEPS, points); + + ax = x; + ay = y; + px = x2; + py = y2; + + this .comma (); + continue; + } + } + } + } + } + } + + break; + } + + continue; + } + case "s": + case "S": + { + // shorthand/smooth curveto, cubic Bézier curve + + while (true) + { + if (this .double ()) + { + let x2 = this .value; + + this .comma (); + + if (this .double ()) + { + let y2 = this .value; + + this .comma (); + + if (this .double ()) + { + let x = this .value; + + this .comma (); + + if (this .double ()) + { + let y = this .value; + + if (relative) + { + x2 += ax; + y2 += ay; + x += ax; + y += ay; + } + + switch (previous) + { + case 'C': + case 'c': + case 'S': + case 's': + { + var x1 = ax + (ax - px); + var y1 = ay + (ay - py); + break; + } + default: + { + var x1 = ax; + var y1 = ay; + break; + } + } + + Algorithms_Bezier .cubic (ax, ay, 0, x1, y1, 0, x2, y2, 0, x, y, 0, this .BEZIER_STEPS, points); + + ax = x; + ay = y; + px = x2; + py = y2; + + this .comma (); + continue; + } + } + } + } + + break; + } + + continue; + } + case "a": + case "A": + { + // elliptical arc + + while (true) + { + if (this .double ()) + { + let rx = this .value; + + this .comma (); + + if (this .double ()) + { + let ry = this .value; + + this .comma (); + + if (this .double ()) + { + let xAxisRotation = Math_Algorithm .radians (this .value); + + this .comma (); + + if (this .int32 ()) + { + let largeArcFlag = this .value; + + this .comma (); + + if (this .int32 ()) + { + let sweepFlag = this .value; + + this .comma (); + + if (this .double ()) + { + let x = this .value; + + this .comma (); + + if (this .double ()) + { + let y = this .value; + + if (relative) + { + x += ax; + y += ay; + } + + Algorithms_Bezier .arc (ax, ay, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y, this .CIRCLE_STEPS, points); + + ax = x; + ay = y; + + this .comma (); + continue; + } + } + } + } + } + } + } + + break; + } + + continue; + } + case "z": + case "Z": + { + // closepath + + if (points .length > 2) + { + ax = points [0] .x; + ay = points [0] .y; + + contours .push (Object .assign (points, { closed: true })); + } + + points = [ ]; + + this .comma (); + continue; + } + } + + break; + } + + if (points .length > 2) + contours .push (Object .assign (points, { closed: false })); + + return !! contours .length; + }, + transformAttribute (attribute) + { + const matrix = new Numbers_Matrix3 (); + + if (attribute === null) + return matrix; + + this .parseValue (attribute); + + while (true) + { + this .comma (); + this .whitespaces (); + + if (SVGParser_Grammar .matrix .parse (this)) + { + this .whitespaces (); + + if (SVGParser_Grammar .openParenthesis .parse (this)) + { + if (this .double ()) + { + const a = this .value; + + if (this .comma ()) + { + if (this .double ()) + { + const b = this .value; + + if (this .comma ()) + { + if (this .double ()) + { + const c = this .value; + + if (this .comma ()) + { + if (this .double ()) + { + const d = this .value; + + if (this .comma ()) + { + if (this .double ()) + { + const e = this .value; + + if (this .comma ()) + { + if (this .double ()) + { + const f = this .value; + + this .whitespaces (); + + if (SVGParser_Grammar .closeParenthesis .parse (this)) + { + matrix .multLeft (new Numbers_Matrix3 (a, b, 0, c, d, 0, e, f, 1)); + continue; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + else if (SVGParser_Grammar .translate .parse (this)) + { + this .whitespaces (); + + if (SVGParser_Grammar .openParenthesis .parse (this)) + { + if (this .double ()) + { + const tx = this .value; + + if (this .comma ()) + { + if (this .double ()) + { + var ty = this .value; + } + } + else + { + var ty = 0; + } + + this .whitespaces (); + + if (SVGParser_Grammar .closeParenthesis .parse (this)) + { + matrix .translate (new Numbers_Vector2 (tx, ty)); + continue; + } + } + } + } + else if (SVGParser_Grammar .rotate .parse (this)) + { + this .whitespaces (); + + if (SVGParser_Grammar .openParenthesis .parse (this)) + { + if (this .double ()) + { + const angle = this .value; + + this .whitespaces (); + + if (SVGParser_Grammar .closeParenthesis .parse (this)) + { + matrix .rotate (Math_Algorithm .radians (angle)); + continue; + } + else + { + if (this .comma ()) + { + if (this .double ()) + { + const cx = this .value; + + if (this .comma ()) + { + if (this .double ()) + { + const cy = this .value; + + this .whitespaces (); + + if (SVGParser_Grammar .closeParenthesis .parse (this)) + { + matrix .translate (new Numbers_Vector2 (cx, cy)); + matrix .rotate (Math_Algorithm .radians (angle)); + matrix .translate (new Numbers_Vector2 (-cx, -cy)); + continue; + } + } + } + } + } + } + } + } + } + else if (SVGParser_Grammar .scale .parse (this)) + { + this .whitespaces (); + + if (SVGParser_Grammar .openParenthesis .parse (this)) + { + if (this .double ()) + { + const sx = this .value; + + if (this .comma ()) + { + if (this .double ()) + { + var sy = this .value; + } + } + else + { + var sy = sx; + } + + this .whitespaces (); + + if (SVGParser_Grammar .closeParenthesis .parse (this)) + { + matrix .scale (new Numbers_Vector2 (sx, sy)); + continue; + } + } + } + } + else if (SVGParser_Grammar .skewX .parse (this)) + { + this .whitespaces (); + + if (SVGParser_Grammar .openParenthesis .parse (this)) + { + if (this .double ()) + { + const angle = this .value; + + this .whitespaces (); + + if (SVGParser_Grammar .closeParenthesis .parse (this)) + { + matrix .skewX (Math_Algorithm .radians (angle)); + continue; + } + } + } + } + else if (SVGParser_Grammar .skewY .parse (this)) + { + this .whitespaces (); + + if (SVGParser_Grammar .openParenthesis .parse (this)) + { + if (this .double ()) + { + const angle = this .value; + + this .whitespaces (); + + if (SVGParser_Grammar .closeParenthesis .parse (this)) + { + matrix .skewY (Math_Algorithm .radians (angle)); + continue; + } + } + } + } + + break; + } + + return matrix; + }, + styleAttributes (xmlElement) + { + const style = Object .assign ({ }, this .styles .at (-1)); + + if (this .style .display === "none") + return false; + + this .styles .push (style); + + for (const attribute of xmlElement .attributes) + this .parseStyle (attribute .name, attribute .value) + + // Style attribute has higher precedence. + + this .styleAttribute (xmlElement .getAttribute ("style")); + + return true; + }, + styleAttribute (attribute) + { + if (attribute === null) + return; + + const values = attribute .split (";"); + + for (const value of values) + { + const pair = value .split (":"); + + if (pair .length !== 2) + continue; + + this .parseStyle (pair [0] .trim (), pair [1] .trim ()); + } + }, + parseStyle (style, value) + { + if (value === "inherit" || value == "unset") + return; + + this .parseValue (value); + + switch (style) + { + case "display": + this .displayStyle (value); + break; + case "fill": + this .fillStyle (value); + break; + case "fill-opacity": + this .fillOpacityStyle (value); + break; + case "fill-rule": + this .fillRuleStyle (value); + break; + case "stroke": + this .strokeStyle (value); + break; + case "stroke-opacity": + this .strokeOpacityStyle (value); + break; + case "stroke-width": + this .strokeWidthStyle (value); + break; + case "opacity": + this .opacityStyle (value); + break; + case "stop-color": + this .stopColorStyle (value); + break; + case "stop-opacity": + this .stopOpacityStyle (value); + break; + case "vector-effect": + this .vectorEffectStyle (value); + break; + } + }, + displayStyle (value) + { + if (value === "default") + { + this .style .display = "inline"; + return; + } + + this .style .display = value; + }, + fillStyle (value) + { + if (value === "default") + { + this .style .fillType = this .styles [0] .fillType; + this .style .fillColor = this .styles [0] .fillColor; + this .style .fillURL = this .styles [0] .fillURL; + return; + } + + if (value === "transparent") + { + this .style .fillType = "none"; + return; + } + + if (value === "none") + { + this .style .fillType = "none"; + return; + } + + if (this .urlValue ()) + { + this .style .fillType = "URL"; + this .style .fillURL = this .result [1] .trim (); + return; + } + + if (this .colorValue (this .styles .at (-1) .fillColor)) + { + this .style .fillType = "COLOR"; + this .style .fillColor = this .value .copy (); + return; + } + }, + fillOpacityStyle (value) + { + if (value === "default") + { + this .style .fillOpacity = this .styles [0] .fillOpacity; + return; + } + + if (value === "transparent") + { + this .style .fillOpacity = 0; + return; + } + + if (this .double ()) + { + this .style .fillOpacity = Math_Algorithm .clamp (this .value, 0, 1); + return; + } + }, + fillRuleStyle (value) + { + if (value === "default") + { + this .style .fillRule = this .styles [0] .fillRule; + return; + } + + this .style .fillRule = value; + }, + strokeStyle (value) + { + if (value === "default") + { + this .style .strokeType = this .styles [0] .strokeType; + this .style .strokeColor = this .styles [0] .strokeColor; + this .style .strokeURL = this .styles [0] .strokeURL; + return; + } + + if (value === "transparent") + { + this .style .strokeType = "none"; + return; + } + + if (value === "none") + { + this .style .strokeType = "none"; + return; + } + + if (this .urlValue ()) + { + this .style .strokeType = "URL"; + this .style .strokeURL = this .result [1] .trim (); + return; + } + + if (this .colorValue (this .styles .at (-1) .strokeColor)) + { + this .style .strokeType = "COLOR"; + this .style .strokeColor = this .value .copy (); + return; + } + }, + strokeOpacityStyle (value) + { + if (value === "default") + { + this .style .strokeOpacity = this .styles [0] .strokeOpacity; + return; + } + + if (value === "transparent") + { + this .style .strokeOpacity = 0; + return; + } + + if (this .double ()) + { + this .style .strokeOpacity = Math_Algorithm .clamp (this .value, 0, 1); + return; + } + }, + strokeWidthStyle (value) + { + if (value === "default") + { + this .style .strokeWidth = this .styles [0] .strokeWidth; + return; + } + + if (value === "none") + { + this .style .strokeWidth = 0; + return; + } + + if (this .double ()) + { + this .style .strokeWidth = this .lengthAttribute (this .value, 1); + return; + } + }, + opacityStyle (value) + { + if (value === "default") + { + this .style .opacity = this .styles [0] .opacity; + return; + } + + if (value === "transparent") + { + this .style .opacity = 0; + return; + } + + if (this .double ()) + { + this .style .opacity = Math_Algorithm .clamp (this .value, 0, 1) * this .styles .at (-1) .opacity; + return; + } + }, + stopColorStyle (value) + { + if (value === "default") + { + this .style .stopColor = this .styles [0] .stopColor; + return; + } + + if (this .colorValue (Numbers_Color4 .Black)) + { + this .style .stopColor = this .value .copy (); + return; + } + }, + stopOpacityStyle (value) + { + if (value === "default") + { + this .style .stopOpacity = this .styles [0] .stopOpacity; + return; + } + + if (value === "transparent") + { + this .style .stopOpacity = 0; + return; + } + + if (this .double ()) + { + this .style .stopOpacity = Math_Algorithm .clamp (this .value, 0, 1); + return; + } + }, + vectorEffectStyle (value) + { + if (value === "default") + { + this .style .vectorEffect = this .styles [0] .vectorEffect; + return; + } + + this .style .vectorEffect = value; + }, + parseValue (value) + { + this .input = value; + this .lastIndex = 0; + this .value = undefined; + }, + whitespaces () + { + return SVGParser_Grammar .whitespaces .parse (this); + }, + comma () + { + return !! (this .whitespaces () | SVGParser_Grammar .comma .parse (this)); + }, + int32 () + { + this .whitespaces (); + + if (SVGParser_Grammar .int32 .parse (this)) + { + this .value = parseInt (this .result [1]); + + return true; + } + + return false; + }, + double () + { + this .whitespaces (); + + if (SVGParser_Grammar .double .parse (this)) + { + this .value = parseFloat (this .result [1]); + + return true; + } + + if (SVGParser_Grammar .constants .parse (this)) + { + this .value = this .CONSTANTS .get (this .result [2] .toUpperCase ()); + + if (this .result [1] === "-") + this .value = - this .value; + + return true; + } + + return false; + }, + colorValue: (() => + { + const color = new Numbers_Color4 (0, 0, 0, 0); + + return function (c) + { + if (!SVGParser_Grammar .color .parse (this)) + return false; + + const defaultColor = this .cssColor (c); + + this .value = color .set (... this .convertColor (this .result [1], defaultColor)); + + return true; + }; + })(), + urlValue () + { + return SVGParser_Grammar .url .parse (this); + }, + cssColor (c, a = c .a) + { + return `rgba(${c .r * 255},${c .g * 255},${c .b * 255},${a})`; + }, + createTransform (xmlElement, t = Numbers_Vector2 .Zero, s = Numbers_Vector2 .One) + { + // Determine matrix. + + const + scene = this .getExecutionContext (), + m = this .transformAttribute (xmlElement .getAttribute ("transform")); + + this .modelMatrix .push (); + this .modelMatrix .multLeft (Numbers_Matrix4 .Matrix3 (m)); + + m .translate (t); + m .scale (s); + + // Create node. + + const + transformNode = scene .createNode ("Transform"), + matrix = Numbers_Matrix4 .Matrix3 (m), + translation = new Numbers_Vector3 (0, 0, 0), + rotation = new Numbers_Rotation4 (), + scale = new Numbers_Vector3 (1, 1, 1), + scaleOrientation = new Numbers_Rotation4 (); + + matrix .get (translation, rotation, scale, scaleOrientation); + + transformNode .translation = translation; + transformNode .rotation = rotation; + transformNode .scale = scale; + transformNode .scaleOrientation = scaleOrientation; + + // Set name. + + this .idAttribute (xmlElement .getAttribute ("id"), transformNode); + + // Add node to parent. + + this .groupNodes .at (-1) .children .push (transformNode); + + return transformNode; + }, + popAll () + { + this .groupNodes .pop (); + this .modelMatrix .pop (); + this .styles .pop (); + }, + createFillAppearance (bbox) + { + const + scene = this .getExecutionContext (), + appearanceNode = scene .createNode ("Appearance"); + + switch (this .style .fillType) + { + case "none": + { + return null; + } + case "COLOR": + { + const materialNode = scene .createNode ("UnlitMaterial"); + + appearanceNode .material = materialNode; + materialNode .emissiveColor = new Numbers_Color3 (... this .style .fillColor); + materialNode .transparency = 1 - this .style .fillOpacity * this .style .opacity; + + break; + } + case "URL": + { + // Gradient + + const + scene = this .getExecutionContext (), + textureNode = scene .createNode ("ImageTexture"), + url = this .getFillUrl (this .style .fillURL, bbox); + + // Get image from url. + + if (!url) + return null; + + textureNode .url = [url]; + textureNode .textureProperties = this .texturePropertiesNode; + appearanceNode .texture = textureNode; + + break; + } + } + + return appearanceNode; + }, + getFillUrl (fillURL, bbox) + { + const xmlElement = this .hrefAttribute (fillURL); + + if (!xmlElement) + return; + + switch (xmlElement .nodeName) + { + case "linearGradient": + return this .linearGradientElementUrl (xmlElement, bbox); + + case "radialGradient": + return this .radialGradientElementUrl (xmlElement, bbox); + + case "pattern": + return this .patternUrl (xmlElement); + } + }, + createStrokeAppearance () + { + const + scene = this .getExecutionContext (), + appearanceNode = scene .createNode ("Appearance"), + materialNode = scene .createNode ("UnlitMaterial"); + + appearanceNode .material = materialNode; + materialNode .emissiveColor = new Numbers_Color3 (... this .style .strokeColor); + materialNode .transparency = 1 - this .style .strokeOpacity * this .style .opacity; + + const strokeWidth = this .vectorEffect === "non-scaling-stroke" + ? this .style .strokeWidth + : this .getStokeWidth (); + + if (strokeWidth > 1) + appearanceNode .lineProperties = this .getLineProperties (strokeWidth); + + return appearanceNode; + }, + getStokeWidth () + { + const + modelMatrix = this .modelMatrix .get (), + strokeWidth = modelMatrix .multDirMatrix (new Numbers_Vector3 (this .style .strokeWidth, this .style .strokeWidth, 0)); + + return (strokeWidth .x + strokeWidth .y) / 2; + }, + getLineProperties (strokeWidth) + { + const lineProperties = this .lineProperties .get (strokeWidth); + + if (lineProperties) + { + return lineProperties; + } + else + { + const + scene = this .getExecutionContext (), + lineProperties = scene .createNode ("LineProperties"); + + lineProperties .linewidthScaleFactor = strokeWidth; + + this .lineProperties .set (strokeWidth, lineProperties); + + return lineProperties; + } + }, + createTextureProperties () + { + const + scene = this .getExecutionContext (), + texturePropertiesNode = scene .createNode ("TextureProperties"); + + texturePropertiesNode .generateMipMaps = true; + texturePropertiesNode .minificationFilter = "NICEST"; + texturePropertiesNode .magnificationFilter = "NICEST"; + texturePropertiesNode .boundaryModeS = "CLAMP_TO_EDGE"; + texturePropertiesNode .boundaryModeT = "CLAMP_TO_EDGE"; + texturePropertiesNode .boundaryModeR = "CLAMP_TO_EDGE"; + texturePropertiesNode .textureCompression = "DEFAULT"; + + return texturePropertiesNode; + }, + createTextureCoordinate (coordinateNode, bbox, appearance) + { + if (!appearance || !appearance .texture) + return null; + + const + scene = this .getExecutionContext (), + texCoordNode = scene .createNode ("TextureCoordinate"), + invMatrix = bbox .matrix .copy () .inverse (); + + for (const point of coordinateNode .point) + texCoordNode .point .push (invMatrix .multVecMatrix (new Numbers_Vector2 (point .x, point .y)) .add (Numbers_Vector2 .One) .divide (2)); + + return texCoordNode; + }, + createTesselator () + { + // Function called for each vertex of tessellator output. + + function vertexCallback (index, triangles) + { + triangles .push (index); + } + + const tessy = new libtess .GluTesselator (); + + tessy .gluTessCallback (libtess .gluEnum .GLU_TESS_VERTEX_DATA, vertexCallback); + tessy .gluTessNormal (0, 0, 1); + + return tessy; + }, + triangulatePolygon (contours, coordinateNode) + { + // Callback for when segments intersect and must be split. + + function combineCallback (coords, data, weight) + { + const index = coordinateNode .point .length; + + coordinateNode .point .push (new Numbers_Vector3 (... coords)); + + return index; + } + + const + tessy = this .tessy, + winding = this .style .fillRule === "evenodd" ? "GLU_TESS_WINDING_ODD" : "GLU_TESS_WINDING_NONZERO", + triangles = [ ]; + + tessy .gluTessProperty (libtess .gluEnum .GLU_TESS_WINDING_RULE, libtess .windingRule [winding]); + tessy .gluTessCallback (libtess .gluEnum .GLU_TESS_COMBINE, combineCallback); + tessy .gluTessBeginPolygon (triangles); + + for (const points of contours) + { + tessy .gluTessBeginContour (); + + for (const [i, point] of points .entries ()) + tessy .gluTessVertex (point, points .index + i); + + tessy .gluTessEndContour (); + } + + tessy .gluTessEndPolygon (); + + // Array of indices of triangles. + return triangles; + }, +}); + +Object .defineProperty (SVGParser .prototype, "style", +{ + get () + { + return this .styles .at (-1); + }, +}) + +const SVGParser_default_ = SVGParser; +; + +x_ite_Namespace .add ("SVGParser", "x_ite/Parser/SVGParser", SVGParser_default_); +/* harmony default export */ const Parser_SVGParser = (SVGParser_default_); +;// CONCATENATED MODULE: ./src/x_ite/Parser/GoldenGate.js +/* provided dependency */ var GoldenGate_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + +function GoldenGate (scene) +{ + Parser_X3DParser .call (this, scene); + + this .inputs = new Map (); +} + +Object .assign (Object .setPrototypeOf (GoldenGate .prototype, Parser_X3DParser .prototype), +{ + parseIntoScene (x3dSyntax, resolve, reject) + { + for (const Parser of GoldenGate .Parser) + { + try + { + const + parser = new Parser (this .getScene ()), + input = this .getInput (parser .getEncoding (), x3dSyntax); + + if (Array .isArray (input) ? input .some (i => i === undefined) : input === undefined) + continue; + + parser .setInput (input); + + if (!parser .isValid ()) + continue; + + parser .pushExecutionContext (this .getExecutionContext ()); + parser .parseIntoScene (resolve, reject); + return; + } + catch (error) + { + if (reject) + reject (error); + else + throw error; + + return; + } + } + + if (this .getScene () .worldURL .startsWith ("data:")) + throw new Error ("Couldn't parse X3D. No suitable file handler found for 'data:' URL."); + else + throw new Error (`Couldn't parse X3D. No suitable file handler found for '${this .getScene () .worldURL}'.`); + }, + getInput (encoding, x3dSyntax) + { + if (Array .isArray (encoding)) + { + return encoding .map (encoding => this .getInput (encoding)); + } + else + { + if (this .inputs .has (encoding)) + return this .inputs .get (encoding); + + const input = this .createInput (encoding, x3dSyntax); + + this .inputs .set (encoding, input); + + return input; + } + }, + createInput (encoding, x3dSyntax) + { + try + { + switch (encoding) + { + case "STRING": + return GoldenGate_$.decodeText (x3dSyntax); + case "XML": + return GoldenGate_$.parseXML (this .getInput ("STRING", x3dSyntax)); + case "JSON": + return JSON .parse (this .getInput ("STRING", x3dSyntax)); + case "ARRAY_BUFFER": + return x3dSyntax instanceof ArrayBuffer ? x3dSyntax : undefined; + } + } + catch + { + return undefined; + } + }, +}); + +GoldenGate .Parser = [ + Parser_SVGParser, + Parser_XMLParser, + Parser_GLTF2Parser, + Parser_GLB2Parser, + Parser_JSONParser, + Parser_VRMLParser, + Parser_OBJParser, + Parser_STLAParser, + Parser_STLBParser, + Parser_PLYAParser, + Parser_PLYBParser, +]; + +const GoldenGate_default_ = GoldenGate; +; + +x_ite_Namespace .add ("GoldenGate", "x_ite/Parser/GoldenGate", GoldenGate_default_); +/* harmony default export */ const Parser_GoldenGate = (GoldenGate_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Geometry/Plane3.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +const + normal = new Numbers_Vector3 (0, 0, 0), + point = new Numbers_Vector3 (0, 0, 0), + invMatrix = new Numbers_Matrix4 (); + +function Plane3 (point, normal) +{ + this .normal = normal .copy (); + this .distanceFromOrigin = normal .dot (point); +} + +Object .assign (Plane3 .prototype, +{ + copy () + { + const copy = Object .create (Plane3 .prototype); + copy .normal = this .normal .copy (); + copy .distanceFromOrigin = this .distanceFromOrigin; + return copy; + }, + assign (plane) + { + this .normal .assign (plane .normal); + this .distanceFromOrigin = plane .distanceFromOrigin; + return this; + }, + set (point, normal) + { + this .normal .assign (normal); + this .distanceFromOrigin = normal .dot (point); + return this; + }, + multRight (matrix) + { + // Taken from Inventor: + + // Find the point on the plane along the normal from the origin + point .assign (this .normal) .multiply (this .distanceFromOrigin); + + // Transform the plane normal by the matrix + // to get the new normal. Use the inverse transpose + // of the matrix so that normals are not scaled incorrectly. + // n' = n * !~m = ~m * n + invMatrix .assign (matrix) .inverse (); + invMatrix .multMatrixDir (normal .assign (this .normal)) .normalize (); + + // Transform the point by the matrix + matrix .multVecMatrix (point); + + // The new distance is the projected distance of the vector to the + // transformed point onto the (unit) transformed normal. This is + // just a dot product. + this .normal .assign (normal); + this .distanceFromOrigin = normal .dot (point); + + return this; + }, + multLeft (matrix) + { + // Taken from Inventor: + + // Find the point on the plane along the normal from the origin + point .assign (this .normal) .multiply (this .distanceFromOrigin); + + // Transform the plane normal by the matrix + // to get the new normal. Use the inverse transpose + // of the matrix so that normals are not scaled incorrectly. + // n' = !~m * n = n * ~m + invMatrix .assign (matrix) .inverse (); + invMatrix .multDirMatrix (normal .assign (this .normal)) .normalize (); + + // Transform the point by the matrix + matrix .multMatrixVec (point); + + // The new distance is the projected distance of the vector to the + // transformed point onto the (unit) transformed normal. This is + // just a dot product. + this .normal .assign (normal); + this .distanceFromOrigin = normal .dot (point); + + return this; + }, + getDistanceToPoint (point) + { + return point .dot (this .normal) - this .distanceFromOrigin; + }, + intersectsLine (line, intersection) + { + const { point, direction } = line; + + // Check if the line is parallel to the plane. + const theta = direction .dot (this .normal); + + // Plane and line are parallel. + if (theta === 0) + return false; + + // Plane and line are not parallel. The intersection point can be calculated now. + const t = (this .distanceFromOrigin - this .normal .dot (point)) / theta; + + intersection .x = point .x + direction .x * t; + intersection .y = point .y + direction .y * t; + intersection .z = point .z + direction .z * t; + + return true; + }, + toString () + { + return `${this .normal} ${this .distanceFromOrigin}`; + }, +}); + +const Plane3_default_ = Plane3; +; + +x_ite_Namespace .add ("Plane3", "standard/Math/Geometry/Plane3", Plane3_default_); +/* harmony default export */ const Geometry_Plane3 = (Plane3_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Geometry/Triangle3.js +/* provided dependency */ var Triangle3_libtess = __webpack_require__(180); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +const Triangle3 = +{ + area: (() => + { + const + B = new Numbers_Vector3 (0, 0, 0), + C = new Numbers_Vector3 (0, 0, 0); + + return function (a, b, c) + { + return B .assign (b) .subtract (a) .cross (C .assign (c) .subtract (a)) .magnitude () / 2; + }; + })(), + normal (v1, v2, v3, normal) + { + const + x1 = v3 .x - v2 .x, + y1 = v3 .y - v2 .y, + z1 = v3 .z - v2 .z, + x2 = v1 .x - v2 .x, + y2 = v1 .y - v2 .y, + z2 = v1 .z - v2 .z; + + normal .set (y1 * z2 - z1 * y2, + z1 * x2 - x1 * z2, + x1 * y2 - y1 * x2); + + return normal .normalize (); + }, + quadNormal (v1, v2, v3, v4, normal) + { + const + x1 = v3 .x - v1 .x, + y1 = v3 .y - v1 .y, + z1 = v3 .z - v1 .z, + x2 = v4 .x - v2 .x, + y2 = v4 .y - v2 .y, + z2 = v4 .z - v2 .z; + + normal .set (y1 * z2 - z1 * y2, + z1 * x2 - x1 * z2, + x1 * y2 - y1 * x2); + + return normal .normalize (); + }, + triangulatePolygon: (() => + { + // Function called for each vertex of tesselator output. + + function vertexCallback (index, triangles) + { + triangles .push (index); + } + + // Required in case of a combine, otherwise an empty array is returned. + + function combineCallback (coords, data, weight) + { + return data [0]; + } + + const tessy = new Triangle3_libtess .GluTesselator (); + + tessy .gluTessCallback (Triangle3_libtess .gluEnum .GLU_TESS_VERTEX_DATA, vertexCallback); + tessy .gluTessCallback (Triangle3_libtess .gluEnum .GLU_TESS_COMBINE, combineCallback); + tessy .gluTessProperty (Triangle3_libtess .gluEnum .GLU_TESS_WINDING_RULE, Triangle3_libtess .windingRule .GLU_TESS_WINDING_ODD); + + return function (polygon, triangles) + { + tessy .gluTessBeginPolygon (triangles); + tessy .gluTessBeginContour (); + + for (const point of polygon) + tessy .gluTessVertex (point, point .index); + + tessy .gluTessEndContour (); + tessy .gluTessEndPolygon (); + + // Return array of indices. + return triangles; + }; + })(), + triangulateConvexPolygon (vertices, triangles) + { + // Fallback: Very simple triangulation for convex polygons. + for (let i = 1, length = vertices .length - 1; i < length; ++ i) + triangles .push (vertices [0], vertices [i], vertices [i + 1]); + }, +}; + +const Triangle3_default_ = Triangle3; +; + +x_ite_Namespace .add ("Triangle3", "standard/Math/Geometry/Triangle3", Triangle3_default_); +/* harmony default export */ const Geometry_Triangle3 = (Triangle3_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Algorithms/SAT.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +const + extents1 = { min: 0, max: 0 }, + extents2 = { min: 0, max: 0 }; + +/** + * Class to represent the Separating Axis Theorem. + */ +function SAT () { } + +SAT .isSeparated = function (axes, points1, points2) +{ + // https://gamedev.stackexchange.com/questions/25397/obb-vs-obb-collision-detection + + for (const axis of axes) + { + project (points1, axis, extents1); + project (points2, axis, extents2); + + if (overlaps (extents1 .min, extents1 .max, extents2 .min, extents2 .max)) + continue; + + return true; + } + + return false; +}; + +/// Projects @a points to @a axis and returns the minimum and maximum bounds. +function project (points, axis, extents) +{ + extents .min = Number .POSITIVE_INFINITY; + extents .max = Number .NEGATIVE_INFINITY; + + for (const point of points) + { + // Just dot it to get the min and max along this axis. + // NOTE: the axis must be normalized to get accurate projections to calculate the MTV, but if it is only needed to + // know whether it overlaps, every axis can be used. + + const dotVal = point .dot (axis); + + if (dotVal < extents .min) + extents .min = dotVal; + + if (dotVal > extents .max) + extents .max = dotVal; + } +} + +/// Returns true if both ranges overlap, otherwise false. +function overlaps (min1, max1, min2, max2) +{ + return is_between (min2, min1, max1) || is_between (min1, min2, max2); +} + +/// Returns true if @a value is between @a lowerBound and @a upperBound, otherwise false. +function is_between (value, lowerBound, upperBound) +{ + return lowerBound <= value && value <= upperBound; +} + +const SAT_default_ = SAT; +; + +x_ite_Namespace .add ("SAT", "standard/Math/Algorithms/SAT", SAT_default_); +/* harmony default export */ const Algorithms_SAT = (SAT_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Geometry/ViewVolume.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +/* + * p7 -------- p6 far plane + * | \ | \ + * | p3 --------- p2 + * | | | | + * | | | | + * p4 |______ p5 | + * \ | \ | + * \| \| + * p0 -------- p1 near plane + */ + +function ViewVolume (projectionMatrix, viewport, scissor) +{ + this .viewport = new Numbers_Vector4 (0, 0, 0, 0); + this .scissor = new Numbers_Vector4 (0, 0, 0, 0); + + this .points = [ + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + ]; + + this .normals = [ + new Numbers_Vector3 (0, 0, 0), // front + new Numbers_Vector3 (0, 0, 0), // left + new Numbers_Vector3 (0, 0, 0), // right + new Numbers_Vector3 (0, 0, 0), // top + new Numbers_Vector3 (0, 0, 0), // bottom + new Numbers_Vector3 (0, 0, 0), // back + ]; + + this .edges = [ + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + ]; + + this .planes = [ + new Geometry_Plane3 (Numbers_Vector3 .Zero, Numbers_Vector3 .Zero), // front + new Geometry_Plane3 (Numbers_Vector3 .Zero, Numbers_Vector3 .Zero), // left + new Geometry_Plane3 (Numbers_Vector3 .Zero, Numbers_Vector3 .Zero), // right + new Geometry_Plane3 (Numbers_Vector3 .Zero, Numbers_Vector3 .Zero), // top + new Geometry_Plane3 (Numbers_Vector3 .Zero, Numbers_Vector3 .Zero), // bottom + new Geometry_Plane3 (Numbers_Vector3 .Zero, Numbers_Vector3 .Zero), // back + ]; + + if (arguments .length) + this .set (projectionMatrix, viewport, scissor); +} + +Object .assign (ViewVolume .prototype, +{ + set: (() => + { + const matrix = new Numbers_Matrix4 (); + + return function (projectionMatrix, viewport, scissor) + { + this .viewport .assign (viewport); + this .scissor .assign (scissor); + + const [p0, p1 ,p2, p3, p4, p5, p6, p7] = this .points; + + const + x1 = scissor [0], + x2 = x1 + scissor [2], + y1 = scissor [1], + y2 = y1 + scissor [3]; + + matrix .assign (projectionMatrix) .inverse (); + + ViewVolume .unProjectPointMatrix (x1, y1, 0, matrix, viewport, p0), + ViewVolume .unProjectPointMatrix (x2, y1, 0, matrix, viewport, p1), + ViewVolume .unProjectPointMatrix (x2, y2, 0, matrix, viewport, p2), + ViewVolume .unProjectPointMatrix (x1, y2, 0, matrix, viewport, p3), + ViewVolume .unProjectPointMatrix (x1, y1, 1, matrix, viewport, p4), + ViewVolume .unProjectPointMatrix (x2, y1, 1, matrix, viewport, p5); + ViewVolume .unProjectPointMatrix (x2, y2, 1, matrix, viewport, p6); + ViewVolume .unProjectPointMatrix (x1, y2, 1, matrix, viewport, p7); + + const normals = this .normals; + + Geometry_Triangle3 .normal (p0, p1, p2, normals [0]); // front + Geometry_Triangle3 .normal (p7, p4, p0, normals [1]); // left + Geometry_Triangle3 .normal (p6, p2, p1, normals [2]); // right + Geometry_Triangle3 .normal (p2, p6, p7, normals [3]); // top + Geometry_Triangle3 .normal (p1, p0, p4, normals [4]); // bottom + Geometry_Triangle3 .normal (p4, p7, p6, normals [5]); // back + + const planes = this .planes; + + planes [0] .set (p1, normals [0]); // front + planes [1] .set (p4, normals [1]); // left + planes [2] .set (p2, normals [2]); // right + planes [3] .set (p6, normals [3]); // top + planes [4] .set (p0, normals [4]); // bottom + planes [5] .set (p7, normals [5]); // back + + this .edges .tainted = true; + + return this; + }; + })(), + getViewport () + { + return this .viewport; + }, + getScissor () + { + return this .scissor; + }, + getEdges () + { + // Return suitable edges for SAT theorem. + + const edges = this .edges; + + if (edges .tainted) + { + const [p0, p1 ,p2, p3, p4, p5, p6, p7] = this .points; + + edges [0] .assign (p0) .subtract (p1); + edges [1] .assign (p1) .subtract (p2); + edges [2] .assign (p2) .subtract (p3); + edges [3] .assign (p3) .subtract (p0); + + edges [4] .assign (p0) .subtract (p4); + edges [5] .assign (p1) .subtract (p5); + edges [6] .assign (p2) .subtract (p6); + edges [7] .assign (p3) .subtract (p7); + + // Edges 8 - 11 are equal to edges 0 - 3. + + edges .tainted = false; + } + + return edges; + }, + intersectsSphere (radius, center) + { + const [p0, p1 ,p2, p3, p4, p5, p6, p7] = this .planes; + + if (p0 .getDistanceToPoint (center) > radius) + return false; + + if (p1 .getDistanceToPoint (center) > radius) + return false; + + if (p2 .getDistanceToPoint (center) > radius) + return false; + + if (p3 .getDistanceToPoint (center) > radius) + return false; + + if (p4 .getDistanceToPoint (center) > radius) + return false; + + if (p5 .getDistanceToPoint (center) > radius) + return false; + + return true; + }, + intersectsBox: (() => + { + const points1 = [ + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + ]; + + const normals1 = [ + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + ]; + + const axes1 = [ + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + ]; + + const axes = [ ]; + + for (let i = 0; i < 3 * 8; ++ i) + axes .push (new Numbers_Vector3 (0, 0, 0)); + + return function (box) + { + // Get points. + + box .getPoints (points1); + + const points2 = this .points; + + // Test the three planes spanned by the normal vectors of the faces of the box. + + if (Algorithms_SAT .isSeparated (box .getNormals (normals1), points1, points2)) + return false; + + // Test the six planes spanned by the normal vectors of the faces of the view volume. + + if (Algorithms_SAT .isSeparated (this .normals, points1, points2)) + return false; + + // Test the planes spanned by the edges of each object. + + box .getAxes (axes1); + + const edges = this .getEdges (); + + for (let i1 = 0; i1 < 3; ++ i1) + { + for (let i2 = 0; i2 < 8; ++ i2) + axes [i1 * 3 + i2] .assign (axes1 [i1]) .cross (edges [i2]); + } + + if (Algorithms_SAT .isSeparated (axes, points1, points2)) + return false; + + // Both boxes intersect. + + return true; + }; + })(), +}); + +Object .assign (ViewVolume, +{ + unProjectPoint: (() => + { + const invModelViewProjectionMatrix = new Numbers_Matrix4 (); + + return function (winx, winy, winz, modelViewMatrix, projectionMatrix, viewport, point) + { + return this .unProjectPointMatrix (winx, winy, winz, invModelViewProjectionMatrix .assign (modelViewMatrix) .multRight (projectionMatrix) .inverse (), viewport, point); + }; + })(), + unProjectPointMatrix: (() => + { + const vin = new Numbers_Vector4 (0, 0, 0, 0); + + return function (winx, winy, winz, invModelViewProjectionMatrix, viewport, point) + { + // Transformation of normalized coordinates between -1 and 1 + vin .set ((winx - viewport [0]) / viewport [2] * 2 - 1, + (winy - viewport [1]) / viewport [3] * 2 - 1, + 2 * winz - 1, + 1); + + //Objects coordinates + invModelViewProjectionMatrix .multVecMatrix (vin); + + const d = 1 / vin .w; + + return point .set (vin .x * d, vin .y * d, vin .z * d, 1); + }; + })(), + unProjectRay: (() => + { + const invModelViewProjectionMatrix = new Numbers_Matrix4 (); + + return function (winx, winy, modelViewMatrix, projectionMatrix, viewport, result) + { + return this .unProjectRayMatrix (winx, winy, invModelViewProjectionMatrix .assign (modelViewMatrix) .multRight (projectionMatrix) .inverse (), viewport, result); + }; + })(), + unProjectRayMatrix: (() => + { + const + near = new Numbers_Vector3 (0, 0, 0), + far = new Numbers_Vector3 (0, 0, 0); + + return function (winx, winy, invModelViewProjectionMatrix, viewport, result) + { + ViewVolume .unProjectPointMatrix (winx, winy, 0.0, invModelViewProjectionMatrix, viewport, near); + ViewVolume .unProjectPointMatrix (winx, winy, 0.9, invModelViewProjectionMatrix, viewport, far); + + return result .setPoints (near, far); + }; + })(), + projectPoint: (() => + { + const vin = new Numbers_Vector4 (0, 0, 0, 0); + + return function (point, modelViewMatrix, projectionMatrix, viewport, vout) + { + if (point .length === 4) + vin .assign (point); + else + vin .set (point .x, point .y, point .z, 1); + + projectionMatrix .multVecMatrix (modelViewMatrix .multVecMatrix (vin)); + + const d = 1 / (2 * vin .w); + + return vout .set ((vin .x * d + 0.5) * viewport [2] + viewport [0], + (vin .y * d + 0.5) * viewport [3] + viewport [1], + (vin .z * d + 0.5)); + }; + })(), + projectPointMatrix: (() => + { + const vin = new Numbers_Vector4 (0, 0, 0, 0); + + return function (point, modelViewProjectionMatrix, viewport, vout) + { + if (point .length === 4) + vin .assign (point); + else + vin .set (point .x, point .y, point .z, 1); + + modelViewProjectionMatrix .multVecMatrix (vin); + + const d = 1 / (2 * vin .w); + + return vout .set ((vin .x * d + 0.5) * viewport [2] + viewport [0], + (vin .y * d + 0.5) * viewport [3] + viewport [1], + (vin .z * d + 0.5)); + }; + })(), + projectLine: (() => + { + const modelViewProjectionMatrix = new Numbers_Matrix4 (); + + return function (line, modelViewMatrix, projectionMatrix, viewport, result) + { + return this .projectLineMatrix (line, modelViewProjectionMatrix .assign (modelViewMatrix) .multRight (projectionMatrix), viewport, result); + }; + })(), + projectLineMatrix: (() => + { + const + near = new Numbers_Vector2 (0, 0), + far = new Numbers_Vector2 (0, 0), + direction = new Numbers_Vector3 (0, 0, 0); + + return function (line, modelViewProjectionMatrix, viewport, result) + { + ViewVolume .projectPointMatrix (line .point, modelViewProjectionMatrix, viewport, near); + ViewVolume .projectPointMatrix (direction .assign (line .direction) .multiply (1e9) .add (line .point), modelViewProjectionMatrix, viewport, far); + + return result .setPoints (near, far); + }; + })(), +}); + +const ViewVolume_default_ = ViewVolume; +; + +x_ite_Namespace .add ("ViewVolume", "standard/Math/Geometry/ViewVolume", ViewVolume_default_); +/* harmony default export */ const Geometry_ViewVolume = (ViewVolume_default_); +;// CONCATENATED MODULE: ./src/x_ite/Rendering/TextureBuffer.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function TextureBuffer (browser, width, height, float = false) +{ + const gl = browser .getContext (); + + this .context = gl; + this .width = width; + this .height = height; + + Object .defineProperty (this, "array", + { + get () + { + const value = float ? new Float32Array (width * height * 4) : new Uint8Array (width * height * 4); + + Object .defineProperty (this, "array", { value: value }); + + return value; + }, + configurable: true, + }); + + // Create frame buffer. + + this .lastBuffer = gl .getParameter (gl .FRAMEBUFFER_BINDING); + this .frameBuffer = gl .createFramebuffer (); + + gl .bindFramebuffer (gl .FRAMEBUFFER, this .frameBuffer); + + // Create color texture. + + this .colorTexture = gl .createTexture (); + + gl .bindTexture (gl .TEXTURE_2D, this .colorTexture); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_WRAP_S, gl .CLAMP_TO_EDGE); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_WRAP_T, gl .CLAMP_TO_EDGE); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_MIN_FILTER, gl .LINEAR); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_MAG_FILTER, gl .LINEAR); + + if (float) + gl .texImage2D (gl .TEXTURE_2D, 0, gl .getVersion () > 1 ? gl .RGBA32F : gl .RGBA, width, height, 0, gl .RGBA, gl .FLOAT, null); + else + gl .texImage2D (gl .TEXTURE_2D, 0, gl .RGBA, width, height, 0, gl .RGBA, gl .UNSIGNED_BYTE, null); + + gl .framebufferTexture2D (gl .FRAMEBUFFER, gl .COLOR_ATTACHMENT0, gl .TEXTURE_2D, this .colorTexture, 0); + + // Create depth buffer. + + if (gl .HAS_FEATURE_DEPTH_TEXTURE) + { + this .depthTexture = gl .createTexture (); + + gl .bindTexture (gl .TEXTURE_2D, this .depthTexture); + + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_WRAP_S, gl .CLAMP_TO_EDGE); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_WRAP_T, gl .CLAMP_TO_EDGE); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_MAG_FILTER, gl .NEAREST); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_MIN_FILTER, gl .NEAREST); + + const internalFormat = gl .getVersion () >= 2 ? gl .DEPTH_COMPONENT24 : gl .DEPTH_COMPONENT; + + gl .texImage2D (gl .TEXTURE_2D, 0, internalFormat, width, height, 0, gl .DEPTH_COMPONENT, gl .UNSIGNED_INT, null); + gl .framebufferTexture2D (gl .FRAMEBUFFER, gl .DEPTH_ATTACHMENT, gl .TEXTURE_2D, this .depthTexture, 0); + } + else + { + this .depthBuffer = gl .createRenderbuffer (); + + gl .bindRenderbuffer (gl .RENDERBUFFER, this .depthBuffer); + gl .renderbufferStorage (gl .RENDERBUFFER, gl .DEPTH_COMPONENT16, width, height); + gl .framebufferRenderbuffer (gl .FRAMEBUFFER, gl .DEPTH_ATTACHMENT, gl .RENDERBUFFER, this .depthBuffer); + } + + const status = gl .checkFramebufferStatus (gl .FRAMEBUFFER) === gl .FRAMEBUFFER_COMPLETE; + + gl .bindTexture (gl .TEXTURE_2D, null); + gl .bindFramebuffer (gl .FRAMEBUFFER, this .lastBuffer); + + // Always check that our framebuffer is ok. + + if (!status) + throw new Error ("Couldn't create frame buffer."); +} + +Object .assign (TextureBuffer .prototype, +{ + getWidth () + { + return this .width; + }, + getHeight () + { + return this .height; + }, + getColorTexture () + { + return this .colorTexture; + }, + getDepthTexture () + { + return this .depthTexture; + }, + readPixels () + { + const { context: gl, array, width, height } = this; + + gl .readPixels (0, 0, width, height, gl .RGBA, gl .UNSIGNED_BYTE, array); + + return array; + }, + readDepth: (() => + { + const + invProjectionMatrix = new Numbers_Matrix4 (), + point = new Numbers_Vector3 (0, 0, 0); + + return function (projectionMatrix, viewport) + { + const { context: gl, array, width, height } = this; + + gl .readPixels (0, 0, width, height, gl .RGBA, gl .FLOAT, array); + + let + winX = 0, + winY = 0, + winZ = Number .POSITIVE_INFINITY; + + for (let wy = 0, i = 0; wy < height; ++ wy) + { + for (let wx = 0; wx < width; ++ wx, i += 4) + { + const wz = array [i]; + + if (wz < winZ) + { + winX = wx; + winY = wy; + winZ = wz; + } + } + } + + invProjectionMatrix .assign (projectionMatrix) .inverse (); + + Geometry_ViewVolume .unProjectPointMatrix (winX, winY, winZ, invProjectionMatrix, viewport, point); + + return point .z; + }; + })(), + bind () + { + const gl = this .context; + + this .lastBuffer = gl .getParameter (gl .FRAMEBUFFER_BINDING); + + gl .bindFramebuffer (gl .FRAMEBUFFER, this .frameBuffer); + }, + unbind () + { + const gl = this .context; + + gl .bindFramebuffer (gl .FRAMEBUFFER, this .lastBuffer); + }, + delete () + { + const gl = this .context; + + gl .deleteFramebuffer (this .frameBuffer); + gl .deleteTexture (this .colorTexture); + + if (gl .HAS_FEATURE_DEPTH_TEXTURE) + gl .deleteTexture (this .depthTexture); + else + gl .deleteRenderbuffer (this .depthBuffer); + }, +}); + +for (const key of Object .keys (TextureBuffer .prototype)) + Object .defineProperty (TextureBuffer .prototype, key, { enumerable: false }); + +const TextureBuffer_default_ = TextureBuffer; +; + +x_ite_Namespace .add ("TextureBuffer", "x_ite/Rendering/TextureBuffer", TextureBuffer_default_); +/* harmony default export */ const Rendering_TextureBuffer = (TextureBuffer_default_); +;// CONCATENATED MODULE: ./src/x_ite/Rendering/TraverseType.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +let i = 0; + +const TraverseType = +{ + POINTER: i ++, + CAMERA: i ++, + PICKING: i ++, + COLLISION: i ++, + SHADOW: i ++, + DISPLAY: i ++, +}; + +const TraverseType_default_ = TraverseType; +; + +x_ite_Namespace .add ("TraverseType", "x_ite/Rendering/TraverseType", TraverseType_default_); +/* harmony default export */ const Rendering_TraverseType = (TraverseType_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Algorithms/MergeSort.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +function MergeSort (array, compare) +{ + this .array = array; + this .auxiliary = [ ]; + + if (compare) + this .compare = compare; +} + +Object .assign (MergeSort .prototype, +{ + compare (lhs, rhs) + { + return lhs < rhs; + }, + sort (first, last) + { + this .mergeSort (first, last - 1); + }, + mergeSort (lo, hi) + { + if (lo < hi) + { + const m = (lo + hi) >>> 1; + this .mergeSort (lo, m); // Recursion + this .mergeSort (m + 1, hi); // Recursion + this .merge (lo, m, hi); + } + }, + merge (lo, m, hi) + { + const { array, auxiliary, compare } = this; + + let i, j, k; + + i = 0, j = lo; + // Copy first half of array a to auxiliary array b. + while (j <= m) + auxiliary [i++] = array [j++]; + + i = 0; k = lo; + // Copy back next-greatest element at each time. + while (k < j && j <= hi) + { + if (compare (array [j], auxiliary [i])) + array [k++] = array [j++]; + else + array [k++] = auxiliary [i++]; + } + + // Copy back remaining elements of first half (if any). + while (k < j) + array [k++] = auxiliary [i++]; + } +}); + +const MergeSort_default_ = MergeSort; +; + +x_ite_Namespace .add ("MergeSort", "standard/Math/Algorithms/MergeSort", MergeSort_default_); +/* harmony default export */ const Algorithms_MergeSort = (MergeSort_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Geometry/Camera.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +const Camera = +{ + frustum (l, r, b, t, n, f, matrix) + { + const + r_l = r - l, + t_b = t - b, + f_n = f - n, + n_2 = 2 * n, + + A = (r + l) / r_l, + B = (t + b) / t_b, + C = -(f + n) / f_n, + D = -(n_2 * f) / f_n, + E = n_2 / r_l, + F = n_2 / t_b; + + return matrix .set (E, 0, 0, 0, + 0, F, 0, 0, + A, B, C, -1, + 0, 0, D, 0); + }, + perspective (fieldOfView, zNear, zFar, width, height, matrix) + { + const ratio = Math .tan (fieldOfView / 2) * zNear; + + if (width > height) + { + const aspect = width * ratio / height; + return this .frustum (-aspect, aspect, -ratio, ratio, zNear, zFar, matrix); + } + else + { + const aspect = height * ratio / width; + return this .frustum (-ratio, ratio, -aspect, aspect, zNear, zFar, matrix); + } + }, + perspective2 (fieldOfView, zNear, zFar, width, height, matrix) + { + const ratio = Math .tan (fieldOfView / 2) * zNear; + + return this .frustum (-ratio, ratio, -ratio, ratio, zNear, zFar, matrix); + }, + ortho (l, r, b, t, n, f, matrix) + { + const + r_l = r - l, + t_b = t - b, + f_n = f - n, + + A = 2 / r_l, + B = 2 / t_b, + C = -2 / f_n, + D = -(r + l) / r_l, + E = -(t + b) / t_b, + F = -(f + n) / f_n; + + return matrix .set (A, 0, 0, 0, + 0, B, 0, 0, + 0, 0, C, 0, + D, E, F, 1); + }, + orthoBox: (() => + { + const + min = new Numbers_Vector3 (0, 0, 0), + max = new Numbers_Vector3 (0, 0, 0); + + return function (box, matrix) + { + box .getExtents (min, max); + + return this .ortho (min .x, max .x, min .y, max .y, -max .z, -min .z, matrix); + }; + })(), +}; + +const Camera_default_ = Camera; +; + +x_ite_Namespace .add ("Camera", "standard/Math/Geometry/Camera", Camera_default_); +/* harmony default export */ const Geometry_Camera = (Camera_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Geometry/Box3.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + +function Box3 (/* size, center */) +{ + this .matrix = new Numbers_Matrix4 (); + + this .set (... arguments); +} + +Object .assign (Box3 .prototype, +{ + copy () + { + const copy = Object .create (Box3 .prototype); + copy .matrix = this .matrix .copy (); + return copy; + }, + assign (box) + { + this .matrix .assign (box .matrix); + return this; + }, + equals (box) + { + return this .matrix .equals (box .matrix); + }, + getMatrix () + { + return this .matrix; + }, + set (size, center) + { + switch (arguments .length) + { + case 0: + { + this .matrix .set (0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0); + + return this; + } + case 2: + { + this .matrix .set (size .x / 2, 0, 0, 0, + 0, size .y / 2, 0, 0, + 0, 0, size .z / 2, 0, + center .x, center .y, center .z, 1); + + return this; + } + // case 3: + // { + // console .trace () + // return this .setExtents (arguments [0], arguments [1]); + // } + } + }, + setExtents (min, max) + { + const + sx = (max .x - min .x) / 2, + sy = (max .y - min .y) / 2, + sz = (max .z - min .z) / 2, + cx = (max .x + min .x) / 2, + cy = (max .y + min .y) / 2, + cz = (max .z + min .z) / 2; + + this .matrix .set (sx, 0, 0, 0, + 0, sy, 0, 0, + 0, 0, sz, 0, + cx, cy, cz, 1); + + return this; + }, + getExtents (min, max) + { + this .getAbsoluteExtents (min, max); + + min .add (this .center); + max .add (this .center); + }, + getAbsoluteExtents: (() => + { + const + r1 = new Numbers_Vector3 (0, 0, 0), + p1 = new Numbers_Vector3 (0, 0, 0), + p4 = new Numbers_Vector3 (0, 0, 0); + + return function (min, max) + { + const + m = this .matrix, + x = m .xAxis, + y = m .yAxis, + z = m .zAxis; + + r1 .assign (y) .add (z); + + const r2 = z .subtract (y); + + p1 .assign (x) .add (r1), + p4 .assign (x) .add (r2); + + const + p2 = r1 .subtract (x), + p3 = r2 .subtract (x); + + min .assign (p1) .min (p2, p3, p4); + max .assign (p1) .max (p2, p3, p4); + + p1 .negate (); + p2 .negate (); + p3 .negate (); + p4 .negate (); + + min .min (p1, p2, p3, p4); + max .max (p1, p2, p3, p4); + }; + })(), + getPoints: (() => + { + const + x = new Numbers_Vector3 (0, 0, 0), + y = new Numbers_Vector3 (0, 0, 0), + z = new Numbers_Vector3 (0, 0, 0), + r1 = new Numbers_Vector3 (0, 0, 0); + + return function (points) + { + /* + * p6 ---------- p5 + * | \ | \ + * | p2------------ p1 + * | | | | + * | | | | + * p7 |_________ p8 | + * \ | \ | + * \| \| + * p3 ---------- p4 + */ + + const m = this .matrix; + + x .assign (m .xAxis); + y .assign (m .yAxis); + z .assign (m .zAxis); + + r1 .assign (y) .add (z); + + const r2 = z .subtract (y); + + points [0] .assign (x) .add (r1); + points [1] .assign (r1) .subtract (x); + points [2] .assign (r2) .subtract (x); + points [3] .assign (x) .add (r2); + + points [4] .assign (points [2]) .negate (); + points [5] .assign (points [3]) .negate (); + points [6] .assign (points [0]) .negate (); + points [7] .assign (points [1]) .negate (); + + const center = this .center; + + points [0] .add (center); + points [1] .add (center); + points [2] .add (center); + points [3] .add (center); + + points [4] .add (center); + points [5] .add (center); + points [6] .add (center); + points [7] .add (center); + + return points; + }; + })(), + getAxes (axes) + { + const m = this .matrix; + + axes [0] .assign (m .xAxis); + axes [1] .assign (m .yAxis); + axes [2] .assign (m .zAxis); + + return axes; + }, + getNormals: (() => + { + const + x = new Numbers_Vector3 (0, 0, 0), + y = new Numbers_Vector3 (0, 0, 0), + z = new Numbers_Vector3 (0, 0, 0); + + const axes = [ Numbers_Vector3 .xAxis, Numbers_Vector3 .yAxis, Numbers_Vector3 .zAxis ]; + + return function (normals) + { + const m = this .matrix; + + x .assign (m .xAxis); + y .assign (m .yAxis); + z .assign (m .zAxis); + + if (x .norm () === 0) + { + x .assign (y) .cross (z); + + if (x .norm () === 0) + { + for (const axis of axes) + { + x .assign (axis) .cross (y); + + if (x .norm () !== 0) + break; + } + + if (x .norm () === 0) + { + for (const axis of axes) + { + x .assign (axis) .cross (z); + + if (x .norm () !== 0) + break; + } + + if (x .norm () === 0) + x .assign (Numbers_Vector3 .xAxis); + } + } + } + + if (y .norm () === 0) + { + y .assign (z) .cross (x); + + if (y .norm () === 0) + { + for (const axis of axes) + { + y .assign (axis) .cross (z); + + if (y .norm () !== 0) + break; + } + + if (y .norm () === 0) + { + for (const axis of axes) + { + y .assign (axis) .cross (x); + + if (y .norm () !== 0) + break; + } + + if (y .norm () === 0) + y .assign (Numbers_Vector3 .yAxis); + } + } + } + + if (z .norm () === 0) + { + z .assign (x) .cross (y); + + if (z .norm () === 0) + { + for (const axis of axes) + { + z .assign (axis) .cross (x); + + if (z .norm () !== 0) + break; + } + + if (z .norm () === 0) + { + for (const axis of axes) + { + z .assign (axis) .cross (y); + + if (z .norm () !== 0) + break; + } + + if (z .norm () === 0) + z .assign (Numbers_Vector3 .zAxis); + } + } + } + + normals [0] .assign (y) .cross (z) .normalize (); + normals [1] .assign (z) .cross (x) .normalize (); + normals [2] .assign (x) .cross (y) .normalize (); + + return normals; + }; + })(), + isEmpty () + { + return this .matrix [15] === 0; + }, + add: (() => + { + const + lhs_min = new Numbers_Vector3 (0, 0, 0), + lhs_max = new Numbers_Vector3 (0, 0, 0), + rhs_min = new Numbers_Vector3 (0, 0, 0), + rhs_max = new Numbers_Vector3 (0, 0, 0); + + return function (box) + { + if (this .isEmpty ()) + return this .assign (box); + + if (box .isEmpty ()) + return this; + + this .getExtents (lhs_min, lhs_max); + box .getExtents (rhs_min, rhs_max); + + return this .setExtents (lhs_min .min (rhs_min), lhs_max .max (rhs_max)); + }; + })(), + multLeft (matrix) + { + this .matrix .multLeft (matrix); + return this; + }, + multRight (matrix) + { + this .matrix .multRight (matrix); + return this; + }, + containsPoint: (() => + { + const + min = new Numbers_Vector3 (0, 0, 0), + max = new Numbers_Vector3 (0, 0, 0); + + return function (point) + { + this .getExtents (min, max); + + return min .x <= point .x && + max .x >= point .x && + min .y <= point .y && + max .y >= point .y && + min .z <= point .z && + max .z >= point .z; + }; + })(), + intersectsBox: (() => + { + const points1 = [ + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + ]; + + const points2 = [ + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + ]; + + const axes1 = [ + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + ]; + + const axes2 = [ + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + ]; + + const axes9 = [ + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + ]; + + const normals = [ + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + ]; + + return function (other) + { + // Test special cases. + + if (this .isEmpty ()) + return false; + + if (other .isEmpty ()) + return false; + + // Get points. + + this .getPoints (points1); + other .getPoints (points2); + + // Test the three planes spanned by the normal vectors of the faces of the first parallelepiped. + + if (Algorithms_SAT .isSeparated (this .getNormals (normals), points1, points2)) + return false; + + // Test the three planes spanned by the normal vectors of the faces of the second parallelepiped. + + if (Algorithms_SAT .isSeparated (other .getNormals (normals), points1, points2)) + return false; + + // Test the nine other planes spanned by the edges of each parallelepiped. + + this .getAxes (axes1); + other .getAxes (axes2); + + for (let i1 = 0; i1 < 3; ++ i1) + { + for (let i2 = 0; i2 < 3; ++ i2) + axes9 [i1 * 3 + i2] .assign (axes1 [i1]) .cross (axes2 [i2]); + } + + if (Algorithms_SAT .isSeparated (axes9, points1, points2)) + return false; + + // Both boxes intersect. + + return true; + }; + })(), + intersectsTriangle: (() => + { + const points1 = [ + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + ]; + + const axes1 = [ + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + ]; + + const axes9 = [ + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + ]; + + const normals = [ + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + ]; + + const triangle = [ ]; + + const triangleNormal = [ new Numbers_Vector3 (0, 0, 0) ]; + + const triangleEdges = [ + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0), + new Numbers_Vector3 (0, 0, 0) + ]; + + return function (a, b, c) + { + // Test special cases. + + if (this .isEmpty ()) + return false; + + // Get points. + + this .getPoints (points1); + + triangle [0] = a; + triangle [1] = b; + triangle [2] = c; + + // Test the three planes spanned by the normal vectors of the faces of the first parallelepiped. + + if (Algorithms_SAT .isSeparated (this .getNormals (normals), points1, triangle)) + return false; + + // Test the normal of the triangle. + + Geometry_Triangle3 .normal (a, b, c, triangleNormal [0]); + + if (Algorithms_SAT .isSeparated (triangleNormal, points1, triangle)) + return false; + + // Test the nine other planes spanned by the edges of each parallelepiped. + + this .getAxes (axes1); + + triangleEdges [0] .assign (a) .subtract (b); + triangleEdges [1] .assign (b) .subtract (c); + triangleEdges [2] .assign (c) .subtract (a); + + for (let i1 = 0; i1 < 3; ++ i1) + { + for (let i2 = 0; i2 < 3; ++ i2) + axes9 [i1 * 3 + i2] .assign (axes1 [i1]) .cross (triangleEdges [i2]); + } + + if (Algorithms_SAT .isSeparated (axes9, points1, triangle)) + return false; + + // Box and triangle intersect. + + return true; + }; + })(), + toString () + { + return `${this .size}, ${this .center}`; + }, +}); + +Object .assign (Box3, +{ + Extents (min, max) + { + return new Box3 () .setExtents (min, max); + }, + Points (points) + { + const + min = new Numbers_Vector3 (Number .POSITIVE_INFINITY, Number .POSITIVE_INFINITY, Number .POSITIVE_INFINITY), + max = new Numbers_Vector3 (Number .NEGATIVE_INFINITY, Number .NEGATIVE_INFINITY, Number .NEGATIVE_INFINITY); + + for (const point of points) + { + min .min (point); + max .max (point); + } + + return new Box3 () .setExtents (min, max); + }, +}); + +Object .defineProperties (Box3 .prototype, +{ + size: + { + get: (() => + { + const + min = new Numbers_Vector3 (0, 0, 0), + max = new Numbers_Vector3 (0, 0, 0); + + return function () + { + this .getAbsoluteExtents (min, max); + + return max .subtract (min); + }; + })(), + enumerable: true, + }, + center: + { + get () + { + return this .matrix .origin; + }, + enumerable: true, + }, +}); + +const Box3_default_ = Box3; +; + +x_ite_Namespace .add ("Box3", "standard/Math/Geometry/Box3", Box3_default_); +/* harmony default export */ const Geometry_Box3 = (Box3_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Geometry/Line3.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function Line3 (point, direction) +{ + this .point = point .copy (); + this .direction = direction .copy (); +} + +Object .assign (Line3 .prototype, +{ + copy () + { + const copy = Object .create (Line3 .prototype); + copy .point = this .point .copy (); + copy .direction = this .direction .copy (); + return copy; + }, + assign (line) + { + this .point .assign (line .point); + this .direction .assign (line .direction); + return this; + }, + set (point, direction) + { + this .point .assign (point); + this .direction .assign (direction); + return this; + }, + setPoints (point1, point2) + { + this .point .assign (point1); + this .direction .assign (point2) .subtract (point1) .normalize (); + return this; + }, + multMatrixLine (matrix) + { + matrix .multMatrixVec (this .point); + matrix .multMatrixDir (this .direction) .normalize (); + return this; + }, + multLineMatrix (matrix) + { + matrix .multVecMatrix (this .point); + matrix .multDirMatrix (this .direction) .normalize (); + return this; + }, + getClosestPointToPoint (point, result) + { + const + r = result .assign (point) .subtract (this .point), + d = r .dot (this .direction); + + return result .assign (this .direction) .multiply (d) .add (this .point); + }, + getClosestPointToLine: (() => + { + const u = new Numbers_Vector3 (0, 0, 0); + + return function (line, point) + { + const + { point: p1, direction: d1 } = this, + { point: p2, direction: d2 } = line; + + let t = d1 .dot (d2); + + if (Math .abs (t) >= 1) + return false; // lines are parallel + + u .assign (p2) .subtract (p1); + + t = (u .dot (d1) - t * u .dot (d2)) / (1 - t * t); + + point .assign (d1) .multiply (t) .add (p1); + return true; + }; + })(), + getPerpendicularVectorToPoint: (() => + { + const t = new Numbers_Vector3 (0, 0, 0); + + return function (point, result) + { + result .assign (this .point) .subtract (point); + + return result .subtract (t .assign (this .direction) .multiply (result .dot (this .direction))); + }; + })(), + getPerpendicularVectorToLine: (() => + { + const + d = new Numbers_Vector3 (0, 0, 0), + ad = new Numbers_Vector3 (0, 0, 0); + + return function (line, result) + { + const bd = result; + + d .assign (this .point) .subtract (line .point); + + const + re1 = d .dot (this .direction), + re2 = d .dot (line .direction), + e12 = this .direction .dot (line .direction), + E12 = e12 * e12; + + const + a = (re1 - re2 * e12) / (1 - E12), + b = -(re2 - re1 * e12) / (1 - E12); + + ad .assign (this .direction) .multiply (a); + bd .assign (line .direction) .multiply (b); + + return bd .subtract (ad) .add (d); + }; + })(), + intersectsTriangle: (() => + { + const + pvec = new Numbers_Vector3 (0, 0, 0), + tvec = new Numbers_Vector3 (0, 0, 0); + + return function (A, B, C, uvt) + { + // Find vectors for two edges sharing vert0. + const + edge1 = B .subtract (A), + edge2 = C .subtract (A); + + // Begin calculating determinant - also used to calculate U parameter. + pvec .assign (this .direction) .cross (edge2); + + // If determinant is near zero, ray lies in plane of triangle. + const det = edge1 .dot (pvec); + + // Non culling intersection. + + if (det === 0) + return false; + + const inv_det = 1 / det; + + // Calculate distance from vert0 to ray point. + tvec .assign (this .point) .subtract (A); + + // Calculate U parameter and test bounds. + const u = tvec .dot (pvec) * inv_det; + + if (u < 0 || u > 1) + return false; + + // Prepare to test V parameter. + const qvec = tvec .cross (edge1); + + // Calculate V parameter and test bounds. + const v = this .direction .dot (qvec) * inv_det; + + if (v < 0 || u + v > 1) + return false; + + //let t = edge2 .dot (qvec) * inv_det; + + uvt .u = u; + uvt .v = v; + uvt .t = 1 - u - v; + + return true; + }; + })(), + toString () + { + return `${this .point}, ${this .direction}`; + }, +}); + +Object .assign (Line3, +{ + Points (point1, point2) + { + const line = Object .create (Line3 .prototype); + line .point = point1 .copy (); + line .direction = point2 .copy () .subtract (point1) .normalize (); + return line; + }, +}); + +const Line3_default_ = Line3; +; + +x_ite_Namespace .add ("Line3", "standard/Math/Geometry/Line3", Line3_default_); +/* harmony default export */ const Geometry_Line3 = (Line3_default_); +;// CONCATENATED MODULE: ./src/standard/Time/StopWatch.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +class StopWatch +{ + #startTime = 0; + #stopTime = 0; + cycles = 0; + elapsedTime = 0; + + start () + { + this .#startTime = Date .now (); + } + + stop () + { + if (this .#startTime <= this .#stopTime) + return; + + this .#stopTime = Date .now (); + this .cycles += 1; + this .elapsedTime += this .#stopTime - this .#startTime; + } + + reset () + { + this .#startTime = 0; + this .#stopTime = 0; + this .cycles = 0; + this .elapsedTime = 0; + } + + get averageTime () + { + return this .cycles ? this .elapsedTime / this .cycles : 0; + } +} + +const StopWatch_default_ = StopWatch; +; + +x_ite_Namespace .add ("StopWatch", "standard/Time/StopWatch", StopWatch_default_); +/* harmony default export */ const Time_StopWatch = (StopWatch_default_); +;// CONCATENATED MODULE: ./src/x_ite/Rendering/X3DRenderObject.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + +const DEPTH_BUFFER_SIZE = 16; + +let renderCount = 0; + +function X3DRenderObject (executionContext) +{ + const browser = executionContext .getBrowser (); + + this .renderCount = 0; + this .viewVolumes = [ ]; + this .cameraSpaceMatrix = new Utility_MatrixStack (Numbers_Matrix4); + this .viewMatrix = new Utility_MatrixStack (Numbers_Matrix4); + this .projectionMatrix = new Utility_MatrixStack (Numbers_Matrix4); + this .modelViewMatrix = new Utility_MatrixStack (Numbers_Matrix4); + this .viewportArray = new Int32Array (4); + this .projectionMatrixArray = new Float32Array (16); + this .cameraSpaceMatrixArray = new Float32Array (16); + this .hitRay = new Geometry_Line3 (Numbers_Vector3 .Zero, Numbers_Vector3 .Zero); + this .sensors = [[ ]]; + this .viewpointGroups = [ ]; + this .localObjectsCount = [0, 0, 0]; + this .globalObjects = [ ]; + this .localObjects = [ ]; + this .lights = [ ]; + this .globalShadows = [ false ]; + this .localShadows = [ false ]; + this .localFogs = [ null ]; + this .layouts = [ ]; + this .humanoids = [ ]; + this .textureProjectors = [ ]; + this .generatedCubeMapTextures = [ ]; + this .collisions = [ ]; + this .collisionTime = new Time_StopWatch (); + this .numPointingShapes = 0; + this .numCollisionShapes = 0; + this .numShadowShapes = 0; + this .numOpaqueShapes = 0; + this .numTransparentShapes = 0; + this .pointingShapes = [ ]; + this .collisionShapes = [ ]; + this .activeCollisions = [ ]; + this .shadowShapes = [ ]; + this .opaqueShapes = [ ]; + this .transparentShapes = [ ]; + this .transparencySorter = new Algorithms_MergeSort (this .transparentShapes, (a, b) => a .distance < b .distance); + this .speed = 0; + this .depthBuffer = new Rendering_TextureBuffer (browser, DEPTH_BUFFER_SIZE, DEPTH_BUFFER_SIZE, true); +} + +Object .assign (X3DRenderObject .prototype, +{ + initialize () + { }, + isIndependent () + { + return true; + }, + getRenderCount () + { + return this .renderCount; + }, + getViewVolumes () + { + return this .viewVolumes; + }, + getViewVolume () + { + return this .viewVolumes .at (-1); + }, + getCameraSpaceMatrix () + { + return this .cameraSpaceMatrix; + }, + getViewMatrix () + { + return this .viewMatrix; + }, + getProjectionMatrix () + { + return this .projectionMatrix; + }, + getModelViewMatrix () + { + return this .modelViewMatrix; + }, + getViewportArray () + { + return this .viewportArray; + }, + getProjectionMatrixArray () + { + return this .projectionMatrixArray; + }, + getCameraSpaceMatrixArray () + { + return this .cameraSpaceMatrixArray; + }, + getLogarithmicDepthBuffer () + { + return this .logarithmicDepthBuffer; + }, + getHitRay () + { + return this .hitRay; + }, + getSensors () + { + return this .sensors; + }, + getViewpointGroups () + { + return this .viewpointGroups; + }, + getGlobalObjects () + { + return this .globalObjects; + }, + getLocalObjects () + { + return this .localObjects; + }, + getLocalObjectsCount () + { + return this .localObjectsCount; + }, + getLights () + { + return this .lights; + }, + pushGlobalShadows (value) + { + this .globalShadows .push (value || this .globalShadows .at (-1)); + }, + getGlobalShadows () + { + return this .globalShadows; + }, + pushLocalShadows (value) + { + this .localShadows .push (value || this .localShadows .at (-1)); + }, + popLocalShadows () + { + this .localShadows .pop (); + }, + setGlobalFog: (() => + { + const modelViewMatrix = new Numbers_Matrix4 (); + + return function (fogNode) + { + if (fogNode .getFogType ()) + { + const fogContainer = this .localFogs [0] || fogNode .getFogs () .pop (); + + modelViewMatrix .assign (fogNode .getModelMatrix ()) .multRight (this .getViewMatrix () .get ()); + fogContainer .set (fogNode, modelViewMatrix); + + this .localFogs [0] = fogContainer; + } + else + { + this .localFogs [0] = null; + } + }; + })(), + getLocalFogs () + { + return this .localFogs; + }, + getLayouts () + { + return this .layouts; + }, + getParentLayout () + { + return this .layouts .at (-1); + }, + getHumanoids () + { + return this .humanoids; + }, + getTextureProjectors () + { + return this .textureProjectors; + }, + getGeneratedCubeMapTextures () + { + return this .generatedCubeMapTextures; + }, + getCollisions () + { + return this .collisions; + }, + getCollisionTime () + { + return this .collisionTime; + }, + setNumPointingShapes (value) + { + this .numPointingShapes = value; + }, + getNumPointingShapes () + { + return this .numPointingShapes; + }, + getPointingShapes () + { + return this .pointingShapes; + }, + setNumCollisionShapes (value) + { + this .numCollisionShapes = value; + }, + getNumCollisionShapes () + { + return this .numCollisionShapes; + }, + getCollisionShapes () + { + return this .collisionShapes; + }, + setNumShadowShapes (value) + { + this .numShadowShapes = value; + }, + getNumShadowShapes () + { + return this .numShadowShapes; + }, + getShadowShapes () + { + return this .shadowShapes; + }, + setNumOpaqueShapes (value) + { + this .numOpaqueShapes = value; + }, + getNumOpaqueShapes () + { + return this .numOpaqueShapes; + }, + getOpaqueShapes () + { + return this .opaqueShapes; + }, + setNumTransparentShapes (value) + { + this .numTransparentShapes = value; + }, + getNumTransparentShapes () + { + return this .numTransparentShapes; + }, + getTransparentShapes () + { + return this .transparentShapes; + }, + constrainTranslation (translation, stepBack) + { + /// Contrains @a translation to a possible value the avatar can move. If the avatar reaches and intersects with an + /// and obstacle and @a stepBack is true a translation in the opposite directiion is returned. Future implementation will + /// will then return a value where the avatar slides along the wall. Modifies translation in place. + + // Constrain translation when the viewer collides with an obstacle. + + const distance = this .getDistance (translation) - this .getNavigationInfo () .getCollisionRadius (); + + if (distance > 0) + { + // Move. + + const length = translation .magnitude (); + + if (length > distance) + { + // Collision, the avatar would intersect with the obstacle. + + return translation .normalize () .multiply (distance); + } + + // Everything is fine. + + return translation; + } + + // Collision, the avatar is already within an obstacle. + + if (stepBack) + return this .constrainTranslation (translation .normalize () .multiply (distance), false); + + return translation .assign (Numbers_Vector3 .Zero); + }, + getDistance: (() => + { + const + projectionMatrix = new Numbers_Matrix4 (), + cameraSpaceProjectionMatrix = new Numbers_Matrix4 (), + localOrientation = new Numbers_Rotation4 (), + vector = new Numbers_Vector3 (0, 0, 0), + rotation = new Numbers_Rotation4 (); + + return function (direction) + { + /// Returns the distance to the closest object in @a direction. The maximum determinable value is avatarHeight * 2. + + this .collisionTime .start (); + + const + viewpoint = this .getViewpoint (), + navigationInfo = this .getNavigationInfo (), + collisionRadius = navigationInfo .getCollisionRadius (), + bottom = navigationInfo .getStepHeight () - navigationInfo .getAvatarHeight (), + nearValue = navigationInfo .getNearValue (), + avatarHeight = navigationInfo .getAvatarHeight (); + + // Determine width and height of camera + + // Reshape camera + + Geometry_Camera .ortho (-collisionRadius, + collisionRadius, + Math .min (bottom, -collisionRadius), /// TODO: bottom could be a positive value if stepHeight > avatarHeight. + collisionRadius, + nearValue, + Math .max (collisionRadius * 2, avatarHeight * 2), + projectionMatrix); + + // Translate camera to user position and to look in the direction of the direction. + + localOrientation .assign (viewpoint ._orientation .getValue ()) .inverse () .multRight (viewpoint .getOrientation ()); + rotation .setFromToVec (Numbers_Vector3 .zAxis, vector .assign (direction) .negate ()) .multRight (localOrientation); + viewpoint .straightenHorizon (rotation); + + cameraSpaceProjectionMatrix .assign (viewpoint .getModelMatrix ()); + cameraSpaceProjectionMatrix .translate (viewpoint .getUserPosition ()); + cameraSpaceProjectionMatrix .rotate (rotation); + cameraSpaceProjectionMatrix .inverse (); + + cameraSpaceProjectionMatrix .multRight (projectionMatrix); + cameraSpaceProjectionMatrix .multLeft (viewpoint .getCameraSpaceMatrix ()); + + this .getProjectionMatrix () .pushMatrix (cameraSpaceProjectionMatrix); + + const depth = this .getDepth (projectionMatrix); + + this .getProjectionMatrix () .pop (); + + this .collisionTime .stop (); + return -depth; + }; + })(), + getDepth: (() => + { + const + depthBufferViewport = new Numbers_Vector4 (0, 0, DEPTH_BUFFER_SIZE, DEPTH_BUFFER_SIZE), + depthBufferViewVolume = new Geometry_ViewVolume (); + + depthBufferViewVolume .set (Numbers_Matrix4 .Identity, depthBufferViewport, depthBufferViewport); + + return function (projectionMatrix) + { + /// Returns the depth value to the closest object. The maximum determinable value is avatarHeight * 2. + + this .depthBuffer .bind (); + this .viewVolumes .push (depthBufferViewVolume); + + this .depth (this .collisionShapes, this .numCollisionShapes); + + const depth = this .depthBuffer .readDepth (projectionMatrix, depthBufferViewport); + + this .viewVolumes .pop (); + this .depthBuffer .unbind (); + + return depth; + }; + })(), + render (type, callback, group) + { + switch (type) + { + case Rendering_TraverseType .POINTER: + { + this .numPointingShapes = 0; + + callback .call (group, type, this); + this .pointing (this .pointingShapes, this .numPointingShapes); + break; + } + case Rendering_TraverseType .COLLISION: + { + // Collect for collide and gravite + this .numCollisionShapes = 0; + + callback .call (group, type, this); + this .collide (); + this .gravite (); + break; + } + case Rendering_TraverseType .SHADOW: + { + this .numShadowShapes = 0; + + callback .call (group, type, this); + this .depth (this .shadowShapes, this .numShadowShapes); + break; + } + case Rendering_TraverseType .DISPLAY: + { + this .lightIndex = 0; + this .numOpaqueShapes = 0; + this .numTransparentShapes = 0; + + this .setGlobalFog (this .getFog ()); + + callback .call (group, type, this); + this .draw (); + break; + } + } + }, + setHitRay (projectionMatrix, viewport, pointer) + { + Geometry_ViewVolume .unProjectRay (pointer .x, pointer .y, Numbers_Matrix4 .Identity, projectionMatrix, viewport, this .hitRay); + }, + addPointingShape: (() => + { + const + bboxSize = new Numbers_Vector3 (0, 0, 0), + bboxCenter = new Numbers_Vector3 (0, 0, 0); + + return function (shapeNode) + { + const modelViewMatrix = this .getModelViewMatrix () .get (); + + modelViewMatrix .multDirMatrix (bboxSize .assign (shapeNode .getBBoxSize ())); + modelViewMatrix .multVecMatrix (bboxCenter .assign (shapeNode .getBBoxCenter ())); + + const + radius = bboxSize .magnitude () / 2, + viewVolume = this .viewVolumes .at (-1); + + if (viewVolume .intersectsSphere (radius, bboxCenter)) + { + const num = this .numPointingShapes ++; + + if (num === this .pointingShapes .length) + { + this .pointingShapes .push ({ renderObject: this, modelViewMatrix: new Float32Array (16), clipPlanes: [ ], sensors: [ ] }); + } + + const pointingContext = this .pointingShapes [num]; + + pointingContext .modelViewMatrix .set (modelViewMatrix); + pointingContext .shapeNode = shapeNode; + pointingContext .scissor = viewVolume .getScissor (); + pointingContext .humanoidNode = this .humanoids .at (-1); + + // Clip planes & sensors + + X3DRenderObject_assign (pointingContext .clipPlanes, this .localObjects); + X3DRenderObject_assign (pointingContext .sensors, this .sensors .at (-1)); + + return true; + } + + return false; + }; + })(), + addCollisionShape: (() => + { + const + bboxSize = new Numbers_Vector3 (0, 0, 0), + bboxCenter = new Numbers_Vector3 (0, 0, 0); + + return function (shapeNode) + { + const modelViewMatrix = this .getModelViewMatrix () .get (); + + modelViewMatrix .multDirMatrix (bboxSize .assign (shapeNode .getBBoxSize ())); + modelViewMatrix .multVecMatrix (bboxCenter .assign (shapeNode .getBBoxCenter ())); + + const + radius = bboxSize .magnitude () / 2, + viewVolume = this .viewVolumes .at (-1); + + if (viewVolume .intersectsSphere (radius, bboxCenter)) + { + const num = this .numCollisionShapes ++; + + if (num === this .collisionShapes .length) + { + this .collisionShapes .push ({ renderObject: this, modelViewMatrix: new Float32Array (16), collisions: [ ], clipPlanes: [ ] }); + } + + const collisionContext = this .collisionShapes [num]; + + collisionContext .modelViewMatrix .set (modelViewMatrix); + collisionContext .shapeNode = shapeNode; + collisionContext .scissor = viewVolume .getScissor (); + + // Collisions + + X3DRenderObject_assign (collisionContext .collisions, this .collisions); + + // Clip planes + + X3DRenderObject_assign (collisionContext .clipPlanes, this .localObjects); + + return true; + } + + return false; + }; + })(), + addShadowShape: (() => + { + const + bboxSize = new Numbers_Vector3 (0, 0, 0), + bboxCenter = new Numbers_Vector3 (0, 0, 0); + + return function (shapeNode) + { + const modelViewMatrix = this .getModelViewMatrix () .get (); + + modelViewMatrix .multDirMatrix (bboxSize .assign (shapeNode .getBBoxSize ())); + modelViewMatrix .multVecMatrix (bboxCenter .assign (shapeNode .getBBoxCenter ())); + + const + radius = bboxSize .magnitude () / 2, + viewVolume = this .viewVolumes .at (-1); + + if (viewVolume .intersectsSphere (radius, bboxCenter)) + { + const num = this .numShadowShapes ++; + + if (num === this .shadowShapes .length) + { + this .shadowShapes .push ({ renderObject: this, modelViewMatrix: new Float32Array (16), clipPlanes: [ ] }); + } + + const depthContext = this .shadowShapes [num]; + + depthContext .modelViewMatrix .set (modelViewMatrix); + depthContext .shapeNode = shapeNode; + depthContext .scissor = viewVolume .getScissor (); + depthContext .humanoidNode = this .humanoids .at (-1); + + // Clip planes + + X3DRenderObject_assign (depthContext .clipPlanes, this .localObjects); + + return true; + } + + return false; + }; + })(), + addDisplayShape: (() => + { + const + bboxSize = new Numbers_Vector3 (0, 0, 0), + bboxCenter = new Numbers_Vector3 (0, 0, 0); + + return function (shapeNode) + { + const modelViewMatrix = this .getModelViewMatrix () .get (); + + modelViewMatrix .multDirMatrix (bboxSize .assign (shapeNode .getBBoxSize ())); + modelViewMatrix .multVecMatrix (bboxCenter .assign (shapeNode .getBBoxCenter ())); + + const + radius = bboxSize .magnitude () / 2, + viewVolume = this .viewVolumes .at (-1); + + if (viewVolume .intersectsSphere (radius, bboxCenter)) + { + if (shapeNode .isTransparent ()) + { + const num = this .numTransparentShapes ++; + + if (num === this .transparentShapes .length) + this .transparentShapes .push (this .createRenderContext (true)); + + var renderContext = this .transparentShapes [num]; + + renderContext .distance = bboxCenter .z; + } + else + { + const num = this .numOpaqueShapes ++; + + if (num === this .opaqueShapes .length) + this .opaqueShapes .push (this .createRenderContext (false)); + + var renderContext = this .opaqueShapes [num]; + } + + renderContext .modelViewMatrix .set (modelViewMatrix); + renderContext .scissor .assign (viewVolume .getScissor ()); + renderContext .shadows = this .localShadows .at (-1); + renderContext .fogNode = this .localFogs .at (-1); + renderContext .shapeNode = shapeNode; + renderContext .appearanceNode = shapeNode .getAppearance (); + renderContext .humanoidNode = this .humanoids .at (-1); + + // Clip planes and local lights + + X3DRenderObject_assign (renderContext .localObjects, this .localObjects); + X3DRenderObject_assign (renderContext .objectsCount, this .localObjectsCount); + + return true; + } + + return false; + }; + })(), + createRenderContext (transparent) + { + return { + renderObject: this, + transparent: transparent, + modelViewMatrix: new Float32Array (16), + scissor: new Numbers_Vector4 (0, 0, 0, 0), + localObjects: [ ], + objectsCount: [0, 0, 0], // [clip planes, lights, texture projectors] + }; + }, + pointing: (() => + { + const projectionMatrixArray = new Float32Array (16); + + return function (shapes, numShapes) + { + const + browser = this .getBrowser (), + gl = browser .getContext (), + viewport = this .getViewVolume () .getViewport (), + [x, y] = browser .getPointer (); + + // Configure depth shaders. + + projectionMatrixArray .set (this .getProjectionMatrix () .get ()); + + // Configure viewport and background + + gl .viewport (viewport [0] - x, + viewport [1] - y, + viewport [2], + viewport [3]); + + gl .scissor (0, 0, 1, 1); + gl .clear (gl .DEPTH_BUFFER_BIT); + + // Render all objects + + gl .disable (gl .CULL_FACE); + + for (let s = 0; s < numShapes; ++ s) + { + const + renderContext = shapes [s], + { scissor, clipPlanes, modelViewMatrix, shapeNode, humanoidNode } = renderContext, + appearanceNode = shapeNode .getAppearance (), + geometryContext = shapeNode .getGeometryContext (), + stylePropertiesNode = appearanceNode .getStyleProperties (geometryContext .geometryType), + shaderNode = browser .getPointingShader (clipPlanes .length, shapeNode, humanoidNode), + id = browser .addPointingShape (renderContext); + + gl .scissor (scissor .x - x, + scissor .y - y, + scissor .z, + scissor .w); + + // Draw + + shaderNode .enable (gl); + shaderNode .setClipPlanes (gl, clipPlanes); + + gl .uniformMatrix4fv (shaderNode .x3d_ProjectionMatrix, false, projectionMatrixArray); + gl .uniformMatrix4fv (shaderNode .x3d_ModelViewMatrix, false, modelViewMatrix); + gl .uniform1f (shaderNode .x3d_Id, id); + + stylePropertiesNode ?.setShaderUniforms (gl, shaderNode); + humanoidNode ?.setShaderUniforms (gl, shaderNode); + + shapeNode .displaySimple (gl, renderContext, shaderNode); + browser .resetTextureUnits (); + } + }; + })(), + collide: (() => + { + const + invModelViewMatrix = new Numbers_Matrix4 (), + modelViewMatrix = new Numbers_Matrix4 (), + collisionBox = new Geometry_Box3 (Numbers_Vector3 .Zero, Numbers_Vector3 .Zero), + collisionSize = new Numbers_Vector3 (0, 0, 0); + + return function () + { + // Collision nodes are handled here. + + const + activeCollisions = [ ], // current active Collision nodes + collisionRadius2 = 2.2 * this .getNavigationInfo () .getCollisionRadius (); // Make the radius a little bit larger. + + collisionSize .set (collisionRadius2, collisionRadius2, collisionRadius2); + + for (let i = 0, length = this .numCollisionShapes; i < length; ++ i) + { + const + collisionContext = this .collisionShapes [i], + collisions = collisionContext .collisions; + + if (collisions .length) + { + collisionBox .set (collisionSize, Numbers_Vector3 .Zero); + collisionBox .multRight (invModelViewMatrix .assign (collisionContext .modelViewMatrix) .inverse ()); + + if (collisionContext .shapeNode .intersectsBox (collisionBox, collisionContext .clipPlanes, modelViewMatrix .assign (collisionContext .modelViewMatrix))) + { + for (const collision of collisions) + activeCollisions .push (collision); + } + } + } + + // Set isActive to FALSE for affected nodes. + + if (this .activeCollisions .length) + { + const inActiveCollisions = activeCollisions .length + ? this .activeCollisions .filter (a => !activeCollisions .includes (a)) + : this .activeCollisions; + + for (const collision of inActiveCollisions) + collision .set_active (false); + } + + // Set isActive to TRUE for affected nodes. + + this .activeCollisions = activeCollisions; + + for (const collision of activeCollisions) + collision .set_active (true); + }; + })(), + gravite: (() => + { + const + projectionMatrix = new Numbers_Matrix4 (), + cameraSpaceProjectionMatrix = new Numbers_Matrix4 (), + translation = new Numbers_Vector3 (0, 0, 0), + rotation = new Numbers_Rotation4 (); + + return function () + { + const browser = this .getBrowser (); + + // Terrain following and gravitation. + + if (browser .getActiveLayer () === this) + { + if (browser .getCurrentViewer () !== "WALK") + return; + } + else if (this .getNavigationInfo () .getViewer () !== "WALK") + { + return; + } + + // Get NavigationInfo values. + + const + navigationInfo = this .getNavigationInfo (), + viewpoint = this .getViewpoint (), + collisionRadius = navigationInfo .getCollisionRadius (), + nearValue = navigationInfo .getNearValue (), + avatarHeight = navigationInfo .getAvatarHeight (), + stepHeight = navigationInfo .getStepHeight (); + + // Reshape viewpoint for gravite. + + Geometry_Camera .ortho (-collisionRadius, + collisionRadius, + -collisionRadius, + collisionRadius, + nearValue, + Math .max (collisionRadius * 2, avatarHeight * 2), + projectionMatrix); + + // Transform viewpoint to look down the up vector. + + const + upVector = viewpoint .getUpVector (), + down = rotation .setFromToVec (Numbers_Vector3 .zAxis, upVector); + + cameraSpaceProjectionMatrix .assign (viewpoint .getModelMatrix ()); + cameraSpaceProjectionMatrix .translate (viewpoint .getUserPosition ()); + cameraSpaceProjectionMatrix .rotate (down); + cameraSpaceProjectionMatrix .inverse (); + + cameraSpaceProjectionMatrix .multRight (projectionMatrix); + cameraSpaceProjectionMatrix .multLeft (viewpoint .getCameraSpaceMatrix ()); + + this .getProjectionMatrix () .pushMatrix (cameraSpaceProjectionMatrix); + + let distance = -this .getDepth (projectionMatrix); + + this .getProjectionMatrix () .pop (); + + // Gravite or step up. + + distance -= avatarHeight; + + const up = rotation .setFromToVec (Numbers_Vector3 .yAxis, upVector); + + if (distance > 0) + { + // Gravite and fall down the to the floor. + + const currentFrameRate = this .speed ? browser .getCurrentFrameRate () : 1000000; + + this .speed -= browser .getBrowserOptions () ._Gravity .getValue () / currentFrameRate; + + let y = this .speed / currentFrameRate; + + if (y < -distance) + { + // The ground is reached. + y = -distance; + this .speed = 0; + } + + viewpoint ._positionOffset = viewpoint ._positionOffset .getValue () .add (up .multVecRot (translation .set (0, y, 0))); + } + else + { + this .speed = 0; + + distance = -distance; + + if (distance > 0.01 && distance < stepHeight) + { + // Step up. + + this .constrainTranslation (up .multVecRot (translation .set (0, distance, 0)), false); + + //if (getBrowser () -> getBrowserOptions () -> animateStairWalks ()) + //{ + // float step = getBrowser () -> getCurrentSpeed () / getBrowser () -> getCurrentFrameRate (); + // step = abs (getViewMatrix () .mult_matrix_dir (Vector3f (0, step, 0) * up)); + // + // Vector3f offset = Vector3f (0, step, 0) * up; + // + // if (math::abs (offset) > math::abs (translation) or getBrowser () -> getCurrentSpeed () == 0) + // offset = translation; + // + // getViewpoint () -> positionOffset () += offset; + //} + //else + viewpoint ._positionOffset = translation .add (viewpoint ._positionOffset .getValue ()); + } + } + }; + })(), + depth: (() => + { + const projectionMatrixArray = new Float32Array (16); + + return function (shapes, numShapes) + { + const + browser = this .getBrowser (), + gl = browser .getContext (), + viewport = this .getViewVolume () .getViewport (); + + // Configure depth shaders. + + projectionMatrixArray .set (this .getProjectionMatrix () .get ()); + + // Configure viewport and background + + gl .viewport (... viewport); + gl .scissor (... viewport); + + gl .clearColor (1, 0, 0, 0); // '1' for infinity, '0 0 0' for normal (TODO). + gl .clear (gl .COLOR_BUFFER_BIT | gl .DEPTH_BUFFER_BIT); + + // Render all objects + + gl .disable (gl .CULL_FACE); + + for (let s = 0; s < numShapes; ++ s) + { + const + renderContext = shapes [s], + { scissor, clipPlanes, modelViewMatrix, shapeNode, humanoidNode } = renderContext, + appearanceNode = shapeNode .getAppearance (), + geometryContext = shapeNode .getGeometryContext (), + stylePropertiesNode = appearanceNode .getStyleProperties (geometryContext .geometryType), + shaderNode = browser .getDepthShader (clipPlanes .length, shapeNode, humanoidNode); + + gl .scissor (... scissor); + + // Draw + + shaderNode .enable (gl); + shaderNode .setClipPlanes (gl, clipPlanes); + + gl .uniformMatrix4fv (shaderNode .x3d_ProjectionMatrix, false, projectionMatrixArray); + gl .uniformMatrix4fv (shaderNode .x3d_ModelViewMatrix, false, modelViewMatrix); + + stylePropertiesNode ?.setShaderUniforms (gl, shaderNode); + humanoidNode ?.setShaderUniforms (gl, shaderNode); + + shapeNode .displaySimple (gl, renderContext, shaderNode); + browser .resetTextureUnits (); + } + }; + })(), + draw () + { + const + browser = this .getBrowser (), + gl = browser .getContext (), + viewport = this .getViewVolume () .getViewport (), + globalObjects = this .globalObjects, + lights = this .lights, + textureProjectors = this .textureProjectors, + generatedCubeMapTextures = this .generatedCubeMapTextures, + globalShadows = this .globalShadows, + shadows = globalShadows .at (-1), + headlight = this .getNavigationInfo () ._headlight .getValue (), + numGlobalLights = globalObjects .reduce ((n, c) => n + !!c .lightNode, 0), + numGlobalTextureProjectors = globalObjects .reduce ((n, c) => n + !!c .textureProjectorNode, 0), + oit = browser .getFrameBuffer () .getOrderIndependentTransparency (); + + + this .renderCount = ++ renderCount; + + this .logarithmicDepthBuffer = browser .getBrowserOption ("LogarithmicDepthBuffer") + || this .getViewpoint () .getLogarithmicDepthBuffer (); + + + // PREPARATIONS + + + if (this .isIndependent ()) + { + // Render shadow maps. + + for (const light of lights) + light .renderShadowMap (this); + + // Render GeneratedCubeMapTextures. + + for (const generatedCubeMapTexture of generatedCubeMapTextures) + generatedCubeMapTexture .renderTexture (this); + } + + // Set up shadow matrix for all lights, and matrix for all projective textures. + + if (headlight) + browser .getHeadlight () .setGlobalVariables (this); + + for (const light of lights) + light .setGlobalVariables (this); + + for (const textureProjector of textureProjectors) + textureProjector .setGlobalVariables (this); + + // Set global uniforms. + + this .viewportArray .set (viewport); + this .cameraSpaceMatrixArray .set (this .getCameraSpaceMatrix () .get ()); + this .projectionMatrixArray .set (this .getProjectionMatrix () .get ()); + + + // DRAW + + + // Configure viewport and background + + gl .viewport (... viewport); + gl .scissor (... viewport); + + // Draw background. + + gl .clear (gl .DEPTH_BUFFER_BIT); + gl .blendFuncSeparate (gl .SRC_ALPHA, gl .ONE_MINUS_SRC_ALPHA, gl .ONE, gl .ONE_MINUS_SRC_ALPHA); + + this .getBackground () .display (gl, this, viewport); + + // Sorted blend or order independent transparency + + // Render opaque objects first + + const opaqueShapes = this .opaqueShapes; + + for (let i = 0, length = this .numOpaqueShapes; i < length; ++ i) + { + const renderContext = opaqueShapes [i]; + + gl .scissor (... renderContext .scissor); + + renderContext .shadows = renderContext .shadows || shadows; + renderContext .objectsCount [1] += numGlobalLights; + renderContext .objectsCount [2] += numGlobalTextureProjectors; + + renderContext .shapeNode .display (gl, renderContext); + browser .resetTextureUnits (); + } + + // Render transparent objects + + const transparentShapes = this .transparentShapes; + + if (oit) + browser .getFrameBuffer () .bindForOrderIndependentTransparency (); + else + this .transparencySorter .sort (0, this .numTransparentShapes); + + gl .depthMask (false); + gl .enable (gl .BLEND); + + for (let i = 0, length = this .numTransparentShapes; i < length; ++ i) + { + const renderContext = transparentShapes [i]; + + gl .scissor (... renderContext .scissor); + + renderContext .shadows = renderContext .shadows || shadows; + renderContext .objectsCount [1] += numGlobalLights; + renderContext .objectsCount [2] += numGlobalTextureProjectors; + + renderContext .shapeNode .display (gl, renderContext); + browser .resetTextureUnits (); + } + + gl .depthMask (true); + gl .disable (gl .BLEND); + + if (oit) + { + browser .getFrameBuffer () .compose (); + browser .getFrameBuffer () .unbind (); + } + + // POST DRAW + + if (this .isIndependent ()) + { + // Recycle clip planes, local fogs, local lights, and local projective textures. + + const localObjects = browser .getLocalObjects (); + + for (const localObject of localObjects) + localObject .dispose (); + + localObjects .length = 0; + + // Recycle global lights and global projective textures. + + for (const globalObject of globalObjects) + globalObject .dispose (); + } + + // Reset containers. + + globalObjects .length = 0; + lights .length = 0; + globalShadows .length = 1; + textureProjectors .length = 0; + generatedCubeMapTextures .length = 0; + }, +}); + +function X3DRenderObject_assign (lhs, rhs) +{ + for (var i = 0, length = rhs .length; i < length; ++ i) + lhs [i] = rhs [i]; + + lhs .length = length; +} + +const X3DRenderObject_default_ = X3DRenderObject; +; + +x_ite_Namespace .add ("X3DRenderObject", "x_ite/Rendering/X3DRenderObject", X3DRenderObject_default_); +/* harmony default export */ const Rendering_X3DRenderObject = (X3DRenderObject_default_); +;// CONCATENATED MODULE: ./src/x_ite/Execution/BindableStack.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function BindableStack (executionContext, defaultNode) +{ + Base_X3DBaseNode .call (this, executionContext); + + this .nodes = [ defaultNode ]; +} + +Object .assign (Object .setPrototypeOf (BindableStack .prototype, Base_X3DBaseNode .prototype), +{ + get () + { + return this .nodes; + }, + top () + { + return this .nodes .at (-1); + }, + pushOnTop (node) + { + if (node !== this .nodes [0]) + { + this .nodes .at (-1) ._isBound = false; + this .nodes .push (node); + } + + // Don't do set_bind. + node ._isBound = true; + node ._bindTime = this .getBrowser () .getCurrentTime (); + + this .addNodeEvent (); + }, + update (layerNode, removedNodes, changedNodes) + { + if (!removedNodes .length && !changedNodes .length) + return; + + // Save top node for later use. + + const + fromNode = this .top (), + boundNode = this .nodes .at (-1); + + // Remove invisible nodes and unbind them if needed. + + for (const removedNode of removedNodes) + { + const index = this .nodes .indexOf (removedNode); + + if (index > 0) + this .nodes .splice (index, 1); + } + + // Unbind nodes with set_bind false and pop top node. + + if (boundNode !== this .nodes [0]) + { + if (changedNodes .some (node => !node ._set_bind .getValue () && node === boundNode)) + { + this .nodes .pop (); + } + } + + // Push nodes with set_bind true to top of stack. + + for (const bindNode of changedNodes) + { + if (bindNode ._set_bind .getValue ()) + { + const index = this .nodes .indexOf (bindNode); + + if (index > -1) + this .nodes .splice (index, 1); + + this .nodes .push (bindNode); + } + } + + // Bind top node if not bound. + + const top = this .nodes .at (-1); + + if (top !== boundNode) + { + // First unbind last bound node. + + boundNode ._isBound = false; + + // Now bind new top node. + + top ._isBound = true; + top ._bindTime = this .getBrowser () .getCurrentTime (); + } + + // Do transition. + + top .transitionStart (layerNode, fromNode); + + this .addNodeEvent (); + }, +}); + +for (const key of Object .keys (BindableStack .prototype)) + Object .defineProperty (BindableStack .prototype, key, { enumerable: false }); + +Object .defineProperties (BindableStack, +{ + typeName: + { + value: "BindableStack", + enumerable: true, + }, +}); + +const BindableStack_default_ = BindableStack; +; + +x_ite_Namespace .add ("BindableStack", "x_ite/Execution/BindableStack", BindableStack_default_); +/* harmony default export */ const Execution_BindableStack = (BindableStack_default_); +;// CONCATENATED MODULE: ./src/x_ite/Execution/BindableList.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function BindableList (executionContext, defaultNode) +{ + Base_X3DBaseNode .call (this, executionContext); + + this .modificationCount = 0; + this .nodes = [ defaultNode ]; + this .collectedNodes = [ defaultNode ]; + this .changedNodes = [ ]; + this .removedNodes = [ ]; +} + +Object .assign (Object .setPrototypeOf (BindableList .prototype, Base_X3DBaseNode .prototype), +{ + get () + { + return this .nodes; + }, + getBound (name) + { + const length = this .nodes .length; + + if (length === 1) + return this .nodes [0]; // Return default viewpoint. + + const enableInlineBindables = false; + + if (name) + { + // Return first viewpoint with @name. + + for (let i = 1; i < length; ++ i) + { + const + node = this .nodes [i], + scene = node .getExecutionContext () .getOuterNode () ?.getScene () ?? node .getScene (); + + if (!enableInlineBindables && !scene .isMainScene ()) + continue; + + if (node .getName () == name) + return node; + } + } + + // Return first bound viewpoint in scene. + + for (let i = 1; i < length; ++ i) + { + const + node = this .nodes [i], + scene = node .getExecutionContext () .getOuterNode () ?.getScene () ?? node .getScene (); + + if (!enableInlineBindables && !scene .isMainScene ()) + continue; + + if (node ._isBound .getValue ()) + return node; + } + + // Return first viewpoint in scene. + + for (let i = 1; i < length; ++ i) + { + const + node = this .nodes [i], + scene = node .getExecutionContext () .getOuterNode () ?.getScene () ?? node .getScene (); + + if (!enableInlineBindables && !scene .isMainScene ()) + continue; + + return node; + } + + return this .nodes [0]; // Return default viewpoint. + }, + push (node) + { + return this .collectedNodes .push (node); + }, + update (layerNode, stack) + { + const { collectedNodes, changedNodes, removedNodes } = this; + + for (const node of collectedNodes) + { + if (node .getModificationCount () > this .modificationCount) + changedNodes .push (node); + } + + if (!equals (collectedNodes, this .nodes)) + { + // Unbind nodes not in current list (collectedNodes); + + for (const node of this .nodes) + { + if (!collectedNodes .includes (node)) + removedNodes .push (node); + } + + // Swap nodes. + + const tmp = this .nodes; + + this .nodes = collectedNodes; + this .collectedNodes = tmp; + } + + // Clear collected nodes. + + this .collectedNodes .length = 1; + + // Update stack. + + stack .update (layerNode, removedNodes, changedNodes) + + changedNodes .length = 0; + removedNodes .length = 0; + + // Advance modificationCount time. + + this .modificationCount = Core_X3DBindableNode .getModificationCount (); + }, +}); + +for (const key of Object .keys (BindableList .prototype)) + Object .defineProperty (BindableList .prototype, key, { enumerable: false }); + +// Compares two nodes. + +function equals (lhs, rhs) +{ + if (lhs .length !== rhs .length) + return false; + + for (let i = 0; i < lhs .length; ++ i) + { + if (lhs [i] !== rhs [i]) + return false; + } + + return true; +} + +Object .defineProperties (BindableList, +{ + typeName: + { + value: "BindableList", + enumerable: true, + }, +}); + +const BindableList_default_ = BindableList; +; + +x_ite_Namespace .add ("BindableList", "x_ite/Execution/BindableList", BindableList_default_); +/* harmony default export */ const Execution_BindableList = (BindableList_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Navigation/NavigationInfo.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +const TransitionType = +{ + TELEPORT: true, + LINEAR: true, + ANIMATE: true, +}; + +function NavigationInfo (executionContext) +{ + Core_X3DBindableNode .call (this, executionContext); + + this .addType (Base_X3DConstants .NavigationInfo); + + this .addChildObjects (Base_X3DConstants .outputOnly, "transitionStart", new x_ite_Fields .SFBool (), + Base_X3DConstants .outputOnly, "transitionActive", new x_ite_Fields .SFBool (), + Base_X3DConstants .outputOnly, "availableViewers", new x_ite_Fields .MFString (), + Base_X3DConstants .outputOnly, "viewer", new x_ite_Fields .SFString ("EXAMINE")); + + this ._avatarSize .setUnit ("length"); + this ._speed .setUnit ("speed"); + this ._visibilityLimit .setUnit ("speed"); +} + +Object .assign (Object .setPrototypeOf (NavigationInfo .prototype, Core_X3DBindableNode .prototype), +{ + initialize () + { + Core_X3DBindableNode .prototype .initialize .call (this); + + this ._type .addInterest ("set_type__", this); + this ._headlight .addInterest ("set_headlight__", this); + this ._transitionStart .addInterest ("set_transitionStart__", this); + this ._transitionComplete .addInterest ("set_transitionComplete__", this); + this ._isBound .addInterest ("set_isBound__", this); + + this .set_type__ (); + this .set_headlight__ (); + }, + getViewer () + { + return this ._viewer .getValue (); + }, + getCollisionRadius () + { + if (this ._avatarSize .length > 0) + { + if (this ._avatarSize [0] > 0) + return this ._avatarSize [0]; + } + + return 0.25; + }, + getAvatarHeight () + { + if (this ._avatarSize .length > 1) + return this ._avatarSize [1]; + + return 1.6; + }, + getStepHeight () + { + if (this ._avatarSize .length > 2) + return this ._avatarSize [2]; + + return 0.75; + }, + getNearValue () + { + const nearValue = this .getCollisionRadius (); + + if (nearValue === 0) + return 1e-5; + + else + return nearValue / 2; + }, + getFarValue (viewpoint) + { + return this ._visibilityLimit .getValue () + ? this ._visibilityLimit .getValue () + : viewpoint .getMaxFarValue (); + }, + getTransitionType () + { + for (const value of this ._transitionType) + { + const transitionType = TransitionType [value]; + + if (transitionType) + return value; + } + + return "LINEAR"; + }, + set_type__ () + { + // Determine active viewer. + + this ._viewer = "EXAMINE"; + + for (const string of this ._type) + { + switch (string) + { + case "EXAMINE": + case "WALK": + case "FLY": + case "LOOKAT": + case "PLANE": + case "NONE": + this ._viewer = string; + break; + case "PLANE_create3000.github.io": + case "PLANE_create3000.de": + this ._viewer = "PLANE"; + break; + default: + continue; + } + + // Leave for loop. + break; + } + + // Determine available viewers. + + let + examineViewer = false, + walkViewer = false, + flyViewer = false, + planeViewer = false, + noneViewer = false, + lookAt = false; + + if (! this ._type .length) + { + examineViewer = true; + walkViewer = true; + flyViewer = true; + planeViewer = true; + noneViewer = true; + lookAt = true; + } + else + { + for (const string of this ._type) + { + switch (string) + { + case "EXAMINE": + examineViewer = true; + continue; + case "WALK": + walkViewer = true; + continue; + case "FLY": + flyViewer = true; + continue; + case "LOOKAT": + lookAt = true; + continue; + case "PLANE": + planeViewer = true; + continue; + case "NONE": + noneViewer = true; + continue; + case "ANY": + examineViewer = true; + walkViewer = true; + flyViewer = true; + planeViewer = true; + noneViewer = true; + lookAt = true; + break; + default: + // Some string defaults to EXAMINE. + examineViewer = true; + continue; + } + + break; + } + } + + this ._availableViewers .length = 0; + + if (examineViewer) + this ._availableViewers .push ("EXAMINE"); + + if (walkViewer) + this ._availableViewers .push ("WALK"); + + if (flyViewer) + this ._availableViewers .push ("FLY"); + + if (planeViewer) + this ._availableViewers .push ("PLANE"); + + if (lookAt) + this ._availableViewers .push ("LOOKAT"); + + if (noneViewer) + this ._availableViewers .push ("NONE"); + }, + set_headlight__ () + { + if (this ._headlight .getValue ()) + delete this .enable; + else + this .enable = Function .prototype; + }, + set_transitionStart__ () + { + if (! this ._transitionActive .getValue ()) + this ._transitionActive = true; + }, + set_transitionComplete__ () + { + if (this ._transitionActive .getValue ()) + this ._transitionActive = false; + }, + set_isBound__ () + { + if (this ._isBound .getValue ()) + return; + + if (this ._transitionActive .getValue ()) + this ._transitionActive = false; + }, + enable (type, renderObject) + { + if (type !== Rendering_TraverseType .DISPLAY) + return; + + if (this ._headlight .getValue ()) + renderObject .getGlobalObjects () .push (this .getBrowser () .getHeadlight ()); + }, + traverse (type, renderObject) + { + if (type !== Rendering_TraverseType .CAMERA) + return; + + renderObject .getLayer () .getNavigationInfos () .push (this); + } +}); + +Object .defineProperties (NavigationInfo, +{ + typeName: + { + value: "NavigationInfo", + enumerable: true, + }, + componentName: + { + value: "Navigation", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_bind", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "type", new x_ite_Fields .MFString ("EXAMINE", "ANY")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "avatarSize", new x_ite_Fields .MFFloat (0.25, 1.6, 0.75)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "speed", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "headlight", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "visibilityLimit", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "transitionType", new x_ite_Fields .MFString ("LINEAR")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "transitionTime", new x_ite_Fields .SFTime (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "transitionComplete", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isBound", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "bindTime", new x_ite_Fields .SFTime ()), + ]), + enumerable: true, + }, +}); + +const NavigationInfo_default_ = NavigationInfo; +; + +x_ite_Namespace .add ("NavigationInfo", "x_ite/Components/Navigation/NavigationInfo", NavigationInfo_default_); +/* harmony default export */ const Navigation_NavigationInfo = (NavigationInfo_default_); +;// CONCATENATED MODULE: ./src/standard/Utility/ObjectCache.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +function ObjectCache (Type) +{ + return Object .assign ([ ], + { + top: 0, + pop () + { + if (this .top !== 0) + return this [-- this .top]; + + return new Type (); + }, + push (object) + { + this [this .top ++] = object; + }, + clear () + { + this .length = 0; + this .top = 0; + }, + }); +} + +const ObjectCache_default_ = ObjectCache; +; + +x_ite_Namespace .add ("ObjectCache", "standard/Utility/ObjectCache", ObjectCache_default_); +/* harmony default export */ const Utility_ObjectCache = (ObjectCache_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/EnvironmentalEffects/X3DFogObject.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +const Fogs = Utility_ObjectCache (FogContainer); + +function FogContainer () +{ + this .fogMatrix = new Float32Array (9); +} + +Object .assign (FogContainer .prototype, +{ + set (fogNode, modelViewMatrix) + { + this .fogNode = fogNode; + + this .fogMatrix .set (modelViewMatrix .submatrix .inverse ()); + }, + getFogType () + { + return this .fogNode .getFogType (); + }, + setShaderUniforms (gl, shaderObject) + { + if (shaderObject .hasFog (this)) + return; + + const fogNode = this .fogNode; + + gl .uniform3fv (shaderObject .x3d_FogColor, fogNode .colorArray); + gl .uniform1f (shaderObject .x3d_FogVisibilityRange, fogNode .visibilityRange); + gl .uniformMatrix3fv (shaderObject .x3d_FogMatrix, false, this .fogMatrix); + }, + dispose () + { + Fogs .push (this); + }, +}); + +function X3DFogObject (executionContext) +{ + this .addType (Base_X3DConstants .X3DFogObject); + + this .addChildObjects (Base_X3DConstants .inputOutput, "hidden", new x_ite_Fields .SFBool ()); + + this ._visibilityRange .setUnit ("length"); + + this .colorArray = new Float32Array (3); +} + +Object .assign (X3DFogObject .prototype, +{ + initialize () + { + this ._hidden .addInterest ("set_fogType__", this); + this ._fogType .addInterest ("set_fogType__", this); + this ._color .addInterest ("set_color__", this); + this ._visibilityRange .addInterest ("set_visibilityRange__", this); + + this .set_color__ (); + this .set_visibilityRange__ (); + }, + isHidden () + { + return this ._hidden .getValue (); + }, + setHidden (value) + { + if (value === this ._hidden .getValue ()) + return; + + this ._hidden = value; + }, + getFogType () + { + return this .fogType; + }, + getFogs () + { + return Fogs; + }, + set_fogType__: (() => + { + const fogTypes = new Map ([ + ["LINEAR", 1], + ["EXPONENTIAL", 2], + ]); + + return function () + { + if (this ._hidden .getValue () || this .visibilityRange === 0) + this .fogType = 0; + else + this .fogType = fogTypes .get (this ._fogType .getValue ()) || 1; + }; + })(), + set_color__ () + { + const + color = this ._color .getValue (), + colorArray = this .colorArray; + + colorArray [0] = color .r; + colorArray [1] = color .g; + colorArray [2] = color .b; + }, + set_visibilityRange__ () + { + this .visibilityRange = Math .max (0, this ._visibilityRange .getValue ()); + + this .set_fogType__ (); + }, + dispose () { }, +}); + +Object .defineProperties (X3DFogObject, +{ + typeName: + { + value: "X3DFogObject", + enumerable: true, + }, + componentName: + { + value: "EnvironmentalEffects", + enumerable: true, + }, +}); + +const X3DFogObject_default_ = X3DFogObject; +; + +x_ite_Namespace .add ("X3DFogObject", "x_ite/Components/EnvironmentalEffects/X3DFogObject", X3DFogObject_default_); +/* harmony default export */ const EnvironmentalEffects_X3DFogObject = (X3DFogObject_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/EnvironmentalEffects/Fog.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + +function Fog (executionContext) +{ + Core_X3DBindableNode .call (this, executionContext); + EnvironmentalEffects_X3DFogObject .call (this, executionContext); + + this .addType (Base_X3DConstants .Fog); + + this .modelMatrix = new Numbers_Matrix4 (); +} + +Object .assign (Object .setPrototypeOf (Fog .prototype, Core_X3DBindableNode .prototype), + EnvironmentalEffects_X3DFogObject .prototype, +{ + initialize () + { + Core_X3DBindableNode .prototype .initialize .call (this); + EnvironmentalEffects_X3DFogObject .prototype .initialize .call (this); + }, + getModelMatrix () + { + return this .modelMatrix; + }, + traverse (type, renderObject) + { + if (type !== Rendering_TraverseType .CAMERA) + return; + + renderObject .getLayer () .getFogs () .push (this); + + this .modelMatrix .assign (renderObject .getModelViewMatrix () .get ()); + }, + dispose () + { + EnvironmentalEffects_X3DFogObject .prototype .dispose .call (this); + Core_X3DBindableNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (Fog, +{ + typeName: + { + value: "Fog", + enumerable: true, + }, + componentName: + { + value: "EnvironmentalEffects", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_bind", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "fogType", new x_ite_Fields .SFString ("LINEAR")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "color", new x_ite_Fields .SFColor (1, 1, 1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "visibilityRange", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isBound", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "bindTime", new x_ite_Fields .SFTime ()), + ]), + enumerable: true, + }, +}); + +const Fog_default_ = Fog; +; + +x_ite_Namespace .add ("Fog", "x_ite/Components/EnvironmentalEffects/Fog", Fog_default_); +/* harmony default export */ const EnvironmentalEffects_Fog = (Fog_default_); +;// CONCATENATED MODULE: ./src/x_ite/Rendering/VertexArray.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +function VertexArray (gl) +{ + this .gl = gl; + this .vertexArrays = new Map (); +} + +Object .assign (VertexArray .prototype, +{ + update (value = true) + { + if (value) + this .delete (); + + return this; + }, + enable (shaderNode) + { + const vertexArray = this .vertexArrays .get (shaderNode); + + if (vertexArray) + { + this .gl .bindVertexArray (vertexArray); + + return false; + } + else + { + const vertexArray = this .gl .createVertexArray (); + + this .vertexArrays .set (shaderNode, vertexArray) + + this .gl .bindVertexArray (vertexArray); + + // console .log ("rebuild vao"); + + return true; // Rebuild + } + }, + delete () + { + for (const vertexArray of this .vertexArrays .values ()) + this .gl .deleteVertexArray (vertexArray); + + this .vertexArrays .clear (); + }, +}); + +const VertexArray_default_ = VertexArray; +; + +x_ite_Namespace .add ("VertexArray", "x_ite/Rendering/VertexArray", VertexArray_default_); +/* harmony default export */ const Rendering_VertexArray = (VertexArray_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Core/Shading.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +let Shading_i = 0; + +const Shading = +{ + POINT: Shading_i ++, + WIREFRAME: Shading_i ++, + FLAT: Shading_i ++, + GOURAUD: Shading_i ++, + PHONG: Shading_i ++, +}; + +const Shading_default_ = Shading; +; + +x_ite_Namespace .add ("Shading", "x_ite/Browser/Core/Shading", Shading_default_); +/* harmony default export */ const Core_Shading = (Shading_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/X3DGeometryNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + +// Box normals for bbox / line intersection. +const boxNormals = [ + new Numbers_Vector3 (0, 0, 1), // front + new Numbers_Vector3 (0, 0, -1), // back + new Numbers_Vector3 (0, 1, 0), // top + new Numbers_Vector3 (0, -1, 0), // bottom + new Numbers_Vector3 (1, 0, 0) // right + // left: We do not have to test for left. +]; + +function X3DGeometryNode (executionContext) +{ + Core_X3DNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DGeometryNode); + + this .addChildObjects (Base_X3DConstants .outputOnly, "transparent", new x_ite_Fields .SFBool (), + Base_X3DConstants .outputOnly, "bbox_changed", new x_ite_Fields .SFTime (), + Base_X3DConstants .outputOnly, "rebuild", new x_ite_Fields .SFTime ()); + + // Members + + const browser = this .getBrowser (); + + this .min = new Numbers_Vector3 (0, 0, 0); + this .max = new Numbers_Vector3 (0, 0, 0); + this .bbox = Geometry_Box3 .Extents (this .min, this .max); + this .solid = true; + this .primitiveMode = browser .getContext () .TRIANGLES; + this .geometryType = 3; + this .flatShading = undefined; + this .colorMaterial = false; + this .attribNodes = [ ]; + this .attribArrays = [ ]; + this .textureCoordinateMapping = new Map (); + this .multiTexCoords = [ ]; + this .coordIndices = new x_ite_Fields .MFFloat (); + this .texCoords = new x_ite_Fields .MFFloat (); + this .fogDepths = new x_ite_Fields .MFFloat (); + this .colors = new x_ite_Fields .MFFloat (); + this .normals = new x_ite_Fields .MFFloat (); + this .flatNormals = new x_ite_Fields .MFFloat (); + this .vertices = new x_ite_Fields .MFFloat (); + this .hasFogCoords = false; + this .hasNormals = false; + this .geometryKey = ""; + this .vertexCount = 0; + this .planes = [ ]; + + for (let i = 0; i < 5; ++ i) + this .planes [i] = new Geometry_Plane3 (Numbers_Vector3 .Zero, Numbers_Vector3 .zAxis); +} + +Object .assign (Object .setPrototypeOf (X3DGeometryNode .prototype, Core_X3DNode .prototype), +{ + setup () + { + Core_X3DNode .prototype .setup .call (this); + + this .rebuild (); + }, + initialize () + { + Core_X3DNode .prototype .initialize .call (this); + + const + browser = this .getBrowser (), + gl = browser .getContext (); + + this .getLive () .addInterest ("set_live__", this); + + this .addInterest ("requestRebuild", this); + this ._rebuild .addInterest ("rebuild", this); + + this .frontFace = gl .CCW; + this .backFace = new Map ([[gl .CCW, gl .CW], [gl .CW, gl .CCW]]); + this .coordIndexBuffer = gl .createBuffer (); + this .attribBuffers = [ ]; + this .textureCoordinateNode = browser .getDefaultTextureCoordinate (); + this .texCoordBuffers = Array .from ({length: browser .getMaxTexCoords ()}, () => gl .createBuffer ()); + this .fogDepthBuffer = gl .createBuffer (); + this .colorBuffer = gl .createBuffer (); + this .normalBuffer = gl .createBuffer (); + this .vertexBuffer = gl .createBuffer (); + this .vertexArrayObject = new Rendering_VertexArray (gl); + + this .set_live__ (); + }, + setGeometryType (value) + { + this .geometryType = value; + }, + getGeometryType () + { + return this .geometryType; + }, + setTransparent (value) + { + if (value !== this ._transparent .getValue ()) + this ._transparent = value; + }, + isTransparent () + { + return this ._transparent .getValue (); + }, + getBBox () + { + // With screen matrix applied. + return this .bbox; + }, + setBBox (bbox) + { + if (bbox .equals (this .bbox)) + return; + + bbox .getExtents (this .min, this .max); + + this .bbox .assign (bbox); + + for (let i = 0; i < 5; ++ i) + this .planes [i] .set (i % 2 ? this .min : this .max, boxNormals [i]); + + this ._bbox_changed .addEvent (); + }, + getMin () + { + // With screen matrix applied. + return this .min; + }, + getMax () + { + // With screen matrix applied. + return this .max; + }, + getMatrix () + { + return Numbers_Matrix4 .Identity; + }, + setPrimitiveMode (value) + { + this .primitiveMode = value; + }, + getPrimitiveMode () + { + return this .primitiveMode; + }, + setSolid (value) + { + this .solid = value; + }, + setCCW (value) + { + const gl = this .getBrowser () .getContext (); + + this .frontFace = value ? gl .CCW : gl .CW; + }, + getCoordIndices () + { + return this .coordIndices; + }, + getAttrib () + { + return this .attribNodes; + }, + getAttribs () + { + return this .attribArrays; + }, + getAttribBuffers () + { + return this .attribBuffers; + }, + setFogDepths (value) + { + this .fogDepths .assign (value); + }, + getFogDepths () + { + return this .fogDepths; + }, + setColors (value) + { + this .colors .assign (value); + }, + getColors () + { + return this .colors; + }, + setMultiTexCoords (value) + { + const + multiTexCoords = this .multiTexCoords, + length = value .length; + + for (let i = 0; i < length; ++ i) + multiTexCoords [i] = value [i]; + + multiTexCoords .length = length; + }, + getMultiTexCoords () + { + return this .multiTexCoords; + }, + getTexCoords () + { + return this .texCoords; + }, + getTextureCoordinate () + { + return this .textureCoordinateNode; + }, + setTextureCoordinate (value) + { + this .textureCoordinateNode .removeInterest ("updateTextureCoordinateMapping", this); + + this .textureCoordinateNode = value ?? this .getBrowser () .getDefaultTextureCoordinate (); + + this .textureCoordinateNode .addInterest ("updateTextureCoordinateMapping", this); + + this .updateTextureCoordinateMapping (); + }, + getTextureCoordinateMapping () + { + return this .textureCoordinateMapping; + }, + updateTextureCoordinateMapping () + { + this .textureCoordinateMapping .clear (); + + this .textureCoordinateNode .getTextureCoordinateMapping (this .textureCoordinateMapping); + }, + setNormals (value) + { + this .normals .assign (value); + }, + getNormals () + { + return this .normals; + }, + setVertices (value) + { + this .vertices .assign (value); + }, + getVertices () + { + return this .vertices; + }, + updateVertexArrays () + { + this .vertexArrayObject .update (); + + this .updateParticles = true; + }, + buildTexCoords () + { + const texCoords = this .texCoords; + + if (texCoords .length === 0) + { + const + p = this .getTexCoordParams (), + min = p .min, + Sindex = p .Sindex, + Tindex = p .Tindex, + Ssize = p .Ssize, + S = min [Sindex], + T = min [Tindex], + vertices = this .vertices .getValue (); + + for (let i = 0, length = vertices .length; i < length; i += 4) + { + texCoords .push ((vertices [i + Sindex] - S) / Ssize, + (vertices [i + Tindex] - T) / Ssize, + 0, + 1); + } + + texCoords .shrinkToFit (); + } + + this .getMultiTexCoords () .push (texCoords); + }, + getTexCoordParams: (() => + { + const texCoordParams = { min: new Numbers_Vector3 (0, 0, 0), Ssize: 0, Sindex: 0, Tindex: 0 }; + + return function () + { + const + bbox = this .getBBox (), + size = bbox .size, + Xsize = size .x, + Ysize = size .y, + Zsize = size .z; + + texCoordParams .min .assign (bbox .center) .subtract (size .divide (2)); + + if ((Xsize >= Ysize) && (Xsize >= Zsize)) + { + // X size largest + texCoordParams .Ssize = Xsize; + texCoordParams .Sindex = 0; + + if (Ysize >= Zsize) + texCoordParams .Tindex = 1; + else + texCoordParams .Tindex = 2; + } + else if ((Ysize >= Xsize) && (Ysize >= Zsize)) + { + // Y size largest + texCoordParams .Ssize = Ysize; + texCoordParams .Sindex = 1; + + if (Xsize >= Zsize) + texCoordParams .Tindex = 0; + else + texCoordParams .Tindex = 2; + } + else + { + // Z is the largest + texCoordParams .Ssize = Zsize; + texCoordParams .Sindex = 2; + + if (Xsize >= Ysize) + texCoordParams .Tindex = 0; + else + texCoordParams .Tindex = 1; + } + + return texCoordParams; + }; + })(), + refineNormals (normalIndex, normals, creaseAngle) + { + if (creaseAngle === 0) + return normals; + + const + cosCreaseAngle = Math .cos (Math_Algorithm .clamp (creaseAngle, 0, Math .PI)), + refinedNormals = [ ]; + + for (const vertex of normalIndex .values ()) + { + for (const p of vertex) + { + const + P = normals [p], + N = new Numbers_Vector3 (0, 0, 0); + + for (const q of vertex) + { + const Q = normals [q]; + + if (Q .dot (P) >= cosCreaseAngle) + N .add (Q); + } + + refinedNormals [p] = N .normalize (); + } + } + + return refinedNormals; + }, + transformLine (hitRay) + { + // Apply sceen nodes transformation in place here. + }, + transformMatrix (hitRay) + { + // Apply sceen nodes transformation in place here. + }, + isClipped (point, clipPlanes) + { + return clipPlanes .some (clipPlane => clipPlane .isClipped (point)); + }, + intersectsLine: (() => + { + const + modelViewMatrix = new Numbers_Matrix4 (), + uvt = { u: 0, v: 0, t: 0 }, + v0 = new Numbers_Vector3 (0, 0, 0), + v1 = new Numbers_Vector3 (0, 0, 0), + v2 = new Numbers_Vector3 (0, 0, 0), + clipPoint = new Numbers_Vector3 (0, 0, 0); + + return function (hitRay, matrix, clipPlanes, intersections) + { + if (this .intersectsBBox (hitRay)) + { + this .transformLine (hitRay); // Apply screen transformations from screen nodes. + this .transformMatrix (modelViewMatrix .assign (matrix)); // Apply screen transformations from screen nodes. + + const + texCoords = this .multiTexCoords [0] .getValue (), + normals = this .normals .getValue (), + vertices = this .vertices .getValue (), + vertexCount = this .vertexCount; + + for (let i = 0; i < vertexCount; i += 3) + { + const i4 = i * 4; + + v0 .x = vertices [i4]; v0 .y = vertices [i4 + 1]; v0 .z = vertices [i4 + 2]; + v1 .x = vertices [i4 + 4]; v1 .y = vertices [i4 + 5]; v1 .z = vertices [i4 + 6]; + v2 .x = vertices [i4 + 8]; v2 .y = vertices [i4 + 9]; v2 .z = vertices [i4 + 10]; + + if (hitRay .intersectsTriangle (v0, v1, v2, uvt)) + { + // Get barycentric coordinates. + + const + u = uvt .u, + v = uvt .v, + t = uvt .t; + + // Determine vectors for X3DPointingDeviceSensors. + + const point = new Numbers_Vector3 (t * vertices [i4] + u * vertices [i4 + 4] + v * vertices [i4 + 8], + t * vertices [i4 + 1] + u * vertices [i4 + 5] + v * vertices [i4 + 9], + t * vertices [i4 + 2] + u * vertices [i4 + 6] + v * vertices [i4 + 10]); + + if (clipPlanes .length) + { + if (this .isClipped (modelViewMatrix .multVecMatrix (clipPoint .assign (point)), clipPlanes)) + continue; + } + + const texCoord = new Numbers_Vector2 (t * texCoords [i4] + u * texCoords [i4 + 4] + v * texCoords [i4 + 8], + t * texCoords [i4 + 1] + u * texCoords [i4 + 5] + v * texCoords [i4 + 9]); + + const i3 = i * 3; + + const normal = new Numbers_Vector3 (t * normals [i3] + u * normals [i3 + 3] + v * normals [i3 + 6], + t * normals [i3 + 1] + u * normals [i3 + 4] + v * normals [i3 + 7], + t * normals [i3 + 2] + u * normals [i3 + 5] + v * normals [i3 + 8]); + + intersections .push ({ texCoord: texCoord, normal: normal, point: this .getMatrix () .multVecMatrix (point) }); + } + } + } + + return intersections .length; + }; + })(), + getPlanesWithOffset: (() => + { + const + min = new Numbers_Vector3 (0, 0, 0), + max = new Numbers_Vector3 (0, 0, 0), + planes = [ ]; + + for (let i = 0; i < 5; ++ i) + planes [i] = new Geometry_Plane3 (Numbers_Vector3 .Zero, Numbers_Vector3 .zAxis); + + return function (minX, minY, minZ, maxX, maxY, maxZ) + { + min .set (minX, minY, minZ); + max .set (maxX, maxY, maxZ); + + for (let i = 0; i < 5; ++ i) + planes [i] .set (i % 2 ? min : max, boxNormals [i]); + + return planes; + }; + })(), + intersectsBBox: (() => + { + const intersection = new Numbers_Vector3 (0, 0, 0); + + return function (hitRay, offsets) + { + if (offsets) + { + var + min = this .min, + max = this .max, + minX = min .x - offsets .x, + maxX = max .x + offsets .x, + minY = min .y - offsets .y, + maxY = max .y + offsets .y, + minZ = min .z - offsets .z, + maxZ = max .z + offsets .z, + planes = this .getPlanesWithOffset (minX, minY, minZ, maxX, maxY, maxZ); + } + else + { + var + min = this .min, + max = this .max, + minX = min .x, + maxX = max .x, + minY = min .y, + maxY = max .y, + minZ = min .z, + maxZ = max .z, + planes = this .planes; + } + + // front + if (planes [0] .intersectsLine (hitRay, intersection)) + { + if (intersection .x >= minX && intersection .x <= maxX && + intersection .y >= minY && intersection .y <= maxY) + return true; + } + + // back + if (planes [1] .intersectsLine (hitRay, intersection)) + { + if (intersection .x >= minX && intersection .x <= maxX && + intersection .y >= minY && intersection .y <= maxY) + return true; + } + + // top + if (planes [2] .intersectsLine (hitRay, intersection)) + { + if (intersection .x >= minX && intersection .x <= maxX && + intersection .z >= minZ && intersection .z <= maxZ) + return true; + } + + // bottom + if (planes [3] .intersectsLine (hitRay, intersection)) + { + if (intersection .x >= minX && intersection .x <= maxX && + intersection .z >= minZ && intersection .z <= maxZ) + return true; + } + + // right + if (planes [4] .intersectsLine (hitRay, intersection)) + { + if (intersection .y >= minY && intersection .y <= maxY && + intersection .z >= minZ && intersection .z <= maxZ) + return true; + } + + return false; + }; + })(), + intersectsBox: (() => + { + const + v0 = new Numbers_Vector3 (0, 0, 0), + v1 = new Numbers_Vector3 (0, 0, 0), + v2 = new Numbers_Vector3 (0, 0, 0), + invMatrix = new Numbers_Matrix4 (), + clipPoint = new Numbers_Vector3 (0, 0, 0); + + return function (box, clipPlanes, modelViewMatrix) + { + if (box .intersectsBox (this .bbox)) + { + box .multRight (invMatrix .assign (this .getMatrix ()) .inverse ()); + + this .transformMatrix (modelViewMatrix); // Apply screen transformations from screen nodes. + + const vertices = this .vertices .getValue (); + + for (let i = 0, length = this .vertexCount; i < length; i += 3) + { + const i4 = i * 4; + + v0 .x = vertices [i4]; v0 .y = vertices [i4 + 1]; v0 .z = vertices [i4 + 2]; + v1 .x = vertices [i4 + 4]; v1 .y = vertices [i4 + 5]; v1 .z = vertices [i4 + 6]; + v2 .x = vertices [i4 + 8]; v2 .y = vertices [i4 + 9]; v2 .z = vertices [i4 + 10]; + + if (box .intersectsTriangle (v0, v1, v2)) + { + if (clipPlanes .length) + { + if (this .isClipped (modelViewMatrix .multVecMatrix (clipPoint .assign (v0)), clipPlanes)) + continue; + + if (this .isClipped (modelViewMatrix .multVecMatrix (clipPoint .assign (v1)), clipPlanes)) + continue; + + if (this .isClipped (modelViewMatrix .multVecMatrix (clipPoint .assign (v2)), clipPlanes)) + continue; + } + + return true; + } + } + } + + return false; + }; + })(), + set_live__ () + { + if (this .getLive () .getValue ()) + this .getBrowser () .getBrowserOptions () ._Shading .addInterest ("set_shading__", this); + else + this .getBrowser () .getBrowserOptions () ._Shading .removeInterest ("set_shading__", this); + }, + set_shading__: (() => + { + const + v0 = new Numbers_Vector3 (0, 0, 0), + v1 = new Numbers_Vector3 (0, 0, 0), + v2 = new Numbers_Vector3 (0, 0, 0), + normal = new Numbers_Vector3 (0, 0, 0); + + return function (shading) + { + const + browser = this .getBrowser (), + gl = browser .getContext (); + + if (this .geometryType < 2) + { + gl .bindBuffer (gl .ARRAY_BUFFER, this .normalBuffer); + gl .bufferData (gl .ARRAY_BUFFER, this .normals .getValue (), gl .DYNAMIC_DRAW); + } + else + { + const flatShading = browser .getBrowserOptions () .getShading () === Core_Shading .FLAT; + + if (flatShading === this .flatShading) + return; + + this .flatShading = flatShading; + + // Generate flat normals if needed. + + if (flatShading) + { + if (!this .flatNormals .length) + { + const + cw = this .frontFace === gl .CW, + flatNormals = this .flatNormals, + vertices = this .vertices .getValue (); + + for (let i = 0, length = vertices .length; i < length; i += 12) + { + Geometry_Triangle3 .normal (v0 .set (vertices [i], vertices [i + 1], vertices [i + 2]), + v1 .set (vertices [i + 4], vertices [i + 5], vertices [i + 6]), + v2 .set (vertices [i + 8], vertices [i + 9], vertices [i + 10]), + normal); + + if (cw) + normal .negate (); + + flatNormals .push (normal .x, normal .y, normal .z, + normal .x, normal .y, normal .z, + normal .x, normal .y, normal .z); + } + + flatNormals .shrinkToFit (); + } + } + + // Transfer normals. + + gl .bindBuffer (gl .ARRAY_BUFFER, this .normalBuffer); + gl .bufferData (gl .ARRAY_BUFFER, flatShading ? this .flatNormals .getValue () : this .normals .getValue (), gl .DYNAMIC_DRAW); + } + }; + })(), + requestRebuild () + { + this ._rebuild .addEvent (); + }, + rebuild: (() => + { + const point = new Numbers_Vector3 (0, 0, 0); + + return function () + { + this .clear (); + this .build (); + + // Shrink arrays before transferring them to graphics card. + + for (const attribArray of this .attribArrays) + attribArray .shrinkToFit (); + + for (const multiTexCoord of this .multiTexCoords) + multiTexCoord .shrinkToFit (); + + this .coordIndices .shrinkToFit (); + this .fogDepths .shrinkToFit (); + this .colors .shrinkToFit (); + this .normals .shrinkToFit (); + this .vertices .shrinkToFit (); + + // Determine bbox. + + const + vertices = this .vertices .getValue (), + min = this .min, + max = this .max; + + if (vertices .length) + { + if (min .x === Number .POSITIVE_INFINITY) + { + for (let i = 0, length = vertices .length; i < length; i += 4) + { + point .set (vertices [i], vertices [i + 1], vertices [i + 2]); + + min .min (point); + max .max (point); + } + } + + this .bbox .setExtents (min, max); + } + else + { + this .bbox .setExtents (min .set (0, 0, 0), max .set (0, 0, 0)); + } + + this ._bbox_changed .addEvent (); + + for (let i = 0; i < 5; ++ i) + this .planes [i] .set (i % 2 ? min : max, boxNormals [i]); + + // Generate texCoord if needed. + + if (this .multiTexCoords .length === 0) + this .buildTexCoords (); + + // Transfer arrays and update. + + this .transfer (); + this .updateGeometryKey (); + this .updateRenderFunctions (); + }; + })(), + clear () + { + // BBox + + this .min .set (Number .POSITIVE_INFINITY, Number .POSITIVE_INFINITY, Number .POSITIVE_INFINITY); + this .max .set (Number .NEGATIVE_INFINITY, Number .NEGATIVE_INFINITY, Number .NEGATIVE_INFINITY); + + // Create attribArray arrays. + { + const attribArrays = this .attribArrays; + + for (const attribArray of attribArrays) + attribArray .length = 0; + + const length = this .attribNodes .length; + + for (let a = attribArrays .length; a < length; ++ a) + attribArrays [a] = new x_ite_Fields .MFFloat (); + + attribArrays .length = length; + } + + // Buffer + + this .flatShading = undefined; + + this .coordIndices .length = 0; + this .fogDepths .length = 0; + this .colors .length = 0; + this .multiTexCoords .length = 0; + this .texCoords .length = 0; + this .normals .length = 0; + this .flatNormals .length = 0; + this .vertices .length = 0; + }, + transfer () + { + const gl = this .getBrowser () .getContext (); + + // Transfer coord indices. + + gl .bindBuffer (gl .ARRAY_BUFFER, this .coordIndexBuffer); + gl .bufferData (gl .ARRAY_BUFFER, this .coordIndices .getValue (), gl .DYNAMIC_DRAW); + + // Transfer attribArrays. + + for (let i = this .attribBuffers .length, length = this .attribArrays .length; i < length; ++ i) + this .attribBuffers .push (gl .createBuffer ()); + + for (let i = 0, length = this .attribArrays .length; i < length; ++ i) + { + gl .bindBuffer (gl .ARRAY_BUFFER, this .attribBuffers [i]); + gl .bufferData (gl .ARRAY_BUFFER, this .attribArrays [i] .getValue (), gl .DYNAMIC_DRAW); + } + + // Transfer fog depths. + + const lastHasFogCoords = this .hasFogCoords; + + gl .bindBuffer (gl .ARRAY_BUFFER, this .fogDepthBuffer); + gl .bufferData (gl .ARRAY_BUFFER, this .fogDepths .getValue (), gl .DYNAMIC_DRAW); + + this .hasFogCoords = !! this .fogDepths .length; + + if (this .hasFogCoords !== lastHasFogCoords) + this .updateVertexArrays (); + + // Transfer colors. + + const lastColorMaterial = this .colorMaterial; + + gl .bindBuffer (gl .ARRAY_BUFFER, this .colorBuffer); + gl .bufferData (gl .ARRAY_BUFFER, this .colors .getValue (), gl .DYNAMIC_DRAW); + + this .colorMaterial = !! this .colors .length; + + if (this .colorMaterial !== lastColorMaterial) + this .updateVertexArrays (); + + // Transfer multiTexCoords. + + for (let i = 0, length = this .multiTexCoords .length; i < length; ++ i) + { + gl .bindBuffer (gl .ARRAY_BUFFER, this .texCoordBuffers [i]); + gl .bufferData (gl .ARRAY_BUFFER, this .multiTexCoords [i] .getValue (), gl .DYNAMIC_DRAW); + } + + // Transfer normals or flat normals. + + const lastHasNormals = this .hasNormals; + + this .set_shading__ (this .getBrowser () .getBrowserOptions () ._Shading); + + this .hasNormals = !! this .normals .length; + + if (this .hasNormals !== lastHasNormals) + this .updateVertexArrays (); + + // Transfer vertices. + + gl .bindBuffer (gl .ARRAY_BUFFER, this .vertexBuffer); + gl .bufferData (gl .ARRAY_BUFFER, this .vertices .getValue (), gl .DYNAMIC_DRAW); + + this .vertexCount = this .vertices .length / 4; + }, + updateGeometryKey () + { + this .geometryKey = ""; + this .geometryKey += this .geometryType; + this .geometryKey += this .hasFogCoords ? "1" : "0"; + this .geometryKey += this .colorMaterial ? "1" : "0"; + this .geometryKey += this .hasNormals ? "1" : "0"; + }, + updateRenderFunctions () + { + if (this .vertexCount) + { + // Use default render functions. + + delete this .displaySimple; + delete this .display; + delete this .displaySimpleParticles; + delete this .displayParticles; + } + else + { + // Use no render function. + + this .displaySimple = Function .prototype; + this .display = Function .prototype; + this .displaySimpleParticles = Function .prototype; + this .displayParticles = Function .prototype; + } + }, + traverse (type, renderObject) + { }, + displaySimple (gl, renderContext, shaderNode) + { + if (this .vertexArrayObject .enable (shaderNode)) + { + if (this .coordIndices .length) + shaderNode .enableCoordIndexAttribute (gl, this .coordIndexBuffer, 0, 0); + + if (this .multiTexCoords .length) + shaderNode .enableTexCoordAttribute (gl, this .texCoordBuffers, 0, 0); + + if (this .hasNormals) + shaderNode .enableNormalAttribute (gl, this .normalBuffer, 0, 0); + + shaderNode .enableVertexAttribute (gl, this .vertexBuffer, 0, 0); + } + + gl .drawArrays (this .primitiveMode, 0, this .vertexCount); + }, + display (gl, renderContext) + { + const + browser = this .getBrowser (), + appearanceNode = renderContext .appearanceNode, + shaderNode = appearanceNode .getShader (this, renderContext); + + if (this .solid || !appearanceNode .getBackMaterial () || browser .getWireframe ()) + { + this .displayGeometry (gl, renderContext, appearanceNode, shaderNode, true, true); + } + else + { + const backShaderNode = appearanceNode .getBackShader (this, renderContext); + + this .displayGeometry (gl, renderContext, appearanceNode, backShaderNode, true, false); + this .displayGeometry (gl, renderContext, appearanceNode, shaderNode, false, true); + } + }, + displayGeometry (gl, renderContext, appearanceNode, shaderNode, back, front) + { + const + browser = this .getBrowser (), + blendModeNode = appearanceNode .getBlendMode (), + attribNodes = this .attribNodes, + attribBuffers = this .attribBuffers, + primitiveMode = browser .getPrimitiveMode (this .primitiveMode); + + blendModeNode ?.enable (gl); + + shaderNode .enable (gl); + shaderNode .setUniforms (gl, this, renderContext, front); + + // Setup vertex attributes. + + if (this .vertexArrayObject .enable (shaderNode)) + { + if (this .coordIndices .length) + shaderNode .enableCoordIndexAttribute (gl, this .coordIndexBuffer, 0, 0); + + for (let i = 0, length = attribNodes .length; i < length; ++ i) + attribNodes [i] .enable (gl, shaderNode, attribBuffers [i]); + + if (this .hasFogCoords) + shaderNode .enableFogDepthAttribute (gl, this .fogDepthBuffer, 0, 0); + + if (this .colorMaterial) + shaderNode .enableColorAttribute (gl, this .colorBuffer, 0, 0); + + shaderNode .enableTexCoordAttribute (gl, this .texCoordBuffers, 0, 0); + shaderNode .enableNormalAttribute (gl, this .normalBuffer, 0, 0); + shaderNode .enableVertexAttribute (gl, this .vertexBuffer, 0, 0); + } + + // Draw depending on wireframe, solid and transparent. + + if (browser .getWireframe ()) + { + for (let i = 0, length = this .vertexCount; i < length; i += 3) + gl .drawArrays (primitiveMode, i, 3); + } + else + { + const positiveScale = Numbers_Matrix4 .prototype .determinant3 .call (renderContext .modelViewMatrix) > 0; + + gl .frontFace (positiveScale ? this .frontFace : this .backFace .get (this .frontFace)); + + if (renderContext .transparent || back !== front) + { + // Render transparent or back or front. + + gl .enable (gl .CULL_FACE); + + // Render back. + + if (back && !this .solid) + { + gl .cullFace (gl .FRONT); + gl .drawArrays (primitiveMode, 0, this .vertexCount); + } + + // Render front. + + if (front) + { + gl .cullFace (gl .BACK); + gl .drawArrays (primitiveMode, 0, this .vertexCount); + } + } + else + { + // Render solid or both sides. + + if (this .solid) + gl .enable (gl .CULL_FACE); + else + gl .disable (gl .CULL_FACE); + + gl .drawArrays (primitiveMode, 0, this .vertexCount); + } + } + + blendModeNode ?.disable (gl); + }, + displaySimpleParticles (gl, shaderNode, particleSystem) + { + const outputParticles = particleSystem .outputParticles; + + if (outputParticles .vertexArrayObject .update (this .updateParticles) .enable (shaderNode)) + { + const { particleStride, particleOffset, matrixOffset } = particleSystem; + + shaderNode .enableParticleAttribute (gl, outputParticles, particleStride, particleOffset, 1); + shaderNode .enableParticleMatrixAttribute (gl, outputParticles, particleStride, matrixOffset, 1); + shaderNode .enableTexCoordAttribute (gl, this .texCoordBuffers, 0, 0); + shaderNode .enableNormalAttribute (gl, this .normalBuffer, 0, 0); + shaderNode .enableVertexAttribute (gl, this .vertexBuffer, 0, 0); + + this .updateParticles = false; + } + + gl .drawArraysInstanced (this .primitiveMode, 0, this .vertexCount, particleSystem .numParticles); + }, + displayParticles (gl, renderContext, particleSystem) + { + const + browser = this .getBrowser (), + appearanceNode = renderContext .appearanceNode, + shaderNode = appearanceNode .getShader (this, renderContext); + + if (this .solid || !appearanceNode .getBackMaterial () || browser .getWireframe ()) + { + this .displayParticlesGeometry (gl, renderContext, appearanceNode, shaderNode, true, true, particleSystem); + } + else + { + const backShaderNode = appearanceNode .getBackShader (this, renderContext); + + this .displayParticlesGeometry (gl, renderContext, appearanceNode, backShaderNode, true, false, particleSystem); + this .displayParticlesGeometry (gl, renderContext, appearanceNode, shaderNode, false, true, particleSystem); + } + }, + displayParticlesGeometry (gl, renderContext, appearanceNode, shaderNode, back, front, particleSystem) + { + const + browser = this .getBrowser (), + blendModeNode = appearanceNode .getBlendMode (), + attribNodes = this .attribNodes, + attribBuffers = this .attribBuffers, + primitiveMode = browser .getPrimitiveMode (this .primitiveMode); + + blendModeNode ?.enable (gl); + + // Setup shader. + + shaderNode .enable (gl); + shaderNode .setUniforms (gl, this, renderContext, front); + + // Setup vertex attributes. + + const outputParticles = particleSystem .outputParticles; + + if (outputParticles .vertexArrayObject .update (this .updateParticles) .enable (shaderNode)) + { + const { particleStride, particleOffset, matrixOffset } = particleSystem; + + shaderNode .enableParticleAttribute (gl, outputParticles, particleStride, particleOffset, 1); + shaderNode .enableParticleMatrixAttribute (gl, outputParticles, particleStride, matrixOffset, 1); + + for (let i = 0, length = attribNodes .length; i < length; ++ i) + attribNodes [i] .enable (gl, shaderNode, attribBuffers [i]); + + if (this .hasFogCoords) + shaderNode .enableFogDepthAttribute (gl, this .fogDepthBuffer, 0, 0); + + if (this .colorMaterial) + shaderNode .enableColorAttribute (gl, this .colorBuffer, 0, 0); + + shaderNode .enableTexCoordAttribute (gl, this .texCoordBuffers, 0, 0); + shaderNode .enableNormalAttribute (gl, this .normalBuffer, 0, 0); + shaderNode .enableVertexAttribute (gl, this .vertexBuffer, 0, 0); + + this .updateParticles = false; + } + + // Draw depending on wireframe, solid and transparent. + + const positiveScale = Numbers_Matrix4 .prototype .determinant3 .call (renderContext .modelViewMatrix) > 0; + + gl .frontFace (positiveScale ? this .frontFace : this .backFace .get (this .frontFace)); + + if (renderContext .transparent || back !== front) + { + // Render transparent or back or front. + + gl .enable (gl .CULL_FACE); + + if (back && !this .solid) + { + gl .cullFace (gl .FRONT); + gl .drawArraysInstanced (primitiveMode, 0, this .vertexCount, particleSystem .numParticles); + } + + if (front) + { + gl .cullFace (gl .BACK); + gl .drawArraysInstanced (primitiveMode, 0, this .vertexCount, particleSystem .numParticles); + } + } + else + { + // Render solid or both sides. + + if (this .solid) + gl .enable (gl .CULL_FACE); + else + gl .disable (gl .CULL_FACE); + + gl .drawArraysInstanced (primitiveMode, 0, this .vertexCount, particleSystem .numParticles); + } + + blendModeNode ?.disable (gl); + }, +}); + +Object .defineProperties (X3DGeometryNode, +{ + typeName: + { + value: "X3DGeometryNode", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, +}); + +const X3DGeometryNode_default_ = X3DGeometryNode; +; + +x_ite_Namespace .add ("X3DGeometryNode", "x_ite/Components/Rendering/X3DGeometryNode", X3DGeometryNode_default_); +/* harmony default export */ const Rendering_X3DGeometryNode = (X3DGeometryNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Shape/AlphaMode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +let AlphaMode_i = 0; + +const AlphaMode = +{ + AUTO: AlphaMode_i ++, // Must be zero! + OPAQUE: AlphaMode_i ++, + MASK: AlphaMode_i ++, + BLEND: AlphaMode_i ++, +}; + +const AlphaMode_default_ = AlphaMode; +; + +x_ite_Namespace .add ("AlphaMode", "x_ite/Browser/Shape/AlphaMode", AlphaMode_default_); +/* harmony default export */ const Shape_AlphaMode = (AlphaMode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Rendering/GeometryContext.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function GeometryContext (options = { }) +{ + Object .assign (this, + { + alphaMode: Shape_AlphaMode .OPAQUE, + geometryType: 3, + hasFogCoords: false, + colorMaterial: false, + hasNormals: false, + textureNode: false, + objectsCount: [0, 0, 0], + textureCoordinateMapping: new Map (), + textureCoordinateNode: null, + }, + options) + + this .updateGeometryKey (); +} + +Object .assign (GeometryContext .prototype, +{ + updateGeometryKey: Rendering_X3DGeometryNode .prototype .updateGeometryKey, + getTextureCoordinateMapping () + { + return this .textureCoordinateMapping; + }, + getTextureCoordinate () + { + return this .textureCoordinateNode; + }, +}); + +const GeometryContext_default_ = GeometryContext; +; + +x_ite_Namespace .add ("GeometryContext", "x_ite/Browser/Rendering/GeometryContext", GeometryContext_default_); +/* harmony default export */ const Rendering_GeometryContext = (GeometryContext_default_); +;// CONCATENATED MODULE: ./src/standard/Utility/BitSet.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function BitSet (value = 0) +{ + this .value = value; +} + +Object .assign (BitSet .prototype, +{ + *[Symbol .iterator] () + { + let + value = this .value, + index = 0; + + while (value) + { + if (value & 1) + yield index; + + value >>>= 1; + index += 1; + } + }, + get (index) + { + const mask = 1 << index; + + return !! (this .value & mask); + }, + set (index, value) + { + const mask = 1 << index; + + if (value) + this .value |= mask; + else + this .value &= ~mask; + }, + clear () + { + this .value = 0; + }, + *entries () + { + for (const i of this) + yield [i, i]; + }, + valueOf () + { + return this .value; + }, + toString (radix) + { + return this .value .toString (radix); + }, +}); + +BitSet .prototype .keys = BitSet .prototype [Symbol .iterator]; +BitSet .prototype .values = BitSet .prototype [Symbol .iterator]; + +Object .defineProperty (BitSet .prototype, "size", +{ + get () + { + return Math_Algorithm .bitCount (this .value); + }, +}); + +const BitSet_default_ = BitSet; +; + +x_ite_Namespace .add ("BitSet", "standard/Utility/BitSet", BitSet_default_); +/* harmony default export */ const Utility_BitSet = (BitSet_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/EnvironmentalEffects/X3DBackgroundNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + +const + RADIUS = 1, + SIZE = Math .SQRT2 / 2; + +function X3DBackgroundNode (executionContext) +{ + Core_X3DBindableNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DBackgroundNode); + + this .addChildObjects (Base_X3DConstants .inputOutput, "hidden", new x_ite_Fields .SFBool ()); + + this ._skyAngle .setUnit ("angle"); + this ._groundAngle .setUnit ("angle"); + + this .projectionMatrixArray = new Float32Array (16); + this .modelMatrix = new Numbers_Matrix4 (); + this .modelViewMatrixArray = new Float32Array (16); + this .clipPlanes = [ ]; + this .colors = [ ]; + this .sphere = [ ]; + this .textureNodes = new Array (6); + this .textureBits = new Utility_BitSet (); + this .sphereContext = new Rendering_GeometryContext ({ colorMaterial: true }); + this .sphereAlphaContext = new Rendering_GeometryContext ({ colorMaterial: true, alphaMode: Shape_AlphaMode .BLEND }); + this .texturesContext = new Rendering_GeometryContext ({ textureNode: true }); + this .texturesAlphaContext = new Rendering_GeometryContext ({ textureNode: true, alphaMode: Shape_AlphaMode .BLEND }); +} + +Object .assign (Object .setPrototypeOf (X3DBackgroundNode .prototype, Core_X3DBindableNode .prototype), +{ + initialize () + { + Core_X3DBindableNode .prototype .initialize .call (this); + + const + browser = this .getBrowser (), + gl = browser .getContext (); + + this .colorBuffer = gl .createBuffer (); + this .sphereBuffer = gl .createBuffer (); + this .texCoordBuffers = [gl .createBuffer ()]; + this .textureBuffers = Array .from ({length: 6}, () => gl .createBuffer ()); + this .sphereArrayObject = new Rendering_VertexArray (gl); + this .textureArrayObjects = Array .from ({length: 6}, () => new Rendering_VertexArray (gl)); + + this ._groundAngle .addInterest ("build", this); + this ._groundColor .addInterest ("build", this); + this ._skyAngle .addInterest ("build", this); + this ._skyColor .addInterest ("build", this); + + this .build (); + this .transferRectangle (); + }, + isHidden () + { + return this ._hidden .getValue (); + }, + setHidden (value) + { + if (value === this ._hidden .getValue ()) + return; + + this ._hidden = value; + }, + isTransparent () + { + if (this ._hidden .getValue ()) + return true; + + if (this ._transparency .getValue () <= 0) + return false; + + if (this .textureBits .size !== 6) + return true; + + for (const i of this .textureBits) + { + if (this .textureNodes [i] ._transparent .getValue ()) + return true; + } + + return false; + }, + set_texture__ (textureNode, index) + { + this .textureNodes [index] ?._loadState .removeInterest ("set_loadState__", this); + + this .textureNodes [index] = textureNode; + + textureNode ?._loadState .addInterest ("set_loadState__", this, textureNode, index); + + this .set_loadState__ (textureNode, index); + }, + set_loadState__ (textureNode, index) + { + this .setTextureBit (index, textureNode, textureNode ?.checkLoadState () ?? Base_X3DConstants .NOT_STARTED); + }, + setTextureBit (bit, textureNode, loadState) + { + this .textureBits .set (bit, loadState === Base_X3DConstants .COMPLETE_STATE || textureNode ?.getWidth ()); + }, + getColor (theta, color, angle) + { + const index = Math_Algorithm .upperBound (angle, 0, angle .length, theta); + + return color [index]; + }, + build () + { + const s = SIZE; + + this .colors .length = 0; + this .sphere .length = 0; + + if (this ._groundColor .length === 0 && this ._skyColor .length == 1) + { + // Build cube + + this .sphere .vertices = 36; + + this .sphere .push ( s, s, -s, 1, -s, s, -s, 1, -s, -s, -s, 1, // Back + s, s, -s, 1, -s, -s, -s, 1, s, -s, -s, 1, + -s, s, s, 1, s, s, s, 1, -s, -s, s, 1, // Front + -s, -s, s, 1, s, s, s, 1, s, -s, s, 1, + -s, s, -s, 1, -s, s, s, 1, -s, -s, s, 1, // Left + -s, s, -s, 1, -s, -s, s, 1, -s, -s, -s, 1, + s, s, s, 1, s, s, -s, 1, s, -s, s, 1, // Right + s, -s, s, 1, s, s, -s, 1, s, -s, -s, 1, + s, s, s, 1, -s, s, s, 1, -s, s, -s, 1, // Top + s, s, s, 1, -s, s, -s, 1, s, s, -s, 1, + -s, -s, s, 1, s, -s, s, 1, -s, -s, -s, 1, // Bottom + -s, -s, -s, 1, s, -s, s, 1, s, -s, -s, 1); + + const color = this ._skyColor [0]; + + for (let i = 0, vertices = this .sphere .vertices; i < vertices; ++ i) + this .colors .push (... color, 1); + } + else + { + // Build sphere + + if (this ._skyColor .length > this ._skyAngle .length) + { + const vAngle = this ._skyAngle .slice (); + + if (vAngle .length === 0 || vAngle [0] > 0) + vAngle .unshift (0); + + if (vAngle .at (-1) < Math .PI) + vAngle .push (Math .PI); + + if (vAngle .length === 2) + vAngle .splice (1, 0, (vAngle [0] + vAngle [1]) / 2) + + this .buildSphere (RADIUS, vAngle, this ._skyAngle, this ._skyColor, false); + } + + if (this ._groundColor .length > this ._groundAngle .length) + { + const vAngle = this ._groundAngle .slice () .reverse (); + + if (vAngle .length === 0 || vAngle [0] < Math .PI / 2) + vAngle .unshift (Math .PI / 2); + + if (vAngle .at (-1) > 0) + vAngle .push (0); + + this .buildSphere (RADIUS, vAngle, this ._groundAngle, this ._groundColor, true); + } + } + + this .transferSphere (); + }, + buildSphere: (() => + { + const U_DIMENSION = 20; + + const + z1 = new Numbers_Complex (0, 0), + z2 = new Numbers_Complex (0, 0), + y1 = new Numbers_Complex (0, 0), + y2 = new Numbers_Complex (0, 0), + y3 = new Numbers_Complex (0, 0), + y4 = new Numbers_Complex (0, 0); + + return function (radius, vAngle, angle, color, bottom) + { + const + vAngleMax = bottom ? Math .PI / 2 : Math .PI, + V_DIMENSION = vAngle .length - 1; + + for (let v = 0; v < V_DIMENSION; ++ v) + { + let + theta1 = Math_Algorithm .clamp (vAngle [v], 0, vAngleMax), + theta2 = Math_Algorithm .clamp (vAngle [v + 1], 0, vAngleMax); + + if (bottom) + { + theta1 = Math .PI - theta1; + theta2 = Math .PI - theta2; + } + + z1 .setPolar (radius, theta1); + z2 .setPolar (radius, theta2); + + const + c1 = this .getColor (vAngle [v], color, angle), + c2 = this .getColor (vAngle [v + 1], color, angle); + + for (let u = 0; u < U_DIMENSION; ++ u) + { + // p4 --- p1 + // | / | + // | / | + // p3 --- p2 + + // The last point is the first one. + const u1 = u < U_DIMENSION - 1 ? u + 1 : 0; + + // p1, p2 + let phi = 2 * Math .PI * (u / U_DIMENSION); + y1 .setPolar (-z1 .imag, phi); + y2 .setPolar (-z2 .imag, phi); + + // p3, p4 + phi = 2 * Math .PI * (u1 / U_DIMENSION); + y3 .setPolar (-z2 .imag, phi); + y4 .setPolar (-z1 .imag, phi); + + // Triangle 1 and 2 + + this .colors .push (... c1, 1, + ... c2, 1, + ... c2, 1, + // Triangle 2 + ... c1, 1, + ... c1, 1, + ... c2, 1); + + this .sphere .push (y1 .imag, z1 .real, y1 .real, 1, + y3 .imag, z2 .real, y3 .real, 1, + y2 .imag, z2 .real, y2 .real, 1, + // Triangle 2 + y1 .imag, z1 .real, y1 .real, 1, + y4 .imag, z1 .real, y4 .real, 1, + y3 .imag, z2 .real, y3 .real, 1); + } + } + }; + })(), + transferSphere () + { + const gl = this .getBrowser () .getContext (); + + // Transfer colors. + + gl .bindBuffer (gl .ARRAY_BUFFER, this .colorBuffer); + gl .bufferData (gl .ARRAY_BUFFER, new Float32Array (this .colors), gl .DYNAMIC_DRAW); + + // Transfer sphere. + + gl .bindBuffer (gl .ARRAY_BUFFER, this .sphereBuffer); + gl .bufferData (gl .ARRAY_BUFFER, new Float32Array (this .sphere), gl .DYNAMIC_DRAW); + + this .sphereCount = this .sphere .length / 4; + }, + transferRectangle: (() => + { + const s = SIZE; + + const texCoords = new Float32Array ([ + 1, 1, 0, 1, + 0, 1, 0, 1, + 0, 0, 0, 1, + 1, 1, 0, 1, + 0, 0, 0, 1, + 1, 0, 0, 1, + ]); + + const frontVertices = new Float32Array ([ + s, s, -s, 1, + -s, s, -s, 1, + -s, -s, -s, 1, + s, s, -s, 1, + -s, -s, -s, 1, + s, -s, -s, 1, + ]); + + const backVertices = new Float32Array ([ + -s, s, s, 1, + s, s, s, 1, + s, -s, s, 1, + -s, s, s, 1, + s, -s, s, 1, + -s, -s, s, 1, + ]); + + const leftVertices = new Float32Array ([ + -s, s, -s, 1, + -s, s, s, 1, + -s, -s, s, 1, + -s, s, -s, 1, + -s, -s, s, 1, + -s, -s, -s, 1, + ]); + + const rightVertices = new Float32Array ([ + s, s, s, 1, + s, s, -s, 1, + s, -s, -s, 1, + s, s, s, 1, + s, -s, -s, 1, + s, -s, s, 1, + ]); + + const topVertices = new Float32Array ([ + s, s, s, 1, + -s, s, s, 1, + -s, s, -s, 1, + s, s, s, 1, + -s, s, -s, 1, + s, s, -s, 1, + ]); + + const bottomVertices = new Float32Array ([ + s, -s, -s, 1, + -s, -s, -s, 1, + -s, -s, s, 1, + s, -s, -s, 1, + -s, -s, s, 1, + s, -s, s, 1, + ]); + + const vertices = [ + frontVertices, + backVertices, + leftVertices, + rightVertices, + topVertices, + bottomVertices, + ]; + + return function () + { + const gl = this .getBrowser () .getContext (); + + // Transfer texCoords. + + gl .bindBuffer (gl .ARRAY_BUFFER, this .texCoordBuffers [0]); + gl .bufferData (gl .ARRAY_BUFFER, texCoords, gl .DYNAMIC_DRAW); + + // Transfer rectangle. + + for (let i = 0; i < 6; ++ i) + { + gl .bindBuffer (gl .ARRAY_BUFFER, this .textureBuffers [i]); + gl .bufferData (gl .ARRAY_BUFFER, vertices [i], gl .DYNAMIC_DRAW); + } + }; + })(), + traverse (type, renderObject) + { + switch (type) + { + case Rendering_TraverseType .CAMERA: + { + renderObject .getLayer () .getBackgrounds () .push (this); + + this .modelMatrix .assign (renderObject .getModelViewMatrix () .get ()); + return; + } + case Rendering_TraverseType .DISPLAY: + { + const + localObjects = renderObject .getLocalObjects (), + clipPlanes = this .clipPlanes; + + let c = 0; + + for (let l = 0, length = localObjects .length; l < length; ++ l) + { + if (localObjects [l] .isClipped) + clipPlanes [c ++] = localObjects [l]; + } + + clipPlanes .length = c; + + this .sphereContext .objectsCount [0] = clipPlanes .length; + this .texturesContext .objectsCount [0] = clipPlanes .length; + return; + } + } + }, + display: (() => + { + const + modelViewMatrix = new Numbers_Matrix4 (), + rotation = new Numbers_Rotation4 (), + scale = new Numbers_Vector3 (0, 0, 0); + + return function (gl, renderObject, viewport) + { + if (this ._hidden .getValue ()) + return; + + // Setup context. + + gl .disable (gl .DEPTH_TEST); + gl .depthMask (false); + gl .enable (gl .CULL_FACE); + gl .frontFace (gl .CCW); + + // Get projection matrix. + + this .projectionMatrixArray .set (renderObject .getViewpoint () .getProjectionMatrixWithLimits (0.125, 200_000, viewport)); + + // Rotate and scale background. + + modelViewMatrix .assign (this .modelMatrix); + modelViewMatrix .multRight (renderObject .getViewMatrix () .get ()); + modelViewMatrix .get (null, rotation); + modelViewMatrix .identity (); + modelViewMatrix .rotate (rotation); + modelViewMatrix .scale (scale .set (100_000, 100_000, 100_000)); + + this .modelViewMatrixArray .set (modelViewMatrix); + + // Draw background sphere and texture cube. + + this .drawSphere (renderObject); + + if (+this .textureBits) + this .drawCube (renderObject); + + gl .depthMask (true); + gl .enable (gl .DEPTH_TEST); + gl .disable (gl .BLEND); + }; + })(), + drawSphere (renderObject) + { + const transparency = Math_Algorithm .clamp (this ._transparency .getValue (), 0, 1); + + if (transparency === 1) + return; + + const + browser = this .getBrowser (), + gl = browser .getContext (), + shaderNode = browser .getDefaultMaterial () .getShader (transparency ? this .sphereAlphaContext : this .sphereContext); + + shaderNode .enable (gl); + shaderNode .setClipPlanes (gl, this .clipPlanes); + + // Uniforms + + gl .uniformMatrix4fv (shaderNode .x3d_ProjectionMatrix, false, this .projectionMatrixArray); + gl .uniformMatrix4fv (shaderNode .x3d_ModelViewMatrix, false, this .modelViewMatrixArray); + + gl .uniform1f (shaderNode .x3d_Transparency, transparency) + gl .uniform1i (shaderNode .x3d_TextureCoordinateGeneratorMode [0], 0); + + // Enable vertex attribute arrays. + + if (this .sphereArrayObject .enable (shaderNode)) + { + shaderNode .enableColorAttribute (gl, this .colorBuffer, 0, 0); + shaderNode .enableVertexAttribute (gl, this .sphereBuffer, 0, 0); + } + + // Draw. + + if (transparency) + gl .enable (gl .BLEND); + else + gl .disable (gl .BLEND); + + gl .drawArrays (gl .TRIANGLES, 0, this .sphereCount); + }, + drawCube: (() => + { + const textureMatrixArray = new Float32Array (Numbers_Matrix4 .Identity); + + return function (renderObject) + { + const + browser = this .getBrowser (), + gl = browser .getContext (), + shaderNode = browser .getDefaultMaterial () .getShader (this .texturesContext), + alphaShaderNode = browser .getDefaultMaterial () .getShader (this .texturesAlphaContext); + + shaderNode .enable (gl); + shaderNode .setClipPlanes (gl, this .clipPlanes); + + // Set uniforms. + + gl .uniformMatrix4fv (shaderNode .x3d_ProjectionMatrix, false, this .projectionMatrixArray); + gl .uniformMatrix4fv (shaderNode .x3d_ModelViewMatrix, false, this .modelViewMatrixArray); + gl .uniformMatrix4fv (shaderNode .x3d_TextureMatrix [0], false, textureMatrixArray); + + gl .uniform3f (shaderNode .x3d_EmissiveColor, 1, 1, 1); + gl .uniform1f (shaderNode .x3d_Transparency, 0); + gl .uniform1i (shaderNode .x3d_TextureCoordinateGeneratorMode [0], 0); + + // Draw all textures. + + for (const i of this .textureBits) + { + const textureNode = this .textureNodes [i]; + + this .drawRectangle (gl, browser, textureNode ._transparent .getValue () ? alphaShaderNode : shaderNode, renderObject, textureNode, this .textureBuffers [i], this .textureArrayObjects [i]); + } + }; + })(), + drawRectangle (gl, browser, shaderNode, renderObject, textureNode, buffer, vertexArray) + { + textureNode .setShaderUniforms (gl, shaderNode, renderObject); + + if (vertexArray .enable (gl, shaderNode)) + { + shaderNode .enableTexCoordAttribute (gl, this .texCoordBuffers, 0, 0); + shaderNode .enableVertexAttribute (gl, buffer, 0, 0); + } + + // Draw. + + if (textureNode ._transparent .getValue ()) + gl .enable (gl .BLEND); + else + gl .disable (gl .BLEND); + + gl .drawArrays (gl .TRIANGLES, 0, 6); + + browser .resetTextureUnits (); + }, +}); + +Object .defineProperties (X3DBackgroundNode, +{ + typeName: + { + value: "X3DBackgroundNode", + enumerable: true, + }, + componentName: + { + value: "EnvironmentalEffects", + enumerable: true, + }, +}); + +const X3DBackgroundNode_default_ = X3DBackgroundNode; +; + +x_ite_Namespace .add ("X3DBackgroundNode", "x_ite/Components/EnvironmentalEffects/X3DBackgroundNode", X3DBackgroundNode_default_); +/* harmony default export */ const EnvironmentalEffects_X3DBackgroundNode = (X3DBackgroundNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shape/X3DAppearanceChildNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function X3DAppearanceChildNode (executionContext) +{ + Core_X3DNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DAppearanceChildNode); +} + +Object .setPrototypeOf (X3DAppearanceChildNode .prototype, Core_X3DNode .prototype); + +Object .defineProperties (X3DAppearanceChildNode, +{ + typeName: + { + value: "X3DAppearanceChildNode", + enumerable: true, + }, + componentName: + { + value: "Shape", + enumerable: true, + }, +}); + +const X3DAppearanceChildNode_default_ = X3DAppearanceChildNode; +; + +x_ite_Namespace .add ("X3DAppearanceChildNode", "x_ite/Components/Shape/X3DAppearanceChildNode", X3DAppearanceChildNode_default_); +/* harmony default export */ const Shape_X3DAppearanceChildNode = (X3DAppearanceChildNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Texturing/X3DTextureNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function X3DTextureNode (executionContext) +{ + Shape_X3DAppearanceChildNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DTextureNode); + + this .addChildObjects (Base_X3DConstants .outputOnly, "transparent", new x_ite_Fields .SFBool ()); +} + +Object .assign (Object .setPrototypeOf (X3DTextureNode .prototype, Shape_X3DAppearanceChildNode .prototype), +{ + setTransparent (value) + { + if (value !== this ._transparent .getValue ()) + this ._transparent = value; + }, + isTransparent () + { + return this ._transparent .getValue (); + }, +}); + +Object .defineProperties (X3DTextureNode, +{ + typeName: + { + value: "X3DTextureNode", + enumerable: true, + }, + componentName: + { + value: "Texturing", + enumerable: true, + }, +}); + +const X3DTextureNode_default_ = X3DTextureNode; +; + +x_ite_Namespace .add ("X3DTextureNode", "x_ite/Components/Texturing/X3DTextureNode", X3DTextureNode_default_); +/* harmony default export */ const Texturing_X3DTextureNode = (X3DTextureNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Base/X3DCast.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function X3DCast (type, node, innerNode = true) +{ + try + { + if (node) + { + if (node instanceof x_ite_Fields .SFNode) + node = node .getValue (); + + if (node) + { + if (innerNode) + node = node .getInnerNode (); + + if (node .getType () .includes (type)) + return node; + } + } + } + catch + { } + + return null; +} + +const X3DCast_default_ = X3DCast; +; + +x_ite_Namespace .add ("X3DCast", "x_ite/Base/X3DCast", X3DCast_default_); +/* harmony default export */ const Base_X3DCast = (X3DCast_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Texturing/X3DSingleTextureNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function X3DSingleTextureNode (executionContext) +{ + Texturing_X3DTextureNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DSingleTextureNode); +} + +Object .assign (Object .setPrototypeOf (X3DSingleTextureNode .prototype, Texturing_X3DTextureNode .prototype), +{ + initialize () + { + Texturing_X3DTextureNode .prototype .initialize .call (this); + + this ._textureProperties .addInterest ("set_textureProperties__", this, true); + + const gl = this .getBrowser () .getContext (); + + this .texture = gl .createTexture (); + + this .set_textureProperties__ (false); + }, + set_textureProperties__ (update) + { + if (this .texturePropertiesNode) + this .texturePropertiesNode .removeInterest ("updateTextureParameters", this); + + this .texturePropertiesNode = Base_X3DCast (Base_X3DConstants .TextureProperties, this ._textureProperties); + + if (! this .texturePropertiesNode) + this .texturePropertiesNode = this .getBrowser () .getDefaultTextureProperties (); + + this .texturePropertiesNode .addInterest ("updateTextureParameters", this); + + if (update) + this .updateTextureParameters (); + }, + getCount () + { + return 1; + }, + getTexture () + { + return this .texture; + }, + updateTextureParameters: (() => + { + // Anisotropic Filtering in WebGL is handled by an extension, use one of getExtension depending on browser: + + const ANISOTROPIC_EXT = [ + "EXT_texture_filter_anisotropic", + "MOZ_EXT_texture_filter_anisotropic", + "WEBKIT_EXT_texture_filter_anisotropic", + ]; + + return function (target, haveTextureProperties, textureProperties, width, height, repeatS, repeatT, repeatR) + { + const gl = this .getBrowser () .getContext (); + + gl .bindTexture (target, this .getTexture ()); + + if (Math .max (width, height) < this .getBrowser () .getMinTextureSize () && ! haveTextureProperties) + { + // Don't generate MipMaps. + gl .texParameteri (target, gl .TEXTURE_MIN_FILTER, gl .NEAREST); + gl .texParameteri (target, gl .TEXTURE_MAG_FILTER, gl .NEAREST); + } + else + { + if (textureProperties ._generateMipMaps .getValue ()) + gl .generateMipmap (target); + + gl .texParameteri (target, gl .TEXTURE_MIN_FILTER, gl [textureProperties .getMinificationFilter ()]); + gl .texParameteri (target, gl .TEXTURE_MAG_FILTER, gl [textureProperties .getMagnificationFilter ()]); + } + + if (haveTextureProperties) + { + gl .texParameteri (target, gl .TEXTURE_WRAP_S, gl [textureProperties .getBoundaryModeS ()]); + gl .texParameteri (target, gl .TEXTURE_WRAP_T, gl [textureProperties .getBoundaryModeT ()]); + + if (gl .getVersion () >= 2) + gl .texParameteri (target, gl .TEXTURE_WRAP_R, gl [textureProperties .getBoundaryModeR ()]); + } + else + { + gl .texParameteri (target, gl .TEXTURE_WRAP_S, repeatS ? gl .REPEAT : gl .CLAMP_TO_EDGE); + gl .texParameteri (target, gl .TEXTURE_WRAP_T, repeatT ? gl .REPEAT : gl .CLAMP_TO_EDGE); + + if (gl .getVersion () >= 2) + gl .texParameteri (target, gl .TEXTURE_WRAP_R, repeatR ? gl .REPEAT : gl .CLAMP_TO_EDGE); + } + + //gl .texParameterfv (target, gl .TEXTURE_BORDER_COLOR, textureProperties ._borderColor .getValue ()); + //gl .texParameterf (target, gl .TEXTURE_PRIORITY, textureProperties ._texturePriority .getValue ()); + + for (const extension of ANISOTROPIC_EXT) + { + const ext = gl .getExtension (extension); + + if (ext) + { + gl .texParameterf (target, ext .TEXTURE_MAX_ANISOTROPY_EXT, textureProperties ._anisotropicDegree .getValue ()); + break; + } + } + }; + })(), + updateTextureBits (textureBits, channel = 0) + { + const textureType = this .getTextureType () - 1; + + textureBits .set (channel * 2 + 0, textureType & 0b01); + textureBits .set (channel * 2 + 1, textureType & 0b10); + }, + getShaderOptions: (() => + { + const textureTypes = { + 2: "2D", + 3: "3D", + 4: "CUBE" + }; + + return function (options, channel = 0) + { + options .push (`X3D_TEXTURE${channel}_${textureTypes [this .getTextureType ()]}`); + }; + })(), +}); + +Object .defineProperties (X3DSingleTextureNode, +{ + typeName: + { + value: "X3DSingleTextureNode", + enumerable: true, + }, + componentName: + { + value: "Texturing", + enumerable: true, + }, +}); + +const X3DSingleTextureNode_default_ = X3DSingleTextureNode; +; + +x_ite_Namespace .add ("X3DSingleTextureNode", "x_ite/Components/Texturing/X3DSingleTextureNode", X3DSingleTextureNode_default_); +/* harmony default export */ const Texturing_X3DSingleTextureNode = (X3DSingleTextureNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Texturing/X3DTexture2DNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +const defaultData = new Uint8Array ([ 255, 255, 255, 255 ]); + +function X3DTexture2DNode (executionContext) +{ + Texturing_X3DSingleTextureNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DTexture2DNode); + + const gl = this .getBrowser () .getContext (); + + this .target = gl .TEXTURE_2D; + this .width = 0; + this .height = 0; +} + +Object .assign (Object .setPrototypeOf (X3DTexture2DNode .prototype, Texturing_X3DSingleTextureNode .prototype), +{ + initialize () + { + Texturing_X3DSingleTextureNode .prototype .initialize .call (this); + + this ._repeatS .addInterest ("updateTextureParameters", this); + this ._repeatT .addInterest ("updateTextureParameters", this); + + const gl = this .getBrowser () .getContext (); + + gl .bindTexture (gl .TEXTURE_2D, this .getTexture ()); + gl .texImage2D (gl .TEXTURE_2D, 0, gl .RGBA, 1, 1, 0, gl .RGBA, gl .UNSIGNED_BYTE, defaultData); + }, + getTarget () + { + return this .target; + }, + getTextureType () + { + return 2; + }, + getTextureTypeString () + { + return "2D"; + }, + getWidth () + { + return this .width; + }, + getHeight () + { + return this .height; + }, + clearTexture () + { + this .setTexture (1, 1, false, defaultData, false); + }, + setTexture (width, height, transparent, data, flipY) + { + this .width = width; + this .height = height; + + const gl = this .getBrowser () .getContext (); + + gl .bindTexture (gl .TEXTURE_2D, this .getTexture ()); + gl .pixelStorei (gl .UNPACK_FLIP_Y_WEBGL, flipY); + //gl .pixelStorei (gl .UNPACK_COLORSPACE_CONVERSION_WEBGL, colorspace ? gl .BROWSER_DEFAULT_WEBGL : gl .NONE); + gl .texImage2D (gl .TEXTURE_2D, 0, gl .RGBA, width, height, 0, gl .RGBA, gl .UNSIGNED_BYTE, data); + gl .pixelStorei (gl .UNPACK_FLIP_Y_WEBGL, false); + //gl .pixelStorei (gl .UNPACK_COLORSPACE_CONVERSION_WEBGL, gl .BROWSER_DEFAULT_WEBGL); + + this .setTransparent (transparent); + this .updateTextureParameters (); + this .addNodeEvent (); + }, + updateTexture (data, flipY) + { + const gl = this .getBrowser () .getContext (); + + gl .bindTexture (gl .TEXTURE_2D, this .getTexture ()); + gl .pixelStorei (gl .UNPACK_FLIP_Y_WEBGL, flipY); + gl .texSubImage2D (gl .TEXTURE_2D, 0, 0, 0, gl .RGBA, gl .UNSIGNED_BYTE, data); + gl .pixelStorei (gl .UNPACK_FLIP_Y_WEBGL, false); + + if (this .texturePropertiesNode ._generateMipMaps .getValue ()) + gl .generateMipmap (gl .TEXTURE_2D); + + this .addNodeEvent (); + }, + updateTextureParameters () + { + Texturing_X3DSingleTextureNode .prototype .updateTextureParameters .call (this, + this .target, + this ._textureProperties .getValue (), + this .texturePropertiesNode, + this .width, + this .height, + this ._repeatS .getValue (), + this ._repeatT .getValue (), + false); + }, + setShaderUniforms (gl, shaderObject, renderObject, channel = shaderObject .x3d_Texture [0]) + { + const textureUnit = this .getBrowser () .getTexture2DUnit (); + + gl .activeTexture (gl .TEXTURE0 + textureUnit); + gl .bindTexture (gl .TEXTURE_2D, this .getTexture ()); + gl .uniform1i (channel .texture2D, textureUnit); + }, +}); + +Object .defineProperties (X3DTexture2DNode, +{ + typeName: + { + value: "X3DTexture2DNode", + enumerable: true, + }, + componentName: + { + value: "Texturing", + enumerable: true, + }, +}); + +const X3DTexture2DNode_default_ = X3DTexture2DNode; +; + +x_ite_Namespace .add ("X3DTexture2DNode", "x_ite/Components/Texturing/X3DTexture2DNode", X3DTexture2DNode_default_); +/* harmony default export */ const Texturing_X3DTexture2DNode = (X3DTexture2DNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Texturing/ImageTexture.js +/* provided dependency */ var ImageTexture_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + +function ImageTexture (executionContext) +{ + Texturing_X3DTexture2DNode .call (this, executionContext); + Networking_X3DUrlObject .call (this, executionContext); + + this .addType (Base_X3DConstants .ImageTexture); + + this .image = ImageTexture_$(""); + this .urlStack = new x_ite_Fields .MFString (); +} + +Object .assign (Object .setPrototypeOf (ImageTexture .prototype, Texturing_X3DTexture2DNode .prototype), + Networking_X3DUrlObject .prototype, +{ + initialize () + { + Texturing_X3DTexture2DNode .prototype .initialize .call (this); + Networking_X3DUrlObject .prototype .initialize .call (this); + + this ._colorSpaceConversion .addInterest ("loadNow", this); + + this .image .on ("load", this .setImage .bind (this)); + this .image .on ("abort error", this .setError .bind (this)); + this .image .prop ("crossOrigin", "Anonymous"); + + this .requestImmediateLoad () .catch (Function .prototype); + }, + getElement () + { + return this .image [0]; + }, + unloadData () + { + this .clearTexture (); + }, + loadData () + { + this .urlStack .setValue (this ._url); + this .loadNext (); + }, + loadNext () + { + if (this .urlStack .length === 0) + { + this .clearTexture (); + this .setLoadState (Base_X3DConstants .FAILED_STATE); + return; + } + + // Get URL. + + this .URL = new URL (this .urlStack .shift (), this .getExecutionContext () .getBaseURL ()); + + if (this .URL .protocol !== "data:") + { + if (!this .getCache ()) + this .URL .searchParams .set ("_", Date .now ()); + } + + this .image .attr ("src", this .URL .href); + }, + setError (event) + { + if (this .URL .protocol !== "data:") + console .warn (`Error loading image '${decodeURI (this .URL .href)}'`, event .type); + + this .loadNext (); + }, + setImage: async function () + { + if (DEVELOPMENT) + { + if (this .URL .protocol !== "data:") + console .info (`Done loading image '${decodeURI (this .URL .href)}'`); + } + + try + { + const + gl = this .getBrowser () .getContext (), + image = this .image [0]; + + // https://developer.mozilla.org/en-US/docs/Web/API/createImageBitmap + // createImageBitmap + + if (gl .getVersion () === 1 && !(Math_Algorithm .isPowerOfTwo (image .width) && Math_Algorithm .isPowerOfTwo (image .height))) + { + const + canvas = document .createElement ("canvas"), + cx = canvas .getContext ("2d", { willReadFrequently: true }), + width = Math_Algorithm .nextPowerOfTwo (image .width), + height = Math_Algorithm .nextPowerOfTwo (image .height); + + // Flip Y and scale image to next power of two if needed. + + canvas .width = width; + canvas .height = height; + + cx .clearRect (0, 0, width, height); + cx .save (); + + // Flip vertically. + cx .translate (0, height); + cx .scale (1, -1); + + cx .drawImage (image, 0, 0, image .width, image .height, 0, 0, width, height); + cx .restore (); + + // Determine image alpha. + + const + data = cx .getImageData (0, 0, width, height) .data, + transparent = this .isImageTransparent (data); + + // Upload image to GPU. + + this .setTexture (width, height, transparent, data, false); + this .setLoadState (Base_X3DConstants .COMPLETE_STATE); + } + else + { + const + data = await this .getImageData (image, this ._colorSpaceConversion .getValue ()), + transparent = this .isImageTransparent (data), + width = image .width, + height = image .height; + + // Flip vertically. + + this .flipImage (data, width, height, 4); + + // Upload image to GPU. + + this .setTexture (width, height, transparent, data, false); + this .setLoadState (Base_X3DConstants .COMPLETE_STATE); + } + } + catch (error) + { + // Catch security error from cross origin requests. + this .setError ({ type: error .message }); + } + }, + getImageData: async function (image, colorSpaceConversion = true) + { + const + gl = this .getBrowser () .getContext (), + framebuffer = gl .createFramebuffer (), + texture = gl .createTexture (), + data = new Uint8Array (image .width * image .height * 4); + + gl .bindFramebuffer (gl .FRAMEBUFFER, framebuffer); + gl .bindTexture (gl .TEXTURE_2D, texture); + gl .pixelStorei (gl .UNPACK_COLORSPACE_CONVERSION_WEBGL, colorSpaceConversion ? gl .BROWSER_DEFAULT_WEBGL : gl .NONE); + gl .texImage2D (gl .TEXTURE_2D, 0, gl .RGBA, gl .RGBA, gl .UNSIGNED_BYTE, image); + gl .pixelStorei (gl .UNPACK_COLORSPACE_CONVERSION_WEBGL, gl .BROWSER_DEFAULT_WEBGL); + gl .framebufferTexture2D (gl .FRAMEBUFFER, gl .COLOR_ATTACHMENT0, gl .TEXTURE_2D, texture, 0); + await gl .readPixelsAsync (0, 0, image .width, image .height, gl .RGBA, gl .UNSIGNED_BYTE, data); + gl .deleteFramebuffer (framebuffer); + gl .deleteTexture (texture); + + return data; + }, + isImageTransparent (data) + { + for (let i = 3, length = data .length; i < length; i += 4) + { + if (data [i] !== 255) + return true; + } + + return false; + }, + flipImage (data, width, height, components) + { + const + height1_2 = height >>> 1, + bytesPerRow = width * components, + tmp = new Uint8Array (bytesPerRow); + + for (let y = 0; y < height1_2; ++ y) + { + const + top = y * bytesPerRow, + bottom = (height - y - 1) * bytesPerRow; + + tmp .set (data .subarray (top, top + bytesPerRow)); + data .copyWithin (top, bottom, bottom + bytesPerRow); + data .set (tmp, bottom); + } + + return data; + }, + dispose () + { + Networking_X3DUrlObject .prototype .dispose .call (this); + Texturing_X3DTexture2DNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (ImageTexture, +{ + typeName: + { + value: "ImageTexture", + enumerable: true, + }, + componentName: + { + value: "Texturing", + enumerable: true, + }, + containerField: + { + value: "texture", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "load", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "url", new x_ite_Fields .MFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoRefresh", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoRefreshTimeLimit", new x_ite_Fields .SFTime (3600)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "colorSpaceConversion", new x_ite_Fields .SFBool (true)), // experimental + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "repeatS", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "repeatT", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "textureProperties", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +const ImageTexture_default_ = ImageTexture; +; + +x_ite_Namespace .add ("ImageTexture", "x_ite/Components/Texturing/ImageTexture", ImageTexture_default_); +/* harmony default export */ const Texturing_ImageTexture = (ImageTexture_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/EnvironmentalEffects/Background.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function Background (executionContext) +{ + EnvironmentalEffects_X3DBackgroundNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Background); +} + +Object .assign (Object .setPrototypeOf (Background .prototype, EnvironmentalEffects_X3DBackgroundNode .prototype), +{ + initialize () + { + EnvironmentalEffects_X3DBackgroundNode .prototype .initialize .call (this); + + const + frontTexture = new Texturing_ImageTexture (this .getExecutionContext ()), + backTexture = new Texturing_ImageTexture (this .getExecutionContext ()), + leftTexture = new Texturing_ImageTexture (this .getExecutionContext ()), + rightTexture = new Texturing_ImageTexture (this .getExecutionContext ()), + topTexture = new Texturing_ImageTexture (this .getExecutionContext ()), + bottomTexture = new Texturing_ImageTexture (this .getExecutionContext ()), + textureProperties = this .getBrowser () .getBackgroundTextureProperties (); + + this ._frontUrl .addFieldInterest (frontTexture ._url); + this ._backUrl .addFieldInterest (backTexture ._url); + this ._leftUrl .addFieldInterest (leftTexture ._url); + this ._rightUrl .addFieldInterest (rightTexture ._url); + this ._topUrl .addFieldInterest (topTexture ._url); + this ._bottomUrl .addFieldInterest (bottomTexture ._url); + + frontTexture ._url = this ._frontUrl; + backTexture ._url = this ._backUrl; + leftTexture ._url = this ._leftUrl; + rightTexture ._url = this ._rightUrl; + topTexture ._url = this ._topUrl; + bottomTexture ._url = this ._bottomUrl; + + frontTexture ._textureProperties = textureProperties; + backTexture ._textureProperties = textureProperties; + leftTexture ._textureProperties = textureProperties; + rightTexture ._textureProperties = textureProperties; + topTexture ._textureProperties = textureProperties; + bottomTexture ._textureProperties = textureProperties; + + frontTexture .setup (); + backTexture .setup (); + leftTexture .setup (); + rightTexture .setup (); + topTexture .setup (); + bottomTexture .setup (); + + this .set_texture__ (frontTexture, 0); + this .set_texture__ (backTexture, 1); + this .set_texture__ (leftTexture, 2); + this .set_texture__ (rightTexture, 3); + this .set_texture__ (topTexture, 4); + this .set_texture__ (bottomTexture, 5); + } +}); + +Object .defineProperties (Background, +{ + typeName: + { + value: "Background", + enumerable: true, + }, + componentName: + { + value: "EnvironmentalEffects", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_bind", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "frontUrl", new x_ite_Fields .MFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "backUrl", new x_ite_Fields .MFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "leftUrl", new x_ite_Fields .MFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "rightUrl", new x_ite_Fields .MFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "topUrl", new x_ite_Fields .MFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "bottomUrl", new x_ite_Fields .MFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "skyAngle", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "skyColor", new x_ite_Fields .MFColor (new x_ite_Fields .SFColor ())), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "groundAngle", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "groundColor", new x_ite_Fields .MFColor ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "transparency", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isBound", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "bindTime", new x_ite_Fields .SFTime ()), + ]), + enumerable: true, + }, +}); + +const Background_default_ = Background; +; + +x_ite_Namespace .add ("Background", "x_ite/Components/EnvironmentalEffects/Background", Background_default_); +/* harmony default export */ const EnvironmentalEffects_Background = (Background_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Layering/X3DLayerNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + +function X3DLayerNode (executionContext, defaultViewpoint, groupNode) +{ + Core_X3DNode .call (this, executionContext); + Rendering_X3DRenderObject .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DLayerNode); + + this .addChildObjects (Base_X3DConstants .inputOutput, "hidden", new x_ite_Fields .SFBool (), + Base_X3DConstants .outputOnly, "display", new x_ite_Fields .SFBool (true)); + + if (executionContext .getSpecificationVersion () <= 3.3) + this .addAlias ("isPickable", this ._pickable); + + this .groupNode = groupNode; + this .viewportNode = null; + + this .defaultNavigationInfo = new Navigation_NavigationInfo (executionContext); + this .defaultViewpoint = defaultViewpoint; + this .defaultBackground = new EnvironmentalEffects_Background (executionContext); + this .defaultFog = new EnvironmentalEffects_Fog (executionContext); + + this .navigationInfoStack = new Execution_BindableStack (executionContext, this .defaultNavigationInfo); + this .viewpointStack = new Execution_BindableStack (executionContext, this .defaultViewpoint); + this .backgroundStack = new Execution_BindableStack (executionContext, this .defaultBackground); + this .fogStack = new Execution_BindableStack (executionContext, this .defaultFog); + + this .navigationInfos = new Execution_BindableList (executionContext, this .defaultNavigationInfo); + this .viewpoints = new Execution_BindableList (executionContext, this .defaultViewpoint); + this .backgrounds = new Execution_BindableList (executionContext, this .defaultBackground); + this .fogs = new Execution_BindableList (executionContext, this .defaultFog); + + this .defaultBackground .setHidden (true); + this .defaultFog .setHidden (true); +} + +Object .assign (Object .setPrototypeOf (X3DLayerNode .prototype, Core_X3DNode .prototype), + Rendering_X3DRenderObject .prototype, +{ + layer0: false, + initialize () + { + Core_X3DNode .prototype .initialize .call (this); + Rendering_X3DRenderObject .prototype .initialize .call (this); + + this .defaultNavigationInfo .setup (); + this .defaultViewpoint .setup (); + this .defaultBackground .setup (); + this .defaultFog .setup (); + + this .navigationInfoStack .setup (); + this .viewpointStack .setup (); + this .backgroundStack .setup (); + this .fogStack .setup (); + + this .navigationInfos .setup (); + this .viewpoints .setup (); + this .backgrounds .setup (); + this .fogs .setup (); + + this ._hidden .addInterest ("set_visible_and_hidden__", this); + this ._visible .addInterest ("set_visible_and_hidden__", this); + this ._viewport .addInterest ("set_viewport__", this); + + this .set_visible_and_hidden__ (); + this .set_viewport__ (); + }, + isHidden () + { + return this ._hidden .getValue (); + }, + setHidden (value) + { + if (value === this ._hidden .getValue ()) + return; + + this ._hidden = value; + }, + getBBox (bbox, shadows) + { + return this .groupNode .getBBox (bbox, shadows); + }, + setLayer0 (value) + { + this .layer0 = value; + this .defaultBackground .setHidden (!value); + }, + getLayer () + { + return this; + }, + getGroup () + { + return this .groupNode; + }, + getViewport () + { + return this .viewportNode; + }, + getBackground () + { + return this .backgroundStack .top (); + }, + getFog () + { + return this .fogStack .top (); + }, + getNavigationInfo () + { + return this .navigationInfoStack .top (); + }, + getViewpoint () + { + return this .viewpointStack .top (); + }, + getBackgrounds () + { + return this .backgrounds; + }, + getFogs () + { + return this .fogs; + }, + getNavigationInfos () + { + return this .navigationInfos; + }, + getViewpoints () + { + return this .viewpoints; + }, + getUserViewpoints () + { + const userViewpoints = [ ]; + + for (const viewpointNode of this .viewpoints .get ()) + { + if (viewpointNode ._description .length) + userViewpoints .push (viewpointNode); + } + + return userViewpoints; + }, + getBackgroundStack () + { + return this .backgroundStack; + }, + getFogStack () + { + return this .fogStack; + }, + getNavigationInfoStack () + { + return this .navigationInfoStack; + }, + getViewpointStack () + { + return this .viewpointStack; + }, + getCollisionTime () + { + return this .collisionTime; + }, + viewAll (transitionTime = 1, factor = 1, straighten = false) + { + const + viewpointNode = this .getViewpoint (), + bbox = this .getBBox (new Geometry_Box3 ()) .multRight (viewpointNode .getModelMatrix () .copy () .inverse ()); + + viewpointNode .lookAt (this, bbox .center, viewpointNode .getLookAtDistance (bbox), transitionTime, factor, straighten); + }, + straightenView () + { + this .getViewpoint () .straightenView (this); + }, + set_visible_and_hidden__ () + { + const value = this ._visible .getValue () && !this ._hidden .getValue (); + + if (value === this ._display .getValue ()) + return; + + this ._display = value; + }, + set_viewport__ () + { + this .viewportNode = Base_X3DCast (Base_X3DConstants .X3DViewportNode, this ._viewport); + + if (!this .viewportNode) + this .viewportNode = this .getBrowser () .getDefaultViewport (); + }, + bindBindables (viewpointName) + { + this .traverse (Rendering_TraverseType .CAMERA, this); + + // Bind first viewpoint in viewpoint list. + + const + navigationInfoNode = this .navigationInfos .getBound (), + backgroundNode = this .backgrounds .getBound (), + fogNode = this .fogs .getBound (), + viewpointNode = this .viewpoints .getBound (viewpointName); + + this .navigationInfoStack .pushOnTop (navigationInfoNode); + this .viewpointStack .pushOnTop (viewpointNode); + this .backgroundStack .pushOnTop (backgroundNode); + this .fogStack .pushOnTop (fogNode); + + viewpointNode .resetUserOffsets (); + + if (viewpointNode ._viewAll .getValue ()) + viewpointNode .viewAll (this .getBBox (new Geometry_Box3 ())); + }, + traverse (type, renderObject = this) + { + const viewpointNode = this .getViewpoint (); + + this .getProjectionMatrix () .pushMatrix (viewpointNode .getProjectionMatrix (this)); + this .getCameraSpaceMatrix () .pushMatrix (viewpointNode .getCameraSpaceMatrix ()); + this .getViewMatrix () .pushMatrix (viewpointNode .getViewMatrix ()); + + switch (type) + { + case Rendering_TraverseType .POINTER: + this .pointer (type, renderObject); + break; + case Rendering_TraverseType .CAMERA: + this .camera (type, renderObject); + break; + case Rendering_TraverseType .PICKING: + this .picking (type, renderObject); + break; + case Rendering_TraverseType .COLLISION: + this .collision (type, renderObject); + break; + case Rendering_TraverseType .SHADOW: + case Rendering_TraverseType .DISPLAY: + this .display (type, renderObject); + break; + } + + this .getViewMatrix () .pop (); + this .getCameraSpaceMatrix () .pop (); + this .getProjectionMatrix () .pop (); + }, + pointer (type, renderObject) + { + const + browser = this .getBrowser (), + viewport = this .viewportNode .getRectangle (); + + if (browser .getPointingLayer ()) + { + if (browser .getPointingLayer () !== this) + return; + } + else + { + if (!browser .isPointerInRectangle (viewport)) + return; + } + + this .setHitRay (this .getProjectionMatrix () .get (), viewport, browser .getPointer ()); + this .getNavigationInfo () .enable (type, renderObject); + this .getModelViewMatrix () .pushMatrix (this .getViewMatrix () .get ()); + + this .viewportNode .push (this); + renderObject .render (type, this .groupNode .traverse, this .groupNode); + this .viewportNode .pop (this); + + this .getModelViewMatrix () .pop (); + }, + camera (type, renderObject) + { + if (this ._display .getValue ()) + { + this .getModelViewMatrix () .pushMatrix (Numbers_Matrix4 .Identity); + + this .viewportNode .push (this); + this .groupNode .traverse (type, renderObject); + this .viewportNode .pop (this); + + this .getModelViewMatrix () .pop (); + + this .navigationInfos .update (this, this .navigationInfoStack); + this .viewpoints .update (this, this .viewpointStack); + this .backgrounds .update (this, this .backgroundStack); + this .fogs .update (this, this .fogStack); + + this .getViewpoint () .update (); + } + }, + picking (type, renderObject) + { + if (this ._pickable .getValue ()) + { + this .getModelViewMatrix () .pushMatrix (Numbers_Matrix4 .Identity); + + this .viewportNode .push (this); + this .groupNode .traverse (type, renderObject); + this .viewportNode .pop (this); + + this .getModelViewMatrix () .pop (); + } + }, + collision: (() => + { + const projectionMatrix = new Numbers_Matrix4 (); + + return function (type, renderObject) + { + if (this ._display .getValue ()) + { + const navigationInfo = this .getNavigationInfo (); + + if (navigationInfo ._transitionActive .getValue ()) + return; + + const + collisionRadius = navigationInfo .getCollisionRadius (), + avatarHeight = navigationInfo .getAvatarHeight (), + size = Math .max (collisionRadius * 2, avatarHeight * 2); + + Geometry_Camera .ortho (-size, size, -size, size, -size, size, projectionMatrix); + + this .getProjectionMatrix () .pushMatrix (projectionMatrix); + this .getModelViewMatrix () .pushMatrix (this .getViewMatrix () .get ()); + + // Render + this .viewportNode .push (this); + renderObject .render (type, this .groupNode .traverse, this .groupNode); + this .viewportNode .pop (this); + + this .getModelViewMatrix () .pop (); + this .getProjectionMatrix () .pop (); + } + }; + })(), + display (type, renderObject) + { + if (this ._display .getValue ()) + { + this .getNavigationInfo () .enable (type, renderObject); + this .getModelViewMatrix () .pushMatrix (this .getViewMatrix () .get ()); + + this .viewportNode .push (this); + renderObject .render (type, this .groupNode .traverse, this .groupNode); + this .viewportNode .pop (this); + + this .getModelViewMatrix () .pop (); + } + }, +}); + +Object .defineProperties (X3DLayerNode, +{ + typeName: + { + value: "X3DLayerNode", + enumerable: true, + }, + componentName: + { + value: "Layering", + enumerable: true, + }, +}); + +const X3DLayerNode_default_ = X3DLayerNode; +; + +x_ite_Namespace .add ("X3DLayerNode", "x_ite/Components/Layering/X3DLayerNode", X3DLayerNode_default_); +/* harmony default export */ const Layering_X3DLayerNode = (X3DLayerNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Core/X3DSensorNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function X3DSensorNode (executionContext) +{ + Core_X3DChildNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DSensorNode); +} + +Object .setPrototypeOf (X3DSensorNode .prototype, Core_X3DChildNode .prototype); + +Object .defineProperties (X3DSensorNode, +{ + typeName: + { + value: "X3DSensorNode", + enumerable: true, + }, + componentName: + { + value: "Core", + enumerable: true, + }, +}); + +const X3DSensorNode_default_ = X3DSensorNode; +; + +x_ite_Namespace .add ("X3DSensorNode", "x_ite/Components/Core/X3DSensorNode", X3DSensorNode_default_); +/* harmony default export */ const Core_X3DSensorNode = (X3DSensorNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Time/X3DTimeDependentNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function X3DTimeDependentNode (executionContext) +{ + this .addType (Base_X3DConstants .X3DTimeDependentNode); + + this .addChildObjects (Base_X3DConstants .outputOnly, "initialized", new x_ite_Fields .SFTime (), + Base_X3DConstants .inputOutput, "isEvenLive", new x_ite_Fields .SFBool ()); + + this .startTimeValue = 0; + this .pauseTimeValue = 0; + this .resumeTimeValue = 0; + this .stopTimeValue = 0; + this .start = 0; + this .pause = 0; + this .pauseInterval = 0; + this .timeouts = new Map (); + this .disabled = false; +} + +Object .assign (Object .setPrototypeOf (X3DTimeDependentNode .prototype, Core_X3DChildNode .prototype), +{ + initialize () + { + this .getLive () .addInterest ("set_live__", this); + this ._isEvenLive .addInterest ("set_live__", this); + + this ._initialized .addInterest ("set_loop__", this); + this ._enabled .addInterest ("set_enabled__", this); + this ._loop .addInterest ("set_loop__", this); + this ._startTime .addInterest ("set_startTime__", this); + this ._pauseTime .addInterest ("set_pauseTime__", this); + this ._resumeTime .addInterest ("set_resumeTime__", this); + this ._stopTime .addInterest ("set_stopTime__", this); + + this .startTimeValue = this ._startTime .getValue (); + this .pauseTimeValue = this ._pauseTime .getValue (); + this .resumeTimeValue = this ._resumeTime .getValue (); + this .stopTimeValue = this ._stopTime .getValue (); + + this ._initialized = this .getBrowser () .getCurrentTime (); + }, + getLiveState () + { + /// Determines the live state of this node. + + return this .isLive () && (this .getExecutionContext () .getLive () .getValue () || this ._isEvenLive .getValue ()); + }, + getElapsedTime () + { + return this .getBrowser () .getCurrentTime () - this .start - this .pauseInterval; + }, + resetElapsedTime () + { + this .start = this .getBrowser () .getCurrentTime (); + this .pause = this .getBrowser () .getCurrentTime (); + this .pauseInterval = 0; + }, + set_live__ () + { + if (this .getLive () .getValue () || this ._isEvenLive .getValue ()) + { + if (this .disabled) + { + this .disabled = false; + + if (this ._isActive .getValue () && !this ._isPaused .getValue ()) + this .real_resume (); + } + } + else + { + if (!this .disabled && this ._isActive .getValue () && !this ._isPaused .getValue ()) + { + // Only disable if needed, ie. if running! + this .disabled = true; + this .real_pause (); + } + } + }, + set_enabled__ () + { + if (this ._enabled .getValue ()) + this .set_loop__ (); + + else + this .stop (); + }, + set_loop__ () + { + if (this ._enabled .getValue ()) + { + if (this ._loop .getValue ()) + { + if (this .stopTimeValue <= this .startTimeValue) + { + if (this .startTimeValue <= this .getBrowser () .getCurrentTime ()) + this .do_start (); + } + } + } + + this .set_loop (); + }, + set_startTime__ () + { + this .startTimeValue = this ._startTime .getValue (); + + if (this ._enabled .getValue ()) + { + this .removeTimeout ("start"); + + if (this .startTimeValue <= this .getBrowser () .getCurrentTime ()) + this .do_start (); + + else + this .addTimeout ("start", "do_start", this .startTimeValue); + } + }, + set_pauseTime__ () + { + this .pauseTimeValue = this ._pauseTime .getValue (); + + if (this ._enabled .getValue ()) + { + this .removeTimeout ("pause"); + + if (this .pauseTimeValue <= this .resumeTimeValue) + return; + + if (this .pauseTimeValue <= this .getBrowser () .getCurrentTime ()) + this .do_pause (); + + else + this .addTimeout ("pause", "do_pause", this .pauseTimeValue); + } + }, + set_resumeTime__ () + { + this .resumeTimeValue = this ._resumeTime .getValue (); + + if (this ._enabled .getValue ()) + { + this .removeTimeout ("resume"); + + if (this .resumeTimeValue <= this .pauseTimeValue) + return; + + if (this .resumeTimeValue <= this .getBrowser () .getCurrentTime ()) + this .do_resume (); + + else + this .addTimeout ("resume", "do_resume", this .resumeTimeValue); + } + }, + set_stopTime__ () + { + this .stopTimeValue = this ._stopTime .getValue (); + + if (this ._enabled .getValue ()) + { + this .removeTimeout ("stop"); + + if (this .stopTimeValue <= this .startTimeValue) + return; + + if (this .stopTimeValue <= this .getBrowser () .getCurrentTime ()) + this .do_stop (); + + else + this .addTimeout ("stop", "do_stop", this .stopTimeValue); + } + }, + do_start () + { + if (!this ._isActive .getValue ()) + { + this .resetElapsedTime (); + + // The event order below is very important. + + this ._isActive = true; + this ._elapsedTime = 0; + + this .set_start (); + + if (this .getLive () .getValue ()) + { + this .getBrowser () .timeEvents () .addInterest ("set_time" ,this); + } + else + { + this .disabled = true; + this .real_pause (); + } + } + }, + do_pause () + { + if (this ._isActive .getValue () && !this ._isPaused .getValue ()) + { + this ._isPaused = true; + + if (this .pauseTimeValue !== this .getBrowser () .getCurrentTime ()) + this .pauseTimeValue = this .getBrowser () .getCurrentTime (); + + if (this .getLive () .getValue ()) + this .real_pause (); + } + }, + real_pause () + { + this .pause = Date .now (); + + this .set_pause (); + + this .getBrowser () .timeEvents () .removeInterest ("set_time" ,this); + }, + do_resume () + { + if (this ._isActive .getValue () && this ._isPaused .getValue ()) + { + this ._isPaused = false; + + if (this .resumeTimeValue !== this .getBrowser () .getCurrentTime ()) + this .resumeTimeValue = this .getBrowser () .getCurrentTime (); + + if (this .getLive () .getValue ()) + this .real_resume (); + } + }, + real_resume () + { + const interval = (Date .now () - this .pause) / 1000; + + this .pauseInterval += interval; + + this .set_resume (interval); + + this .getBrowser () .timeEvents () .addInterest ("set_time", this); + this .getBrowser () .addBrowserEvent (); + }, + do_stop () + { + this .stop (); + }, + stop () + { + if (this ._isActive .getValue ()) + { + // The event order below is very important. + + this .set_stop (); + + this ._elapsedTime = this .getElapsedTime (); + + if (this ._isPaused .getValue ()) + this ._isPaused = false; + + this ._isActive = false; + + this .getBrowser () .timeEvents () .removeInterest ("set_time" ,this); + } + }, + addTimeout (name, callback, time) + { + this .removeTimeout (name); + + this .timeouts .set (name, setTimeout (this .processTimeout .bind (this, callback), (time - this .getBrowser () .getCurrentTime ()) * 1000)); + }, + removeTimeout (name) + { + clearTimeout (this .timeouts .get (name)); + + this .timeouts .delete (name); + }, + processTimeout (callback) + { + if (!this ._enabled .getValue ()) + return; + + if (!(this .getLive () .getValue () || this ._isEvenLive .getValue ())) + return; + + this .getBrowser () .advanceTime (); + + this [callback] (); + }, + set_loop: Function .prototype, + set_start: Function .prototype, + set_pause: Function .prototype, + set_resume: Function .prototype, + set_stop: Function .prototype, + set_time: Function .prototype, + dispose () + { + for (const name of [... this .timeouts .keys ()]) + this .removeTimeout (name); + }, +}); + +Object .defineProperties (X3DTimeDependentNode, +{ + typeName: + { + value: "X3DTimeDependentNode", + enumerable: true, + }, + componentName: + { + value: "Time", + enumerable: true, + }, +}); + +const X3DTimeDependentNode_default_ = X3DTimeDependentNode; +; + +x_ite_Namespace .add ("X3DTimeDependentNode", "x_ite/Components/Time/X3DTimeDependentNode", X3DTimeDependentNode_default_); +/* harmony default export */ const Time_X3DTimeDependentNode = (X3DTimeDependentNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Time/TimeSensor.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +function TimeSensor (executionContext) +{ + Core_X3DSensorNode .call (this, executionContext); + Time_X3DTimeDependentNode .call (this, executionContext); + + this .addType (Base_X3DConstants .TimeSensor); + + this .addChildObjects (Base_X3DConstants .inputOutput, "range", new x_ite_Fields .MFFloat (0, 0, 1)); // current, first, last (in fractions) - play range starting at current + + this .cycle = 0; + this .interval = 0; + this .fraction = 0; + this .first = 0; + this .last = 1; + this .scale = 1; +} + +Object .assign (Object .setPrototypeOf (TimeSensor .prototype, Core_X3DSensorNode .prototype), + Time_X3DTimeDependentNode .prototype, +{ + initialize () + { + Core_X3DSensorNode .prototype .initialize .call (this); + Time_X3DTimeDependentNode .prototype .initialize .call (this); + + this ._cycleInterval .addInterest ("set_cycleInterval__", this); + this ._range .addInterest ("set_range__", this); + }, + setRange (fraction, firstFraction, lastFraction, offset) + { + const + currentTime = this .getBrowser () .getCurrentTime (), + startTime = this ._startTime .getValue (), + cycleInterval = this ._cycleInterval .getValue (); + + this .first = Math_Algorithm .clamp (firstFraction, 0, 1); + this .last = Math_Algorithm .clamp (lastFraction, 0, 1); + this .scale = this .last - this .first; + this .interval = cycleInterval * this .scale; + this .offset = offset && this .interval ? (currentTime - startTime) / this .interval : 0; + this .fraction = Math_Algorithm .fract (fraction + this .offset); + this .cycle = currentTime - (this .fraction - this .first) * cycleInterval; + }, + set_cycleInterval__ () + { + if (!this ._isActive .getValue ()) + return; + + this .setRange (this .fraction, this ._range [1], this ._range [2], false); + }, + set_range__ () + { + if (!this ._isActive .getValue ()) + return; + + this .setRange (this ._range [0], this ._range [1], this ._range [2], false); + + if (this ._isPaused .getValue ()) + return; + + this .set_fraction (this .getBrowser () .getCurrentTime ()); + }, + set_start () + { + this .setRange (this ._range [0], this ._range [1], this ._range [2], true); + + const time = this .getBrowser () .getCurrentTime (); + + this ._cycleTime = time; + this ._fraction_changed = this .fraction; + this ._time = time; + }, + set_resume (pauseInterval) + { + this .setRange (this .fraction, this ._range [1], this ._range [2], false); + }, + set_fraction (time) + { + this ._fraction_changed = this .fraction = this .first + (this .interval ? Math_Algorithm .fract ((time - this .cycle) / this .interval) : 0) * this .scale; + }, + set_time () + { + // The event order below is very important. + + const time = this .getBrowser () .getCurrentTime (); + + if (time - this .cycle >= this .interval) + { + if (this ._loop .getValue ()) + { + if (this .interval) + { + this .cycle += this .interval * Math .floor ((time - this .cycle) / this .interval); + + this ._elapsedTime = this .getElapsedTime (); + this ._cycleTime = time; + + this .set_fraction (time); + } + } + else + { + this ._fraction_changed = this .fraction = this .last; + this .stop (); + } + } + else + { + this ._elapsedTime = this .getElapsedTime (); + + this .set_fraction (time); + } + + this ._time = time; + }, + dispose () + { + Time_X3DTimeDependentNode .prototype .dispose .call (this); + Core_X3DSensorNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (TimeSensor, +{ + typeName: + { + value: "TimeSensor", + enumerable: true, + }, + componentName: + { + value: "Time", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "cycleInterval", new x_ite_Fields .SFTime (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "loop", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "startTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "resumeTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pauseTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "stopTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isPaused", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "cycleTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "elapsedTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "fraction_changed", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "time", new x_ite_Fields .SFTime ()), + ]), + enumerable: true, + }, +}); + +const TimeSensor_default_ = TimeSensor; +; + +x_ite_Namespace .add ("TimeSensor", "x_ite/Components/Time/TimeSensor", TimeSensor_default_); +/* harmony default export */ const Time_TimeSensor = (TimeSensor_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Interpolation/X3DInterpolatorNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function X3DInterpolatorNode (executionContext) +{ + Core_X3DChildNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DInterpolatorNode); +} + +Object .assign (Object .setPrototypeOf (X3DInterpolatorNode .prototype, Core_X3DChildNode .prototype), +{ + setup () + { + // If an X3DInterpolatorNode value_changed outputOnly field is read before it receives any inputs, + // keyValue[0] is returned if keyValue is not empty. If keyValue is empty (i.e., [ ]), the initial + // value for the respective field type is returned (EXAMPLE (0, 0, 0) for Fields .SFVec3f); + + this .set_key__ (); + + if (this ._key .length) + this .interpolate (0, 0, 0); + + Core_X3DChildNode .prototype .setup .call (this); + }, + initialize () + { + Core_X3DChildNode .prototype .initialize .call (this); + + this ._set_fraction .addInterest ("set_fraction__", this); + this ._key .addInterest ("set_key__", this); + }, + set_fraction__ () + { + const + key = this ._key, + length = key .length, + fraction = this ._set_fraction .getValue (); + + switch (length) + { + case 0: + // Interpolator nodes containing no keys in the key field shall not produce any events. + return; + case 1: + return this .interpolate (0, 0, 0); + default: + { + if (fraction <= key [0]) + return this .interpolate (0, 1, 0); + + const index1 = Math_Algorithm .upperBound (key, 0, length, fraction); + + if (index1 !== length) + { + const + index0 = index1 - 1, + weight = (fraction - key [index0]) / (key [index1] - key [index0]); + + this .interpolate (index0, index1, Math_Algorithm .clamp (weight, 0, 1)); + } + else + this .interpolate (length - 2, length - 1, 1); + } + } + }, + set_key__ () + { + this .set_keyValue__ (); + }, + set_keyValue__ () { }, + interpolate () { }, +}); + +Object .defineProperties (X3DInterpolatorNode, +{ + typeName: + { + value: "X3DInterpolatorNode", + enumerable: true, + }, + componentName: + { + value: "Interpolation", + enumerable: true, + }, +}); + +const X3DInterpolatorNode_default_ = X3DInterpolatorNode; +; + +x_ite_Namespace .add ("X3DInterpolatorNode", "x_ite/Components/Interpolation/X3DInterpolatorNode", X3DInterpolatorNode_default_); +/* harmony default export */ const Interpolation_X3DInterpolatorNode = (X3DInterpolatorNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Interpolation/EaseInEaseOut.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function EaseInEaseOut (executionContext) +{ + Interpolation_X3DInterpolatorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .EaseInEaseOut); +} + +Object .assign (Object .setPrototypeOf (EaseInEaseOut .prototype, Interpolation_X3DInterpolatorNode .prototype), +{ + initialize () + { + Interpolation_X3DInterpolatorNode .prototype .initialize .call (this); + + this ._easeInEaseOut .addInterest ("set_keyValue__", this); + }, + set_keyValue__ () + { + if (this ._easeInEaseOut .length < this ._key .length) + this ._easeInEaseOut .resize (this ._key .length, this ._easeInEaseOut .length ? this ._easeInEaseOut [this ._easeInEaseOut .length - 1] : new x_ite_Fields .SFVec2f ()); + }, + interpolate (index0, index1, weight) + { + let + easeOut = this ._easeInEaseOut [index0] .y, + easeIn = this ._easeInEaseOut [index1] .x; + + const sum = easeOut + easeIn; + + if (sum < 0) + { + this ._modifiedFraction_changed = weight; + } + else + { + if (sum > 1) + { + easeIn /= sum; + easeOut /= sum; + } + + const t = 1 / (2 - easeOut - easeIn); + + if (weight < easeOut) + { + this ._modifiedFraction_changed = (t / easeOut) * weight * weight; + } + else if (weight <= 1 - easeIn) // Spec says (weight < 1 - easeIn), but then we get a NaN below if easeIn == 0. + { + this ._modifiedFraction_changed = t * (2 * weight - easeOut); + } + else + { + const w = 1 - weight; + + this ._modifiedFraction_changed = 1 - ((t * w * w) / easeIn); + } + } + }, +}); + +Object .defineProperties (EaseInEaseOut, +{ + typeName: + { + value: "EaseInEaseOut", + enumerable: true, + }, + componentName: + { + value: "Interpolation", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_fraction", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "key", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "easeInEaseOut", new x_ite_Fields .MFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "modifiedFraction_changed", new x_ite_Fields .SFFloat ()), + ]), + enumerable: true, + }, +}); + +const EaseInEaseOut_default_ = EaseInEaseOut; +; + +x_ite_Namespace .add ("EaseInEaseOut", "x_ite/Components/Interpolation/EaseInEaseOut", EaseInEaseOut_default_); +/* harmony default export */ const Interpolation_EaseInEaseOut = (EaseInEaseOut_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Interpolation/PositionInterpolator.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function PositionInterpolator (executionContext) +{ + Interpolation_X3DInterpolatorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .PositionInterpolator); +} + +Object .assign (Object .setPrototypeOf (PositionInterpolator .prototype, Interpolation_X3DInterpolatorNode .prototype), +{ + initialize () + { + Interpolation_X3DInterpolatorNode .prototype .initialize .call (this); + + this ._keyValue .addInterest ("set_keyValue__", this); + }, + set_keyValue__ () + { + const + key = this ._key, + keyValue = this ._keyValue; + + if (keyValue .length < key .length) + keyValue .resize (key .length, keyValue .length ? keyValue [keyValue .length - 1] : new x_ite_Fields .SFVec3f ()); + }, + interpolate: (() => + { + const keyValue = new Numbers_Vector3 (0, 0, 0); + + return function (index0, index1, weight) + { + this ._value_changed = keyValue .assign (this ._keyValue [index0] .getValue ()) .lerp (this ._keyValue [index1] .getValue (), weight); + }; + })(), +}); + +Object .defineProperties (PositionInterpolator, +{ + typeName: + { + value: "PositionInterpolator", + enumerable: true, + }, + componentName: + { + value: "Interpolation", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_fraction", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "key", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "keyValue", new x_ite_Fields .MFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .SFVec3f ()), + ]), + enumerable: true, + }, +}); + +const PositionInterpolator_default_ = PositionInterpolator; +; + +x_ite_Namespace .add ("PositionInterpolator", "x_ite/Components/Interpolation/PositionInterpolator", PositionInterpolator_default_); +/* harmony default export */ const Interpolation_PositionInterpolator = (PositionInterpolator_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Interpolation/OrientationInterpolator.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function OrientationInterpolator (executionContext) +{ + Interpolation_X3DInterpolatorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .OrientationInterpolator); + + this ._keyValue .setUnit ("angle"); + this ._value_changed .setUnit ("angle"); +} + +Object .assign (Object .setPrototypeOf (OrientationInterpolator .prototype, Interpolation_X3DInterpolatorNode .prototype), +{ + initialize () + { + Interpolation_X3DInterpolatorNode .prototype .initialize .call (this); + + this ._keyValue .addInterest ("set_keyValue__", this); + }, + set_keyValue__ () + { + const + key = this ._key, + keyValue = this ._keyValue; + + if (keyValue .length < key .length) + keyValue .resize (key .length, keyValue .length ? keyValue [keyValue .length - 1] : new x_ite_Fields .SFRotation ()); + }, + interpolate: (() => + { + const + keyValue0 = new Numbers_Rotation4 (), + keyValue1 = new Numbers_Rotation4 (); + + return function (index0, index1, weight) + { + // Both values can change in slerp. + keyValue0 .assign (this ._keyValue [index0] .getValue ()); + keyValue1 .assign (this ._keyValue [index1] .getValue ()); + + this ._value_changed = keyValue0 .slerp (keyValue1, weight); + }; + }) (), +}); + +Object .defineProperties (OrientationInterpolator, +{ + typeName: + { + value: "OrientationInterpolator", + enumerable: true, + }, + componentName: + { + value: "Interpolation", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_fraction", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "key", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "keyValue", new x_ite_Fields .MFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .SFRotation ()), + ]), + enumerable: true, + }, +}); + +const OrientationInterpolator_default_ = OrientationInterpolator; +; + +x_ite_Namespace .add ("OrientationInterpolator", "x_ite/Components/Interpolation/OrientationInterpolator", OrientationInterpolator_default_); +/* harmony default export */ const Interpolation_OrientationInterpolator = (OrientationInterpolator_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Interpolation/ScalarInterpolator.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function ScalarInterpolator (executionContext) +{ + Interpolation_X3DInterpolatorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .ScalarInterpolator); +} + +Object .assign (Object .setPrototypeOf (ScalarInterpolator .prototype, Interpolation_X3DInterpolatorNode .prototype), +{ + initialize () + { + Interpolation_X3DInterpolatorNode .prototype .initialize .call (this); + + this ._keyValue .addInterest ("set_keyValue__", this); + }, + set_keyValue__ () + { + const + key = this ._key, + keyValue = this ._keyValue; + + if (keyValue .length < key .length) + keyValue .resize (key .length, keyValue .length ? keyValue [keyValue .length - 1] : 0); + }, + interpolate (index0, index1, weight) + { + this ._value_changed = Math_Algorithm .lerp (this ._keyValue [index0], this ._keyValue [index1], weight); + }, +}); + +Object .defineProperties (ScalarInterpolator, +{ + typeName: + { + value: "ScalarInterpolator", + enumerable: true, + }, + componentName: + { + value: "Interpolation", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_fraction", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "key", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "keyValue", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .SFFloat ()), + ]), + enumerable: true, + }, +}); + +const ScalarInterpolator_default_ = ScalarInterpolator; +; + +x_ite_Namespace .add ("ScalarInterpolator", "x_ite/Components/Interpolation/ScalarInterpolator", ScalarInterpolator_default_); +/* harmony default export */ const Interpolation_ScalarInterpolator = (ScalarInterpolator_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Navigation/X3DViewpointNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + + +function X3DViewpointNode (executionContext) +{ + Core_X3DBindableNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DViewpointNode); + + this .addChildObjects (Base_X3DConstants .inputOutput, "positionOffset", new x_ite_Fields .SFVec3f (), + Base_X3DConstants .inputOutput, "orientationOffset", new x_ite_Fields .SFRotation (), + Base_X3DConstants .inputOutput, "scaleOffset", new x_ite_Fields .SFVec3f (1, 1, 1), + Base_X3DConstants .inputOutput, "scaleOrientationOffset", new x_ite_Fields .SFRotation (), + Base_X3DConstants .inputOutput, "centerOfRotationOffset", new x_ite_Fields .SFVec3f (), + Base_X3DConstants .inputOutput, "fieldOfViewScale", new x_ite_Fields .SFFloat (1)); + + this .descriptions = [ ]; + this .userPosition = new Numbers_Vector3 (0, 1, 0); + this .userOrientation = new Numbers_Rotation4 (); + this .userCenterOfRotation = new Numbers_Vector3 (0, 0, 0); + this .modelMatrix = new Numbers_Matrix4 (); + this .cameraSpaceMatrix = new Numbers_Matrix4 (1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 10, 1); + this .viewMatrix = new Numbers_Matrix4 (1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, -10, 1); + + const browser = this .getBrowser (); + + this .timeSensor = new Time_TimeSensor (browser .getPrivateScene ()); + this .easeInEaseOut = new Interpolation_EaseInEaseOut (browser .getPrivateScene ()); + this .positionInterpolator = new Interpolation_PositionInterpolator (browser .getPrivateScene ()); + this .orientationInterpolator = new Interpolation_OrientationInterpolator (browser .getPrivateScene ()); + this .scaleInterpolator = new Interpolation_PositionInterpolator (browser .getPrivateScene ()); + this .scaleOrientationInterpolator = new Interpolation_OrientationInterpolator (browser .getPrivateScene ()); + this .fieldOfViewScaleInterpolator = new Interpolation_ScalarInterpolator (browser .getPrivateScene ()); +} + +Object .assign (Object .setPrototypeOf (X3DViewpointNode .prototype, Core_X3DBindableNode .prototype), +{ + initialize () + { + Core_X3DBindableNode .prototype .initialize .call (this); + + this .timeSensor ._stopTime = 1; + this .timeSensor .setup (); + + this .easeInEaseOut ._key = new x_ite_Fields .MFFloat (0, 1); + this .easeInEaseOut ._easeInEaseOut = new x_ite_Fields .MFVec2f (new x_ite_Fields .SFVec2f (0, 0), new x_ite_Fields .SFVec2f (0, 0)); + this .easeInEaseOut .setup (); + + this .positionInterpolator ._key = new x_ite_Fields .MFFloat (0, 1); + this .orientationInterpolator ._key = new x_ite_Fields .MFFloat (0, 1); + this .scaleInterpolator ._key = new x_ite_Fields .MFFloat (0, 1); + this .scaleOrientationInterpolator ._key = new x_ite_Fields .MFFloat (0, 1); + this .fieldOfViewScaleInterpolator ._key = new x_ite_Fields .MFFloat (0, 1); + + this .positionInterpolator .setup (); + this .orientationInterpolator .setup (); + this .scaleInterpolator .setup (); + this .scaleOrientationInterpolator .setup (); + this .fieldOfViewScaleInterpolator .setup (); + + this .timeSensor ._fraction_changed .addFieldInterest (this .easeInEaseOut ._set_fraction); + + this .easeInEaseOut ._modifiedFraction_changed .addFieldInterest (this .positionInterpolator ._set_fraction); + this .easeInEaseOut ._modifiedFraction_changed .addFieldInterest (this .orientationInterpolator ._set_fraction); + this .easeInEaseOut ._modifiedFraction_changed .addFieldInterest (this .scaleInterpolator ._set_fraction); + this .easeInEaseOut ._modifiedFraction_changed .addFieldInterest (this .scaleOrientationInterpolator ._set_fraction); + this .easeInEaseOut ._modifiedFraction_changed .addFieldInterest (this .fieldOfViewScaleInterpolator ._set_fraction); + + this .positionInterpolator ._value_changed .addFieldInterest (this ._positionOffset); + this .orientationInterpolator ._value_changed .addFieldInterest (this ._orientationOffset); + this .scaleInterpolator ._value_changed .addFieldInterest (this ._scaleOffset); + this .scaleOrientationInterpolator ._value_changed .addFieldInterest (this ._scaleOrientationOffset); + this .fieldOfViewScaleInterpolator ._value_changed .addFieldInterest (this ._fieldOfViewScale); + + this ._nearDistance .addInterest ("set_nearDistance__", this); + this ._farDistance .addInterest ("set_farDistance__", this); + this ._viewAll .addInterest ("set_viewAll__", this); + this ._navigationInfo .addInterest ("set_navigationInfo__", this); + this ._isBound .addInterest ("set_bound__", this); + + this .set_nearDistance__ (); + this .set_farDistance__ (); + this .set_navigationInfo__ (); + }, + set_nearDistance__ () + { + const nearDistance = this ._nearDistance .getValue (); + + this .nearDistance = nearDistance >= 0 ? nearDistance : undefined; + }, + set_farDistance__ () + { + const farDistance = this ._farDistance .getValue (); + + this .farDistance = farDistance >= 0 ? farDistance : undefined; + }, + set_viewAll__ () + { + if (! this ._viewAll .getValue ()) + return; + + if (! this ._isBound .getValue ()) + return; + + this ._set_bind = true; + }, + set_navigationInfo__ () + { + if (this .navigationInfoNode) + this ._isBound .removeFieldInterest (this .navigationInfoNode ._set_bind); + + this .navigationInfoNode = Base_X3DCast (Base_X3DConstants .NavigationInfo, this ._navigationInfo); + + if (this .navigationInfoNode) + this ._isBound .addFieldInterest (this .navigationInfoNode ._set_bind); + }, + set_bound__ () + { + const browser = this .getBrowser (); + + if (this ._isBound .getValue ()) + browser .getNotification () ._string = this ._description; + else + this .timeSensor ._stopTime = browser .getCurrentTime (); + }, + set_active__ (navigationInfoNode, active) + { + if (active .getValue ()) + return; + + this .timeSensor ._isActive .removeInterest ("set_active__", this); + + if (!this ._isBound .getValue ()) + return; + + if (this .timeSensor ._fraction_changed .getValue () !== 1) + return; + + navigationInfoNode ._transitionComplete = true; + }, + getDescriptions () + { + return this .descriptions; + }, + setInterpolators () { }, + getPosition () + { + return this ._position .getValue (); + }, + getUserPosition () + { + return this .userPosition .assign (this .getPosition ()) .add (this ._positionOffset .getValue ()); + }, + getOrientation () + { + return this ._orientation .getValue (); + }, + getUserOrientation () + { + return this .userOrientation .assign (this .getOrientation ()) .multRight (this ._orientationOffset .getValue ()); + }, + getCenterOfRotation () + { + return this ._centerOfRotation .getValue (); + }, + getUserCenterOfRotation () + { + return this .userCenterOfRotation .assign (this .getCenterOfRotation ()) .add (this ._centerOfRotationOffset .getValue ()); + }, + getProjectionMatrix (renderObject) + { + const navigationInfo = renderObject .getNavigationInfo (); + + return this .getProjectionMatrixWithLimits (this .nearDistance ?? navigationInfo .getNearValue (), + this .farDistance ?? navigationInfo .getFarValue (this), + renderObject .getLayer () .getViewport () .getRectangle ()); + }, + getCameraSpaceMatrix () + { + return this .cameraSpaceMatrix; + }, + getViewMatrix () + { + return this .viewMatrix; + }, + getModelMatrix () + { + return this .modelMatrix; + }, + getMaxFarValue () + { + return this .getBrowser () .getRenderingProperty ("LogarithmicDepthBuffer") ? 1e10 : 1e5; + }, + getUpVector () + { + // Local y-axis, + // see https://www.web3d.org/documents/specifications/19775-1/V3.3/index.html#NavigationInfo. + return Numbers_Vector3 .yAxis; + }, + getSpeedFactor () + { + return 1; + }, + setVRMLTransition (value) + { + // VRML behavior support. + this .VRMLTransition = value; + }, + getVRMLTransition () + { + // VRML behavior support. + return this .VRMLTransition; + }, + transitionStart (layerNode, fromViewpointNode) + { + if (this ._jump .getValue ()) + { + const relative = this .getRelativeTransformation (fromViewpointNode); + + if (! this ._retainUserOffsets .getValue ()) + this .resetUserOffsets (); + + if (this ._viewAll .getValue ()) + this .viewAll (layerNode .getBBox (new Geometry_Box3 ())); + + // Handle NavigationInfo. + + const + navigationInfoNode = layerNode .getNavigationInfo (), + transitionTime = navigationInfoNode ._transitionTime .getValue (); + + let transitionType = navigationInfoNode .getTransitionType (); + + // VRML behavior + + if (this .getExecutionContext () .getSpecificationVersion () == 2.0) + { + if (this .getVRMLTransition ()) + transitionType = "LINEAR"; + else + transitionType = "TELEPORT"; + } + + this .setVRMLTransition (false); + + // End VRML behavior + + if (transitionTime <= 0) + transitionType = "TELEPORT"; + + if (this .constructor !== fromViewpointNode .constructor) + transitionType = "TELEPORT"; + + switch (transitionType) + { + case "TELEPORT": + { + navigationInfoNode ._transitionComplete = true; + return; + } + case "ANIMATE": + { + this .easeInEaseOut ._easeInEaseOut = new x_ite_Fields .MFVec2f (new x_ite_Fields .SFVec2f (0, 1), new x_ite_Fields .SFVec2f (1, 0)); + break; + } + default: + { + // LINEAR + this .easeInEaseOut ._easeInEaseOut = new x_ite_Fields .MFVec2f (new x_ite_Fields .SFVec2f (0, 0), new x_ite_Fields .SFVec2f (0, 0)); + break; + } + } + + navigationInfoNode ._transitionStart = true; + + this .timeSensor ._cycleInterval = transitionTime; + this .timeSensor ._stopTime = this .getBrowser () .getCurrentTime (); + this .timeSensor ._startTime = this .getBrowser () .getCurrentTime (); + + this .timeSensor ._isActive .addInterest ("set_active__", this, navigationInfoNode); + + this .positionInterpolator ._keyValue = new x_ite_Fields .MFVec3f (relative .position, this ._positionOffset); + this .orientationInterpolator ._keyValue = new x_ite_Fields .MFRotation (relative .orientation, this ._orientationOffset); + this .scaleInterpolator ._keyValue = new x_ite_Fields .MFVec3f (relative .scale, this ._scaleOffset); + this .scaleOrientationInterpolator ._keyValue = new x_ite_Fields .MFRotation (relative .scaleOrientation, this ._scaleOrientationOffset); + + this ._positionOffset = relative .position; + this ._orientationOffset = relative .orientation; + this ._scaleOffset = relative .scale; + this ._scaleOrientationOffset = relative .scaleOrientation; + + this .setInterpolators (fromViewpointNode, relative); + } + else + { + const navigationInfoNode = layerNode .getNavigationInfo (); + + navigationInfoNode ._transitionComplete = true; + + const relative = this .getRelativeTransformation (fromViewpointNode); + + this ._positionOffset = relative .position; + this ._orientationOffset = relative .orientation; + this ._scaleOffset = relative .scale; + this ._scaleOrientationOffset = relative .scaleOrientation; + + this .setInterpolators (fromViewpointNode, relative); + } + }, + transitionStop () + { + this .timeSensor ._stopTime = this .getBrowser () .getCurrentTime (); + this .timeSensor ._isActive .removeInterest ("set_active__", this); + }, + resetUserOffsets () + { + this ._positionOffset = Numbers_Vector3 .Zero; + this ._orientationOffset = Numbers_Rotation4 .Identity; + this ._scaleOffset = Numbers_Vector3 .One; + this ._scaleOrientationOffset = Numbers_Rotation4 .Identity; + this ._centerOfRotationOffset = Numbers_Vector3 .Zero; + this ._fieldOfViewScale = 1; + + this .set_nearDistance__ (); + this .set_farDistance__ (); + }, + getRelativeTransformation: (() => + { + const + position = new Numbers_Vector3 (0, 0, 0), + orientation = new Numbers_Rotation4 (), + scale = new Numbers_Vector3 (0, 0, 0), + scaleOrientation = new Numbers_Rotation4 (); + + return function (fromViewpointNode) + { + const differenceMatrix = this .modelMatrix .copy () .multRight (fromViewpointNode .getViewMatrix ()) .inverse (); + + differenceMatrix .get (position, orientation, scale, scaleOrientation); + + position .subtract (this .getPosition ()); + orientation .multLeft (this .getOrientation () .copy () .inverse ()); + + return { + position: position, + orientation: orientation, + scale: scale, + scaleOrientation: scaleOrientation, + }; + }; + })(), + getLookAtRotation: (() => + { + const + x = new Numbers_Vector3 (0, 0, 0), + y = new Numbers_Vector3 (0, 0, 0), + z = new Numbers_Vector3 (0, 0, 0), + m = new Numbers_Matrix3 (), + r = new Numbers_Rotation4 (); + + return function (fromPoint, toPoint) + { + const up = this .getUpVector (true); + + z .assign (fromPoint) .subtract (toPoint) .normalize (); + x .assign (up) .cross (z) .normalize (); + y .assign (z) .cross (x) .normalize (); + + m .set (... x, ... y, ... z); + r .setMatrix (m); + + return r; + }; + })(), + lookAtPoint (layerNode, point, transitionTime = 1, factor = 1, straighten = false) + { + this .getCameraSpaceMatrix () .multVecMatrix (point); + this .getModelMatrix () .copy () .inverse () .multVecMatrix (point); + + const minDistance = layerNode .getNavigationInfo () .getNearValue () * 2; + + this .lookAt (layerNode, point, minDistance, transitionTime = 1, factor = 1, straighten = false); + }, + lookAtBBox (layerNode, bbox, transitionTime = 1, factor, straighten) + { + bbox = bbox .copy () .multRight (this .getModelMatrix () .copy () .inverse ()); + + const minDistance = Math .max (layerNode .getNavigationInfo () .getNearValue () * 2, this .getLookAtDistance (bbox)); + + this .lookAt (layerNode, bbox .center, minDistance, transitionTime, factor, straighten); + }, + lookAt (layerNode, point, distance, transitionTime = 1, factor = 1, straighten = false) + { + const + offset = point .copy () .add (this .getUserOrientation () .multVecRot (new Numbers_Vector3 (0, 0, distance))) .subtract (this .getPosition ()); + + layerNode .getNavigationInfo () ._transitionStart = true; + + this .timeSensor ._cycleInterval = transitionTime; + this .timeSensor ._stopTime = this .getBrowser () .getCurrentTime (); + this .timeSensor ._startTime = this .getBrowser () .getCurrentTime (); + + this .timeSensor ._isActive .addInterest ("set_active__", this, layerNode .getNavigationInfo ()); + + this .easeInEaseOut ._easeInEaseOut = new x_ite_Fields .MFVec2f (new x_ite_Fields .SFVec2f (0, 1), new x_ite_Fields .SFVec2f (1, 0)); + + const + translation = this ._positionOffset .getValue () .copy () .lerp (offset, factor), + direction = this .getPosition () .copy () .add (translation) .subtract (point); + + let rotation = this ._orientationOffset .getValue () .copy () .multRight (new Numbers_Rotation4 (this .getUserOrientation () .multVecRot (new Numbers_Vector3 (0, 0, 1)), direction)); + + if (straighten) + { + rotation = this .getOrientation () .copy () .inverse () .multRight (this .straightenHorizon (this .getOrientation () .copy () .multRight (rotation))); + } + + this .positionInterpolator ._keyValue = new x_ite_Fields .MFVec3f (this ._positionOffset, translation); + this .orientationInterpolator ._keyValue = new x_ite_Fields .MFRotation (this ._orientationOffset, rotation); + this .scaleInterpolator ._keyValue = new x_ite_Fields .MFVec3f (this ._scaleOffset, Numbers_Vector3 .One); + this .scaleOrientationInterpolator ._keyValue = new x_ite_Fields .MFRotation (this ._scaleOrientationOffset, this ._scaleOrientationOffset); + + const relative = this .getRelativeTransformation (this); + + this ._fieldOfViewScale = 1; + this ._centerOfRotationOffset = point .copy () .subtract (this .getCenterOfRotation ()); + this .nearDistance = Math .min (distance / 2, 0.125); + this .farDistance = this .nearDistance * this .getMaxFarValue () / 0.125; + + this .setInterpolators (this, relative); + }, + straightenView (layerNode) + { + layerNode .getNavigationInfo () ._transitionStart = true; + + this .timeSensor ._cycleInterval = 1; + this .timeSensor ._stopTime = this .getBrowser () .getCurrentTime (); + this .timeSensor ._startTime = this .getBrowser () .getCurrentTime (); + + this .timeSensor ._isActive .addInterest ("set_active__", this, layerNode .getNavigationInfo ()); + + this .easeInEaseOut ._easeInEaseOut = new x_ite_Fields .MFVec2f (new x_ite_Fields .SFVec2f (0, 1), new x_ite_Fields .SFVec2f (1, 0)); + + const rotation = this .getOrientation () .copy () .inverse () .multRight (this .straightenHorizon (this .getUserOrientation ())); + + this .positionInterpolator ._keyValue = new x_ite_Fields .MFVec3f (this ._positionOffset, this ._positionOffset); + this .orientationInterpolator ._keyValue = new x_ite_Fields .MFRotation (this ._orientationOffset, rotation); + this .scaleInterpolator ._keyValue = new x_ite_Fields .MFVec3f (this ._scaleOffset, this ._scaleOffset); + this .scaleOrientationInterpolator ._keyValue = new x_ite_Fields .MFRotation (this ._scaleOrientationOffset, this ._scaleOrientationOffset); + + const relative = this .getRelativeTransformation (this); + + this ._fieldOfViewScale = 1; + + this .setInterpolators (this, relative); + }, + straightenHorizon: (() => + { + const + localXAxis = new Numbers_Vector3 (0, 0, 0), + localZAxis = new Numbers_Vector3 (0, 0, 0), + rotation = new Numbers_Rotation4 (); + + return function (orientation, upVector = this .getUpVector (true)) + { + orientation .multVecRot (localXAxis .assign (Numbers_Vector3 .xAxis) .negate ()); + orientation .multVecRot (localZAxis .assign (Numbers_Vector3 .zAxis)); + + const vector = localZAxis .cross (upVector); + + // If viewer looks along the up vector. + if (Math .abs (localZAxis .dot (upVector)) >= 1) + return orientation; + + if (Math .abs (vector .dot (localXAxis)) >= 1) + return orientation; + + rotation .setFromToVec (localXAxis, vector); + + return orientation .multRight (rotation); + }; + })(), + viewAll (bbox) + { + bbox .multRight (this .modelMatrix .copy () .inverse ()); + + const + direction = this .getUserPosition () .copy () .subtract (bbox .center) .normalize (), + distance = this .getLookAtDistance (bbox), + userPosition = bbox .center .copy () .add (direction .multiply (distance)), + userOrientation = this .getLookAtRotation (userPosition, bbox .center); + + this ._positionOffset = userPosition .subtract (this .getPosition ()); + this ._orientationOffset = this .getOrientation () .copy () .inverse () .multRight (userOrientation); + this ._centerOfRotationOffset = bbox .center .copy () .subtract (this .getCenterOfRotation ()); + this ._fieldOfViewScale = 1; + this .nearDistance = Math .min ((distance - bbox .size .magnitude ()) / 2, 0.125); + this .farDistance = this .nearDistance * this .getMaxFarValue () / 0.125; + }, + traverse (type, renderObject) + { + if (type !== Rendering_TraverseType .CAMERA) + return; + + if (this .navigationInfoNode) + this .navigationInfoNode .traverse (type, renderObject); + + this .descriptions .length = 0; + + if (this ._description .getValue ()) + { + if (renderObject .getViewpointGroups () .every (viewpointGroupNode => viewpointGroupNode ._displayed .getValue ())) + { + for (const viewpointGroupNode of renderObject .getViewpointGroups ()) + { + if (viewpointGroupNode ._description .getValue ()) + this .descriptions .push (viewpointGroupNode ._description .getValue ()); + } + + this .descriptions .push (this ._description .getValue ()); + } + } + + renderObject .getLayer () .getViewpoints () .push (this); + + this .modelMatrix .assign (renderObject .getModelViewMatrix () .get ()); + }, + update () + { + this .cameraSpaceMatrix .set (this .getUserPosition (), + this .getUserOrientation (), + this ._scaleOffset .getValue (), + this ._scaleOrientationOffset .getValue ()); + + this .cameraSpaceMatrix .multRight (this .modelMatrix); + + this .viewMatrix .assign (this .cameraSpaceMatrix) .inverse (); + } +}); + +Object .defineProperties (X3DViewpointNode, +{ + typeName: + { + value: "X3DViewpointNode", + enumerable: true, + }, + componentName: + { + value: "Navigation", + enumerable: true, + }, +}); + +const X3DViewpointNode_default_ = X3DViewpointNode; +; + +x_ite_Namespace .add ("X3DViewpointNode", "x_ite/Components/Navigation/X3DViewpointNode", X3DViewpointNode_default_); +/* harmony default export */ const Navigation_X3DViewpointNode = (X3DViewpointNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Navigation/Viewpoint.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + +function Viewpoint (executionContext) +{ + Navigation_X3DViewpointNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Viewpoint); + + this ._position .setUnit ("length"); + this ._centerOfRotation .setUnit ("length"); + this ._fieldOfView .setUnit ("angle"); + + this .projectionMatrix = new Numbers_Matrix4 (); +} + +Object .assign (Object .setPrototypeOf (Viewpoint .prototype, Navigation_X3DViewpointNode .prototype), +{ + getRelativeTransformation (fromViewpointNode) + { + const relative = Navigation_X3DViewpointNode .prototype .getRelativeTransformation .call (this, fromViewpointNode); + + if (fromViewpointNode .constructor === this .constructor) + relative .fieldOfView = fromViewpointNode .getFieldOfView (); + + return relative; + }, + setInterpolators (fromViewpointNode, relative) + { + if (fromViewpointNode .constructor === this .constructor) + { + const scale = relative .fieldOfView / this .getFieldOfView (); + + this .fieldOfViewScaleInterpolator ._keyValue = new x_ite_Fields .MFFloat (scale, this ._fieldOfViewScale .getValue ()); + + this ._fieldOfViewScale = scale; + } + else + { + this .fieldOfViewScaleInterpolator ._keyValue = new x_ite_Fields .MFFloat (this ._fieldOfViewScale .getValue (), this ._fieldOfViewScale .getValue ()); + + this ._fieldOfViewScale = this ._fieldOfViewScale .getValue (); + } + }, + getLogarithmicDepthBuffer () + { + return false; + }, + getFieldOfView () + { + const fov = this ._fieldOfView .getValue () * this ._fieldOfViewScale .getValue (); + + return fov > 0 && fov < Math .PI ? fov : Math .PI / 4; + }, + getScreenScale (point, viewport, screenScale) + { + // Returns the screen scale in meter/pixel for on pixel. + + const + width = viewport [2], + height = viewport [3]; + + let size = Math .abs (point .z) * Math .tan (this .getFieldOfView () / 2) * 2; + + if (width > height) + size /= height; + else + size /= width; + + return screenScale .set (size, size, size); + }, + getViewportSize: (() => + { + const viewportSize = new Numbers_Vector2 (0, 0); + + return function (viewport, nearValue) + { + // Returns viewport size in meters. + + const + width = viewport [2], + height = viewport [3], + size = nearValue * Math .tan (this .getFieldOfView () / 2) * 2, + aspect = width / height; + + if (aspect > 1) + return viewportSize .set (size * aspect, size); + + return viewportSize .set (size, size / aspect); + }; + })(), + getLookAtDistance (bbox) + { + return (bbox .size .magnitude () / 2) / Math .tan (this .getFieldOfView () / 2); + }, + getProjectionMatrixWithLimits (nearValue, farValue, viewport) + { + return Geometry_Camera .perspective (this .getFieldOfView (), nearValue, farValue, viewport [2], viewport [3], this .projectionMatrix); + }, +}); + +Object .defineProperties (Viewpoint, +{ + typeName: + { + value: "Viewpoint", + enumerable: true, + }, + componentName: + { + value: "Navigation", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_bind", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "position", new x_ite_Fields .SFVec3f (0, 0, 10)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "orientation", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "centerOfRotation", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "fieldOfView", new x_ite_Fields .SFFloat (0.785398)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "nearDistance", new x_ite_Fields .SFFloat (-1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "farDistance", new x_ite_Fields .SFFloat (-1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "viewAll", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "jump", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "retainUserOffsets", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isBound", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "bindTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "navigationInfo", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +const Viewpoint_default_ = Viewpoint; +; + +x_ite_Namespace .add ("Viewpoint", "x_ite/Components/Navigation/Viewpoint", Viewpoint_default_); +/* harmony default export */ const Navigation_Viewpoint = (Viewpoint_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Grouping/X3DBoundedObject.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function X3DBoundedObject (executionContext) +{ + this .addType (Base_X3DConstants .X3DBoundedObject); + + this .addChildObjects (Base_X3DConstants .inputOutput, "hidden", new x_ite_Fields .SFBool (), + Base_X3DConstants .outputOnly, "display", new x_ite_Fields .SFBool (true), + Base_X3DConstants .outputOnly, "transformSensors_changed", new x_ite_Fields .SFTime ()); + + this ._bboxSize .setUnit ("length"); + this ._bboxCenter .setUnit ("length"); + + this .childBBox = new Geometry_Box3 (); // Must be unique for each X3DBoundedObject. + this .transformSensorNodes = new Set (); +} + +Object .assign (X3DBoundedObject .prototype, +{ + initialize () + { + this ._hidden .addInterest ("set_visible_and_hidden__", this); + this ._visible .addInterest ("set_visible_and_hidden__", this); + + this .set_visible_and_hidden__ (); + }, + isHidden () + { + return this ._hidden .getValue (); + }, + setHidden (value) + { + if (value === this ._hidden .getValue ()) + return; + + this ._hidden = value; + }, + getDefaultBBoxSize: (() => + { + const defaultBBoxSize = new Numbers_Vector3 (-1, -1, -1); + + return function () + { + return defaultBBoxSize; + }; + })(), + getBBox (nodes, bbox, shadows) + { + // Must be unique for each X3DBoundedObject. + const childBBox = this .childBBox; + + // Add bounding boxes. + + bbox .set (); + + for (const node of nodes) + { + if (node .getBBox) + bbox .add (node .getBBox (childBBox, shadows)); + } + + return bbox; + }, + displayBBox: (() => + { + const + bbox = new Geometry_Box3 (), + matrix = new Numbers_Matrix4 (); + + return function (type, renderObject) + { + const modelViewMatrix = renderObject .getModelViewMatrix (); + + this .getBBox (bbox); + matrix .set (bbox .center, null, bbox .size); + + modelViewMatrix .push (); + modelViewMatrix .multLeft (matrix); + + this .getBrowser () .getBBoxNode () .traverse (type, renderObject); + + modelViewMatrix .pop (); + }; + })(), + addTransformSensor (transformSensorNode) + { + this .transformSensorNodes .add (transformSensorNode); + + this ._transformSensors_changed = this .getBrowser () .getCurrentTime (); + }, + removeTransformSensor (transformSensorNode) + { + this .transformSensorNodes .delete (transformSensorNode); + + this ._transformSensors_changed = this .getBrowser () .getCurrentTime (); + }, + getTransformSensors () + { + return this .transformSensorNodes; + }, + set_visible_and_hidden__ () + { + const value = this ._visible .getValue () && !this ._hidden .getValue (); + + if (value === this ._display .getValue ()) + return; + + this ._display = value; + }, + dispose () { }, +}); + +Object .defineProperties (X3DBoundedObject, +{ + typeName: + { + value: "X3DBoundedObject", + enumerable: true, + }, + componentName: + { + value: "Grouping", + enumerable: true, + }, +}); + +const X3DBoundedObject_default_ = X3DBoundedObject; +; + +x_ite_Namespace .add ("X3DBoundedObject", "x_ite/Components/Grouping/X3DBoundedObject", X3DBoundedObject_default_); +/* harmony default export */ const Grouping_X3DBoundedObject = (X3DBoundedObject_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Grouping/X3DGroupingNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function X3DGroupingNode (executionContext) +{ + Core_X3DChildNode .call (this, executionContext); + Grouping_X3DBoundedObject .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DGroupingNode); + + this .allowedTypes = new Set (); + this .clipPlaneNodes = [ ]; + this .localFogNodes = [ ]; + this .lightNodes = [ ]; + this .textureProjectorNodes = [ ]; + this .pointingDeviceSensorNodes = [ ]; + this .maybeCameraObjects = [ ]; + this .cameraObjects = [ ]; + this .maybePickableSensorNodes = [ ]; + this .pickableSensorNodes = [ ]; + this .pickableObjects = [ ]; + this .childNodes = [ ]; + this .displayNodes = [ ]; + this .visibleNodes = [ ]; + this .boundedObjects = [ ]; + this .sensors = [ ]; +} + +Object .assign (Object .setPrototypeOf (X3DGroupingNode .prototype, Core_X3DChildNode .prototype), + Grouping_X3DBoundedObject .prototype, +{ + initialize () + { + Core_X3DChildNode .prototype .initialize .call (this); + Grouping_X3DBoundedObject .prototype .initialize .call (this); + + this ._transformSensors_changed .addInterest ("set_transformSensors__", this); + + this ._addChildren .addInterest ("set_addChildren__", this); + this ._removeChildren .addInterest ("set_removeChildren__", this); + this ._children .addInterest ("set_children__", this); + + this .set_children__ (); + }, + getBBox (bbox, shadows) + { + return this .getSubBBox (bbox, shadows); + }, + getSubBBox (bbox, shadows) + { + if (this ._bboxSize .getValue () .equals (this .getDefaultBBoxSize ())) + return Grouping_X3DBoundedObject .prototype .getBBox .call (this, this .visibleNodes, bbox, shadows); + + return bbox .set (this ._bboxSize .getValue (), this ._bboxCenter .getValue ()); + }, + setAllowedTypes (/* type, ... */) + { + const allowedTypes = this .allowedTypes; + + allowedTypes .clear (); + + for (const type of arguments) + allowedTypes .add (type); + }, + set_addChildren__ () + { + if (this ._addChildren .length === 0) + return; + + this ._addChildren .setTainted (true); + this ._addChildren .assign (filter (this ._addChildren, this ._children)); + + if (!this ._children .isTainted ()) + { + this ._children .removeInterest ("set_children__", this); + this ._children .addInterest ("connectChildren", this); + } + + this ._children .splice (this ._children .length, 0, ... this ._addChildren); + this .add (this ._addChildren); + + this ._addChildren .length = 0; + this ._addChildren .setTainted (false); + }, + set_removeChildren__ () + { + if (this ._removeChildren .length === 0) + return; + + this ._removeChildren .setTainted (true); + + if (this ._children .length > 0) + { + if (!this ._children .isTainted ()) + { + this ._children .removeInterest ("set_children__", this); + this ._children .addInterest ("connectChildren", this); + } + + this ._children .assign (filter (this ._children, this ._removeChildren)); + this .remove (this ._removeChildren); + } + + this ._removeChildren .length = 0; + this ._removeChildren .setTainted (false); + }, + set_children__ () + { + this .clear (); + this .add (this ._children); + }, + connectChildren () + { + this ._children .removeInterest ("connectChildren", this); + this ._children .addInterest ("set_children__", this); + }, + clear () + { + for (const maybePickableSensorNode of this .maybePickableSensorNodes) + maybePickableSensorNode ._isPickableObject .removeInterest ("set_pickableObjects__", this); + + for (const childNode of this .childNodes) + { + childNode ._isCameraObject .removeInterest ("set_cameraObjects__", this); + childNode ._isPickableObject .removeInterest ("set_pickableObjects__", this); + + if (Base_X3DCast (Base_X3DConstants .X3DBoundedObject, childNode)) + { + childNode ._display .removeInterest ("set_displays_", this); + childNode ._bboxDisplay .removeInterest ("set_bboxDisplays__", this); + } + } + + this .clipPlaneNodes .length = 0; + this .localFogNodes .length = 0; + this .lightNodes .length = 0; + this .textureProjectorNodes .length = 0; + this .pointingDeviceSensorNodes .length = 0; + this .maybeCameraObjects .length = 0; + this .maybePickableSensorNodes .length = 0; + this .childNodes .length = 0; + }, + add (children) + { + for (const child of children) + { + const childNode = Base_X3DCast (Base_X3DConstants .X3DChildNode, child); + + if (!childNode) + continue; + + const type = childNode .getType (); + + for (let t = type .length - 1; t >= 0; -- t) + { + // if (this .allowedTypes .size) + // { + // if (!childNode .getType () .some (Set .prototype .has, this .allowedTypes)) + // continue; + // } + + switch (type [t]) + { + case Base_X3DConstants .X3DPointingDeviceSensorNode: + { + this .pointingDeviceSensorNodes .push (childNode); + break; + } + case Base_X3DConstants .ClipPlane: + { + this .clipPlaneNodes .push (childNode); + break; + } + case Base_X3DConstants .LocalFog: + { + this .localFogNodes .push (childNode); + break; + } + case Base_X3DConstants .X3DTextureProjectorNode: + { + this .textureProjectorNodes .push (childNode); + break; + } + case Base_X3DConstants .X3DLightNode: + { + this .lightNodes .push (childNode); + break; + } + case Base_X3DConstants .X3DBindableNode: + { + this .maybeCameraObjects .push (childNode); + break; + } + case Base_X3DConstants .TransformSensor: + case Base_X3DConstants .X3DPickSensorNode: + { + childNode ._isPickableObject .addInterest ("set_pickableObjects__", this); + + this .maybePickableSensorNodes .push (childNode); + break; + } + case Base_X3DConstants .Sound: + case Base_X3DConstants .SpatialSound: + case Base_X3DConstants .X3DBackgroundNode: + case Base_X3DConstants .X3DChildNode: + { + childNode ._isCameraObject .addInterest ("set_cameraObjects__", this); + childNode ._isPickableObject .addInterest ("set_pickableObjects__", this); + + if (Base_X3DCast (Base_X3DConstants .X3DBoundedObject, childNode)) + { + childNode ._display .addInterest ("set_displays_", this); + childNode ._bboxDisplay .addInterest ("set_bboxDisplays__", this); + } + + this .maybeCameraObjects .push (childNode); + this .childNodes .push (childNode); + break; + } + case Base_X3DConstants .BooleanFilter: + case Base_X3DConstants .BooleanToggle: + case Base_X3DConstants .HAnimMotion: + case Base_X3DConstants .NurbsOrientationInterpolator: + case Base_X3DConstants .NurbsPositionInterpolator: + case Base_X3DConstants .NurbsSurfaceInterpolator: + case Base_X3DConstants .TimeSensor: + case Base_X3DConstants .X3DFollowerNode: + case Base_X3DConstants .X3DInfoNode: + case Base_X3DConstants .X3DInterpolatorNode: + case Base_X3DConstants .X3DKeyDeviceSensorNode: + case Base_X3DConstants .X3DLayoutNode: + case Base_X3DConstants .X3DScriptNode: + case Base_X3DConstants .X3DSequencerNode: + case Base_X3DConstants .X3DSoundNode: + case Base_X3DConstants .X3DTriggerNode: + break; + default: + continue; + } + + break; + } + + if (childNode .getMustDisplay ()) + { + if (!this .childNodes .includes (childNode)) + this .childNodes .push (childNode); + } + } + + this .set_pickableObjects__ () + this .set_displayNodes__ () + this .set_displays_ () + this .set_bboxDisplays__ (); + }, + remove (children) + { + for (const child of children) + { + const childNode = Base_X3DCast (Base_X3DConstants .X3DChildNode, child); + + if (!childNode) + continue; + + if (childNode .getMustDisplay ()) + { + const index = this .childNodes .indexOf (childNode); + + if (index >= 0) + this .childNodes .splice (index, 1); + } + + const type = childNode .getType (); + + for (let t = type .length - 1; t >= 0; -- t) + { + switch (type [t]) + { + case Base_X3DConstants .X3DPointingDeviceSensorNode: + { + const index = this .pointingDeviceSensorNodes .indexOf (childNode); + + if (index >= 0) + this .pointingDeviceSensorNodes .splice (index, 1); + + break; + } + case Base_X3DConstants .ClipPlane: + { + const index = this .clipPlaneNodes .indexOf (childNode); + + if (index >= 0) + this .clipPlaneNodes .splice (index, 1); + + break; + } + case Base_X3DConstants .LocalFog: + { + const index = this .localFogNodes .indexOf (childNode); + + if (index >= 0) + this .localFogNodes .splice (index, 1); + + break; + } + case Base_X3DConstants .X3DTextureProjectorNode: + { + const index = this .textureProjectorNodes .indexOf (childNode); + + if (index >= 0) + this .textureProjectorNodes .splice (index, 1); + + break; + } + case Base_X3DConstants .X3DLightNode: + { + const index = this .lightNodes .indexOf (childNode); + + if (index >= 0) + this .lightNodes .splice (index, 1); + + break; + } + case Base_X3DConstants .X3DBindableNode: + { + const index = this .maybeCameraObjects .indexOf (childNode); + + if (index >= 0) + this .maybeCameraObjects .splice (index, 1); + + break; + } + case Base_X3DConstants .TransformSensor: + case Base_X3DConstants .X3DPickSensorNode: + { + childNode ._isPickableObject .removeInterest ("set_pickableObjects__", this); + + const index = this .maybePickableSensorNodes .indexOf (childNode); + + if (index >= 0) + this .maybePickableSensorNodes .splice (index, 1); + + break; + } + case Base_X3DConstants .Sound: + case Base_X3DConstants .SpatialSound: + case Base_X3DConstants .X3DBackgroundNode: + case Base_X3DConstants .X3DChildNode: + { + childNode ._isCameraObject .removeInterest ("set_cameraObjects__", this); + childNode ._isPickableObject .removeInterest ("set_pickableObjects__", this); + + if (Base_X3DCast (Base_X3DConstants .X3DBoundedObject, childNode)) + { + childNode ._display .removeInterest ("set_displays_", this); + childNode ._bboxDisplay .removeInterest ("set_bboxDisplays__", this); + } + + var index = this .maybeCameraObjects .indexOf (childNode); + + if (index >= 0) + this .maybeCameraObjects .splice (index, 1); + + var index = this .childNodes .indexOf (childNode); + + if (index >= 0) + this .childNodes .splice (index, 1); + + break; + } + case Base_X3DConstants .BooleanFilter: + case Base_X3DConstants .BooleanToggle: + case Base_X3DConstants .HAnimMotion: + case Base_X3DConstants .NurbsOrientationInterpolator: + case Base_X3DConstants .NurbsPositionInterpolator: + case Base_X3DConstants .NurbsSurfaceInterpolator: + case Base_X3DConstants .TimeSensor: + case Base_X3DConstants .X3DFollowerNode: + case Base_X3DConstants .X3DInfoNode: + case Base_X3DConstants .X3DInterpolatorNode: + case Base_X3DConstants .X3DKeyDeviceSensorNode: + case Base_X3DConstants .X3DLayoutNode: + case Base_X3DConstants .X3DScriptNode: + case Base_X3DConstants .X3DSequencerNode: + case Base_X3DConstants .X3DSoundNode: + case Base_X3DConstants .X3DTriggerNode: + break; + default: + continue; + } + + break; + } + } + + this .set_displayNodes__ (); + this .set_displays_ (); + this .set_bboxDisplays__ (); + }, + set_cameraObjects__ () + { + const cameraObjects = this .cameraObjects; + + cameraObjects .length = 0; + + for (const childNode of this .maybeCameraObjects) + { + if (!childNode .isCameraObject ()) + continue; + + if (Base_X3DCast (Base_X3DConstants .X3DBoundedObject, childNode)) + { + if (childNode ._display .getValue ()) + cameraObjects .push (childNode); + } + else + { + cameraObjects .push (childNode); + } + } + + this .setCameraObject (!!(cameraObjects .length)); + }, + set_pickableObjects__ () + { + const + pickableSensorNodes = this .pickableSensorNodes, + pickableObjects = this .pickableObjects; + + pickableSensorNodes .length = 0; + pickableObjects .length = 0; + + for (const sensorNode of this .maybePickableSensorNodes) + { + if (sensorNode .isPickableObject ()) + pickableSensorNodes .push (sensorNode); + } + + for (const childNode of this .visibleNodes) + { + if (childNode .isPickableObject ()) + pickableObjects .push (childNode); + } + + this .set_transformSensors__ () + }, + set_transformSensors__ () + { + this .setPickableObject (!!(this .getTransformSensors () .size || this .pickableSensorNodes .length || this .pickableObjects .length)); + }, + set_displayNodes__ () + { + const displayNodes = this .displayNodes; + + displayNodes .length = 0; + + for (const node of this .clipPlaneNodes) + displayNodes .push (node); + + for (const node of this .localFogNodes) + displayNodes .push (node); + + for (const node of this .lightNodes) + displayNodes .push (node); + + for (const node of this .textureProjectorNodes) + displayNodes .push (node); + }, + set_displays_ () + { + const visibleNodes = this .visibleNodes; + + visibleNodes .length = 0; + + for (const childNode of this .childNodes) + { + if (Base_X3DCast (Base_X3DConstants .X3DBoundedObject, childNode)) + { + if (childNode ._display .getValue ()) + visibleNodes .push (childNode); + } + else + { + visibleNodes .push (childNode); + } + } + + this .set_cameraObjects__ (); + this .set_pickableObjects__ (); + }, + set_bboxDisplays__ () + { + const boundedObjects = this .boundedObjects; + + boundedObjects .length = 0; + + for (const childNode of this .childNodes) + { + if (Base_X3DCast (Base_X3DConstants .X3DBoundedObject, childNode)) + { + if (childNode ._bboxDisplay .getValue ()) + { + boundedObjects .push (childNode); + } + } + } + }, + traverse (type, renderObject) + { + switch (type) + { + case Rendering_TraverseType .POINTER: + { + const + pointingDeviceSensorNodes = this .pointingDeviceSensorNodes, + clipPlaneNodes = this .clipPlaneNodes, + sensors = this .sensors; + + sensors .length = 0; + + if (pointingDeviceSensorNodes .length) + { + for (const pointingDeviceSensorNode of pointingDeviceSensorNodes) + pointingDeviceSensorNode .push (renderObject, sensors); + + if (sensors .length) + renderObject .getSensors () .push (sensors); + } + + for (const clipPlaneNode of clipPlaneNodes) + clipPlaneNode .push (renderObject); + + for (const visibleNode of this .visibleNodes) + visibleNode .traverse (type, renderObject); + + for (const clipPlaneNode of clipPlaneNodes) + clipPlaneNode .pop (renderObject); + + if (sensors .length) + renderObject .getSensors () .pop (); + + return; + } + case Rendering_TraverseType .CAMERA: + { + for (const cameraObject of this .cameraObjects) + cameraObject .traverse (type, renderObject); + + return; + } + case Rendering_TraverseType .PICKING: + { + if (this .getTransformSensors () .size) + { + const modelMatrix = renderObject .getModelViewMatrix () .get (); + + for (const transformSensorNode of this .getTransformSensors ()) + transformSensorNode .collect (modelMatrix); + } + + for (const pickableSensorNode of this .pickableSensorNodes) + pickableSensorNode .traverse (type, renderObject); + + const + browser = this .getBrowser (), + pickingHierarchy = browser .getPickingHierarchy (); + + pickingHierarchy .push (this); + + if (browser .getPickable () .at (-1)) + { + for (const visibleNode of this .visibleNodes) + visibleNode .traverse (type, renderObject); + } + else + { + for (const pickableObject of this .pickableObjects) + pickableObject .traverse (type, renderObject); + } + + pickingHierarchy .pop (); + return; + } + case Rendering_TraverseType .COLLISION: + { + const clipPlaneNodes = this .clipPlaneNodes; + + for (const clipPlaneNode of clipPlaneNodes) + clipPlaneNode .push (renderObject); + + for (const visibleNode of this .visibleNodes) + visibleNode .traverse (type, renderObject); + + for (const clipPlaneNode of clipPlaneNodes) + clipPlaneNode .pop (renderObject); + + return; + } + case Rendering_TraverseType .SHADOW: + { + // Nodes that are not visible do not cast shadows. + + const clipPlaneNodes = this .clipPlaneNodes; + + for (const clipPlaneNode of clipPlaneNodes) + clipPlaneNode .push (renderObject); + + for (const visibleNode of this .visibleNodes) + visibleNode .traverse (type, renderObject); + + for (const clipPlaneNode of clipPlaneNodes) + clipPlaneNode .push (renderObject); + + return; + } + case Rendering_TraverseType .DISPLAY: + { + const displayNodes = this .displayNodes; + + for (const displayNode of displayNodes) + displayNode .push (renderObject, this); + + for (const visibleNode of this .visibleNodes) + visibleNode .traverse (type, renderObject); + + for (const boundedObject of this .boundedObjects) + boundedObject .displayBBox (type, renderObject); + + for (const displayNode of displayNodes) + displayNode .pop (renderObject); + + return; + } + } + }, + dispose () + { + Grouping_X3DBoundedObject .prototype .dispose .call (this); + Core_X3DChildNode .prototype .dispose .call (this); + }, +}); + +function filter (array, remove) +{ + const set = new Set (remove); + + return array .filter (value => !set .has (value)); +} + +Object .defineProperties (X3DGroupingNode, +{ + typeName: + { + value: "X3DGroupingNode", + enumerable: true, + }, + componentName: + { + value: "Grouping", + enumerable: true, + }, +}); + +const X3DGroupingNode_default_ = X3DGroupingNode; +; + +x_ite_Namespace .add ("X3DGroupingNode", "x_ite/Components/Grouping/X3DGroupingNode", X3DGroupingNode_default_); +/* harmony default export */ const Grouping_X3DGroupingNode = (X3DGroupingNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Grouping/Group.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function Group (executionContext) +{ + Grouping_X3DGroupingNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Group); +} + +Object .setPrototypeOf (Group .prototype, Grouping_X3DGroupingNode .prototype); + +Object .defineProperties (Group, +{ + typeName: + { + value: "Group", + enumerable: true, + }, + componentName: + { + value: "Grouping", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "visible", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "bboxDisplay", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxSize", new x_ite_Fields .SFVec3f (-1, -1, -1)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxCenter", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "addChildren", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "removeChildren", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const Group_default_ = Group; +; + +x_ite_Namespace .add ("Group", "x_ite/Components/Grouping/Group", Group_default_); +/* harmony default export */ const Grouping_Group = (Group_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Layering/Layer.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +function Layer (executionContext) +{ + Layering_X3DLayerNode .call (this, + executionContext, + new Navigation_Viewpoint (executionContext), + new Grouping_Group (executionContext)); + + this .addType (Base_X3DConstants .Layer); +} + +Object .assign (Object .setPrototypeOf (Layer .prototype, Layering_X3DLayerNode .prototype), +{ + initialize () + { + Layering_X3DLayerNode .prototype .initialize .call (this); + + this ._addChildren .addFieldInterest (this .getGroup () ._addChildren); + this ._removeChildren .addFieldInterest (this .getGroup () ._removeChildren); + this ._children .addFieldInterest (this .getGroup () ._children); + + this .getGroup () ._children = this ._children; + this .getGroup () .setPrivate (true); + this .getGroup () .setup (); + }, +}); + +Object .defineProperties (Layer, +{ + typeName: + { + value: "Layer", + enumerable: true, + }, + componentName: + { + value: "Layering", + enumerable: true, + }, + containerField: + { + value: "layers", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pickable", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "objectType", new x_ite_Fields .MFString ("ALL")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "visible", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "viewport", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "addChildren", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "removeChildren", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const Layer_default_ = Layer; +; + +x_ite_Namespace .add ("Layer", "x_ite/Components/Layering/Layer", Layer_default_); +/* harmony default export */ const Layering_Layer = (Layer_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Layering/LayerSet.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + +function LayerSet (executionContext) +{ + Core_X3DNode .call (this, executionContext); + + this .addType (Base_X3DConstants .LayerSet); + + this .layerNodes = [ new Layering_Layer (executionContext) ]; + this .layerNode0 = this .layerNodes [0]; + this .activeLayerNode = null; +} + +Object .assign (Object .setPrototypeOf (LayerSet .prototype, Core_X3DNode .prototype), +{ + initialize () + { + Core_X3DNode .prototype .initialize .call (this); + + this .layerNode0 .setPrivate (true); + this .layerNode0 .setup (); + this .layerNode0 .setLayer0 (true); + + this ._activeLayer .addInterest ("set_activeLayer__", this); + this ._order .addInterest ("set_layers__", this); + this ._layers .addInterest ("set_layers__", this); + + this .set_layers__ (); + }, + getActiveLayer () + { + return this .activeLayerNode; + }, + setLayer0 (value) + { + this .layerNode0 = value; + + this .set_layers__ (); + }, + getLayer0 () + { + return this .layerNode0; + }, + getLayers () + { + return this .layerNodes; + }, + set_activeLayer__ () + { + if (this ._activeLayer .getValue () === 0) + { + if (this .activeLayerNode !== this .layerNode0) + this .activeLayerNode = this .layerNode0; + } + else + { + const index = this ._activeLayer - 1; + + if (index >= 0 && index < this ._layers .length) + { + if (this .activeLayerNode !== this ._layers [index] .getValue ()) + this .activeLayerNode = Base_X3DCast (Base_X3DConstants .X3DLayerNode, this ._layers [index]); + } + else + { + if (this .activeLayerNode !== null) + this .activeLayerNode = null; + } + } + }, + set_layers__ () + { + const layers = this ._layers .getValue (); + + this .layerNodes .length = 0; + + for (let index of this ._order) + { + if (index === 0) + { + this .layerNodes .push (this .layerNode0); + } + else + { + -- index; + + if (index >= 0 && index < layers .length) + { + const layerNode = Base_X3DCast (Base_X3DConstants .X3DLayerNode, layers [index]); + + if (layerNode) + this .layerNodes .push (layerNode); + } + } + } + + this .set_activeLayer__ (); + }, + bindBindables (viewpointName) + { + const layers = this ._layers .getValue (); + + this .layerNode0 .bindBindables (viewpointName); + + for (let i = 0, length = layers .length; i < length; ++ i) + { + const layerNode = Base_X3DCast (Base_X3DConstants .X3DLayerNode, layers [i]); + + if (layerNode) + layerNode .bindBindables (viewpointName); + } + }, + traverse (type, renderObject) + { + for (const layerNode of this .layerNodes) + layerNode .traverse (type, renderObject); + }, +}); + +Object .defineProperties (LayerSet, +{ + typeName: + { + value: "LayerSet", + enumerable: true, + }, + componentName: + { + value: "Layering", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "activeLayer", new x_ite_Fields .SFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "order", new x_ite_Fields .MFInt32 (0)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "layers", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const LayerSet_default_ = LayerSet; +; + +x_ite_Namespace .add ("LayerSet", "x_ite/Components/Layering/LayerSet", LayerSet_default_); +/* harmony default export */ const Layering_LayerSet = (LayerSet_default_); +;// CONCATENATED MODULE: ./src/x_ite/Execution/X3DWorld.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function X3DWorld (executionContext) +{ + Base_X3DBaseNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DWorld) + + this .addChildObjects (Base_X3DConstants .outputOnly, "activeLayer", new Fields_SFNode (this .layer0)); + + this .defaultLayerSet = new Layering_LayerSet (executionContext); + this .layerSet = this .defaultLayerSet; + this .layer0 = new Layering_Layer (executionContext); +} + +Object .assign (Object .setPrototypeOf (X3DWorld .prototype, Base_X3DBaseNode .prototype), +{ + initialize () + { + Base_X3DBaseNode .prototype .initialize .call (this); + + this .layerSet .setPrivate (true); + this .layerSet .setup (); + this .layerSet .setLayer0 (this .layer0); + this .layerSet ._activeLayer .addInterest ("set_rootNodes__", this); + + this .getExecutionContext () .getRootNodes () .addInterest ("set_rootNodes__", this); + + this .set_rootNodes__ (); + + this .layer0 .setPrivate (true); + this .layer0 .setLayer0 (true); + this .layer0 .setup (); + + this .set_activeLayer__ (); + }, + getCache () + { + return this .getBrowser () .getBrowserOption ("Cache"); + }, + getLayerSet () + { + return this .layerSet; + }, + getActiveLayer () + { + return this ._activeLayer .getValue (); + }, + set_rootNodes__ () + { + const + oldLayerSet = this .layerSet, + rootNodes = this .getExecutionContext () .getRootNodes (); + + this .layerSet = this .defaultLayerSet; + this .layer0 ._children = rootNodes; + + for (const rootNode of rootNodes) + { + const layerSet = Base_X3DCast (Base_X3DConstants .LayerSet, rootNode); + + if (layerSet) + this .layerSet = layerSet; + } + + if (this .layerSet === oldLayerSet) + return; + + this .layerSet .setLayer0 (this .layer0); + + oldLayerSet ._activeLayer .removeInterest ("set_activeLayer__", this); + this .layerSet ._activeLayer .addInterest ("set_activeLayer__", this); + + this .set_activeLayer__ (); + }, + set_activeLayer__ () + { + this ._activeLayer = this .layerSet .getActiveLayer (); + }, + bindBindables () + { + // Bind first X3DBindableNodes found in each layer. + + const worldURL = this .getExecutionContext () .getWorldURL (); + + this .layerSet .bindBindables (decodeURIComponent (new URL (worldURL) .hash .substring (1))); + }, + traverse (type, renderObject) + { + this .layerSet .traverse (type, renderObject); + }, +}); + +for (const key of Object .keys (X3DWorld .prototype)) + Object .defineProperty (X3DWorld .prototype, key, { enumerable: false }); + +Object .defineProperties (X3DWorld, +{ + typeName: + { + value: "X3DWorld", + enumerable: true, + }, +}); + +Base_X3DConstants .addNode (X3DWorld); + +const X3DWorld_default_ = X3DWorld; +; + +x_ite_Namespace .add ("X3DWorld", "x_ite/Execution/X3DWorld", X3DWorld_default_); +/* harmony default export */ const Execution_X3DWorld = (X3DWorld_default_); +;// CONCATENATED MODULE: ./src/x_ite/InputOutput/FileLoader.js +/* provided dependency */ var FileLoader_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +const foreignContentTypes = new Set ([ + "text/html", + "application/xhtml+xml", +]) + +function FileLoader (node) +{ + Base_X3DObject .call (this); + + this .node = node; + this .browser = node .getBrowser (); + this .external = this .browser .isExternal (); + this .executionContext = this .external ? node .getExecutionContext () : this .browser .currentScene; + this .target = ""; + this .url = [ ]; + this .URL = new URL (this .getBaseURL ()); + this .controller = new AbortController (); +} + +Object .assign (Object .setPrototypeOf (FileLoader .prototype, Base_X3DObject .prototype), +{ + abort () + { + this .url .length = 0; + + this .controller .abort (); + }, + getURL () + { + return this .URL; + }, + getBaseURL () + { + if (this .node instanceof Execution_X3DWorld) + { + if (this .external) + return this .browser .getBaseURL (); + } + + return this .executionContext .getBaseURL (); + }, + getTarget (parameters) + { + for (const parameter of parameters) + { + const pair = parameter .split ("="); + + if (pair .length !== 2) + continue; + + if (pair [0] === "target") + return pair [1]; + } + + return ""; + }, + createX3DFromString (worldURL, string = "", resolve, reject) + { + try + { + const scene = this .browser .createScene (); + + if (this .node instanceof Execution_X3DWorld) + scene .loader = this; + else + scene .setExecutionContext (this .executionContext); + + scene .setWorldURL (new URL (worldURL, this .getBaseURL ()) .href); + + if (resolve) + resolve = this .setScene .bind (this, scene, resolve, reject); + + new Parser_GoldenGate (scene) .parseIntoScene (string, resolve, reject); + + return scene; + } + catch (error) + { + if (reject) + reject (error); + else + throw error; + } + }, + setScene (scene, resolve, reject) + { + scene ._initLoadCount .addInterest ("set_initLoadCount__", this, scene, resolve, reject); + scene ._initLoadCount .addEvent (); + }, + set_initLoadCount__ (scene, resolve, reject, field) + { + // Wait for extern protos to be loaded. + + if (field .getValue ()) + return; + + scene ._initLoadCount .removeInterest ("set_initLoadCount__", this); + + delete scene .loader; + + // Wait for instances to be created. + + setTimeout (() => + { + try + { + resolve (scene); + } + catch (error) + { + if (reject) + reject (error); + else + throw error; + } + }); + + if (DEVELOPMENT) + { + if (this .URL .protocol !== "data:") + console .info (`Done loading scene '${decodeURI (this .URL .href)}'`); + } + }, + createX3DFromURL (url, parameter, callback, bindViewpoint, foreign) + { + this .bindViewpoint = bindViewpoint; + this .foreign = foreign; + this .target = this .getTarget (parameter || new x_ite_Fields .MFString ()); + + return this .loadDocument (url, this .createX3DFromURLAsync .bind (this, callback)); + }, + createX3DFromURLAsync (callback, data) + { + if (data === null) + callback (null); + else + this .createX3DFromString (this .URL, data, callback, this .loadDocumentError .bind (this)); + }, + loadDocument (url, callback) + { + this .url = url .copy (); + this .callback = callback; + + if (url .length === 0) + return this .loadDocumentError (new Error ("No URL given.")); + + this .loadDocumentAsync (this .url .shift ()) + .catch (this .loadDocumentError .bind (this)); + }, + loadDocumentAsync: async function (url) + { + if (url .length === 0) + { + this .loadDocumentError (new Error ("URL is empty.")); + return; + } + + // Script + { + const result = url .match (/^\s*(?:vrmlscript|javascript|ecmascript)\:(.*)$/s); + + if (result) + { + this .callback (result [1]); + return; + } + } + + this .URL = new URL (url, this .getBaseURL ()); + + // Data URL + { + const result = url .match (/^data:(.*?)(?:;charset=(.*?))?(?:;(base64))?,/s); + + if (result && result [3] !== "base64") + { + // const mimeType = result [1]; + + let data = url .substring (result [0] .length); + + data = unescape (data); // Unescape data, don't use decodeURIComponent! + data = data .replace (/^/, ""); // Remove BOM. + + this .callback (data); + return; + } + } + + if (this .URL .protocol !== "data:" && this .bindViewpoint) + { + const referer = new URL (this .getBaseURL ()); + + if (this .URL .protocol === referer .protocol && + this .URL .hostname === referer .hostname && + this .URL .port === referer .port && + this .URL .pathname === referer .pathname && + this .URL .hash) + { + this .bindViewpoint (decodeURIComponent (this .URL .hash .substr (1))); + return; + } + } + + if (this .foreign) + { + // Handle target + + if (this .target .length && this .target !== "_self") + return this .foreign (this .URL .href, this .target); + + // Handle well known foreign content depending on extension or if path looks like directory. + + if (this .URL .protocol !== "data:" && this .URL .href .match (/\.(?:html|htm|xhtml)$/)) + return this .foreign (this .URL .href, this .target); + } + + // Load URL async + + const + options = { cache: this .node .getCache () ? "default" : "reload", signal: this .controller .signal }, + response = this .checkResponse (await fetch (this .URL, options)), + contentType = response .headers .get ("content-type") ?.replace (/;.*$/, ""); + + if (this .foreign) + { + // console .log (contentType); + + if (foreignContentTypes .has (contentType)) + return this .foreign (this .URL .href, this .target); + } + + this .callback (FileLoader_$.ungzip (await response .arrayBuffer ()), this .URL); + }, + checkResponse (response) + { + if (response .ok) + return response; + + throw Error (response .statusText || response .status); + }, + loadDocumentError (error) + { + // Output error. + + this .printError (error); + + // Try to load next URL. + + if (this .url .length) + { + this .loadDocumentAsync (this .url .shift ()) + .catch (this .loadDocumentError .bind (this)); + } + else + { + this .callback (null); + } + }, + printError (error) + { + if (this .URL .protocol === "data:") + console .error (`Couldn't load data URL.`, error); + else + console .error (`Couldn't load URL '${decodeURI (this .URL .href)}'.`, error); + }, +}); + +for (const key of Object .keys (FileLoader .prototype)) + Object .defineProperty (FileLoader .prototype, key, { enumerable: false }); + +const FileLoader_default_ = FileLoader; +; + +x_ite_Namespace .add ("FileLoader", "x_ite/InputOutput/FileLoader", FileLoader_default_); +/* harmony default export */ const InputOutput_FileLoader = (FileLoader_default_); +;// CONCATENATED MODULE: ./src/x_ite/Prototype/X3DExternProtoDeclaration.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +const + _proto = Symbol (), + _scene = Symbol (); + +function X3DExternProtoDeclaration (executionContext, url) +{ + Prototype_X3DProtoDeclarationNode .call (this, executionContext); + Networking_X3DUrlObject .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DExternProtoDeclaration) + + this .addChildObjects (Base_X3DConstants .inputOutput, "load", new x_ite_Fields .SFBool (true), + Base_X3DConstants .inputOutput, "url", url .copy (), // Must be of type MFString. + Base_X3DConstants .inputOutput, "autoRefresh", new x_ite_Fields .SFTime (), + Base_X3DConstants .inputOutput, "autoRefreshTimeLimit", new x_ite_Fields .SFTime (3600)); +} + +Object .assign (Object .setPrototypeOf (X3DExternProtoDeclaration .prototype, Prototype_X3DProtoDeclarationNode .prototype), + Networking_X3DUrlObject .prototype, +{ + initialize () + { + Prototype_X3DProtoDeclarationNode .prototype .initialize .call (this); + Networking_X3DUrlObject .prototype .initialize .call (this); + }, + set_live__ () + { + Networking_X3DUrlObject .prototype .set_live__ .call (this); + + if (this .checkLoadState () !== Base_X3DConstants .COMPLETE_STATE) + return; + + this [_scene] .setLive (this .getLive () .getValue ()); + }, + canUserDefinedFields () + { + return true; + }, + setProtoDeclaration (proto) + { + this [_proto] = proto; + + if (proto) + { + for (const field of [... this .getUserDefinedFields ()]) + this .removeUserDefinedField (field .getName ()) + + for (const field of proto .getUserDefinedFields ()) + this .addUserDefinedField (field .getAccessType (), field .getName (), field); + } + + this .updateInstances (); + }, + getProtoDeclaration () + { + return this [_proto]; + }, + loadData () + { + // 7.73 — ExternProtoDeclaration function + + this .getScene () .addInitLoadCount (this); + + new InputOutput_FileLoader (this) .createX3DFromURL (this ._url, null, this .setInternalSceneAsync .bind (this)); + }, + setInternalSceneAsync (value) + { + if (value) + this .setInternalScene (value); + + else + this .setError (new Error ("File could not be loaded.")); + + this .getScene () .removeInitLoadCount (this); + }, + setInternalScene (value) + { + this [_scene] = value; + + const + protoName = decodeURIComponent (new URL (this [_scene] .getWorldURL ()) .hash .substring (1)), + proto = protoName ? this [_scene] .protos .get (protoName) : this [_scene] .protos [0]; + + if (!proto) + throw new Error ("PROTO not found"); + + this [_scene] .setLive (this .getLive () .getValue ()); + this [_scene] .setExecutionContext (this .getExecutionContext ()); + + this .setLoadState (Base_X3DConstants .COMPLETE_STATE); + this .setProtoDeclaration (proto); + }, + getInternalScene () + { + /// Returns the internal X3DScene of this extern proto, that is loaded from the url given. + + return this [_scene]; + }, + setError (error) + { + console .error (`Error loading extern prototype '${this .getName ()}':`, error); + + this [_scene] = this .getBrowser () .getPrivateScene (); + + this .setLoadState (Base_X3DConstants .FAILED_STATE); + this .setProtoDeclaration (null); + }, + toVRMLStream (generator) + { + generator .string += generator .Indent (); + generator .string += "EXTERNPROTO"; + generator .string += generator .Space (); + generator .string += this .getName (); + generator .string += generator .TidySpace (); + generator .string += "["; + + const userDefinedFields = this .getUserDefinedFields (); + + if (userDefinedFields .length === 0) + { + generator .string += generator .TidySpace (); + } + else + { + let + fieldTypeLength = 0, + accessTypeLength = 0; + + for (const field of userDefinedFields) + { + fieldTypeLength = Math .max (fieldTypeLength, field .getTypeName () .length); + accessTypeLength = Math .max (accessTypeLength, generator .AccessType (field .getAccessType ()) .length); + } + + generator .string += generator .TidyBreak (); + + generator .IncIndent (); + + for (const field of userDefinedFields) + { + this .toVRMLStreamUserDefinedField (generator, field, fieldTypeLength, accessTypeLength); + + generator .string += generator .Break (); + } + + generator .DecIndent (); + + generator .string += generator .Indent (); + } + + generator .string += "]"; + generator .string += generator .TidyBreak (); + generator .string += generator .Indent (); + + this ._url .toVRMLStream (generator); + }, + toVRMLStreamUserDefinedField (generator, field, fieldTypeLength, accessTypeLength) + { + generator .string += generator .Indent (); + generator .string += generator .AccessType (field .getAccessType ()) .padEnd (accessTypeLength, " "); + generator .string += generator .Space (); + generator .string += field .getTypeName () .padEnd (fieldTypeLength, " "); + generator .string += generator .Space (); + generator .string += field .getName (); + }, + toXMLStream (generator) + { + generator .string += generator .Indent (); + generator .string += "" : "/>"; + generator .string += generator .TidyBreak (); + } + + generator .DecIndent (); + + generator .string += generator .Indent (); + generator .string += ""; + }, + toJSONStream (generator) + { + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += "ExternProtoDeclare"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@name"; + generator .string += '"'; + generator .string += ':'; + generator .string += '"'; + generator .string += generator .JSONEncode (this .getName ()); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + + // Fields + + const userDefinedFields = this .getUserDefinedFields (); + + if (userDefinedFields .length) + { + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "field"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '['; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + for (const field of userDefinedFields) + { + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@accessType"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .AccessType (field .getAccessType ()); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@type"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += field .getTypeName (); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@name"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (field .getName ()); + generator .string += '"'; + generator .string += generator .TidyBreak (); + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + + if (field !== userDefinedFields .at (-1)) + generator .string += ','; + + generator .string += generator .TidyBreak (); + } + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += ']'; + generator .string += ','; + generator .string += generator .TidyBreak (); + } + + + // URL + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@url"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + + this ._url .toJSONStream (generator); + + generator .string += generator .TidyBreak (); + + + // End + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + }, +}); + +for (const key of Object .keys (X3DExternProtoDeclaration .prototype)) + Object .defineProperty (X3DExternProtoDeclaration .prototype, key, { enumerable: false }); + +Object .defineProperties (X3DExternProtoDeclaration .prototype, +{ + name: + { + get: X3DExternProtoDeclaration .prototype .getName, + enumerable: true, + }, + fields: + { + get: X3DExternProtoDeclaration .prototype .getFieldDefinitions, + enumerable: true, + }, + isExternProto: + { + value: true, + enumerable: true, + }, + urls: + { + get () { return this ._url; }, + enumerable: true, + }, + loadState: + { + get: X3DExternProtoDeclaration .prototype .checkLoadState, + enumerable: true, + }, +}); + +Object .defineProperties (X3DExternProtoDeclaration, +{ + typeName: + { + value: "X3DExternProtoDeclaration", + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +Base_X3DConstants .addNode (X3DExternProtoDeclaration); + +const X3DExternProtoDeclaration_default_ = X3DExternProtoDeclaration; +; + +x_ite_Namespace .add ("X3DExternProtoDeclaration", "x_ite/Prototype/X3DExternProtoDeclaration", X3DExternProtoDeclaration_default_); +/* harmony default export */ const Prototype_X3DExternProtoDeclaration = (X3DExternProtoDeclaration_default_); +;// CONCATENATED MODULE: ./src/x_ite/Prototype/ExternProtoDeclarationArray.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function ExternProtoDeclarationArray (values = [ ]) +{ + return Base_X3DInfoArray .call (this, Array .from (values, value => [value .name, value]), Prototype_X3DExternProtoDeclaration); +} + +Object .setPrototypeOf (ExternProtoDeclarationArray .prototype, Base_X3DInfoArray .prototype); + +for (const key of Object .keys (ExternProtoDeclarationArray .prototype)) + Object .defineProperty (ExternProtoDeclarationArray .prototype, key, { enumerable: false }); + +Object .defineProperties (ExternProtoDeclarationArray, +{ + typeName: + { + value: "ExternProtoDeclarationArray", + enumerable: true, + }, +}); + +const ExternProtoDeclarationArray_default_ = ExternProtoDeclarationArray; +; + +x_ite_Namespace .add ("ExternProtoDeclarationArray", "x_ite/Prototype/ExternProtoDeclarationArray", ExternProtoDeclarationArray_default_); +/* harmony default export */ const Prototype_ExternProtoDeclarationArray = (ExternProtoDeclarationArray_default_); +;// CONCATENATED MODULE: ./src/x_ite/Prototype/ProtoDeclarationArray.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function ProtoDeclarationArray (values = [ ]) +{ + return Base_X3DInfoArray .call (this, Array .from (values, value => [value .name, value]), Prototype_X3DProtoDeclaration); +} + +Object .setPrototypeOf (ProtoDeclarationArray .prototype, Base_X3DInfoArray .prototype); + +for (const key of Object .keys (ProtoDeclarationArray .prototype)) + Object .defineProperty (ProtoDeclarationArray .prototype, key, { enumerable: false }); + +Object .defineProperties (ProtoDeclarationArray, +{ + typeName: + { + value: "ProtoDeclarationArray", + enumerable: true, + }, +}); + +const ProtoDeclarationArray_default_ = ProtoDeclarationArray; +; + +x_ite_Namespace .add ("ProtoDeclarationArray", "x_ite/Prototype/ProtoDeclarationArray", ProtoDeclarationArray_default_); +/* harmony default export */ const Prototype_ProtoDeclarationArray = (ProtoDeclarationArray_default_); +;// CONCATENATED MODULE: ./src/x_ite/Routing/X3DRoute.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +const + X3DRoute_executionContext = Symbol (), + _sourceNode = Symbol (), + _sourceField = Symbol (), + _destinationNode = Symbol (), + _destinationField = Symbol (); + +function X3DRoute (executionContext, sourceNode, sourceField, destinationNode, destinationField) +{ + Base_X3DObject .call (this, executionContext); + + this [X3DRoute_executionContext] = executionContext; + this [_sourceNode] = sourceNode; + this [_sourceField] = sourceField; + this [_destinationNode] = destinationNode; + this [_destinationField] = destinationField; + + // Must connect in every context, to make X3DBaseNode.hasRoutes work. + + sourceField .addFieldInterest (destinationField); + + sourceField .addOutputRoute (this); + destinationField .addInputRoute (this); +} + +Object .assign (Object .setPrototypeOf (X3DRoute .prototype, Base_X3DObject .prototype), +{ + getExecutionContext () + { + return this [X3DRoute_executionContext]; + }, + getRouteId () + { + return X3DRoute .getRouteId (this [_sourceField], this [_destinationField]); + }, + getSourceNode () + { + /// SAI + return this [_sourceNode]; + }, + getSourceField () + { + /// SAI + return this [_sourceField]; + }, + getDestinationNode () + { + /// SAI + return this [_destinationNode]; + }, + getDestinationField () + { + /// SAI + return this [_destinationField]; + }, + disconnect () + { + this [_sourceField] .removeFieldInterest (this [_destinationField]); + + this [_sourceField] .removeOutputRoute (this); + this [_destinationField] .removeInputRoute (this); + }, + toVRMLStream (generator) + { + const + sourceNodeName = generator .LocalName (this [_sourceNode]), + destinationNodeName = generator .LocalName (this [_destinationNode]); + + generator .string += generator .Indent (); + generator .string += "ROUTE"; + generator .string += generator .Space (); + generator .string += sourceNodeName; + generator .string += "."; + generator .string += this [_sourceField] .getName (); + + if (this [_sourceField] .getAccessType () === Base_X3DConstants .inputOutput) + generator .string += "_changed"; + + generator .string += generator .Space (); + generator .string += "TO"; + generator .string += generator .Space (); + generator .string += destinationNodeName; + generator .string += "."; + + if (this [_destinationField] .getAccessType () === Base_X3DConstants .inputOutput) + generator .string += "set_"; + + generator .string += this [_destinationField] .getName (); + }, + toXMLStream (generator) + { + const + sourceNodeName = generator .LocalName (this [_sourceNode]), + destinationNodeName = generator .LocalName (this [_destinationNode]); + + generator .string += generator .Indent (); + generator .string += "" : "/>"; + }, + toJSONStream (generator) + { + const + sourceNodeName = generator .LocalName (this [_sourceNode]), + destinationNodeName = generator .LocalName (this [_destinationNode]); + + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += "ROUTE"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@fromNode"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (sourceNodeName); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@fromField"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (this [_sourceField] .getName ()); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@toNode"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (destinationNodeName); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@toField"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (this [_destinationField] .getName ()); + generator .string += '"'; + generator .string += generator .TidyBreak (); + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + }, + dispose () + { + this .disconnect (); + + this [X3DRoute_executionContext] .deleteRoute (this); + + Base_X3DObject .prototype .dispose .call (this); + } +}); + +for (const key of Object .keys (X3DRoute .prototype)) + Object .defineProperty (X3DRoute .prototype, key, { enumerable: false }); + +Object .defineProperties (X3DRoute .prototype, +{ + sourceNode: + { + get () + { + return Fields_SFNodeCache .get (this [_sourceNode]); + }, + enumerable: true, + }, + sourceField: + { + get () + { + return this [_sourceField] .getName (); + }, + enumerable: true, + }, + destinationNode: + { + get () + { + return Fields_SFNodeCache .get (this [_destinationNode]); + }, + enumerable: true, + }, + destinationField: + { + get () + { + return this [_destinationField] .getName (); + }, + enumerable: true, + }, +}); + +Object .defineProperties (X3DRoute, +{ + typeName: + { + value: "X3DRoute", + enumerable: true, + }, +}); + +Object .assign (X3DRoute, +{ + getRouteId (sourceField, destinationField) + { + return `${sourceField .getId ()}.${destinationField .getId ()}`; + }, +}); + +const X3DRoute_default_ = X3DRoute; +; + +x_ite_Namespace .add ("X3DRoute", "x_ite/Routing/X3DRoute", X3DRoute_default_); +/* harmony default export */ const Routing_X3DRoute = (X3DRoute_default_); +;// CONCATENATED MODULE: ./src/x_ite/Routing/RouteArray.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function RouteArray (values = [ ]) +{ + return Base_X3DInfoArray .call (this, Array .from (values, value => [value .getId (), value]), Routing_X3DRoute); +} + +Object .setPrototypeOf (RouteArray .prototype, Base_X3DInfoArray .prototype); + +for (const key of Object .keys (RouteArray .prototype)) + Object .defineProperty (RouteArray .prototype, key, { enumerable: false }); + +Object .defineProperties (RouteArray, +{ + typeName: + { + value: "RouteArray", + enumerable: true, + }, +}); + +const RouteArray_default_ = RouteArray; +; + +x_ite_Namespace .add ("RouteArray", "x_ite/Routing/RouteArray", RouteArray_default_); +/* harmony default export */ const Routing_RouteArray = (RouteArray_default_); +;// CONCATENATED MODULE: ./src/x_ite/Execution/X3DExecutionContext.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + + +const + _namedNodes = Symbol (), + _importedNodes = Symbol (), + _protos = Symbol (), + _externprotos = Symbol (), + X3DExecutionContext_routes = Symbol (), + _outerNode = Symbol (); + +function X3DExecutionContext (executionContext, outerNode = null, browser = executionContext .getBrowser ()) +{ + Base_X3DBaseNode .call (this, executionContext, browser); + + this .addType (Base_X3DConstants .X3DExecutionContext) + + this .addChildObjects (Base_X3DConstants .initializeOnly, "rootNodes", new x_ite_Fields .MFNode (), + Base_X3DConstants .outputOnly, "worldInfos", new x_ite_Fields .MFNode (), + Base_X3DConstants .outputOnly, "sceneGraph_changed", new x_ite_Fields .SFTime ()) + + this ._rootNodes .collectCloneCount = () => 1; + + this [_outerNode] = outerNode; + this [_namedNodes] = new Execution_NamedNodesArray (); + this [_importedNodes] = new Execution_ImportedNodesArray (); + this [_protos] = new Prototype_ProtoDeclarationArray (); + this [_externprotos] = new Prototype_ExternProtoDeclarationArray (); + this [X3DExecutionContext_routes] = new Routing_RouteArray (); + + this [_namedNodes] .addParent (this); + this [_importedNodes] .addParent (this); + this [_protos] .addParent (this); + this [_externprotos] .addParent (this); + this [X3DExecutionContext_routes] .addParent (this); +} + +Object .assign (Object .setPrototypeOf (X3DExecutionContext .prototype, Base_X3DBaseNode .prototype), +{ + initialize () + { + Base_X3DBaseNode .prototype .initialize .call (this); + + if (!this .isScene ()) + this ._sceneGraph_changed .addInterest ("set_sceneGraph", this) + }, + set_sceneGraph () + { + this .getExecutionContext () ._sceneGraph_changed = this .getBrowser () .getCurrentTime (); + }, + isScene () + { + return false; + }, + getOuterNode () + { + // Can be either of type X3DProtoDeclaration or X3DPrototypeInstance, or null. + return this [_outerNode]; + }, + getSpecificationVersion () + { + return this .getExecutionContext () .getSpecificationVersion (); + }, + getEncoding () + { + return this .getExecutionContext () .getEncoding (); + }, + getWorldURL () + { + return this .getExecutionContext () .getWorldURL (); + }, + getBaseURL () + { + return this .getExecutionContext () .getBaseURL (); + }, + getProfile () + { + return this .getExecutionContext () .getProfile (); + }, + hasComponent (name, level) + { + return this .getExecutionContext () .hasComponent (name, level); + }, + getComponents () + { + return this .getExecutionContext () .getComponents (); + }, + fromUnit (category, value) + { + return this .getExecutionContext () .fromUnit (category, value); + }, + toUnit (category, value) + { + return this .getExecutionContext () .toUnit (category, value); + }, + getUnits () + { + return this .getExecutionContext () .getUnits (); + }, + createNode (typeName, setup = true /* non-public argument */) + { + typeName = String (typeName); + + if (setup === false) + { + const ConcreteNode = this .getBrowser () .getConcreteNodes () .get (typeName); + + if (!ConcreteNode) + return null; + + const specificationRange = ConcreteNode .specificationRange; + + if (this .getSpecificationVersion () < specificationRange [0]) + return null; + + if (this .getSpecificationVersion () > specificationRange [1]) + return null; + + if (!this .hasComponent (ConcreteNode .componentName)) + console .warn (`Node type '${typeName}' does not match component/profile statements in '${this .getWorldURL ()}'.`); + + return new ConcreteNode (this); + } + else + { + const ConcreteNode = this .getBrowser () .getConcreteNodes () .get (typeName); + + if (!ConcreteNode) + throw new Error (`Unknown node type '${typeName}'.`); + + const specificationRange = ConcreteNode .specificationRange; + + if (this .getSpecificationVersion () < specificationRange [0]) + throw new Error (`Node type '${typeName}' does not match specification version in '${this .getWorldURL ()}.`); + + if (this .getSpecificationVersion () > specificationRange [1]) + throw new Error (`Node type '${typeName}' does not match specification version in '${this .getWorldURL ()}.`); + + if (!this .hasComponent (ConcreteNode .componentName)) + console .warn (`Node type '${typeName}' does not match component/profile statements in '${this .getWorldURL ()}'.`); + + const baseNode = new ConcreteNode (this); + + baseNode .setup (); + + return Fields_SFNodeCache .get (baseNode); + } + }, + createProto (name, setup = true /* non-public argument */) + { + name = String (name); + + for (let executionContext = this;;) + { + const protoNode = executionContext .protos .get (name) + ?? executionContext .externprotos .get (name); + + if (protoNode) + return protoNode .createInstance (this, setup); + + if (executionContext .isScene ()) + break; + + executionContext = executionContext .getExecutionContext (); + } + + if (setup === false) + return null; + + throw new Error (`Unknown proto or externproto type '${name}'.`); + }, + addNamedNode (name, node) + { + name = String (name); + node = Base_X3DCast (Base_X3DConstants .X3DNode, node, false); + + if (!node) + throw new Error ("Couldn't add named node: node must be of type X3DNode."); + + if (node .getExecutionContext () !== this) + throw new Error ("Couldn't add named node: node does not belong to this execution context."); + + if (name .length === 0) + throw new Error ("Couldn't add named node: node name is empty."); + + if (this [_namedNodes] .has (name)) + throw new Error (`Couldn't add named node: node named '${name}' is already in use.`); + + if (this [_namedNodes] .get (node .getName ()) ?.getValue () === node) + throw new Error (`Couldn't add named node: node named '${node .getName ()}' is already added.`); + + // Add named node. + + node .setName (name); + + this [_namedNodes] .add (name, Fields_SFNodeCache .get (node)); + }, + updateNamedNode (name, node) + { + name = String (name); + node = Base_X3DCast (Base_X3DConstants .X3DNode, node, false); + + if (!node) + throw new Error ("Couldn't update named node: node must be of type X3DNode."); + + if (node .getExecutionContext () !== this) + throw new Error ("Couldn't update named node: node does not belong to this execution context."); + + if (name .length === 0) + throw new Error ("Couldn't update named node: node name is empty."); + + // Remove named node. + + this .removeNamedNode (node .getName ()); + this .removeNamedNode (name); + + // Update named node. + + node .setName (name); + + this [_namedNodes] .add (name, Fields_SFNodeCache .get (node)); + + this ._namedNodes_changed = this .getBrowser () .getCurrentTime (); + }, + removeNamedNode (name) + { + name = String (name); + + const node = this [_namedNodes] .get (name); + + if (!node || !node .getValue ()) + return; + + node .getValue () .setName (""); + + this [_namedNodes] .remove (name); + + this ._namedNodes_changed = this .getBrowser () .getCurrentTime (); + }, + getNamedNode (name) + { + name = String (name); + + const node = this [_namedNodes] .get (name); + + if (node) + return node; + + throw new Error (`Named node '${name}' not found.`); + }, + getNamedNodes () + { + return this [_namedNodes]; + }, + getUniqueName (name) + { + return getUniqueName (this [_namedNodes], name); + }, + addImportedNode (inlineNode, exportedName, importedName = exportedName) + { + exportedName = String (exportedName); + importedName = String (importedName); + + if (this [_importedNodes] .has (importedName)) + throw new Error (`Couldn't add imported node: imported name '${importedName}' already in use.`); + + this .updateImportedNode (inlineNode, exportedName, importedName); + }, + updateImportedNode (inlineNode, exportedName, importedName) + { + inlineNode = Base_X3DCast (Base_X3DConstants .Inline, inlineNode, false); + exportedName = String (exportedName); + importedName = importedName === undefined ? exportedName : String (importedName); + + if (!inlineNode) + throw new Error ("Node must be of type Inline node."); + + if (inlineNode .getExecutionContext () !== this) + throw new Error ("Couldn't update imported node: Inline node does not belong to this execution context."); + + if (exportedName .length === 0) + throw new Error ("Couldn't update imported node: exported name is empty."); + + if (importedName .length === 0) + throw new Error ("Couldn't update imported node: imported name is empty."); + + // Update imported node. + + this .removeImportedNode (importedName); + + const importedNode = new Execution_X3DImportedNode (this, inlineNode, exportedName, importedName); + + this [_importedNodes] .add (importedName, importedNode); + + this ._importedNodes_changed = this .getBrowser () .getCurrentTime (); + }, + removeImportedNode (importedName) + { + importedName = String (importedName); + + const importedNode = this [_importedNodes] .get (importedName); + + if (!importedNode) + return; + + importedNode .dispose (); + + this [_importedNodes] .remove (importedName); + + this ._importedNodes_changed = this .getBrowser () .getCurrentTime (); + }, + getImportedNode (importedName) + { + importedName = String (importedName); + + const importedNode = this [_importedNodes] .get (importedName); + + if (importedNode) + return Fields_SFNodeCache .get (importedNode .getExportedNode ()); + + throw new Error (`Imported node '${importedName}' not found.`); + }, + getImportedNodes () + { + return this [_importedNodes]; + }, + getLocalNode (name) + { + name = String (name); + + try + { + return this .getNamedNode (name); + } + catch + { + const importedNode = this [_importedNodes] .get (name); + + if (importedNode) + return Fields_SFNodeCache .get (importedNode); + + throw new Error (`Unknown named or imported node '${name}'.`); + } + }, + getLocalName (node) + { + node = Base_X3DCast (Base_X3DConstants .X3DNode, node, false); + + if (!node) + throw new Error ("Couldn't get local name: node must be of type X3DNode."); + + if (node .getExecutionContext () === this) + return node .getName (); + + for (const importedNode of this [_importedNodes]) + { + try + { + if (importedNode .getExportedNode () === node) + return importedNode .getImportedName (); + } + catch + { } + } + + throw new Error ("Couldn't get local name: node is shared."); + }, + setRootNodes () { }, + getRootNodes () + { + return this ._rootNodes; + }, + getProtoDeclaration (name) + { + name = String (name); + + const proto = this [_protos] .get (name); + + if (proto) + return proto; + + throw new Error (`Proto declaration '${name}' not found.`); + }, + addProtoDeclaration (name, proto) + { + name = String (name); + + if (!(proto instanceof Prototype_X3DProtoDeclaration)) + throw new Error ("Couldn't add proto declaration: proto must be of type X3DProtoDeclaration."); + + if (proto .getExecutionContext () !== this) + throw new Error ("Couldn't add proto declaration: proto does not belong to this execution context."); + + if (this [_protos] .get (name)) + throw new Error (`Couldn't add proto declaration: proto '${name}' already in use.`); + + if (this [_protos] .get (proto .getName ()) === proto) + throw new Error (`Couldn't add proto declaration: proto '${proto .getName ()}' already added.`); + + name = String (name); + + if (name .length === 0) + throw new Error ("Couldn't add proto declaration: proto name is empty."); + + this [_protos] .add (name, proto); + proto .setName (name); + + this ._protos_changed = this .getBrowser () .getCurrentTime (); + }, + updateProtoDeclaration (name, proto) + { + name = String (name); + + if (!(proto instanceof Prototype_X3DProtoDeclaration)) + throw new Error ("Couldn't update proto declaration: proto must be of type X3DProtoDeclaration."); + + if (proto .getExecutionContext () !== this) + throw new Error ("Couldn't update proto declaration: proto does not belong to this execution context."); + + name = String (name); + + if (name .length === 0) + throw new Error ("Couldn't update proto declaration: proto name is empty."); + + this [_protos] .update (proto .getName (), name, proto); + proto .setName (name); + + this ._protos_changed = this .getBrowser () .getCurrentTime (); + }, + removeProtoDeclaration (name) + { + name = String (name); + + this [_protos] .remove (name); + + this ._protos_changed = this .getBrowser () .getCurrentTime (); + }, + getProtoDeclarations () + { + return this [_protos]; + }, + getUniqueProtoName (name) + { + return getUniqueName (this [_protos], name); + }, + getExternProtoDeclaration (name) + { + name = String (name); + + const externproto = this [_externprotos] .get (name); + + if (externproto) + return externproto; + + throw new Error (`Extern proto declaration '${name}' not found.`); + }, + addExternProtoDeclaration (name, externproto) + { + name = String (name); + + if (!(externproto instanceof Prototype_X3DExternProtoDeclaration)) + throw new Error ("Couldn't add extern proto declaration: extern proto must be of type X3DExternProtoDeclaration."); + + if (externproto .getExecutionContext () !== this) + throw new Error ("Couldn't add extern proto declaration: extern proto does not belong to this execution context."); + + if (this [_externprotos] .get (name)) + throw new Error (`Couldn't add extern proto declaration: extern proto '${name}' already in use.`); + + if (this [_externprotos] .get (externproto .getName ()) === externproto) + throw new Error (`Couldn't add extern proto declaration: extern proto '${externproto .getName ()}' already added.`); + + name = String (name); + + if (name .length === 0) + throw new Error ("Couldn't add extern proto declaration: extern proto name is empty."); + + this [_externprotos] .add (name, externproto); + externproto .setName (name); + + this ._externprotos_changed = this .getBrowser () .getCurrentTime (); + }, + updateExternProtoDeclaration (name, externproto) + { + name = String (name); + + if (!(externproto instanceof Prototype_X3DExternProtoDeclaration)) + throw new Error ("Couldn't update extern proto declaration: extern proto must be of type X3DExternProtoDeclaration."); + + if (externproto .getExecutionContext () !== this) + throw new Error ("Couldn't update extern proto declaration: extern proto does not belong to this execution context."); + + name = String (name); + + if (name .length === 0) + throw new Error ("Couldn't update extern proto declaration: extern proto name is empty."); + + this [_externprotos] .update (externproto .getName (), name, externproto); + externproto .setName (name); + + this ._externprotos_changed = this .getBrowser () .getCurrentTime (); + }, + removeExternProtoDeclaration (name) + { + name = String (name); + + this [_externprotos] .remove (name); + + this ._externprotos_changed = this .getBrowser () .getCurrentTime (); + }, + getExternProtoDeclarations () + { + return this [_externprotos]; + }, + getUniqueExternProtoName (name) + { + return getUniqueName (this [_externprotos], name); + }, + addRoute (sourceNode, sourceField, destinationNode, destinationField) + { + sourceNode = Base_X3DCast (Base_X3DConstants .X3DNode, sourceNode, false); + sourceField = String (sourceField); + destinationNode = Base_X3DCast (Base_X3DConstants .X3DNode, destinationNode, false); + destinationField = String (destinationField); + + if (!sourceNode) + throw new Error ("Bad ROUTE specification: source node must be of type X3DNode."); + + if (!destinationNode) + throw new Error ("Bad ROUTE specification: destination node must be of type X3DNode."); + + // Imported nodes handling. + + let + importedSourceNode = sourceNode instanceof Execution_X3DImportedNode ? sourceNode : null, + importedDestinationNode = destinationNode instanceof Execution_X3DImportedNode ? destinationNode : null; + + try + { + // If sourceNode is shared node try to find the corresponding X3DImportedNode. + if (sourceNode .getExecutionContext () !== this) + importedSourceNode = this .getLocalNode (this .getLocalName (sourceNode)) .getValue (); + } + catch + { + // Source node is shared but not imported. + } + + try + { + // If destinationNode is shared node try to find the corresponding X3DImportedNode. + if (destinationNode .getExecutionContext () !== this) + importedDestinationNode = this .getLocalNode (this .getLocalName (destinationNode)) .getValue (); + } + catch + { + // Destination node is shared but not imported. + } + + if (importedSourceNode instanceof Execution_X3DImportedNode && importedDestinationNode instanceof Execution_X3DImportedNode) + { + importedSourceNode .addRoute (importedSourceNode, sourceField, importedDestinationNode, destinationField); + importedDestinationNode .addRoute (importedSourceNode, sourceField, importedDestinationNode, destinationField); + } + else if (importedSourceNode instanceof Execution_X3DImportedNode) + { + importedSourceNode .addRoute (importedSourceNode, sourceField, destinationNode, destinationField); + } + else if (importedDestinationNode instanceof Execution_X3DImportedNode) + { + importedDestinationNode .addRoute (sourceNode, sourceField, importedDestinationNode, destinationField); + } + + // If either sourceNode or destinationNode is an X3DImportedNode return here without value. + if (importedSourceNode === sourceNode || importedDestinationNode === destinationNode) + return; + + // Create route and return. + + return this .addSimpleRoute (sourceNode, sourceField, destinationNode, destinationField); + }, + addSimpleRoute (sourceNode, sourceField, destinationNode, destinationField) + { + // Source and dest node are here X3DBaseNode. + + try + { + // Private function. + // Create route and return. + + sourceField = sourceNode .getField (sourceField), + destinationField = destinationNode .getField (destinationField); + + if (!sourceField .isOutput ()) + throw new Error (`Field named '${sourceField .getName ()}' in node named '${sourceNode .getName ()}' of type ${sourceNode .getTypeName ()} is not an output field.`); + + if (!destinationField .isInput ()) + throw new Error (`Field named '${destinationField .getName ()}' in node named '${destinationNode .getName ()}' of type ${destinationNode .getTypeName ()} is not an input field.`); + + if (sourceField .getType () !== destinationField .getType ()) + throw new Error (`ROUTE types ${sourceField .getTypeName ()} and ${destinationField .getTypeName ()} do not match.`); + + const id = Routing_X3DRoute .getRouteId (sourceField, destinationField); + + let route = this [X3DExecutionContext_routes] .get (id); + + if (route) + return route; + + route = new Routing_X3DRoute (this, sourceNode, sourceField, destinationNode, destinationField); + + this [X3DExecutionContext_routes] .add (id, route); + + this ._routes_changed = this .getBrowser () .getCurrentTime (); + + return route; + } + catch (error) + { + throw new Error (`Bad ROUTE specification: ${error .message}`); + } + }, + deleteRoute (route) + { + // sourceNode, sourceField, destinationNode, destinationField + if (arguments .length === 4) + route = this .getRoute (... arguments); + + if (!(route instanceof Routing_X3DRoute)) + return; + + if (route .getExecutionContext () !== this) + return; + + this .deleteSimpleRoute (route); + this .deleteImportedRoute (route .sourceNode, route .destinationNode, route); + }, + deleteSimpleRoute (route) + { + this [X3DExecutionContext_routes] .remove (route .getRouteId ()); + + route .disconnect (); + + this ._routes_changed = this .getBrowser () .getCurrentTime (); + }, + deleteImportedRoute (sourceNode, destinationNode, route) + { + // Imported nodes handling. + + let + importedSourceNode = null, + importedDestinationNode = null; + + try + { + // If sourceNode is shared node try to find the corresponding X3DImportedNode. + if (sourceNode .getValue () .getExecutionContext () !== this) + importedSourceNode = this .getLocalNode (this .getLocalName (sourceNode)) .getValue (); + } + catch + { + // Source node is shared but not imported. + } + + try + { + // If destinationNode is shared node try to find the corresponding X3DImportedNode. + if (destinationNode .getValue () .getExecutionContext () !== this) + importedDestinationNode = this .getLocalNode (this .getLocalName (destinationNode)) .getValue (); + } + catch + { + // Destination node is shared but not imported. + } + + if (importedSourceNode instanceof Execution_X3DImportedNode && importedDestinationNode instanceof Execution_X3DImportedNode) + { + importedSourceNode .deleteRoute (route); + importedDestinationNode .deleteRoute (route); + } + else if (importedSourceNode instanceof Execution_X3DImportedNode) + { + importedSourceNode .deleteRoute (route); + } + else if (importedDestinationNode instanceof Execution_X3DImportedNode) + { + importedDestinationNode .deleteRoute (route); + } + }, + getRoute (sourceNode, sourceField, destinationNode, destinationField) + { + sourceNode = Base_X3DCast (Base_X3DConstants .X3DNode, sourceNode, false); + sourceField = String (sourceField) + destinationNode = Base_X3DCast (Base_X3DConstants .X3DNode, destinationNode, false); + destinationField = String (destinationField) + + if (!sourceNode) + throw new Error ("Bad ROUTE specification: sourceNode must be of type X3DNode."); + + if (!destinationNode) + throw new Error ("Bad ROUTE specification: destinationNode must be of type X3DNode."); + + sourceField = sourceNode .getField (sourceField); + destinationField = destinationNode .getField (destinationField); + + return this [X3DExecutionContext_routes] .get (Routing_X3DRoute .getRouteId (sourceField, destinationField)); + }, + getRoutes () + { + return this [X3DExecutionContext_routes]; + }, + getWorldInfos () + { + return this ._worldInfos; + }, + addWorldInfo (worldInfoNode) + { + this ._worldInfos .push (worldInfoNode); + }, + removeWorldInfo (worldInfoNode) + { + for (let i = this ._worldInfos .length - 1; i >= 0; -- i) + { + if (this ._worldInfos [i] .getValue () === worldInfoNode) + this ._worldInfos .splice (i, 1); + } + }, + toVRMLStream (generator) + { + generator .PushExecutionContext (this); + generator .EnterScope (); + generator .NamedNodes (this .getNamedNodes ()); + generator .ImportedNodes (this .getImportedNodes ()); + + // Output extern protos + + this .getExternProtoDeclarations () .toVRMLStream (generator); + + // Output protos + + this .getProtoDeclarations () .toVRMLStream (generator); + + // Output root nodes + + const rootNodes = this .getRootNodes (); + + for (let i = 0, length = rootNodes .length; i < length; ++ i) + { + const rootNode = rootNodes [i]; + + generator .string += generator .Indent (); + + if (rootNode) + rootNode .toVRMLStream (generator); + else + generator .string += "NULL"; + + generator .string += generator .TidyBreak (); + + if (i !== length - 1) + generator .string += generator .TidyBreak (); + } + + // Output imported nodes + + const importedNodes = this .getImportedNodes (); + + if (importedNodes .length) + { + generator .string += generator .TidyBreak (); + + importedNodes .toVRMLStream (generator); + } + + // Output routes + + const routes = this .getRoutes (); + + if (routes .length) + { + generator .string += generator .TidyBreak (); + + routes .toVRMLStream (generator); + } + + generator .LeaveScope (); + generator .PopExecutionContext (); + }, + toXMLStream (generator) + { + generator .PushExecutionContext (this); + generator .EnterScope (); + generator .NamedNodes (this .getNamedNodes ()); + generator .ImportedNodes (this .getImportedNodes ()); + + // Output extern protos + + this .getExternProtoDeclarations () .toXMLStream (generator); + + // Output protos + + this .getProtoDeclarations () .toXMLStream (generator); + + // Output root nodes + + const rootNodes = this .getRootNodes (); + + if (rootNodes .length) + { + rootNodes .toXMLStream (generator); + + generator .string += generator .TidyBreak (); + } + + // Output imported nodes + + this .getImportedNodes () .toXMLStream (generator); + + // Output routes + + this .getRoutes () .toXMLStream (generator); + + generator .LeaveScope (); + generator .PopExecutionContext (); + }, + toJSONStream (generator) + { + generator .PushExecutionContext (this); + generator .EnterScope (); + generator .NamedNodes (this .getNamedNodes ()); + generator .ImportedNodes (this .getImportedNodes ()); + + + // Extern proto declarations + + this .getExternProtoDeclarations () .toJSONStream (generator, true); + + + // Proto declarations + + this .getProtoDeclarations () .toJSONStream (generator, true); + + + // Root nodes + + if (this .getRootNodes () .length) + { + for (const rootNode of this .getRootNodes ()) + { + generator .string += generator .Indent (); + + if (rootNode) + { + rootNode .toJSONStream (generator); + } + else + { + generator .string += generator .Indent (); + generator .string += "null"; + } + + generator .string += ','; + generator .string += generator .TidyBreak (); + } + } + + + // Imported nodes + + this .getImportedNodes () .toJSONStream (generator, true); + + + // Routes + + this .getRoutes () .toJSONStream (generator, true); + + + generator .LeaveScope (); + generator .PopExecutionContext (); + }, + dispose () + { + for (const route of [... this [X3DExecutionContext_routes]]) + this .deleteRoute (route); + + Base_X3DBaseNode .prototype .dispose .call (this); + }, +}); + +for (const key of Object .keys (X3DExecutionContext .prototype)) + Object .defineProperty (X3DExecutionContext .prototype, key, { enumerable: false }); + +Object .defineProperties (X3DExecutionContext .prototype, +{ + specificationVersion: + { + get: X3DExecutionContext .prototype .getSpecificationVersion, + enumerable: true, + }, + encoding: + { + get: X3DExecutionContext .prototype .getEncoding, + enumerable: true, + }, + profile: + { + get: X3DExecutionContext .prototype .getProfile, + enumerable: true, + }, + components: + { + get: X3DExecutionContext .prototype .getComponents, + enumerable: true, + }, + worldURL: + { + get: X3DExecutionContext .prototype .getWorldURL, + enumerable: true, + }, + baseURL: + { + get: X3DExecutionContext .prototype .getBaseURL, + enumerable: true, + }, + units: + { + get: X3DExecutionContext .prototype .getUnits, + enumerable: true, + }, + namedNodes: + { + get: X3DExecutionContext .prototype .getNamedNodes, + enumerable: true, + }, + importedNodes: + { + get: X3DExecutionContext .prototype .getImportedNodes, + enumerable: true, + }, + rootNodes: + { + get: X3DExecutionContext .prototype .getRootNodes, + set: X3DExecutionContext .prototype .setRootNodes, + enumerable: true, + }, + protos: + { + get: X3DExecutionContext .prototype .getProtoDeclarations, + enumerable: true, + }, + externprotos: + { + get: X3DExecutionContext .prototype .getExternProtoDeclarations, + enumerable: true, + }, + routes: + { + get: X3DExecutionContext .prototype .getRoutes, + enumerable: true, + }, +}); + +Object .defineProperties (X3DExecutionContext, +{ + typeName: + { + value: "X3DExecutionContext", + enumerable: true, + }, +}); + +Base_X3DConstants .addNode (X3DExecutionContext); + +const X3DExecutionContext_default_ = X3DExecutionContext; +; + +x_ite_Namespace .add ("X3DExecutionContext", "x_ite/Execution/X3DExecutionContext", X3DExecutionContext_default_); +/* harmony default export */ const Execution_X3DExecutionContext = (X3DExecutionContext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Core/X3DPrototypeInstance.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +const + X3DPrototypeInstance_fieldDefinitions = Symbol .for ("X_ITE.X3DBaseNode.fieldDefinitions"), + _protoNode = Symbol (), + _protoFields = Symbol (), + X3DPrototypeInstance_body = Symbol (); + +function X3DPrototypeInstance (executionContext, protoNode) +{ + this [_protoNode] = protoNode; + this [X3DPrototypeInstance_fieldDefinitions] = new Base_FieldDefinitionArray (protoNode .getFieldDefinitions ()); + this [X3DPrototypeInstance_body] = null; + + Core_X3DNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DPrototypeInstance); +} + +Object .assign (Object .setPrototypeOf (X3DPrototypeInstance .prototype, Core_X3DNode .prototype), +{ + create (executionContext) + { + return new X3DPrototypeInstance (executionContext, this [_protoNode]); + }, + getTypeName () + { + return this [_protoNode] .getName (); + }, + initialize () + { + Core_X3DNode .prototype .initialize .call (this); + + this .setProtoNode (this [_protoNode]); + }, + construct () + { + this [X3DPrototypeInstance_body] ?.dispose (); + + const + protoNode = this [_protoNode], + proto = protoNode .getProtoDeclaration (); + + // Assign field definitions. + + this [X3DPrototypeInstance_fieldDefinitions] .assign (protoNode .getFieldDefinitions ()); + + // If there is a proto, the externproto is completely loaded. + + if (protoNode .isExternProto) + { + if (protoNode .checkLoadState () !== Base_X3DConstants .COMPLETE_STATE) + { + this [X3DPrototypeInstance_body] = null; + + if (this .isInitialized ()) + Base_X3DChildObject .prototype .addEvent .call (this); + + protoNode ._updateInstances .addInterest ("construct", this); + protoNode .requestImmediateLoad () .catch (Function .prototype); + + return; + } + + for (const protoField of proto .getUserDefinedFields ()) + { + try + { + const field = this .getField (protoField .getName ()); + + // Continue if something is wrong. + if (field .getAccessType () !== protoField .getAccessType ()) + continue; + + // Continue if something is wrong. + if (field .getType () !== protoField .getType ()) + continue; + + // Continue if field is eventIn or eventOut. + if (!field .isInitializable ()) + continue; + + // Is set during parse. + if (field .getModificationTime ()) + continue; + + // Has IS references. + if (field .hasReferences ()) + continue; + + if (field .equals (protoField)) + continue; + + // If default value of protoField is different from field, thus update default value for field. + field .assign (protoField); + } + catch + { + // Definition exists in proto but does not exist in extern proto. + this .addPredefinedField (proto .getFieldDefinitions () .get (protoField .getName ())); + } + } + } + + // Create execution context. + + this [X3DPrototypeInstance_body] = new Execution_X3DExecutionContext (proto .getExecutionContext (), this); + + // Copy proto. + + this .importExternProtos (proto .getBody () .externprotos); + this .importProtos (proto .getBody () .protos); + this .copyRootNodes (proto .getBody () .rootNodes); + this .copyImportedNodes (proto .getBody (), proto .getBody () .getImportedNodes ()); + this .copyRoutes (proto .getBody (), proto .getBody () .routes); + + this [X3DPrototypeInstance_body] .setup (); + + if (this .isInitialized ()) + Base_X3DChildObject .prototype .addEvent .call (this); + + protoNode ._updateInstances .removeInterest ("construct", this); + protoNode ._updateInstances .addInterest ("update", this); + }, + update () + { + // Remove old fields. + + const + oldProtoFields = this [_protoFields], + oldFields = new Map (Array .from (this .getPredefinedFields (), f => [f .getName (), f])); + + for (const field of oldFields .values ()) + this .removePredefinedField (field .getName ()); + + // Add new fields. + + this [_protoFields] = new Map (Array .from (this [_protoNode] .getUserDefinedFields (), f => [f, f .getName ()])); + + for (const fieldDefinition of this [_protoNode] .getFieldDefinitions ()) + this .addPredefinedField (fieldDefinition); + + // Reuse old fields, and therefor routes. + + for (const protoField of this [_protoFields] .keys ()) + { + const oldFieldName = oldProtoFields .get (protoField); + + if (!oldFieldName) + continue; + + const + newField = this .getPredefinedFields () .get (protoField .getName ()), + oldField = oldFields .get (oldFieldName); + + if (!oldField) + continue; + + oldField .addParent (this); + oldField .setAccessType (newField .getAccessType ()); + oldField .setName (newField .getName ()); + + this .getPredefinedFields () .update (newField .getName (), newField .getName (), oldField); + + oldFields .delete (oldFieldName); + newField .dispose (); + } + + for (const oldField of oldFields .values ()) + oldField .dispose (); + + // Construct now. + + this .construct (); + }, + getExtendedEventHandling () + { + return false; + }, + getProtoNode () + { + return this [_protoNode]; + }, + setProtoNode (protoNode) + { + // Disconnect old proto node. + + const oldProtoNode = this [_protoNode]; + + oldProtoNode ._name_changed .removeFieldInterest (this ._typeName_changed); + oldProtoNode ._updateInstances .removeInterest ("construct", this); + oldProtoNode ._updateInstances .removeInterest ("update", this); + + // Get fields from new proto node. + + this [_protoNode] = protoNode; + this [_protoFields] = new Map (Array .from (protoNode .getUserDefinedFields (), f => [f, f .getName ()])); + + protoNode ._name_changed .addFieldInterest (this ._typeName_changed); + + protoNode === oldProtoNode ? this .construct () : this .update (); + }, + getBody () + { + return this [X3DPrototypeInstance_body]; + }, + getInnerNode () + { + if (this [X3DPrototypeInstance_body]) + { + const rootNodes = this [X3DPrototypeInstance_body] .getRootNodes (); + + if (rootNodes .length) + { + const rootNode = rootNodes [0]; + + if (rootNode) + return rootNode .getValue () .getInnerNode (); + } + } + + throw new Error ("Root node not available."); + }, + importExternProtos (externprotos1) + { + const externprotos2 = this [X3DPrototypeInstance_body] .externprotos; + + for (const externproto of externprotos1) + externprotos2 .add (externproto .getName (), externproto); + }, + importProtos (protos1) + { + const protos2 = this [X3DPrototypeInstance_body] .protos; + + for (const proto of protos1) + protos2 .add (proto .getName (), proto); + }, + copyRootNodes (rootNodes1) + { + const rootNodes2 = this [X3DPrototypeInstance_body] .getRootNodes (); + + for (const node of rootNodes1) + rootNodes2 .push (node .copy (this)); + }, + copyImportedNodes (executionContext, importedNodes) + { + for (const importedNode of importedNodes) + { + try + { + const + inlineNode = this [X3DPrototypeInstance_body] .getNamedNode (importedNode .getInlineNode () .getName ()), + importedName = importedNode .getImportedName (), + exportedName = importedNode .getExportedName (); + + this [X3DPrototypeInstance_body] .addImportedNode (inlineNode, exportedName, importedName); + } + catch (error) + { + console .error ("Bad IMPORT specification in copy: ", error); + } + } + }, + copyRoutes (executionContext, routes) + { + for (const route of routes) + { + try + { + const + sourceNode = this [X3DPrototypeInstance_body] .getLocalNode (executionContext .getLocalName (route .sourceNode)), + destinationNode = this [X3DPrototypeInstance_body] .getLocalNode (executionContext .getLocalName (route .destinationNode)); + + this [X3DPrototypeInstance_body] .addRoute (sourceNode, route .sourceField, destinationNode, route .destinationField); + } + catch (error) + { + console .error (error); + } + } + }, + toXMLStream (generator) + { + const sharedNode = generator .IsSharedNode (this); + + generator .EnterScope (); + + const name = generator .Name (this); + + if (name .length) + { + if (generator .ExistsNode (this)) + { + generator .string += generator .Indent (); + generator .string += "" : "/>"; + + generator .LeaveScope (); + return; + } + } + + generator .string += generator .Indent (); + generator .string += "" : "/>"; + } + else + { + generator .string += ">"; + generator .string += generator .TidyBreak (); + + generator .IncIndent (); + + const references = [ ]; + + for (const field of fields) + { + // If the field is a inputOutput and we have as reference only inputOnly or outputOnly we must output the value + // for this field. + + let mustOutputValue = false; + + if (generator .ExecutionContext ()) + { + if (field .getAccessType () === Base_X3DConstants .inputOutput && field .getReferences () .size !== 0) + { + if (![... field .getReferences ()] .some (reference => reference .isInitializable ())) + mustOutputValue = !this .isDefaultValue (field); + } + } + + // If we have no execution context we are not in a proto and must not generate IS references the same is true + // if the node is a shared node as the node does not belong to the execution context. + + if (field .getReferences () .size === 0 || !generator .ExecutionContext () || sharedNode || mustOutputValue) + { + if (mustOutputValue) + references .push (field); + + switch (field .getType ()) + { + case Base_X3DConstants .MFNode: + { + generator .string += generator .Indent (); + generator .string += "" : "/>"; + generator .string += generator .TidyBreak (); + } + else + { + generator .PushContainerField (field); + + generator .string += ">"; + generator .string += generator .TidyBreak (); + + generator .IncIndent (); + + field .toXMLStream (generator); + + generator .string += generator .TidyBreak (); + + generator .DecIndent (); + + generator .string += generator .Indent (); + generator .string += ""; + generator .string += generator .TidyBreak (); + + generator .PopContainerField (); + } + + break; + } + case Base_X3DConstants .SFNode: + { + if (field .getValue () !== null) + { + generator .PushContainerField (null); + + generator .string += generator .Indent (); + generator .string += "" : "/>"; + generator .string += generator .TidyBreak (); + break; + } + } + } + else + { + references .push (field); + } + } + + if (references .length && !sharedNode) + { + generator .string += generator .Indent (); + generator .string += ""; + generator .string += generator .TidyBreak (); + + generator .IncIndent (); + + for (const field of references) + { + const protoFields = field .getReferences (); + + for (const protoField of protoFields) + { + generator .string += generator .Indent (); + generator .string += "" : "/>"; + generator .string += generator .TidyBreak (); + } + } + + generator .DecIndent (); + + generator .string += generator .Indent (); + generator .string += ""; + generator .string += generator .TidyBreak (); + } + + generator .DecIndent (); + + generator .string += generator .Indent (); + generator .string += ""; + } + + generator .LeaveScope (); + }, + toJSONStream (generator) + { + const sharedNode = generator .IsSharedNode (this); + + generator .EnterScope (); + + const name = generator .Name (this); + + if (name .length) + { + if (generator .ExistsNode (this)) + { + generator .string += '{'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += "ProtoInstance"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@name"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (this .getTypeName ()); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@USE"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (name); + generator .string += '"'; + generator .string += generator .TidyBreak (); + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + + generator .LeaveScope (); + return; + } + } + + // Type name + + generator .string += '{'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += "ProtoInstance"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + + // DEF name + + if (name .length) + { + generator .AddNode (this); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@DEF"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (name); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + } + + + // Type name + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@name"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (this .getTypeName ()); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + + // Fields + + const + fields = this .getChangedFields (), + references = [ ]; + + if (fields .length) + { + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "fieldValue"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '['; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + const outputFields = [ ]; + + for (const field of fields) + { + // If the field is a inputOutput and we have as reference only inputOnly or outputOnly we must output the value + // for this field. + + let mustOutputValue = false; + + if (generator .ExecutionContext ()) + { + if (field .getAccessType () === Base_X3DConstants .inputOutput && field .getReferences () .size !== 0) + { + if (![... field .getReferences ()] .some (reference => reference .isInitializable ())) + mustOutputValue = !this .isDefaultValue (field); + } + } + + // If we have no execution context we are not in a proto and must not generate IS references the same is true + // if the node is a shared node as the node does not belong to the execution context. + + if (field .getReferences () .size === 0 || !generator .ExecutionContext () || sharedNode || mustOutputValue) + { + if (mustOutputValue) + references .push (field); + + outputFields .push (field); + } + else + { + references .push (field); + } + } + + for (const field of outputFields) + { + switch (field .getType ()) + { + case Base_X3DConstants .SFNode: + { + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@name"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (field .getName ()); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "-children"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '['; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + + field .toJSONStream (generator); + + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += ']'; + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + break; + } + case Base_X3DConstants .MFNode: + { + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@name"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (field .getName ()); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "-children"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + + field .toJSONStream (generator); + + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + break; + } + default: + { + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@name"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (field .getName ()); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@value"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + + field .toJSONStream (generator); + + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + break; + } + } + + if (field !== outputFields .at (-1)) + generator .string += ','; + + generator .string += generator .TidyBreak (); + } + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += ']'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + + // IS references + + if (references .length && !sharedNode) + { + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "IS"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "connect"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '['; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + for (const field of references) + { + const protoFields = [... field .getReferences ()]; + + for (const protoField of protoFields) + { + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@nodeField"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (field .getName ()); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@protoField"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (protoField .getName ()); + generator .string += '"'; + generator .string += generator .TidyBreak (); + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + + if (field === references .at (-1) && protoField === protoFields .at (-1)) + ; + else + { + generator .string += ','; + } + + generator .string += generator .TidyBreak (); + } + } + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += ']'; + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + generator .string += ','; + generator .string += generator .TidyBreak (); + } + } + + generator .JSONRemoveComma (); + + + // End + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + + generator .LeaveScope (); + }, + dispose () + { + const protoNode = this [_protoNode]; + + protoNode ._name_changed .removeFieldInterest (this ._typeName_changed); + protoNode ._updateInstances .removeInterest ("construct", this); + protoNode ._updateInstances .removeInterest ("update", this); + + this [X3DPrototypeInstance_body] ?.dispose (); + + Core_X3DNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (X3DPrototypeInstance, +{ + typeName: + { + value: "X3DPrototypeInstance", + enumerable: true, + }, + componentName: + { + value: "Core", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, +}); + +const X3DPrototypeInstance_default_ = X3DPrototypeInstance; +; + +x_ite_Namespace .add ("X3DPrototypeInstance", "x_ite/Components/Core/X3DPrototypeInstance", X3DPrototypeInstance_default_); +/* harmony default export */ const Core_X3DPrototypeInstance = (X3DPrototypeInstance_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Core.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + +const Core_default_ = { + name: "Core", + concreteNodes: + [ + Core_MetadataBoolean, + Core_MetadataDouble, + Core_MetadataFloat, + Core_MetadataInteger, + Core_MetadataSet, + Core_MetadataString, + Core_WorldInfo, + ], + abstractNodes: + [ + Core_X3DBindableNode, + Core_X3DChildNode, + Core_X3DInfoNode, + Core_X3DMetadataObject, + Core_X3DNode, + Core_X3DPrototypeInstance, + Core_X3DSensorNode, + ], +}; +; + +x_ite_Namespace .add ("Core", "x_ite/Components/Core", Core_default_); +/* harmony default export */ const Core = (Core_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/X3DGeometricPropertyNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function X3DGeometricPropertyNode (executionContext) +{ + Core_X3DNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DGeometricPropertyNode); +} + +Object .setPrototypeOf (X3DGeometricPropertyNode .prototype, Core_X3DNode .prototype); + +Object .defineProperties (X3DGeometricPropertyNode, +{ + typeName: + { + value: "X3DGeometricPropertyNode", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, +}); + +const X3DGeometricPropertyNode_default_ = X3DGeometricPropertyNode; +; + +x_ite_Namespace .add ("X3DGeometricPropertyNode", "x_ite/Components/Rendering/X3DGeometricPropertyNode", X3DGeometricPropertyNode_default_); +/* harmony default export */ const Rendering_X3DGeometricPropertyNode = (X3DGeometricPropertyNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/EnvironmentalEffects/FogCoordinate.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function FogCoordinate (executionContext) +{ + Rendering_X3DGeometricPropertyNode .call (this, executionContext); + + this .addType (Base_X3DConstants .FogCoordinate); + + this ._depth .setUnit ("length"); +} + +Object .assign (Object .setPrototypeOf (FogCoordinate .prototype, Rendering_X3DGeometricPropertyNode .prototype), +{ + initialize () + { + Rendering_X3DGeometricPropertyNode .prototype .initialize .call (this); + + this ._depth .addInterest ("set_depth__", this); + + this .set_depth__ (); + }, + set_depth__ () + { + this .depth = this ._depth .getValue (); + this .length = this ._depth .length; + }, + isEmpty () + { + return this .length === 0; + }, + getSize () + { + return this .length; + }, + addDepth (index, array) + { + if (index >= 0 && this .length) + { + return array .push (this .depth [index % this .length]); + } + else + { + array .push (0); + } + }, + addDepths (array, min = this .length) + { + const length = this .length; + + if (length) + { + const depth = this .depth; + + for (let index = 0; index < min; ++ index) + array .push (depth [index % length]); + } + else + { + for (let index = 0; index < min; ++ index) + array .push (0); + } + + return array; + }, +}); + +Object .defineProperties (FogCoordinate, +{ + typeName: + { + value: "FogCoordinate", + enumerable: true, + }, + componentName: + { + value: "EnvironmentalEffects", + enumerable: true, + }, + containerField: + { + value: "fogCoord", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "depth", new x_ite_Fields .MFFloat ()), + ]), + enumerable: true, + }, +}); + +const FogCoordinate_default_ = FogCoordinate; +; + +x_ite_Namespace .add ("FogCoordinate", "x_ite/Components/EnvironmentalEffects/FogCoordinate", FogCoordinate_default_); +/* harmony default export */ const EnvironmentalEffects_FogCoordinate = (FogCoordinate_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/EnvironmentalEffects/LocalFog.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function LocalFog (executionContext) +{ + Core_X3DChildNode .call (this, executionContext); + EnvironmentalEffects_X3DFogObject .call (this, executionContext); + + this .addType (Base_X3DConstants .LocalFog); +} + +Object .assign (Object .setPrototypeOf (LocalFog .prototype, Core_X3DChildNode .prototype), + EnvironmentalEffects_X3DFogObject .prototype, +{ + initialize () + { + Core_X3DChildNode .prototype .initialize .call (this); + EnvironmentalEffects_X3DFogObject .prototype .initialize .call (this); + }, + push (renderObject) + { + if (this ._enabled .getValue () && this .getFogType ()) + { + const fogContainer = this .getFogs () .pop (); + + fogContainer .set (this, renderObject .getModelViewMatrix () .get ()); + + renderObject .getLocalFogs () .push (fogContainer); + } + }, + pop (renderObject) + { + if (this ._enabled .getValue () && this .getFogType ()) + this .getBrowser () .getLocalObjects () .push (renderObject .getLocalFogs () .pop ()); + }, + dispose () + { + EnvironmentalEffects_X3DFogObject .prototype .dispose .call (this); + Core_X3DChildNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (LocalFog, +{ + typeName: + { + value: "LocalFog", + enumerable: true, + }, + componentName: + { + value: "EnvironmentalEffects", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "fogType", new x_ite_Fields .SFString ("LINEAR")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "color", new x_ite_Fields .SFColor (1, 1, 1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "visibilityRange", new x_ite_Fields .SFFloat ()), + ]), + enumerable: true, + }, +}); + +const LocalFog_default_ = LocalFog; +; + +x_ite_Namespace .add ("LocalFog", "x_ite/Components/EnvironmentalEffects/LocalFog", LocalFog_default_); +/* harmony default export */ const EnvironmentalEffects_LocalFog = (LocalFog_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/EnvironmentalEffects/TextureBackground.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function TextureBackground (executionContext) +{ + EnvironmentalEffects_X3DBackgroundNode .call (this, executionContext); + + this .addType (Base_X3DConstants .TextureBackground); +} + +Object .assign (Object .setPrototypeOf (TextureBackground .prototype, EnvironmentalEffects_X3DBackgroundNode .prototype), +{ + initialize () + { + EnvironmentalEffects_X3DBackgroundNode .prototype .initialize .call (this); + + this ._frontTexture .addInterest ("set_texture__", this, 0); + this ._backTexture .addInterest ("set_texture__", this, 1); + this ._leftTexture .addInterest ("set_texture__", this, 2); + this ._rightTexture .addInterest ("set_texture__", this, 3); + this ._topTexture .addInterest ("set_texture__", this, 4); + this ._bottomTexture .addInterest ("set_texture__", this, 5); + + this .set_texture__ (0, this ._frontTexture); + this .set_texture__ (1, this ._backTexture); + this .set_texture__ (2, this ._leftTexture); + this .set_texture__ (3, this ._rightTexture); + this .set_texture__ (4, this ._topTexture); + this .set_texture__ (5, this ._bottomTexture); + }, + set_texture__ (index, textureNode) + { + EnvironmentalEffects_X3DBackgroundNode .prototype .set_texture__ .call (this, Base_X3DCast (Base_X3DConstants .X3DTextureNode, textureNode), index); + }, +}); + +Object .defineProperties (TextureBackground, +{ + typeName: + { + value: "TextureBackground", + enumerable: true, + }, + componentName: + { + value: "EnvironmentalEffects", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_bind", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "skyAngle", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "skyColor", new x_ite_Fields .MFColor (new x_ite_Fields .SFColor ())), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "groundAngle", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "groundColor", new x_ite_Fields .MFColor ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "transparency", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isBound", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "bindTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "frontTexture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "backTexture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "leftTexture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "rightTexture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "topTexture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "bottomTexture", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +const TextureBackground_default_ = TextureBackground; +; + +x_ite_Namespace .add ("TextureBackground", "x_ite/Components/EnvironmentalEffects/TextureBackground", TextureBackground_default_); +/* harmony default export */ const EnvironmentalEffects_TextureBackground = (TextureBackground_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/EnvironmentalEffects.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +const EnvironmentalEffects_default_ = { + name: "EnvironmentalEffects", + concreteNodes: + [ + EnvironmentalEffects_Background, + EnvironmentalEffects_Fog, + EnvironmentalEffects_FogCoordinate, + EnvironmentalEffects_LocalFog, + EnvironmentalEffects_TextureBackground, + ], + abstractNodes: + [ + EnvironmentalEffects_X3DBackgroundNode, + EnvironmentalEffects_X3DFogObject, + ], +}; +; + +x_ite_Namespace .add ("EnvironmentalEffects", "x_ite/Components/EnvironmentalEffects", EnvironmentalEffects_default_); +/* harmony default export */ const EnvironmentalEffects = (EnvironmentalEffects_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/EnvironmentalSensor/X3DEnvironmentalSensorNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + +function X3DEnvironmentalSensorNode (executionContext) +{ + Core_X3DSensorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DEnvironmentalSensorNode); + + this .addChildObjects (Base_X3DConstants .outputOnly, "traversed", new x_ite_Fields .SFBool (true)); + + this ._size .setUnit ("length"); + this ._center .setUnit ("length"); + + this .zeroTest = false; + this .currentTraversed = true; +} + +Object .assign (Object .setPrototypeOf (X3DEnvironmentalSensorNode .prototype, Core_X3DSensorNode .prototype), +{ + initialize () + { + Core_X3DSensorNode .prototype .initialize .call (this); + + this .getLive () .addInterest ("set_live__", this); + + this ._enabled .addInterest ("set_live__", this); + this ._size .addInterest ("set_live__", this); + this ._traversed .addInterest ("set_live__", this); + + this .set_live__ (); + }, + set_live__ () + { + if (this ._traversed .getValue () && this .getLive () .getValue () && this ._enabled .getValue () && !(this .zeroTest && this ._size. getValue () .equals (Numbers_Vector3 .Zero))) + { + this .getBrowser () .sensorEvents () .addInterest ("update", this); + } + else + { + this .getBrowser () .sensorEvents () .removeInterest ("update", this); + + if (this ._isActive .getValue ()) + { + this ._isActive = false; + this ._exitTime = this .getBrowser () .getCurrentTime (); + } + } + }, + setZeroTest (value) + { + this .zeroTest = value; + }, + getZeroTest () + { + return this .zeroTest; + }, + setTraversed (value) + { + if (value) + { + if (this ._traversed .getValue () === false) + this ._traversed = true; + } + else + { + if (this .currentTraversed !== this ._traversed .getValue ()) + this ._traversed = this .currentTraversed; + } + + this .currentTraversed = value; + }, + getTraversed () + { + return this .currentTraversed; + }, + update () { }, +}); + +Object .defineProperties (X3DEnvironmentalSensorNode, +{ + typeName: + { + value: "X3DEnvironmentalSensorNode", + enumerable: true, + }, + componentName: + { + value: "EnvironmentalSensor", + enumerable: true, + }, +}); + +const X3DEnvironmentalSensorNode_default_ = X3DEnvironmentalSensorNode; +; + +x_ite_Namespace .add ("X3DEnvironmentalSensorNode", "x_ite/Components/EnvironmentalSensor/X3DEnvironmentalSensorNode", X3DEnvironmentalSensorNode_default_); +/* harmony default export */ const EnvironmentalSensor_X3DEnvironmentalSensorNode = (X3DEnvironmentalSensorNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/EnvironmentalSensor/ProximitySensor.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + +function ProximitySensor (executionContext) +{ + EnvironmentalSensor_X3DEnvironmentalSensorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .ProximitySensor); + + this .setCameraObject (true); + + this ._centerOfRotation_changed .setUnit ("length"); + this ._position_changed .setUnit ("length"); + + this .setZeroTest (true); + + this .min = new Numbers_Vector3 (0, 0, 0); + this .max = new Numbers_Vector3 (0, 0, 0); + this .layerNode = null; + this .modelMatrix = new Numbers_Matrix4 (); + this .inside = false; +} + +Object .assign (Object .setPrototypeOf (ProximitySensor .prototype, EnvironmentalSensor_X3DEnvironmentalSensorNode .prototype), +{ + initialize () + { + EnvironmentalSensor_X3DEnvironmentalSensorNode .prototype .initialize .call (this); + + this ._enabled .addInterest ("set_enabled__", this); + this ._size .addInterest ("set_extents__", this); + this ._center .addInterest ("set_extents__", this); + + this ._traversed .addFieldInterest (this ._isCameraObject); + + this .set_enabled__ (); + this .set_extents__ (); + }, + set_enabled__ () + { + this .setCameraObject (this ._enabled .getValue ()); + + if (this ._enabled .getValue ()) + delete this .traverse; + else + this .traverse = Function .prototype; + }, + set_extents__ () + { + const + s = this ._size .getValue (), + c = this ._center .getValue (), + sx = s .x / 2, + sy = s .y / 2, + sz = s .z / 2, + cx = c .x, + cy = c .y, + cz = c .z; + + this .min .set (cx - sx, cy - sy, cz - sz); + this .max .set (cx + sx, cy + sy, cz + sz); + }, + update: (() => + { + const + position = new Numbers_Vector3 (0, 0, 0), + orientation = new Numbers_Rotation4 (), + centerOfRotation = new Numbers_Vector3 (0, 0, 0), + centerOfRotationMatrix = new Numbers_Matrix4 (); + + return function () + { + if (this .inside && this .getTraversed ()) + { + if (this .layerNode) + { + const + viewpointNode = this .layerNode .getViewpoint (), + invModelMatrix = this .modelMatrix .inverse () + + centerOfRotationMatrix + .assign (viewpointNode .getModelMatrix ()) + .translate (viewpointNode .getUserCenterOfRotation ()) + .multRight (invModelMatrix) + .get (centerOfRotation); + + invModelMatrix + .multLeft (viewpointNode .getCameraSpaceMatrix ()) + .get (position, orientation); + + if (this ._isActive .getValue ()) + { + if (!this ._position_changed .getValue () .equals (position)) + this ._position_changed = position; + + if (!this ._orientation_changed .getValue () .equals (orientation)) + this ._orientation_changed = orientation; + + if (!this ._centerOfRotation_changed .getValue () .equals (centerOfRotation)) + this ._centerOfRotation_changed = centerOfRotation; + } + else + { + this ._isActive = true; + this ._enterTime = this .getBrowser () .getCurrentTime (); + this ._position_changed = position; + this ._orientation_changed = orientation; + this ._centerOfRotation_changed = centerOfRotation; + } + } + } + else + { + if (this ._isActive .getValue ()) + { + this ._isActive = false; + this ._exitTime = this .getBrowser () .getCurrentTime (); + } + } + + this .inside = false; + this .layerNode = null; + + this .setTraversed (false); + }; + })(), + traverse: (() => + { + const + invModelViewMatrix = new Numbers_Matrix4 (), + infinity = new Numbers_Vector3 (-1, -1, -1); + + return function (type, renderObject) + { + switch (type) + { + case Rendering_TraverseType .CAMERA: + { + this .layerNode = renderObject .getLayer (); + this .modelMatrix .assign (renderObject .getModelViewMatrix () .get ()); + return; + } + case Rendering_TraverseType .DISPLAY: + { + this .setTraversed (true); + + if (this .inside) + return; + + if (this ._size .getValue () .equals (infinity)) + { + this .inside = true; + } + else + { + invModelViewMatrix .assign (renderObject .getModelViewMatrix () .get ()) .inverse (); + + this .inside = this .containsPoint (invModelViewMatrix .origin); + } + + return; + } + } + }; + })(), + containsPoint (point) + { + const + min = this .min, + max = this .max; + + return min .x <= point .x && + max .x >= point .x && + min .y <= point .y && + max .y >= point .y && + min .z <= point .z && + max .z >= point .z; + }, +}); + +Object .defineProperties (ProximitySensor, +{ + typeName: + { + value: "ProximitySensor", + enumerable: true, + }, + componentName: + { + value: "EnvironmentalSensor", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "size", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "center", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "enterTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "exitTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "position_changed", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "orientation_changed", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "centerOfRotation_changed", new x_ite_Fields .SFVec3f ()), + ]), + enumerable: true, + }, +}); + +const ProximitySensor_default_ = ProximitySensor; +; + +x_ite_Namespace .add ("ProximitySensor", "x_ite/Components/EnvironmentalSensor/ProximitySensor", ProximitySensor_default_); +/* harmony default export */ const EnvironmentalSensor_ProximitySensor = (ProximitySensor_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/EnvironmentalSensor/TransformSensor.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + +const + ModelMatrixCache = Utility_ObjectCache (Numbers_Matrix4), + TargetMatrixCache = Utility_ObjectCache (Numbers_Matrix4); + +function TransformSensor (executionContext) +{ + EnvironmentalSensor_X3DEnvironmentalSensorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .TransformSensor); + + this ._position_changed .setUnit ("length"); + + this .setZeroTest (true); + + this .min = new Numbers_Vector3 (); + this .max = new Numbers_Vector3 (); + this .targetObjectNode = null; + this .modelMatrices = [ ]; + this .targetMatrices = [ ]; +} + +Object .assign (Object .setPrototypeOf (TransformSensor .prototype, EnvironmentalSensor_X3DEnvironmentalSensorNode .prototype), +{ + initialize () + { + EnvironmentalSensor_X3DEnvironmentalSensorNode .prototype .initialize .call (this); + + this .getLive () .addInterest ("set_enabled__", this); + + this ._enabled .addInterest ("set_enabled__", this); + this ._size .addInterest ("set_enabled__", this); + this ._size .addInterest ("set_extents__", this); + this ._center .addInterest ("set_extents__", this); + this ._targetObject .addInterest ("set_targetObject__", this); + + this .set_extents__ (); + this .set_targetObject__ (); + }, + set_live__ () + { }, + set_enabled__ () + { + if (this .getLive () .getValue () && this .targetObjectNode && this ._enabled .getValue () && !this ._size. getValue () .equals (Numbers_Vector3 .Zero)) + { + this .setPickableObject (true); + this .getBrowser () .addTransformSensor (this); + this .targetObjectNode .addTransformSensor (this); + } + else + { + this .setPickableObject (false); + this .getBrowser () .removeTransformSensor (this); + + if (this .targetObjectNode) + this .targetObjectNode .removeTransformSensor (this); + + if (this ._isActive .getValue ()) + { + this ._isActive = false; + this ._exitTime = this .getBrowser () .getCurrentTime (); + } + } + }, + set_extents__ () + { + const + s = this ._size .getValue (), + c = this ._center .getValue (), + sx = s .x / 2, + sy = s .y / 2, + sz = s .z / 2, + cx = c .x, + cy = c .y, + cz = c .z; + + this .min .set (cx - sx, cy - sy, cz - sz); + this .max .set (cx + sx, cy + sy, cz + sz); + }, + set_targetObject__ () + { + this .targetObjectNode = null; + + try + { + const + node = this ._targetObject .getValue () .getInnerNode (), + type = node .getType (); + + for (let t = type .length - 1; t >= 0; -- t) + { + switch (type [t]) + { + case Base_X3DConstants .X3DGroupingNode: + case Base_X3DConstants .X3DShapeNode: + { + this .targetObjectNode = node; + break; + } + default: + continue; + } + + break; + } + } + catch + { } + + this .set_enabled__ (); + }, + traverse (type, renderObject) + { + // TransformSensor nodes are sorted out and only traversed during PICKING, except if is child of a LOD or Switch node. + + if (type !== Rendering_TraverseType .PICKING) + return; + + if (this .isPickableObject ()) + this .modelMatrices .push (ModelMatrixCache .pop () .assign (renderObject .getModelViewMatrix () .get ())); + }, + collect (targetMatrix) + { + this .targetMatrices .push (TargetMatrixCache .pop () .assign (targetMatrix)); + }, + process: (() => + { + const + position = new Numbers_Vector3 (0, 0, 0), + orientation = new Numbers_Rotation4 (); + + return function () + { + const + modelMatrices = this .modelMatrices, + targetMatrices = this .targetMatrices, + matrix = this .intersects (); + + if (matrix) + { + matrix .get (position, orientation); + + if (this ._isActive .getValue ()) + { + if (!this ._position_changed .getValue () .equals (position)) + this ._position_changed = position; + + if (!this ._orientation_changed .getValue () .equals (orientation)) + this ._orientation_changed = orientation; + } + else + { + this ._isActive = true; + this ._enterTime = this .getBrowser () .getCurrentTime (); + this ._position_changed = position; + this ._orientation_changed = orientation; + } + } + else + { + if (this ._isActive .getValue ()) + { + this ._isActive = false; + this ._exitTime = this .getBrowser () .getCurrentTime (); + } + } + + for (const modelMatrix of modelMatrices) + ModelMatrixCache .push (modelMatrix); + + for (const targetMatrix of targetMatrices) + TargetMatrixCache .push (targetMatrix); + + modelMatrices .length = 0; + targetMatrices .length = 0; + }; + })(), + intersects: (() => + { + const infinity = new Numbers_Vector3 (-1, -1, -1); + + return function () + { + const + modelMatrices = this .modelMatrices, + targetMatrices = this .targetMatrices, + always = this ._size .getValue () .equals (infinity); + + for (const modelMatrix of modelMatrices) + { + const invModelMatrix = modelMatrix .inverse (); + + for (const targetMatrix of targetMatrices) + { + const matrix = targetMatrix .multRight (invModelMatrix); + + if (always || this .containsPoint (matrix .origin)) + { + return matrix; + } + } + } + + return null; + }; + })(), + containsPoint (point) + { + const + min = this .min, + max = this .max; + + return min .x <= point .x && + max .x >= point .x && + min .y <= point .y && + max .y >= point .y && + min .z <= point .z && + max .z >= point .z; + }, +}); + +Object .defineProperties (TransformSensor, +{ + typeName: + { + value: "TransformSensor", + enumerable: true, + }, + componentName: + { + value: "EnvironmentalSensor", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "size", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "center", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "enterTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "exitTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "position_changed", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "orientation_changed", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "targetObject", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +const TransformSensor_default_ = TransformSensor; +; + +x_ite_Namespace .add ("TransformSensor", "x_ite/Components/EnvironmentalSensor/TransformSensor", TransformSensor_default_); +/* harmony default export */ const EnvironmentalSensor_TransformSensor = (TransformSensor_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/EnvironmentalSensor/VisibilitySensor.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + +function VisibilitySensor (executionContext) +{ + EnvironmentalSensor_X3DEnvironmentalSensorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .VisibilitySensor); + + this .setZeroTest (false); + + this .visible = false; +} + +Object .assign (Object .setPrototypeOf (VisibilitySensor .prototype, EnvironmentalSensor_X3DEnvironmentalSensorNode .prototype), +{ + initialize () + { + EnvironmentalSensor_X3DEnvironmentalSensorNode .prototype .initialize .call (this); + + this ._enabled .addInterest ("set_enabled__", this); + + this .set_enabled__ (); + }, + set_enabled__ () + { + if (this ._enabled .getValue ()) + delete this .traverse; + else + this .traverse = Function .prototype; + }, + update () + { + if (this .visible && this .getTraversed ()) + { + if (!this ._isActive .getValue ()) + { + this ._isActive = true; + this ._enterTime = this .getBrowser () .getCurrentTime (); + } + + this .visible = false; + } + else + { + if (this ._isActive .getValue ()) + { + this ._isActive = false; + this ._exitTime = this .getBrowser () .getCurrentTime (); + } + } + + this .setTraversed (false); + }, + traverse: (() => + { + const + bbox = new Geometry_Box3 (), + infinity = new Numbers_Vector3 (-1, -1, -1); + + return function (type, renderObject) + { + if (type !== Rendering_TraverseType .DISPLAY) + return; + + this .setTraversed (true); + + if (this .visible) + return; + + if (this ._size .getValue () .equals (infinity)) + { + this .visible = true; + } + else + { + bbox + .set (this ._size .getValue (), this ._center .getValue ()) + .multRight (renderObject .getModelViewMatrix () .get ()); + + this .visible = renderObject .getViewVolume () .intersectsBox (bbox); + } + }; + })(), +}); + +Object .defineProperties (VisibilitySensor, +{ + typeName: + { + value: "VisibilitySensor", + enumerable: true, + }, + componentName: + { + value: "EnvironmentalSensor", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "size", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "center", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "enterTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "exitTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + ]), + enumerable: true, + }, +}); + +const VisibilitySensor_default_ = VisibilitySensor; +; + +x_ite_Namespace .add ("VisibilitySensor", "x_ite/Components/EnvironmentalSensor/VisibilitySensor", VisibilitySensor_default_); +/* harmony default export */ const EnvironmentalSensor_VisibilitySensor = (VisibilitySensor_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/EnvironmentalSensor.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + +const EnvironmentalSensor_default_ = { + name: "EnvironmentalSensor", + concreteNodes: + [ + EnvironmentalSensor_ProximitySensor, + EnvironmentalSensor_TransformSensor, + EnvironmentalSensor_VisibilitySensor, + ], + abstractNodes: + [ + EnvironmentalSensor_X3DEnvironmentalSensorNode, + ], +}; +; + +x_ite_Namespace .add ("EnvironmentalSensor", "x_ite/Components/EnvironmentalSensor", EnvironmentalSensor_default_); +/* harmony default export */ const EnvironmentalSensor = (EnvironmentalSensor_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Followers/X3DFollowerNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function X3DFollowerNode (executionContext) +{ + Core_X3DChildNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DFollowerNode); + + this .buffer = [ ]; + + // Auxillary variables + this .a = this .getVector (); + this .vector = this .getVector (); +} + +Object .assign (Object .setPrototypeOf (X3DFollowerNode .prototype, Core_X3DChildNode .prototype), +{ + initialize () + { + Core_X3DChildNode .prototype .initialize .call (this); + + this .getLive () .addInterest ("set_live__", this); + }, + getBuffer () + { + return this .buffer; + }, + getValue () + { + return this ._set_value .getValue (); + }, + getDestination () + { + return this ._set_destination .getValue (); + }, + getInitialValue () + { + return this ._initialValue .getValue (); + }, + getInitialDestination () + { + return this ._initialDestination .getValue (); + }, + setValue (value) + { + this ._value_changed = value; + }, + setDestination (value) + { + this .destination .assign (value); + }, + duplicate (value) + { + return value .copy (); + }, + assign (buffer, i, value) + { + buffer [i] .assign (value); + }, + equals (lhs, rhs, tolerance) + { + return this .a .assign (lhs) .subtract (rhs) .magnitude () < tolerance; + }, + interpolate (source, destination, weight) + { + return this .vector .assign (source) .lerp (destination, weight); + }, + set_live__ () + { + if (this .getLive () .getValue () && this ._isActive .getValue ()) + { + this .getBrowser () .prepareEvents () .addInterest ("prepareEvents", this); + this .getBrowser () .addBrowserEvent (); + } + else + this .getBrowser () .prepareEvents () .removeInterest ("prepareEvents", this); + }, + set_active (value) + { + if (value !== this ._isActive .getValue ()) + { + this ._isActive = value; + + this .set_live__ (); + } + }, +}); + +Object .defineProperties (X3DFollowerNode, +{ + typeName: + { + value: "X3DFollowerNode", + enumerable: true, + }, + componentName: + { + value: "Followers", + enumerable: true, + }, +}); + +const X3DFollowerNode_default_ = X3DFollowerNode; +; + +x_ite_Namespace .add ("X3DFollowerNode", "x_ite/Components/Followers/X3DFollowerNode", X3DFollowerNode_default_); +/* harmony default export */ const Followers_X3DFollowerNode = (X3DFollowerNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Followers/X3DChaserNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function X3DChaserNode (executionContext) +{ + Followers_X3DFollowerNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DChaserNode); + + this .destination = null; + this .previousValue = null; + this .bufferEndTime = 0; + this .stepTime = 0; + + // Auxillary variables + this .deltaOut = this .getVector (); +} + +Object .assign (Object .setPrototypeOf (X3DChaserNode .prototype, Followers_X3DFollowerNode .prototype), +{ + initialize () + { + Followers_X3DFollowerNode .prototype .initialize .call (this); + + this ._set_value .addInterest ("set_value__", this); + this ._set_destination .addInterest ("set_destination__", this); + this ._duration .addInterest ("set_duration__", this); + + this .set_duration__ (); + + var + buffer = this .getBuffer (), + initialValue = this .getInitialValue (), + initialDestination = this .getInitialDestination (), + numBuffers = this .getNumBuffers (); + + this .bufferEndTime = this .getBrowser () .getCurrentTime (); + this .previousValue = this .duplicate (initialValue); + + buffer [0] = this .duplicate (initialDestination); + + for (var i = 1; i < numBuffers; ++ i) + buffer [i] = this .duplicate (initialValue); + + this .destination = this .duplicate (initialDestination); + + if (this .equals (initialDestination, initialValue, this .getTolerance ())) + this .setValue (initialDestination); + + else + this .set_active (true); + }, + getNumBuffers () + { + return 60; + }, + getTolerance () + { + return 1e-8; + }, + getArray () + { + return this .getVector (); + }, + setPreviousValue (value) + { + this .previousValue .assign (value); + }, + step (value1, value2, t) + { + this .output .add (this .deltaOut .assign (value1) .subtract (value2) .multiply (t)); + }, + stepResponse (t) + { + if (t <= 0) + return 0; + + var duration = this ._duration .getValue (); + + if (t >= duration) + return 1; + + return 0.5 - 0.5 * Math .cos ((t / duration) * Math .PI); + }, + set_value__ () + { + if (! this ._isActive .getValue ()) + this .bufferEndTime = this .getBrowser () .getCurrentTime (); + + var + buffer = this .getBuffer (), + value = this .getValue (); + + for (var i = 0, length = buffer .length; i < length; ++ i) + this .assign (buffer, i, value); + + this .setPreviousValue (value); + this .setValue (value); + + this .set_active (true); + }, + set_destination__ () + { + this .setDestination (this .getDestination ()); + + if (! this ._isActive .getValue ()) + this .bufferEndTime = this .getBrowser () .getCurrentTime (); + + this .set_active (true); + }, + set_duration__ () + { + this .stepTime = this ._duration .getValue () / this .getNumBuffers (); + }, + prepareEvents () + { + var + buffer = this .getBuffer (), + numBuffers = buffer .length, + fraction = this .updateBuffer (); + + this .output = this .interpolate (this .previousValue, + buffer [numBuffers - 1], + this .stepResponse ((numBuffers - 1 + fraction) * this .stepTime)); + + for (var i = numBuffers - 2; i >= 0; -- i) + { + this .step (buffer [i], buffer [i + 1], this .stepResponse ((i + fraction) * this .stepTime)); + } + + this .setValue (this .output); + + if (this .equals (this .output, this .destination, this .getTolerance ())) + this .set_active (false); + }, + updateBuffer () + { + var + buffer = this .getBuffer (), + numBuffers = buffer .length, + fraction = (this .getBrowser () .getCurrentTime () - this .bufferEndTime) / this .stepTime; + + if (fraction >= 1) + { + var seconds = Math .floor (fraction); + + fraction -= seconds; + + if (seconds < numBuffers) + { + this .setPreviousValue (buffer [numBuffers - seconds]); + + for (var i = numBuffers - 1; i >= seconds; -- i) + { + this .assign (buffer, i, buffer [i - seconds]) + } + + for (var i = 0; i < seconds; ++ i) + { + var alpha = i / seconds; + + this .assign (buffer, i, this .interpolate (this .destination, buffer [seconds], alpha)) + } + } + else + { + this .setPreviousValue (seconds == numBuffers ? buffer [0] : this .destination); + + for (var i = 0; i < numBuffers; ++ i) + this .assign (buffer, i, this .destination); + } + + this .bufferEndTime += seconds * this .stepTime; + } + + return fraction; + }, +}); + +Object .defineProperties (X3DChaserNode, +{ + typeName: + { + value: "X3DChaserNode", + enumerable: true, + }, + componentName: + { + value: "Followers", + enumerable: true, + }, +}); + +const X3DChaserNode_default_ = X3DChaserNode; +; + +x_ite_Namespace .add ("X3DChaserNode", "x_ite/Components/Followers/X3DChaserNode", X3DChaserNode_default_); +/* harmony default export */ const Followers_X3DChaserNode = (X3DChaserNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Followers/ColorChaser.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +var + initialValue = new Numbers_Vector3 (0, 0, 0), + initialDestination = new Numbers_Vector3 (0, 0, 0), + deltaOut = new Numbers_Vector3 (0, 0, 0), + vector = new Numbers_Vector3 (0, 0, 0); + +function ColorChaser (executionContext) +{ + Followers_X3DChaserNode .call (this, executionContext); + + this .addType (Base_X3DConstants .ColorChaser); +} + +Object .assign (Object .setPrototypeOf (ColorChaser .prototype, Followers_X3DChaserNode .prototype), +{ + getVector () + { + return new Numbers_Vector3 (0, 0, 0); + }, + getValue () + { + return this ._set_value .getValue () .getHSV (vector); + }, + getDestination () + { + return this ._set_destination .getValue () .getHSV (vector); + }, + getInitialValue () + { + return this ._initialValue .getValue () .getHSV (initialValue); + }, + getInitialDestination () + { + return this ._initialDestination .getValue () .getHSV (initialDestination); + }, + setValue (value) + { + this ._value_changed .setHSV (value .x, value .y, value .z); + }, + interpolate (source, destination, weight) + { + return Numbers_Color3 .lerp (source, destination, weight, vector); + }, + step (value1, value2, t) + { + deltaOut .assign (this .output) .add (value1) .subtract (value2); + + //step .x = Algorithm .interval (step .x, 0, 2 * Math .PI); + + Numbers_Color3 .lerp (this .output, deltaOut, t, this .output); + }, +}); + +Object .defineProperties (ColorChaser, +{ + typeName: + { + value: "ColorChaser", + enumerable: true, + }, + componentName: + { + value: "Followers", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.3", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_value", new x_ite_Fields .SFColor ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_destination", new x_ite_Fields .SFColor ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialValue", new x_ite_Fields .SFColor (0.8, 0.8, 0.8)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialDestination", new x_ite_Fields .SFColor (0.8, 0.8, 0.8)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "duration", new x_ite_Fields .SFTime (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .SFColor ()), + ]), + enumerable: true, + }, +}); + +const ColorChaser_default_ = ColorChaser; +; + +x_ite_Namespace .add ("ColorChaser", "x_ite/Components/Followers/ColorChaser", ColorChaser_default_); +/* harmony default export */ const Followers_ColorChaser = (ColorChaser_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Followers/X3DDamperNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function X3DDamperNode (executionContext) +{ + Followers_X3DFollowerNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DDamperNode); +} + +Object .assign (Object .setPrototypeOf (X3DDamperNode .prototype, Followers_X3DFollowerNode .prototype), +{ + initialize () + { + Followers_X3DFollowerNode .prototype .initialize .call (this); + + this ._order .addInterest ("set_order__", this); + this ._set_value .addInterest ("set_value__", this); + this ._set_destination .addInterest ("set_destination__", this); + + var + buffer = this .getBuffer (), + initialValue = this .getInitialValue (), + initialDestination = this .getInitialDestination (); + + buffer [0] = this .duplicate (initialDestination); + + for (var i = 1, length = this .getOrder () + 1; i < length; ++ i) + buffer [i] = this .duplicate (initialValue); + + if (this .equals (initialDestination, initialValue, this .getTolerance ())) + this .setValue (initialDestination); + + else + this .set_active (true); + }, + getOrder () + { + return Math_Algorithm .clamp (this ._order .getValue (), 0, 5); + }, + getTolerance () + { + if (this ._tolerance .getValue () < 0) + return 1e-4; + + return this ._tolerance .getValue (); + }, + prepareEvents () + { + var + buffer = this .getBuffer (), + order = buffer .length - 1; + + if (this ._tau .getValue ()) + { + var + delta = 1 / this .getBrowser () .currentFrameRate, + alpha = Math .exp (-delta / this ._tau .getValue ()); + + for (var i = 0; i < order; ++ i) + { + this .assign (buffer, i + 1, this .interpolate (buffer [i], buffer [i + 1], alpha)); + } + + this .setValue (buffer [order]); + + if (! this .equals (buffer [order], buffer [0], this .getTolerance ())) + return; + } + else + { + this .setValue (buffer [0]); + + order = 0; + } + + for (var i = 1, length = buffer .length; i < length; ++ i) + this .assign (buffer, i, buffer [order]); + + this .set_active (false); + }, + set_value__ () + { + var + buffer = this .getBuffer (), + value = this .getValue (); + + for (var i = 1, length = buffer .length; i < length; ++ i) + this .assign (buffer, i, value); + + this .setValue (value); + + this .set_active (true); + }, + set_destination__ () + { + this .assign (this .getBuffer (), 0, this .getDestination ()); + + this .set_active (true); + }, + set_order__ () + { + var + buffer = this .getBuffer (), + value = buffer [buffer .length - 1]; + + for (var i = buffer .length, length = this .getOrder () + 1; i < length; ++ i) + buffer [i] = this .duplicate (value); + + buffer .length = length; + }, +}); + +Object .defineProperties (X3DDamperNode, +{ + typeName: + { + value: "X3DDamperNode", + enumerable: true, + }, + componentName: + { + value: "Followers", + enumerable: true, + }, +}); + +const X3DDamperNode_default_ = X3DDamperNode; +; + +x_ite_Namespace .add ("X3DDamperNode", "x_ite/Components/Followers/X3DDamperNode", X3DDamperNode_default_); +/* harmony default export */ const Followers_X3DDamperNode = (X3DDamperNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Followers/ColorDamper.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +var + ColorDamper_a = new Numbers_Vector3 (0, 0, 0), + ColorDamper_initialValue = new Numbers_Vector3 (0, 0, 0), + ColorDamper_initialDestination = new Numbers_Vector3 (0, 0, 0), + ColorDamper_vector = new Numbers_Vector3 (0, 0, 0); + +function ColorDamper (executionContext) +{ + Followers_X3DDamperNode .call (this, executionContext); + + this .addType (Base_X3DConstants .ColorDamper); +} + +Object .assign (Object .setPrototypeOf (ColorDamper .prototype, Followers_X3DDamperNode .prototype), +{ + getVector () + { + return new Numbers_Vector3 (0, 0, 0); + }, + getValue () + { + return this ._set_value .getValue () .getHSV (ColorDamper_vector); + }, + getDestination () + { + return this ._set_destination .getValue () .getHSV (ColorDamper_vector); + }, + getInitialValue () + { + return this ._initialValue .getValue () .getHSV (ColorDamper_initialValue); + }, + getInitialDestination () + { + return this ._initialDestination .getValue () .getHSV (ColorDamper_initialDestination); + }, + setValue (value) + { + this ._value_changed .setHSV (value .x, value .y, value .z); + }, + equals (lhs, rhs, tolerance) + { + return ColorDamper_a .assign (lhs) .subtract (rhs) .magnitude () < tolerance; + }, + interpolate (source, destination, weight) + { + return Numbers_Color3 .lerp (source, destination, weight, ColorDamper_vector); + }, +}); + +Object .defineProperties (ColorDamper, +{ + typeName: + { + value: "ColorDamper", + enumerable: true, + }, + componentName: + { + value: "Followers", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_value", new x_ite_Fields .SFColor ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_destination", new x_ite_Fields .SFColor ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialValue", new x_ite_Fields .SFColor (0.8, 0.8, 0.8)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialDestination", new x_ite_Fields .SFColor (0.8, 0.8, 0.8)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "order", new x_ite_Fields .SFInt32 (3)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tau", new x_ite_Fields .SFTime (0.3)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tolerance", new x_ite_Fields .SFFloat (-1)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .SFColor ()), + ]), + enumerable: true, + }, +}); + +const ColorDamper_default_ = ColorDamper; +; + +x_ite_Namespace .add ("ColorDamper", "x_ite/Components/Followers/ColorDamper", ColorDamper_default_); +/* harmony default export */ const Followers_ColorDamper = (ColorDamper_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Followers/X3DArrayFollowerTemplate.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +function X3DArrayFollowerTemplate (Type) +{ + function X3DArrayFollowerObject () + { + this .array = this .getArray (); + this .zero = this .getVector (); + } + + Object .assign (X3DArrayFollowerObject .prototype, + { + getArray () + { + const array = [ ]; + + array .assign = function (value) + { + if (Array .isArray (value)) + { + for (var i = 0, length = Math .min (this .length, value .length); i < length; ++ i) + this [i] .assign (value [i]); + + for (var i = length, length = value .length; i < length; ++ i) + this [i] = value [i] .copy (); + + this .length = length; + } + else + { + for (var i = 0, length = Math .min (this .length, value .length); i < length; ++ i) + this [i] .assign (value [i] .getValue ()); + + for (var i = length, length = value .length; i < length; ++ i) + this [i] = value [i] .getValue () .copy (); + + this .length = length; + } + }; + + return array; + }, + getValue () + { + return this ._set_value; + }, + getDestination () + { + return this ._set_destination; + }, + getInitialValue () + { + return this ._initialValue; + }, + getInitialDestination () + { + return this ._initialDestination; + }, + setValue (value) + { + if (Array .isArray (value)) + { + const value_changed = this ._value_changed; + + for (var i = 0, length = value .length; i < length; ++ i) + value_changed [i] = value [i]; + + value_changed .length = length; + } + else + { + this ._value_changed = value; + } + }, + duplicate (value) + { + const array = this .getArray (); + + array .assign (value); + + return array; + }, + equals (lhs, rhs, tolerance) + { + if (lhs .length !== rhs .length) + return false; + + const a = this .a; + + let distance = 0; + + for (let i = 0, length = lhs .length; i < length; ++ i) + distance = Math .max (a .assign (lhs [i]) .subtract (rhs [i]) .magnitude ()); + + return distance < tolerance; + }, + interpolate (source, destination, weight) + { + const array = this .array; + + array .assign (source); + + for (let i = 0, length = array .length; i < length; ++ i) + array [i] .lerp (destination [i] || this .zero, weight); + + return array; + }, + set_destination__ () + { + const + buffers = this .getBuffer (), + l = this ._set_destination .length; + + for (let i = 0, length = buffers .length; i < length; ++ i) + { + const buffer = buffers [i]; + + for (let b = buffer .length; b < l; ++ b) + buffer [b] = this .getVector (); + + buffer .length = l; + } + + Type .prototype .set_destination__ .call (this); + }, + }); + + return X3DArrayFollowerObject; +} + +const X3DArrayFollowerTemplate_default_ = X3DArrayFollowerTemplate; +; + +x_ite_Namespace .add ("X3DArrayFollowerTemplate", "x_ite/Browser/Followers/X3DArrayFollowerTemplate", X3DArrayFollowerTemplate_default_); +/* harmony default export */ const Followers_X3DArrayFollowerTemplate = (X3DArrayFollowerTemplate_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Followers/X3DArrayChaserTemplate.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function X3DArrayChaserTemplate (Type) +{ + const X3DArrayFollower = Followers_X3DArrayFollowerTemplate (Type); + + function X3DArrayChaserObject () + { + X3DArrayFollower .call (this); + + this .array = this .getArray (); + } + + Object .assign (X3DArrayChaserObject .prototype, + X3DArrayFollower .prototype, + { + step (value1, value2, t) + { + const + output = this .output, + deltaOut = this .deltaOut; + + for (let i = 0, length = output .length; i < length; ++ i) + output [i] .add (deltaOut .assign (value1 [i] || this .zero) .subtract (value2 [i] || this .zero) .multiply (t)); + }, + }); + + return X3DArrayChaserObject; +} + +const X3DArrayChaserTemplate_default_ = X3DArrayChaserTemplate; +; + +x_ite_Namespace .add ("X3DArrayChaserTemplate", "x_ite/Browser/Followers/X3DArrayChaserTemplate", X3DArrayChaserTemplate_default_); +/* harmony default export */ const Followers_X3DArrayChaserTemplate = (X3DArrayChaserTemplate_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Followers/CoordinateChaser.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +var X3DArrayChaserObject = Followers_X3DArrayChaserTemplate (Followers_X3DChaserNode); + +function CoordinateChaser (executionContext) +{ + Followers_X3DChaserNode .call (this, executionContext); + X3DArrayChaserObject .call (this, executionContext); + + this .addType (Base_X3DConstants .CoordinateChaser); +} + +Object .assign (Object .setPrototypeOf (CoordinateChaser .prototype, Followers_X3DChaserNode .prototype), + X3DArrayChaserObject .prototype, +{ + getVector () + { + return new Numbers_Vector3 (0, 0, 0); + }, +}); + +Object .defineProperties (CoordinateChaser, +{ + typeName: + { + value: "CoordinateChaser", + enumerable: true, + }, + componentName: + { + value: "Followers", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.3", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_value", new x_ite_Fields .MFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_destination", new x_ite_Fields .MFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialValue", new x_ite_Fields .MFVec3f (new Numbers_Vector3 (0, 0, 0))), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialDestination", new x_ite_Fields .MFVec3f (new Numbers_Vector3 (0, 0, 0))), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "duration", new x_ite_Fields .SFTime (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .MFVec3f ()), + ]), + enumerable: true, + }, +}); + +const CoordinateChaser_default_ = CoordinateChaser; +; + +x_ite_Namespace .add ("CoordinateChaser", "x_ite/Components/Followers/CoordinateChaser", CoordinateChaser_default_); +/* harmony default export */ const Followers_CoordinateChaser = (CoordinateChaser_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Followers/CoordinateDamper.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +var X3DArrayFollowerObject = Followers_X3DArrayFollowerTemplate (Followers_X3DDamperNode); + +function CoordinateDamper (executionContext) +{ + Followers_X3DDamperNode .call (this, executionContext); + X3DArrayFollowerObject .call (this, executionContext); + + this .addType (Base_X3DConstants .CoordinateDamper); +} + +Object .assign (Object .setPrototypeOf (CoordinateDamper .prototype, Followers_X3DDamperNode .prototype), + X3DArrayFollowerObject .prototype, +{ + getVector () + { + return new Numbers_Vector3 (0, 0, 0); + }, +}); + +Object .defineProperties (CoordinateDamper, +{ + typeName: + { + value: "CoordinateDamper", + enumerable: true, + }, + componentName: + { + value: "Followers", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_value", new x_ite_Fields .MFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_destination", new x_ite_Fields .MFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialValue", new x_ite_Fields .MFVec3f (new Numbers_Vector3 (0, 0, 0))), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialDestination", new x_ite_Fields .MFVec3f (new Numbers_Vector3 (0, 0, 0))), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "order", new x_ite_Fields .SFInt32 (3)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tau", new x_ite_Fields .SFTime (0.3)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tolerance", new x_ite_Fields .SFFloat (-1)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .MFVec3f ()), + ]), + enumerable: true, + }, +}); + +const CoordinateDamper_default_ = CoordinateDamper; +; + +x_ite_Namespace .add ("CoordinateDamper", "x_ite/Components/Followers/CoordinateDamper", CoordinateDamper_default_); +/* harmony default export */ const Followers_CoordinateDamper = (CoordinateDamper_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Followers/OrientationChaser.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +var + OrientationChaser_a = new Numbers_Rotation4 (), + rotation = new Numbers_Rotation4 (); + +function OrientationChaser (executionContext) +{ + Followers_X3DChaserNode .call (this, executionContext); + + this .addType (Base_X3DConstants .OrientationChaser); + + this ._set_value .setUnit ("angle"); + this ._set_destination .setUnit ("angle"); + this ._initialValue .setUnit ("angle"); + this ._initialDestination .setUnit ("angle"); + this ._value_changed .setUnit ("angle"); +} + +Object .assign (Object .setPrototypeOf (OrientationChaser .prototype, Followers_X3DChaserNode .prototype), +{ + getVector () + { + return new Numbers_Rotation4 (); + }, + equals (lhs, rhs, tolerance) + { + OrientationChaser_a .assign (lhs) .inverse () .multRight (rhs); + + return Math .abs (OrientationChaser_a .angle) < tolerance; + }, + interpolate (source, destination, weight) + { + return rotation .assign (source) .slerp (destination, weight); + }, + step (value1, value2, t) + { + this .deltaOut .assign (value2) .inverse () .multRight (value1) .multLeft (this .output); + + this .output .slerp (this .deltaOut, t); + }, +}); + +Object .defineProperties (OrientationChaser, +{ + typeName: + { + value: "OrientationChaser", + enumerable: true, + }, + componentName: + { + value: "Followers", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_value", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_destination", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialValue", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialDestination", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "duration", new x_ite_Fields .SFTime (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .SFRotation ()), + ]), + enumerable: true, + }, +}); + +const OrientationChaser_default_ = OrientationChaser; +; + +x_ite_Namespace .add ("OrientationChaser", "x_ite/Components/Followers/OrientationChaser", OrientationChaser_default_); +/* harmony default export */ const Followers_OrientationChaser = (OrientationChaser_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Followers/OrientationDamper.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +var + OrientationDamper_a = new Numbers_Rotation4 (), + OrientationDamper_rotation = new Numbers_Rotation4 (); + +function OrientationDamper (executionContext) +{ + Followers_X3DDamperNode .call (this, executionContext); + + this .addType (Base_X3DConstants .OrientationDamper); + + this ._set_value .setUnit ("angle"); + this ._set_destination .setUnit ("angle"); + this ._initialValue .setUnit ("angle"); + this ._initialDestination .setUnit ("angle"); + this ._value_changed .setUnit ("angle"); +} + +Object .assign (Object .setPrototypeOf (OrientationDamper .prototype, Followers_X3DDamperNode .prototype), +{ + getVector () + { + return new Numbers_Rotation4 (); + }, + equals (lhs, rhs, tolerance) + { + OrientationDamper_a .assign (lhs) .inverse () .multRight (rhs); + + return Math .abs (OrientationDamper_a .angle) < tolerance; + }, + interpolate (source, destination, weight) + { + return OrientationDamper_rotation .assign (source) .slerp (destination, weight); + }, +}); + +Object .defineProperties (OrientationDamper, +{ + typeName: + { + value: "OrientationDamper", + enumerable: true, + }, + componentName: + { + value: "Followers", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_value", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_destination", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialValue", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialDestination", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "order", new x_ite_Fields .SFInt32 (3)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tau", new x_ite_Fields .SFTime (0.3)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tolerance", new x_ite_Fields .SFFloat (-1)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .SFRotation ()), + ]), + enumerable: true, + }, +}); + +const OrientationDamper_default_ = OrientationDamper; +; + +x_ite_Namespace .add ("OrientationDamper", "x_ite/Components/Followers/OrientationDamper", OrientationDamper_default_); +/* harmony default export */ const Followers_OrientationDamper = (OrientationDamper_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Followers/PositionChaser.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function PositionChaser (executionContext) +{ + Followers_X3DChaserNode .call (this, executionContext); + + this .addType (Base_X3DConstants .PositionChaser); +} + +Object .assign (Object .setPrototypeOf (PositionChaser .prototype, Followers_X3DChaserNode .prototype), +{ + getVector () + { + return new Numbers_Vector3 (0, 0, 0); + }, +}); + +Object .defineProperties (PositionChaser, +{ + typeName: + { + value: "PositionChaser", + enumerable: true, + }, + componentName: + { + value: "Followers", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_value", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_destination", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialValue", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialDestination", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "duration", new x_ite_Fields .SFTime (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .SFVec3f ()), + ]), + enumerable: true, + }, +}); + +const PositionChaser_default_ = PositionChaser; +; + +x_ite_Namespace .add ("PositionChaser", "x_ite/Components/Followers/PositionChaser", PositionChaser_default_); +/* harmony default export */ const Followers_PositionChaser = (PositionChaser_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Followers/PositionChaser2D.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function PositionChaser2D (executionContext) +{ + Followers_X3DChaserNode .call (this, executionContext); + + this .addType (Base_X3DConstants .PositionChaser2D); +} + +Object .assign (Object .setPrototypeOf (PositionChaser2D .prototype, Followers_X3DChaserNode .prototype), +{ + getVector () + { + return new Numbers_Vector2 (0, 0); + }, +}); + +Object .defineProperties (PositionChaser2D, +{ + typeName: + { + value: "PositionChaser2D", + enumerable: true, + }, + componentName: + { + value: "Followers", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_value", new x_ite_Fields .SFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_destination", new x_ite_Fields .SFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialValue", new x_ite_Fields .SFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialDestination", new x_ite_Fields .SFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "duration", new x_ite_Fields .SFTime (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .SFVec2f ()), + ]), + enumerable: true, + }, +}); + +const PositionChaser2D_default_ = PositionChaser2D; +; + +x_ite_Namespace .add ("PositionChaser2D", "x_ite/Components/Followers/PositionChaser2D", PositionChaser2D_default_); +/* harmony default export */ const Followers_PositionChaser2D = (PositionChaser2D_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Followers/PositionDamper.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function PositionDamper (executionContext) +{ + Followers_X3DDamperNode .call (this, executionContext); + + this .addType (Base_X3DConstants .PositionDamper); +} + +Object .assign (Object .setPrototypeOf (PositionDamper .prototype, Followers_X3DDamperNode .prototype), +{ + getVector () + { + return new Numbers_Vector3 (0, 0, 0); + }, +}); + +Object .defineProperties (PositionDamper, +{ + typeName: + { + value: "PositionDamper", + enumerable: true, + }, + componentName: + { + value: "Followers", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_value", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_destination", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialValue", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialDestination", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "order", new x_ite_Fields .SFInt32 (3)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tolerance", new x_ite_Fields .SFFloat (-1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tau", new x_ite_Fields .SFTime (0.3)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + ]), + enumerable: true, + }, +}); + +const PositionDamper_default_ = PositionDamper; +; + +x_ite_Namespace .add ("PositionDamper", "x_ite/Components/Followers/PositionDamper", PositionDamper_default_); +/* harmony default export */ const Followers_PositionDamper = (PositionDamper_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Followers/PositionDamper2D.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function PositionDamper2D (executionContext) +{ + Followers_X3DDamperNode .call (this, executionContext); + + this .addType (Base_X3DConstants .PositionDamper2D); +} + +Object .assign (Object .setPrototypeOf (PositionDamper2D .prototype, Followers_X3DDamperNode .prototype), +{ + getVector () + { + return new Numbers_Vector2 (0, 0); + }, +}); + +Object .defineProperties (PositionDamper2D, +{ + typeName: + { + value: "PositionDamper2D", + enumerable: true, + }, + componentName: + { + value: "Followers", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_value", new x_ite_Fields .SFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_destination", new x_ite_Fields .SFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialValue", new x_ite_Fields .SFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialDestination", new x_ite_Fields .SFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "order", new x_ite_Fields .SFInt32 (3)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tau", new x_ite_Fields .SFTime (0.3)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tolerance", new x_ite_Fields .SFFloat (-1)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .SFVec2f ()), + ]), + enumerable: true, + }, +}); + +const PositionDamper2D_default_ = PositionDamper2D; +; + +x_ite_Namespace .add ("PositionDamper2D", "x_ite/Components/Followers/PositionDamper2D", PositionDamper2D_default_); +/* harmony default export */ const Followers_PositionDamper2D = (PositionDamper2D_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Followers/ScalarChaser.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function ScalarChaser (executionContext) +{ + Followers_X3DChaserNode .call (this, executionContext); + + this .addType (Base_X3DConstants .ScalarChaser); +} + +Object .assign (Object .setPrototypeOf (ScalarChaser .prototype, Followers_X3DChaserNode .prototype), +{ + getVector () + { + return 0; + }, + setPreviousValue (value) + { + this .previousValue = value; + }, + setDestination (value) + { + this .destination = value; + }, + duplicate (value) + { + return value; + }, + assign (buffer, i, value) + { + buffer [i] = value; + }, + equals (lhs, rhs, tolerance) + { + return Math .abs (lhs - rhs) < tolerance; + }, + interpolate (source, destination, weight) + { + return Math_Algorithm .lerp (source, destination, weight); + }, + step (value1, value2, t) + { + this .output += (value1 - value2) * t; + }, +}); + +Object .defineProperties (ScalarChaser, +{ + typeName: + { + value: "ScalarChaser", + enumerable: true, + }, + componentName: + { + value: "Followers", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_value", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_destination", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialValue", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialDestination", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "duration", new x_ite_Fields .SFTime (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .SFFloat ()), + ]), + enumerable: true, + }, +}); + +const ScalarChaser_default_ = ScalarChaser; +; + +x_ite_Namespace .add ("ScalarChaser", "x_ite/Components/Followers/ScalarChaser", ScalarChaser_default_); +/* harmony default export */ const Followers_ScalarChaser = (ScalarChaser_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Followers/ScalarDamper.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function ScalarDamper (executionContext) +{ + Followers_X3DDamperNode .call (this, executionContext); + + this .addType (Base_X3DConstants .ScalarDamper); +} + +Object .assign (Object .setPrototypeOf (ScalarDamper .prototype, Followers_X3DDamperNode .prototype), +{ + getVector () + { + return 0; + }, + duplicate (value) + { + return value; + }, + assign (buffer, i, value) + { + buffer [i] = value; + }, + equals (lhs, rhs, tolerance) + { + return Math .abs (lhs - rhs) < tolerance; + }, + interpolate (source, destination, weight) + { + return Math_Algorithm .lerp (source, destination, weight); + }, +}); + +Object .defineProperties (ScalarDamper, +{ + typeName: + { + value: "ScalarDamper", + enumerable: true, + }, + componentName: + { + value: "Followers", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.3", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_value", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_destination", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialValue", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialDestination", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "order", new x_ite_Fields .SFInt32 (3)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tau", new x_ite_Fields .SFTime (0.3)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tolerance", new x_ite_Fields .SFFloat (-1)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .SFFloat ()), + ]), + enumerable: true, + }, +}); + +const ScalarDamper_default_ = ScalarDamper; +; + +x_ite_Namespace .add ("ScalarDamper", "x_ite/Components/Followers/ScalarDamper", ScalarDamper_default_); +/* harmony default export */ const Followers_ScalarDamper = (ScalarDamper_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Followers/TexCoordChaser2D.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +var TexCoordChaser2D_X3DArrayChaserObject = Followers_X3DArrayChaserTemplate (Followers_X3DChaserNode); + +function TexCoordChaser2D (executionContext) +{ + Followers_X3DChaserNode .call (this, executionContext); + TexCoordChaser2D_X3DArrayChaserObject .call (this, executionContext); + + this .addType (Base_X3DConstants .TexCoordChaser2D); +} + +Object .assign (Object .setPrototypeOf (TexCoordChaser2D .prototype, Followers_X3DChaserNode .prototype), + TexCoordChaser2D_X3DArrayChaserObject .prototype, +{ + getVector () + { + return new Numbers_Vector2 (0, 0); + }, +}); + +Object .defineProperties (TexCoordChaser2D, +{ + typeName: + { + value: "TexCoordChaser2D", + enumerable: true, + }, + componentName: + { + value: "Followers", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.3", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_value", new x_ite_Fields .MFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_destination", new x_ite_Fields .MFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialValue", new x_ite_Fields .MFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialDestination", new x_ite_Fields .MFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "duration", new x_ite_Fields .SFTime (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .MFVec2f ()), + ]), + enumerable: true, + }, +}); + +const TexCoordChaser2D_default_ = TexCoordChaser2D; +; + +x_ite_Namespace .add ("TexCoordChaser2D", "x_ite/Components/Followers/TexCoordChaser2D", TexCoordChaser2D_default_); +/* harmony default export */ const Followers_TexCoordChaser2D = (TexCoordChaser2D_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Followers/TexCoordDamper2D.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +var TexCoordDamper2D_X3DArrayFollowerObject = Followers_X3DArrayFollowerTemplate (Followers_X3DDamperNode); + +function TexCoordDamper2D (executionContext) +{ + Followers_X3DDamperNode .call (this, executionContext); + TexCoordDamper2D_X3DArrayFollowerObject .call (this, executionContext); + + this .addType (Base_X3DConstants .TexCoordDamper2D); +} + +Object .assign (Object .setPrototypeOf (TexCoordDamper2D .prototype, Followers_X3DDamperNode .prototype), + TexCoordDamper2D_X3DArrayFollowerObject .prototype, +{ + getVector () + { + return new Numbers_Vector2 (0, 0, 0); + }, +}); + +Object .defineProperties (TexCoordDamper2D, +{ + typeName: + { + value: "TexCoordDamper2D", + enumerable: true, + }, + componentName: + { + value: "Followers", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_value", new x_ite_Fields .MFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_destination", new x_ite_Fields .MFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialValue", new x_ite_Fields .MFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "initialDestination", new x_ite_Fields .MFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "order", new x_ite_Fields .SFInt32 (3)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tau", new x_ite_Fields .SFTime (0.3)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tolerance", new x_ite_Fields .SFFloat (-1)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .MFVec2f ()), + ]), + enumerable: true, + }, +}); + +const TexCoordDamper2D_default_ = TexCoordDamper2D; +; + +x_ite_Namespace .add ("TexCoordDamper2D", "x_ite/Components/Followers/TexCoordDamper2D", TexCoordDamper2D_default_); +/* harmony default export */ const Followers_TexCoordDamper2D = (TexCoordDamper2D_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Followers.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + + + + +const Followers_default_ = { + name: "Followers", + concreteNodes: + [ + Followers_ColorChaser, + Followers_ColorDamper, + Followers_CoordinateChaser, + Followers_CoordinateDamper, + Followers_OrientationChaser, + Followers_OrientationDamper, + Followers_PositionChaser, + Followers_PositionChaser2D, + Followers_PositionDamper, + Followers_PositionDamper2D, + Followers_ScalarChaser, + Followers_ScalarDamper, + Followers_TexCoordChaser2D, + Followers_TexCoordDamper2D, + ], + abstractNodes: + [ + Followers_X3DChaserNode, + Followers_X3DDamperNode, + Followers_X3DFollowerNode, + ], +}; +; + +x_ite_Namespace .add ("Followers", "x_ite/Components/Followers", Followers_default_); +/* harmony default export */ const Followers = (Followers_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Geometry3D/Box.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function Box (executionContext) +{ + Rendering_X3DGeometryNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Box); + + this ._size .setUnit ("length"); +} + +Object .assign (Object .setPrototypeOf (Box .prototype, Rendering_X3DGeometryNode .prototype), +{ + build: (() => + { + const defaultSize = new Numbers_Vector3 (2, 2, 2); + + return function () + { + const + options = this .getBrowser () .getBoxOptions (), + geometry = options .getGeometry (), + size = this ._size .getValue (); + + this .setMultiTexCoords (geometry .getMultiTexCoords ()); + this .setNormals (geometry .getNormals ()); + + if (size .equals (defaultSize)) + { + this .setVertices (geometry .getVertices ()); + + this .getMin () .assign (geometry .getMin ()); + this .getMax () .assign (geometry .getMax ()); + } + else + { + const + x = Math .abs (size .x / 2), + y = Math .abs (size .y / 2), + z = Math .abs (size .z / 2), + defaultVertices = geometry .getVertices () .getValue (), + vertexArray = this .getVertices (); + + for (let i = 0, length = defaultVertices .length; i < length; i += 4) + { + vertexArray .push (x * defaultVertices [i], + y * defaultVertices [i + 1], + z * defaultVertices [i + 2], + 1); + } + + this .getMin () .set (-x, -y, -z); + this .getMax () .set ( x, y, z); + } + + this .setSolid (this ._solid .getValue ()); + }; + })(), +}); + +Object .defineProperties (Box, +{ + typeName: + { + value: "Box", + enumerable: true, + }, + componentName: + { + value: "Geometry3D", + enumerable: true, + }, + containerField: + { + value: "geometry", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "size", new x_ite_Fields .SFVec3f (2, 2, 2)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "solid", new x_ite_Fields .SFBool (true)), + ]), + enumerable: true, + }, +}); + +const Box_default_ = Box; +; + +x_ite_Namespace .add ("Box", "x_ite/Components/Geometry3D/Box", Box_default_); +/* harmony default export */ const Geometry3D_Box = (Box_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Geometry3D/Cone.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + +function Cone (executionContext) +{ + Rendering_X3DGeometryNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Cone); + + this ._height .setUnit ("length"); + this ._bottomRadius .setUnit ("length"); +} + +Object .assign (Object .setPrototypeOf (Cone .prototype, Rendering_X3DGeometryNode .prototype), +{ + set_live__ () + { + Rendering_X3DGeometryNode .prototype .set_live__ .call (this); + + if (this .getLive () .getValue ()) + this .getBrowser () .getConeOptions () .addInterest ("requestRebuild", this); + else + this .getBrowser () .getConeOptions () .removeInterest ("requestRebuild", this); + }, + build () + { + const + options = this .getBrowser () .getConeOptions (), + xDimension = options ._xDimension .getValue (), + height = this ._height .getValue (), + bottomRadius = this ._bottomRadius .getValue (), + texCoordArray = this .getTexCoords (), + normalArray = this .getNormals (), + vertexArray = this .getVertices (); + + this .getMultiTexCoords () .push (texCoordArray); + + const + y1 = height / 2, + y2 = -y1, + nz = Numbers_Complex .Polar (1, -Math .PI / 2 + Math .atan (bottomRadius / height)); + + if (this ._side .getValue ()) + { + for (let i = 0; i < xDimension; ++ i) + { + const + u1 = (i + 0.5) / xDimension, + theta1 = 2 * Math .PI * u1, + n1 = Numbers_Complex .Polar (nz .imag, theta1); + + const + u2 = i / xDimension, + theta2 = 2 * Math .PI * u2, + p2 = Numbers_Complex .Polar (-bottomRadius, theta2), + n2 = Numbers_Complex .Polar (nz .imag, theta2); + + const + u3 = (i + 1) / xDimension, + theta3 = 2 * Math .PI * u3, + p3 = Numbers_Complex .Polar (-bottomRadius, theta3), + n3 = Numbers_Complex .Polar (nz .imag, theta3); + + /* p1 + * / \ + * / \ + * p2 -- p3 + */ + + // p1 + texCoordArray .push (u1, 1, 0, 1); + normalArray .push (n1 .imag, nz .real, n1 .real); + vertexArray .push (0, y1, 0, 1); + + // p2 + texCoordArray .push (u2, 0, 0, 1); + normalArray .push (n2 .imag, nz .real, n2 .real); + vertexArray .push (p2 .imag, y2, p2 .real, 1); + + // p3 + texCoordArray .push (u3, 0, 0, 1); + normalArray .push (n3 .imag , nz .real, n3 .real); + vertexArray .push (p3 .imag, y2, p3 .real, 1); + } + } + + if (this ._bottom .getValue ()) + { + const + texCoord = [ ], + points = [ ]; + + for (let i = xDimension - 1; i > -1; -- i) + { + const + u = i / xDimension, + theta = 2 * Math .PI * u, + t = Numbers_Complex .Polar (-1, theta), + p = t .copy () .multiply (bottomRadius); + + texCoord .push (new Numbers_Vector2 ((t .imag + 1) / 2, (t .real + 1) / 2)); + points .push (new Numbers_Vector3 (p .imag, y2, p .real)); + } + + const + t0 = texCoord [0], + p0 = points [0]; + + for (let i = 1, length = points .length - 1; i < length; ++ i) + { + const + t1 = texCoord [i], + t2 = texCoord [i + 1], + p1 = points [i], + p2 = points [i + 1]; + + texCoordArray .push (t0 .x, t0 .y, 0, 1); + normalArray .push (0, -1, 0); + vertexArray .push (p0 .x, p0 .y, p0 .z, 1); + + texCoordArray .push (t1 .x, t1 .y, 0, 1); + normalArray .push (0, -1, 0); + vertexArray .push (p1 .x, p1 .y, p1 .z, 1); + + texCoordArray .push (t2 .x, t2 .y, 0, 1); + normalArray .push (0, -1, 0); + vertexArray .push (p2 .x, p2 .y, p2 .z, 1); + } + } + + this .setSolid (this ._solid .getValue ()); + this .setExtents (); + }, + setExtents () + { + const + bottomRadius = this ._bottomRadius .getValue (), + y1 = this ._height .getValue () / 2, + y2 = -y1; + + if (!this ._side .getValue () && !this ._bottom .getValue ()) + { + this .getMin () .set (0, 0, 0); + this .getMax () .set (0, 0, 0); + } + else if (! this ._side .getValue ()) + { + this .getMin () .set (-bottomRadius, y2, -bottomRadius); + this .getMax () .set ( bottomRadius, y2, bottomRadius); + } + else + { + this .getMin () .set (-bottomRadius, y2, -bottomRadius); + this .getMax () .set ( bottomRadius, y1, bottomRadius); + } + }, +}); + +Object .defineProperties (Cone, +{ + typeName: + { + value: "Cone", + enumerable: true, + }, + componentName: + { + value: "Geometry3D", + enumerable: true, + }, + containerField: + { + value: "geometry", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "side", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "bottom", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "height", new x_ite_Fields .SFFloat (2)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bottomRadius", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "solid", new x_ite_Fields .SFBool (true)), + ]), + enumerable: true, + }, +}); + +const Cone_default_ = Cone; +; + +x_ite_Namespace .add ("Cone", "x_ite/Components/Geometry3D/Cone", Cone_default_); +/* harmony default export */ const Geometry3D_Cone = (Cone_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Geometry3D/Cylinder.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + +function Cylinder (executionContext) +{ + Rendering_X3DGeometryNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Cylinder); + + this ._height .setUnit ("length"); + this ._radius .setUnit ("length"); +} + +Object .assign (Object .setPrototypeOf (Cylinder .prototype, Rendering_X3DGeometryNode .prototype), +{ + set_live__ () + { + Rendering_X3DGeometryNode .prototype .set_live__ .call (this); + + if (this .getLive () .getValue ()) + this .getBrowser () .getCylinderOptions () .addInterest ("requestRebuild", this); + else + this .getBrowser () .getCylinderOptions () .removeInterest ("requestRebuild", this); + }, + build () + { + const + options = this .getBrowser () .getCylinderOptions (), + xDimension = options ._xDimension .getValue (), + texCoordArray = this .getTexCoords (), + normalArray = this .getNormals (), + vertexArray = this .getVertices (); + + this .getMultiTexCoords () .push (texCoordArray); + + const + radius = this ._radius .getValue (), + y1 = this ._height .getValue () / 2, + y2 = -y1; + + if (this ._side .getValue ()) + { + for (let i = 0; i < xDimension; ++ i) + { + const + u1 = i / xDimension, + theta1 = 2 * Math .PI * u1, + n1 = Numbers_Complex .Polar (-1, theta1), + p1 = n1 .copy () .multiply (radius); + + const + u2 = (i + 1) / xDimension, + theta2 = 2 * Math .PI * u2, + n2 = Numbers_Complex .Polar (-1, theta2), + p2 = n2 .copy () .multiply (radius); + + // p1 - p4 + // | \ | + // p2 - p3 + + // Triangle one + + // p1 + texCoordArray .push (u1, 1, 0, 1); + normalArray .push (n1 .imag, 0, n1 .real); + vertexArray .push (p1 .imag, y1, p1 .real, 1); + + // p2 + texCoordArray .push (u1, 0, 0, 1); + normalArray .push (n1 .imag, 0, n1 .real); + vertexArray .push (p1 .imag, y2, p1 .real, 1); + + // p3 + texCoordArray .push (u2, 0, 0, 1); + normalArray .push (n2 .imag, 0, n2 .real); + vertexArray .push (p2 .imag, y2, p2 .real, 1); + + // Triangle two + + // p1 + texCoordArray .push (u1, 1, 0, 1); + normalArray .push (n1 .imag, 0, n1 .real); + vertexArray .push (p1 .imag, y1, p1 .real, 1); + + // p3 + texCoordArray .push (u2, 0, 0, 1); + normalArray .push (n2 .imag, 0, n2 .real); + vertexArray .push (p2 .imag, y2, p2 .real, 1); + + // p4 + texCoordArray .push (u2, 1, 0, 1); + normalArray .push (n2 .imag, 0, n2 .real); + vertexArray .push (p2 .imag, y1, p2 .real, 1); + } + } + + if (this ._top .getValue ()) + { + const + texCoord = [ ], + points = [ ]; + + for (let i = 0; i < xDimension; ++ i) + { + const + u = i / xDimension, + theta = 2 * Math .PI * u, + t = Numbers_Complex .Polar (-1, theta); + + texCoord .push (new Numbers_Vector2 ((t .imag + 1) / 2, -(t .real - 1) / 2)); + points .push (new Numbers_Vector3 (t .imag * radius, y1, t .real * radius)); + } + + const + t0 = texCoord [0], + p0 = points [0]; + + for (let i = 1, length = points .length - 1; i < length; ++ i) + { + const + t1 = texCoord [i], + t2 = texCoord [i + 1], + p1 = points [i], + p2 = points [i + 1]; + + texCoordArray .push (t0 .x, t0 .y, 0, 1); + normalArray .push (0, 1, 0); + vertexArray .push (p0 .x, p0 .y, p0 .z, 1); + + texCoordArray .push (t1 .x, t1 .y, 0, 1); + normalArray .push (0, 1, 0); + vertexArray .push (p1 .x, p1 .y, p1 .z, 1); + + texCoordArray .push (t2 .x, t2 .y, 0, 1); + normalArray .push (0, 1, 0); + vertexArray .push (p2 .x, p2 .y, p2 .z, 1); + } + } + + if (this ._bottom .getValue ()) + { + const + texCoord = [ ], + points = [ ]; + + for (let i = xDimension - 1; i > -1; -- i) + { + const + u = i / xDimension, + theta = 2 * Math .PI * u, + t = Numbers_Complex .Polar (-1, theta); + + texCoord .push (new Numbers_Vector2 ((t .imag + 1) / 2, (t .real + 1) / 2)); + points .push (new Numbers_Vector3 (t .imag * radius, y2, t .real * radius)); + } + + const + t0 = texCoord [0], + p0 = points [0]; + + for (let i = 1, length = points .length - 1; i < length; ++ i) + { + const + t1 = texCoord [i], + t2 = texCoord [i + 1], + p1 = points [i], + p2 = points [i + 1]; + + texCoordArray .push (t0 .x, t0 .y, 0, 1); + normalArray .push (0, -1, 0); + vertexArray .push (p0 .x, p0 .y, p0 .z, 1); + + texCoordArray .push (t1 .x, t1 .y, 0, 1); + normalArray .push (0, -1, 0); + vertexArray .push (p1 .x, p1 .y, p1 .z, 1); + + texCoordArray .push (t2 .x, t2 .y, 0, 1); + normalArray .push (0, -1, 0); + vertexArray .push (p2 .x, p2 .y, p2 .z, 1); + } + } + + this .setSolid (this ._solid .getValue ()); + this .setExtents (); + }, + setExtents () + { + const + radius = this ._radius .getValue (), + y1 = this ._height .getValue () / 2, + y2 = -y1; + + if (! this ._top .getValue () && ! this ._side .getValue () && ! this ._bottom .getValue ()) + { + this .getMin () .set (0, 0, 0); + this .getMax () .set (0, 0, 0); + } + + else if (! this ._top .getValue () && ! this ._side .getValue ()) + { + this .getMin () .set (-radius, y2, -radius); + this .getMax () .set ( radius, y2, radius); + } + + else if (! this ._bottom .getValue () && ! this ._side .getValue ()) + { + this .getMin () .set (-radius, y1, -radius); + this .getMax () .set ( radius, y1, radius); + } + + else + { + this .getMin () .set (-radius, y2, -radius); + this .getMax () .set ( radius, y1, radius); + } + }, +}); + +Object .defineProperties (Cylinder, +{ + typeName: + { + value: "Cylinder", + enumerable: true, + }, + componentName: + { + value: "Geometry3D", + enumerable: true, + }, + containerField: + { + value: "geometry", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "top", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "side", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "bottom", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "height", new x_ite_Fields .SFFloat (2)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "radius", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "solid", new x_ite_Fields .SFBool (true)), + ]), + enumerable: true, + }, +}); + +const Cylinder_default_ = Cylinder; +; + +x_ite_Namespace .add ("Cylinder", "x_ite/Components/Geometry3D/Cylinder", Cylinder_default_); +/* harmony default export */ const Geometry3D_Cylinder = (Cylinder_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Geometry3D/ElevationGrid.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + +function ElevationGrid (executionContext) +{ + Rendering_X3DGeometryNode .call (this, executionContext); + + this .addType (Base_X3DConstants .ElevationGrid); + + this ._xSpacing .setUnit ("length"); + this ._zSpacing .setUnit ("length"); + this ._creaseAngle .setUnit ("angle"); + this ._height .setUnit ("length"); + + this .fogCoordNode = null; + this .colorNode = null; + this .texCoordNode = null; + this .normalNode = null; + this .coordNode = null; +} + +Object .assign (Object .setPrototypeOf (ElevationGrid .prototype, Rendering_X3DGeometryNode .prototype), +{ + initialize () + { + Rendering_X3DGeometryNode .prototype .initialize .call (this); + + this ._set_height .addFieldInterest (this ._height); + this ._attrib .addInterest ("set_attrib__", this); + this ._fogCoord .addInterest ("set_fogCoord__", this); + this ._color .addInterest ("set_color__", this); + this ._texCoord .addInterest ("set_texCoord__", this); + this ._normal .addInterest ("set_normal__", this); + + this .set_attrib__ (); + this .set_fogCoord__ (); + this .set_color__ (); + this .set_texCoord__ (); + this .set_normal__ (); + }, + set_attrib__ () + { + const attribNodes = this .getAttrib (); + + for (const attribNode of attribNodes) + { + attribNode .removeInterest ("requestRebuild", this); + attribNode ._attribute_changed .removeInterest ("updateVertexArrays", this); + } + + attribNodes .length = 0; + + for (const node of this ._attrib) + { + const attribNode = Base_X3DCast (Base_X3DConstants .X3DVertexAttributeNode, node); + + if (attribNode) + attribNodes .push (attribNode); + } + + for (const attribNode of attribNodes) + { + attribNode .addInterest ("requestRebuild", this); + attribNode ._attribute_changed .addInterest ("updateVertexArrays", this); + } + + this .updateVertexArrays (); + }, + set_fogCoord__ () + { + this .fogCoordNode ?.removeInterest ("requestRebuild", this); + + this .fogCoordNode = Base_X3DCast (Base_X3DConstants .FogCoordinate, this ._fogCoord); + + this .fogCoordNode ?.addInterest ("requestRebuild", this); + }, + set_color__ () + { + this .colorNode ?.removeInterest ("requestRebuild", this); + + this .colorNode = Base_X3DCast (Base_X3DConstants .X3DColorNode, this ._color); + + this .colorNode ?.addInterest ("requestRebuild", this); + + this .setTransparent (this .colorNode ?.isTransparent () ?? false); + }, + set_texCoord__ () + { + this .texCoordNode ?.removeInterest ("requestRebuild", this); + + this .texCoordNode = Base_X3DCast (Base_X3DConstants .X3DTextureCoordinateNode, this ._texCoord); + + this .texCoordNode ?.addInterest ("requestRebuild", this); + + this .setTextureCoordinate (this .texCoordNode); + }, + set_normal__ () + { + this .normalNode ?.removeInterest ("requestRebuild", this); + + this .normalNode = Base_X3DCast (Base_X3DConstants .X3DNormalNode, this ._normal); + + this .normalNode ?.addInterest ("requestRebuild", this); + }, + getColor () + { + return this .colorNode; + }, + getTexCoord () + { + return this .texCoordNode; + }, + getNormal () + { + return this .normalNode; + }, + getHeight (index) + { + if (index < this ._height .length) + return this ._height [index]; + + return 0; + }, + createTexCoords () + { + const + texCoords = [ ], + xDimension = this ._xDimension .getValue (), + zDimension = this ._zDimension .getValue (), + xSize = xDimension - 1, + zSize = zDimension - 1; + + for (let z = 0; z < zDimension; ++ z) + { + for (let x = 0; x < xDimension; ++ x) + texCoords .push (new Numbers_Vector2 (x / xSize, z / zSize)); + } + + return texCoords; + }, + createNormals (points, coordIndex, creaseAngle) + { + const + cw = ! this ._ccw .getValue (), + normalIndex = new Map (), + normals = [ ]; + + for (let p = 0, length = points .length; p < length; ++ p) + normalIndex .set (p, [ ]); + + for (let c = 0, length = coordIndex .length; c < length; c += 3) + { + const + c0 = coordIndex [c], + c1 = coordIndex [c + 1], + c2 = coordIndex [c + 2]; + + normalIndex .get (c0) .push (normals .length); + normalIndex .get (c1) .push (normals .length + 1); + normalIndex .get (c2) .push (normals .length + 2); + + const normal = Geometry_Triangle3 .normal (points [c0], points [c1], points [c2], new Numbers_Vector3 (0, 0, 0)); + + if (cw) + normal .negate (); + + normals .push (normal); + normals .push (normal); + normals .push (normal); + } + + if (!this ._normalPerVertex .getValue ()) + return normals; + + return this .refineNormals (normalIndex, normals, this ._creaseAngle .getValue ()); + }, + createCoordIndex () + { + // p1 - p4 + // | \ | + // p2 - p3 + + const + coordIndex = [ ], + xDimension = this ._xDimension .getValue (), + zDimension = this ._zDimension .getValue (), + xSize = xDimension - 1, + zSize = zDimension - 1; + + for (let z = 0; z < zSize; ++ z) + { + for (let x = 0; x < xSize; ++ x) + { + const + i1 = z * xDimension + x, + i2 = (z + 1) * xDimension + x, + i3 = (z + 1) * xDimension + (x + 1), + i4 = z * xDimension + (x + 1); + + coordIndex .push (i1); // p1 + coordIndex .push (i2); // p2 + coordIndex .push (i3); // p3 + + coordIndex .push (i1); // p1 + coordIndex .push (i3); // p3 + coordIndex .push (i4); // p4 + } + } + + return coordIndex; + }, + createPoints () + { + const + points = [ ], + xDimension = this ._xDimension .getValue (), + zDimension = this ._zDimension .getValue (), + xSpacing = this ._xSpacing .getValue (), + zSpacing = this ._zSpacing .getValue (); + + for (let z = 0; z < zDimension; ++ z) + { + for (let x = 0; x < xDimension; ++ x) + { + points .push (new Numbers_Vector3 (xSpacing * x, + this .getHeight (x + z * xDimension), + zSpacing * z)); + } + } + + return points; + }, + build () + { + if (this ._xDimension .getValue () < 2 || this ._zDimension .getValue () < 2) + return; + + const + colorPerVertex = this ._colorPerVertex .getValue (), + normalPerVertex = this ._normalPerVertex .getValue (), + coordIndex = this .createCoordIndex (), + coordIndicesArray = this .getCoordIndices (), + attribNodes = this .getAttrib (), + numAttribNodes = attribNodes .length, + attribArrays = this .getAttribs (), + fogCoordNode = this .fogCoordNode, + colorNode = this .getColor (), + texCoordNode = this .getTexCoord (), + normalNode = this .getNormal (), + points = this .createPoints (), + fogDepthArray = this .getFogDepths (), + colorArray = this .getColors (), + multiTexCoordArray = this .getMultiTexCoords (), + normalArray = this .getNormals (), + vertexArray = this .getVertices (); + + let face = 0; + + if (texCoordNode) + { + texCoordNode .init (multiTexCoordArray); + } + else + { + var + texCoords = this .createTexCoords (), + texCoordArray = this .getTexCoords (); + + multiTexCoordArray .push (texCoordArray); + } + + // Build geometry + + for (let c = 0, numCoordIndices = coordIndex .length; c < numCoordIndices; ++ face) + { + for (let p = 0; p < 6; ++ p, ++ c) + { + const + index = coordIndex [c], + point = points [index]; + + coordIndicesArray .push (index); + + for (let a = 0; a < numAttribNodes; ++ a) + attribNodes [a] .addValue (index, attribArrays [a]); + + fogCoordNode ?.addDepth (index, fogDepthArray); + + if (colorNode) + { + if (colorPerVertex) + colorNode .addColor (index, colorArray); + else + colorNode .addColor (face, colorArray); + } + + if (texCoordNode) + { + texCoordNode .addPoint (index, multiTexCoordArray); + } + else + { + const t = texCoords [index]; + + texCoordArray .push (t .x, t .y, 0, 1); + } + + if (normalNode) + { + if (normalPerVertex) + normalNode .addVector (index, normalArray); + + else + normalNode .addVector (face, normalArray); + } + + vertexArray .push (point .x, point .y, point .z, 1); + } + } + + // Add auto-generated normals if needed. + + if (!normalNode) + { + const normals = this .createNormals (points, coordIndex); + + for (const normal of normals) + { + normalArray .push (normal .x, normal .y, normal .z); + } + } + + this .setSolid (this ._solid .getValue ()); + this .setCCW (this ._ccw .getValue ()); + }, +}); + +Object .defineProperties (ElevationGrid, +{ + typeName: + { + value: "ElevationGrid", + enumerable: true, + }, + componentName: + { + value: "Geometry3D", + enumerable: true, + }, + containerField: + { + value: "geometry", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_height", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "xDimension", new x_ite_Fields .SFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "zDimension", new x_ite_Fields .SFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "xSpacing", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "zSpacing", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "solid", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "ccw", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "creaseAngle", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "colorPerVertex", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "normalPerVertex", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "attrib", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "fogCoord", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "color", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "texCoord", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normal", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "height", new x_ite_Fields .MFFloat ()), + ]), + enumerable: true, + }, +}); + +const ElevationGrid_default_ = ElevationGrid; +; + +x_ite_Namespace .add ("ElevationGrid", "x_ite/Components/Geometry3D/ElevationGrid", ElevationGrid_default_); +/* harmony default export */ const Geometry3D_ElevationGrid = (ElevationGrid_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Geometry3D/Extrusion.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + +function Extrusion (executionContext) +{ + Rendering_X3DGeometryNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Extrusion); + + this ._creaseAngle .setUnit ("angle"); + this ._crossSection .setUnit ("length"); + this ._spine .setUnit ("length"); +} + +Object .assign (Object .setPrototypeOf (Extrusion .prototype, Rendering_X3DGeometryNode .prototype), +{ + initialize () + { + Rendering_X3DGeometryNode .prototype .initialize .call (this); + + this ._set_crossSection .addFieldInterest (this ._crossSection); + this ._set_orientation .addFieldInterest (this ._orientation); + this ._set_scale .addFieldInterest (this ._scale); + this ._set_spine .addFieldInterest (this ._spine); + }, + getClosedOrientation () + { + const orientation = this ._orientation; + + if (orientation .length) + { + const + firstOrientation = orientation [0] .getValue (), + lastOrientation = orientation [orientation .length - 1] .getValue (); + + return firstOrientation .equals (lastOrientation); + } + + return true; + }, + createPoints: (() => + { + const scale3 = new Numbers_Vector3 (1, 1, 1); + + return function () + { + const + crossSection = this ._crossSection, + orientation = this ._orientation, + scale = this ._scale, + spine = this ._spine, + points = [ ]; + + // calculate SCP rotations + + const rotations = this .createRotations (); + + // calculate vertices. + + for (let i = 0, length = spine .length; i < length; ++ i) + { + const matrix = rotations [i]; + + if (orientation .length) + matrix .rotate (orientation [Math .min (i, orientation .length - 1)] .getValue ()); + + if (scale .length) + { + const s = scale [Math .min (i, scale .length - 1)] .getValue (); + matrix .scale (scale3 .set (s .x, 1, s .y)); + } + + for (let cs = 0, csLength = crossSection .length; cs < csLength; ++ cs) + { + const vector = crossSection [cs] .getValue (); + points .push (matrix .multVecMatrix (new Numbers_Vector3 (vector .x, 0, vector .y))); + } + } + + return points; + }; + })(), + createRotations: (() => + { + const rotations = [ ]; + + const + SCPxAxis = new Numbers_Vector3 (0, 0, 0), + SCPyAxis = new Numbers_Vector3 (0, 0, 0), + SCPzAxis = new Numbers_Vector3 (0, 0, 0); + + const + SCPyAxisPrevious = new Numbers_Vector3 (0, 0, 0), + SCPzAxisPrevious = new Numbers_Vector3 (0, 0, 0); + + const + vector3 = new Numbers_Vector3 (0, 0, 0), + rotation = new Numbers_Rotation4 (); + + return function () + { + // calculate SCP rotations + + const + spine = this ._spine, + numSpines = spine .length, + firstSpine = spine [0] .getValue (), + lastSpine = spine [spine .length - 1] .getValue (), + closedSpine = firstSpine .equals (lastSpine) && this .getClosedOrientation (); + + // Extend or shrink static rotations array: + for (let i = rotations .length; i < numSpines; ++ i) + rotations [i] = new Numbers_Matrix4 (); + + rotations .length = numSpines; + + // SCP axes: + SCPxAxis .set (0, 0, 0); + SCPyAxis .set (0, 0, 0); + SCPzAxis .set (0, 0, 0); + + // SCP for the first point: + if (closedSpine) + { + const s = firstSpine; + + // Find first defined Y-axis. + for (let i = 1, length = numSpines - 2; i < length; ++ i) + { + SCPyAxis .assign (spine [i] .getValue ()) .subtract (s) .normalize () + .subtract (vector3 .assign (spine [length] .getValue ()) .subtract (s) .normalize ()) + .normalize (); + + if (! SCPyAxis .equals (Numbers_Vector3 .Zero)) + break; + } + + // Find first defined Z-axis. + for (let i = 0, length = numSpines - 2; i < length; ++ i) + { + SCPzAxis .assign (spine [i + 1] .getValue ()) .subtract (spine [i] .getValue ()) + .cross (vector3 .assign (spine [length] .getValue ()) .subtract (spine [i] .getValue ())) + .normalize (); + + if (! SCPzAxis .equals (Numbers_Vector3 .Zero)) + break; + } + } + else + { + // Find first defined Y-axis. + for (let i = 0, length = numSpines - 1; i < length; ++ i) + { + SCPyAxis .assign (spine [i + 1] .getValue ()) .subtract (spine [i] .getValue ()) .normalize (); + + if (! SCPyAxis .equals (Numbers_Vector3 .Zero)) + break; + } + + // Find first defined Z-axis. + for (let i = 1, length = numSpines - 1; i < length; ++ i) + { + SCPzAxis .assign (spine [i + 1] .getValue ()) .subtract (spine [i] .getValue ()) + .cross (vector3 .assign (spine [i - 1] .getValue ()) .subtract (spine [i] .getValue ())) + .normalize (); + + if (! SCPzAxis .equals (Numbers_Vector3 .Zero)) + break; + } + } + + // The entire spine is coincident: + if (SCPyAxis .equals (Numbers_Vector3 .Zero)) + SCPyAxis .set (0, 1, 0); + + // The entire spine is collinear: + if (SCPzAxis .equals (Numbers_Vector3 .Zero)) + rotation .setFromToVec (Numbers_Vector3 .yAxis, SCPyAxis) .multVecRot (SCPzAxis .assign (Numbers_Vector3 .zAxis)); + + // We do not have to normalize SCPxAxis, as SCPyAxis and SCPzAxis are orthogonal. + SCPxAxis .assign (SCPyAxis) .cross (SCPzAxis); + + // Get first spine + const s = firstSpine; + + rotations [0] .set (SCPxAxis .x, SCPxAxis .y, SCPxAxis .z, 0, + SCPyAxis .x, SCPyAxis .y, SCPyAxis .z, 0, + SCPzAxis .x, SCPzAxis .y, SCPzAxis .z, 0, + s .x, s .y, s .z, 1); + + // For all points other than the first or last: + + SCPyAxisPrevious .assign (SCPyAxis); + SCPzAxisPrevious .assign (SCPzAxis); + + for (let i = 1, length = numSpines - 1; i < length; ++ i) + { + const s = spine [i] .getValue (); + + SCPyAxis .assign (spine [i + 1] .getValue ()) .subtract (s) .normalize () + .subtract (vector3 .assign (spine [i - 1] .getValue ()) .subtract (s) .normalize ()) + .normalize (); + SCPzAxis .assign (spine [i + 1] .getValue ()) .subtract (s) + .cross (vector3 .assign (spine [i - 1] .getValue ()) .subtract (s)) + .normalize (); + + // g. + if (SCPzAxisPrevious .dot (SCPzAxis) < 0) + SCPzAxis .negate (); + + // The two points used in computing the Y-axis are coincident. + if (SCPyAxis .equals (Numbers_Vector3 .Zero)) + SCPyAxis .assign (SCPyAxisPrevious); + else + SCPyAxisPrevious .assign (SCPyAxis); + + // The three points used in computing the Z-axis are collinear. + if (SCPzAxis .equals (Numbers_Vector3 .Zero)) + SCPzAxis .assign (SCPzAxisPrevious); + else + SCPzAxisPrevious .assign (SCPzAxis); + + // We do not have to normalize SCPxAxis, as SCPyAxis and SCPzAxis are orthogonal. + SCPxAxis .assign (SCPyAxis) .cross (SCPzAxis); + + rotations [i] .set (SCPxAxis .x, SCPxAxis .y, SCPxAxis .z, 0, + SCPyAxis .x, SCPyAxis .y, SCPyAxis .z, 0, + SCPzAxis .x, SCPzAxis .y, SCPzAxis .z, 0, + s .x, s .y, s .z, 1); + } + + // SCP for the last point + if (closedSpine) + { + // The SCPs for the first and last points are the same. + rotations [numSpines - 1] .assign (rotations [0]); + } + else + { + const s = lastSpine; + + SCPyAxis .assign (s) .subtract (spine [numSpines - 2] .getValue ()) .normalize (); + + if (numSpines > 2) + { + SCPzAxis .assign (s) .subtract (spine [numSpines - 2] .getValue ()) + .cross (vector3 .assign (spine [numSpines - 3] .getValue ()) .subtract (spine [numSpines - 2] .getValue ())) + .normalize (); + } + + // g. + if (SCPzAxisPrevious .dot (SCPzAxis) < 0) + SCPzAxis .negate (); + + // The two points used in computing the Y-axis are coincident. + if (SCPyAxis .equals (Numbers_Vector3 .Zero)) + SCPyAxis .assign (SCPyAxisPrevious); + + // The three points used in computing the Z-axis are collinear. + if (SCPzAxis .equals (Numbers_Vector3 .Zero)) + SCPzAxis .assign (SCPzAxisPrevious); + + // We do not have to normalize SCPxAxis, as SCPyAxis and SCPzAxis are orthogonal. + SCPxAxis .assign (SCPyAxis) .cross (SCPzAxis); + + rotations [numSpines - 1] .set (SCPxAxis .x, SCPxAxis .y, SCPxAxis .z, 0, + SCPyAxis .x, SCPyAxis .y, SCPyAxis .z, 0, + SCPzAxis .x, SCPzAxis .y, SCPzAxis .z, 0, + s .x, s .y, s .z, 1); + } + + return rotations; + }; + })(), + build: (() => + { + const + min = new Numbers_Vector2 (0, 0, 0), + max = new Numbers_Vector2 (0, 0, 0), + vector2 = new Numbers_Vector2 (0, 0, 0); + + return function () + { + const + cw = ! this ._ccw .getValue (), + crossSection = this ._crossSection, + spine = this ._spine, + numSpines = spine .length, + coordIndicesArray = this .getCoordIndices (), + texCoordArray = this .getTexCoords (); + + if (numSpines < 2 || crossSection .length < 2) + return; + + this .getMultiTexCoords () .push (texCoordArray); + + const crossSectionSize = crossSection .length; // This one is used only in the INDEX macro. + + function INDEX (n, k) { return n * crossSectionSize + k; } + + const + firstSpine = spine [0] .getValue (), + lastSpine = spine [numSpines - 1] .getValue (), + closedSpine = firstSpine .equals (lastSpine) && this .getClosedOrientation (); + + const + firstCrossSection = crossSection [0] .getValue (), + lastCrossSection = crossSection [crossSection .length - 1] .getValue (), + closedCrossSection = firstCrossSection .equals (lastCrossSection); + + // For caps calculation + + min .assign (crossSection [0] .getValue ()); + max .assign (crossSection [0] .getValue ()); + + for (let k = 1, length = crossSection .length; k < length; ++ k) + { + min .min (crossSection [k] .getValue ()); + max .max (crossSection [k] .getValue ()); + } + + const + capSize = vector2 .assign (max) .subtract (min), + capMax = Math .max (capSize .x, capSize .y), + numCapPoints = closedCrossSection ? crossSection .length - 1 : crossSection .length; + + // Create + + const + normalIndex = new Map (), + normals = [ ], + points = this .createPoints (); + + for (let p = 0, length = points .length; p < length; ++ p) + normalIndex .set (p, [ ]); + + // Build body. + + const + normalArray = this .getNormals (), + vertexArray = this .getVertices (); + + const + numCrossSection_1 = crossSection .length - 1, + numSpine_1 = numSpines - 1; + + let + indexLeft = INDEX (0, 0), + indexRight = INDEX (0, closedCrossSection ? 0 : numCrossSection_1); + + for (let n = 0; n < numSpine_1; ++ n) + { + for (let k = 0; k < numCrossSection_1; ++ k) + { + const + n1 = closedSpine && n === numSpines - 2 ? 0 : n + 1, + k1 = closedCrossSection && k === crossSection .length - 2 ? 0 : k + 1; + + // k k+1 + // + // p4 ----- p3 n+1 + // | / | + // | / | + // | / | + // p1 ----- p2 n + + let + i1 = INDEX (n, k), + i2 = INDEX (n, k1), + i3 = INDEX (n1, k1), + i4 = INDEX (n1, k), + p1 = points [i1], + p2 = points [i2], + p3 = points [i3], + p4 = points [i4], + l1 = p2 .distance (p3) >= 1e-7, + l2 = p4 .distance (p1) >= 1e-7; + + if (cw) + { + var + normal1 = Geometry_Triangle3 .normal (p3, p2, p1, new Numbers_Vector3 (0, 0, 0)), + normal2 = Geometry_Triangle3 .normal (p4, p3, p1, new Numbers_Vector3 (0, 0, 0)); + } + else + { + var + normal1 = Geometry_Triangle3 .normal (p1, p2, p3, new Numbers_Vector3 (0, 0, 0)), + normal2 = Geometry_Triangle3 .normal (p1, p3, p4, new Numbers_Vector3 (0, 0, 0)); + } + + // Merge points on the left and right side if spine is coincident for better normal generation. + + if (k == 0) + { + if (l2) + { + indexLeft = i1; + } + else + { + i1 = indexLeft; + p1 = points [i1]; + } + } + + if (k == crossSection .length - 2) + { + if (l1) + { + indexRight = i2; + } + else + { + i3 = indexRight; + p3 = points [i3]; + } + } + + // If there are coincident spine points then one length can be zero. + + // Triangle one + + if (l1) + { + coordIndicesArray .push (i1, i2, i3); + + // p1 + if (l2) + { + texCoordArray .push (k / numCrossSection_1, n / numSpine_1, 0, 1); + } + else + { + // Cone case: ((texCoord1 + texCoord4) / 2) + const y = (n / numSpine_1 + (n + 1) / numSpine_1) / 2; + + texCoordArray .push (k / numCrossSection_1, y, 0, 1); + } + + normalIndex .get (i1) .push (normals .length); + normals .push (normal1); + vertexArray .push (p1 .x, p1 .y, p1 .z, 1); + + // p2 + texCoordArray .push ((k + 1) / numCrossSection_1, n / numSpine_1, 0, 1); + normalIndex .get (i2) .push (normals .length); + normals .push (normal1); + vertexArray .push (p2 .x, p2 .y, p2 .z, 1); + + // p3 + texCoordArray .push ((k + 1) / numCrossSection_1, (n + 1) / numSpine_1, 0, 1); + normalIndex .get (i3) .push (normals .length); + normals .push (normal1); + vertexArray .push (p3 .x, p3 .y, p3 .z, 1); + } + + // Triangle two + + if (l2) + { + coordIndicesArray .push (i1, i3, i4); + + // p1 + texCoordArray .push (k / numCrossSection_1, n / numSpine_1, 0, 1); + normalIndex .get (i1) .push (normals .length); + normals .push (normal2); + vertexArray .push (p1 .x, p1 .y, p1 .z, 1); + + // p3 + if (l1) + { + texCoordArray .push ((k + 1) / numCrossSection_1, (n + 1) / numSpine_1, 0, 1); + } + else + { + // Cone case: ((texCoord3 + texCoord2) / 2) + const y = ((n + 1) / numSpine_1 + n / numSpine_1) / 2; + + texCoordArray .push ((k + 1) / numCrossSection_1, y, 0, 1); + } + + normalIndex .get (i3) .push (normals .length); + normals .push (normal2); + vertexArray .push (p3 .x, p3 .y, p3 .z, 1); + + // p4 + texCoordArray .push (k / numCrossSection_1, (n + 1) / numSpine_1, 0, 1); + normalIndex .get (i4) .push (normals .length); + normals .push (normal2); + vertexArray .push (p4 .x, p4 .y, p4 .z, 1); + } + } + } + + // Refine body normals and add them. + + const refinedNormals = this .refineNormals (normalIndex, normals, this ._creaseAngle .getValue ()); + + for (const normal of refinedNormals) + normalArray .push (normal .x, normal .y, normal .z); + + // Build caps + + if (capMax && numCapPoints > 2) + { + if (this ._beginCap .getValue ()) + { + const + j = 0, // spine + convex = this ._convex .getValue (), + texCoord = { }, + polygon = [ ], + triangles = [ ]; + + for (let k = 0; k < numCapPoints; ++ k) + { + const + index = INDEX (j, numCapPoints - 1 - k), + point = points [index] .copy (); + + point .index = index; + texCoord [index] = crossSection [numCapPoints - 1 - k] .getValue () .copy () .subtract (min) .divide (capMax); + polygon .push (convex ? index : point); + } + + if (convex) + Geometry_Triangle3 .triangulateConvexPolygon (polygon, triangles); + + else + Geometry_Triangle3 .triangulatePolygon (polygon, triangles); + + if (triangles .length >= 3) + { + const normal = Geometry_Triangle3 .normal (points [triangles [0]], + points [triangles [1]], + points [triangles [2]], + new Numbers_Vector3 (0, 0, 0)); + + if (cw) + normal .negate (); + + this .addCap (texCoordArray, texCoord, normal, points, triangles); + } + } + + if (this ._endCap .getValue ()) + { + const + j = numSpines - 1, // spine + convex = this ._convex .getValue (), + texCoord = { }, + polygon = [ ], + triangles = [ ]; + + for (let k = 0; k < numCapPoints; ++ k) + { + const + index = INDEX (j, k), + point = points [index] .copy (); + + point .index = index; + texCoord [index] = crossSection [k] .getValue () .copy () .subtract (min) .divide (capMax); + polygon .push (convex ? index : point); + } + + if (convex) + Geometry_Triangle3 .triangulateConvexPolygon (polygon, triangles); + + else + Geometry_Triangle3 .triangulatePolygon (polygon, triangles); + + if (triangles .length >= 3) + { + const normal = Geometry_Triangle3 .normal (points [triangles [0]], + points [triangles [1]], + points [triangles [2]], + new Numbers_Vector3 (0, 0, 0)); + + if (cw) + normal .negate (); + + this .addCap (texCoordArray, texCoord, normal, points, triangles); + } + } + } + + this .setSolid (this ._solid .getValue ()); + this .setCCW (this ._ccw .getValue ()); + }; + })(), + addCap (texCoordArray, texCoord, normal, vertices, triangles) + { + const + coordIndicesArray = this .getCoordIndices (), + normalArray = this .getNormals (), + vertexArray = this .getVertices (); + + for (let i = 0, length = triangles .length; i < length; i += 3) + { + const + i1 = triangles [i], + i2 = triangles [i + 1], + i3 = triangles [i + 2], + p0 = vertices [i1], + p1 = vertices [i2], + p2 = vertices [i3], + t0 = texCoord [i1], + t1 = texCoord [i2], + t2 = texCoord [i3]; + + coordIndicesArray .push (i1, i2, i3); + + texCoordArray .push (t0 .x, t0 .y, 0, 1); + texCoordArray .push (t1 .x, t1 .y, 0, 1); + texCoordArray .push (t2 .x, t2 .y, 0, 1); + + normalArray .push (normal .x, normal .y, normal .z, + normal .x, normal .y, normal .z, + normal .x, normal .y, normal .z); + + vertexArray .push (p0 .x, p0 .y, p0 .z, 1, + p1 .x, p1 .y, p1 .z, 1, + p2 .x, p2 .y, p2 .z, 1); + } + }, +}); + +Object .defineProperties (Extrusion, +{ + typeName: + { + value: "Extrusion", + enumerable: true, + }, + componentName: + { + value: "Geometry3D", + enumerable: true, + }, + containerField: + { + value: "geometry", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_crossSection", new x_ite_Fields .MFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_orientation", new x_ite_Fields .MFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_scale", new x_ite_Fields .MFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_spine", new x_ite_Fields .MFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "beginCap", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "endCap", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "solid", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "ccw", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "convex", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "creaseAngle", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "crossSection", new x_ite_Fields .MFVec2f (new Numbers_Vector2 (1, 1), new Numbers_Vector2 (1, -1), new Numbers_Vector2 (-1, -1), new Numbers_Vector2 (-1, 1), new Numbers_Vector2 (1, 1))), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "orientation", new x_ite_Fields .MFRotation (new Numbers_Rotation4 ())), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "scale", new x_ite_Fields .MFVec2f (new Numbers_Vector2 (1, 1))), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "spine", new x_ite_Fields .MFVec3f (new Numbers_Vector3 (0, 0, 0), new Numbers_Vector3 (0, 1, 0))), + ]), + enumerable: true, + }, +}); + +const Extrusion_default_ = Extrusion; +; + +x_ite_Namespace .add ("Extrusion", "x_ite/Components/Geometry3D/Extrusion", Extrusion_default_); +/* harmony default export */ const Geometry3D_Extrusion = (Extrusion_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/X3DComposedGeometryNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + +function X3DComposedGeometryNode (executionContext) +{ + Rendering_X3DGeometryNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DComposedGeometryNode); + + this .fogCoordNode = null; + this .colorNode = null; + this .texCoordNode = null; + this .normalNode = null; + this .coordNode = null; +} + +Object .assign (Object .setPrototypeOf (X3DComposedGeometryNode .prototype, Rendering_X3DGeometryNode .prototype), +{ + initialize () + { + Rendering_X3DGeometryNode .prototype .initialize .call (this); + + this ._attrib .addInterest ("set_attrib__", this); + this ._fogCoord .addInterest ("set_fogCoord__", this); + this ._color .addInterest ("set_color__", this); + this ._texCoord .addInterest ("set_texCoord__", this); + this ._normal .addInterest ("set_normal__", this); + this ._coord .addInterest ("set_coord__", this); + + this .set_attrib__ (); + this .set_fogCoord__ (); + this .set_color__ (); + this .set_texCoord__ (); + this .set_normal__ (); + this .set_coord__ (); + }, + getFogCoord () + { + return this .fogCoordNode; + }, + getColor () + { + return this .colorNode; + }, + getTexCoord () + { + return this .texCoordNode; + }, + getNormal () + { + return this .normalNode; + }, + getCoord () + { + return this .coordNode; + }, + set_attrib__ () + { + const attribNodes = this .getAttrib (); + + for (const attribNode of attribNodes) + { + attribNode .removeInterest ("requestRebuild", this); + attribNode ._attribute_changed .removeInterest ("updateVertexArrays", this); + } + + attribNodes .length = 0; + + for (const node of this ._attrib) + { + const attribNode = Base_X3DCast (Base_X3DConstants .X3DVertexAttributeNode, node); + + if (attribNode) + attribNodes .push (attribNode); + } + + for (const attribNode of attribNodes) + { + attribNode .addInterest ("requestRebuild", this); + attribNode ._attribute_changed .addInterest ("updateVertexArrays", this); + } + + this .updateVertexArrays (); + }, + set_fogCoord__ () + { + this .fogCoordNode ?.removeInterest ("requestRebuild", this); + + this .fogCoordNode = Base_X3DCast (Base_X3DConstants .FogCoordinate, this ._fogCoord); + + this .fogCoordNode ?.addInterest ("requestRebuild", this); + }, + set_color__ () + { + this .colorNode ?.removeInterest ("requestRebuild", this); + + this .colorNode = Base_X3DCast (Base_X3DConstants .X3DColorNode, this ._color); + + this .colorNode ?.addInterest ("requestRebuild", this); + + this .setTransparent (this .colorNode ?.isTransparent () ?? false); + }, + set_texCoord__ () + { + this .texCoordNode ?.removeInterest ("requestRebuild", this); + + this .texCoordNode = Base_X3DCast (Base_X3DConstants .X3DTextureCoordinateNode, this ._texCoord); + + this .texCoordNode ?.addInterest ("requestRebuild", this); + + this .setTextureCoordinate (this .texCoordNode); + }, + set_normal__ () + { + this .normalNode ?.removeInterest ("requestRebuild", this); + + this .normalNode = Base_X3DCast (Base_X3DConstants .X3DNormalNode, this ._normal); + + this .normalNode ?.addInterest ("requestRebuild", this); + }, + set_coord__ () + { + this .coordNode ?.removeInterest ("requestRebuild", this); + + this .coordNode = Base_X3DCast (Base_X3DConstants .X3DCoordinateNode, this ._coord); + + this .coordNode ?.addInterest ("requestRebuild", this); + }, + getPolygonIndex (index) + { + return index; + }, + getTriangleIndex (index) + { + return index; + }, + build (verticesPerPolygon, polygonsSize, verticesPerFace, trianglesSize) + { + if (!this .coordNode || this .coordNode .isEmpty ()) + return; + + // Set size to a multiple of verticesPerPolygon. + + polygonsSize -= polygonsSize % verticesPerPolygon; + trianglesSize -= trianglesSize % verticesPerFace; + + const + colorPerVertex = this ._colorPerVertex .getValue (), + normalPerVertex = this ._normalPerVertex .getValue (), + coordIndicesArray = this .getCoordIndices (), + attribNodes = this .getAttrib (), + numAttribNodes = attribNodes .length, + attribArrays = this .getAttribs (), + fogCoordNode = this .getFogCoord (), + colorNode = this .getColor (), + texCoordNode = this .getTexCoord (), + normalNode = this .getNormal (), + coordNode = this .getCoord (), + fogDepthArray = this .getFogDepths (), + colorArray = this .getColors (), + multiTexCoordArray = this .getMultiTexCoords (), + normalArray = this .getNormals (), + vertexArray = this .getVertices (); + + texCoordNode ?.init (multiTexCoordArray); + + // Fill GeometryNode + + for (let i = 0; i < trianglesSize; ++ i) + { + const + face = Math .floor (i / verticesPerFace), + index = this .getPolygonIndex (this .getTriangleIndex (i)); + + coordIndicesArray .push (index); + + for (let a = 0; a < numAttribNodes; ++ a) + attribNodes [a] .addValue (index, attribArrays [a]); + + fogCoordNode ?.addDepth (index, fogDepthArray); + + if (colorNode) + { + if (colorPerVertex) + colorNode .addColor (index, colorArray); + else + colorNode .addColor (face, colorArray); + } + + texCoordNode ?.addPoint (index, multiTexCoordArray); + + if (normalNode) + { + if (normalPerVertex) + normalNode .addVector (index, normalArray); + else + normalNode .addVector (face, normalArray); + } + + coordNode .addPoint (index, vertexArray); + } + + // Autogenerate normal if not specified. + + if (!this .getNormal ()) + this .buildNormals (verticesPerPolygon, polygonsSize, trianglesSize); + + this .setSolid (this ._solid .getValue ()); + this .setCCW (this ._ccw .getValue ()); + }, + buildNormals (verticesPerPolygon, polygonsSize, trianglesSize) + { + const + normals = this .createNormals (verticesPerPolygon, polygonsSize), + normalArray = this .getNormals (); + + for (let i = 0; i < trianglesSize; ++ i) + { + const normal = normals [this .getTriangleIndex (i)]; + + normalArray .push (normal .x, normal .y, normal .z); + } + }, + createNormals (verticesPerPolygon, polygonsSize) + { + const normals = this .createFaceNormals (verticesPerPolygon, polygonsSize); + + if (!this ._normalPerVertex .getValue ()) + return normals; + + const normalIndex = new Map (); + + for (let i = 0; i < polygonsSize; ++ i) + { + const index = this .getPolygonIndex (i); + + let pointIndex = normalIndex .get (index); + + if (!pointIndex) + normalIndex .set (index, pointIndex = [ ]); + + pointIndex .push (i); + } + + return this .refineNormals (normalIndex, normals, Math .PI); + }, + createFaceNormals (verticesPerPolygon, polygonsSize) + { + const + cw = !this ._ccw .getValue (), + coord = this .coordNode, + normals = [ ]; + + for (let i = 0; i < polygonsSize; i += verticesPerPolygon) + { + const normal = this .getPolygonNormal (i, verticesPerPolygon, coord); + + if (cw) + normal .negate (); + + for (let n = 0; n < verticesPerPolygon; ++ n) + normals .push (normal); + } + + return normals; + }, + getPolygonNormal: (() => + { + let + current = new Numbers_Vector3 (0, 0, 0), + next = new Numbers_Vector3 (0, 0, 0); + + return function (index, verticesPerPolygon, coord) + { + // Determine polygon normal. + // We use Newell's method https://www.opengl.org/wiki/Calculating_a_Surface_Normal here: + + const normal = new Numbers_Vector3 (0, 0, 0); + + coord .get1Point (this .getPolygonIndex (index), next); + + for (let i = 0; i < verticesPerPolygon; ++ i) + { + const tmp = current; + current = next; + next = tmp; + + coord .get1Point (this .getPolygonIndex (index + (i + 1) % verticesPerPolygon), next); + + normal .x += (current .y - next .y) * (current .z + next .z); + normal .y += (current .z - next .z) * (current .x + next .x); + normal .z += (current .x - next .x) * (current .y + next .y); + } + + return normal .normalize (); + }; + })(), +}); + +Object .defineProperties (X3DComposedGeometryNode, +{ + typeName: + { + value: "X3DComposedGeometryNode", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, +}); + +const X3DComposedGeometryNode_default_ = X3DComposedGeometryNode; +; + +x_ite_Namespace .add ("X3DComposedGeometryNode", "x_ite/Components/Rendering/X3DComposedGeometryNode", X3DComposedGeometryNode_default_); +/* harmony default export */ const Rendering_X3DComposedGeometryNode = (X3DComposedGeometryNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Geometry3D/IndexedFaceSet.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + +function IndexedFaceSet (executionContext) +{ + Rendering_X3DComposedGeometryNode .call (this, executionContext); + + this .addType (Base_X3DConstants .IndexedFaceSet); + + this ._creaseAngle .setUnit ("angle"); +} + +Object .assign (Object .setPrototypeOf (IndexedFaceSet .prototype, Rendering_X3DComposedGeometryNode .prototype), +{ + initialize () + { + Rendering_X3DComposedGeometryNode .prototype .initialize .call (this); + + this ._set_colorIndex .addFieldInterest (this ._colorIndex); + this ._set_texCoordIndex .addFieldInterest (this ._texCoordIndex); + this ._set_normalIndex .addFieldInterest (this ._normalIndex); + this ._set_coordIndex .addFieldInterest (this ._coordIndex); + }, + getTexCoordPerVertexIndex (index) + { + if (index < this ._texCoordIndex .length) + return this ._texCoordIndex [index]; + + return this ._coordIndex [index]; + }, + getColorPerVertexIndex (index) + { + if (index < this ._colorIndex .length) + return this ._colorIndex [index]; + + return this ._coordIndex [index]; + }, + getColorIndex (index) + { + if (index < this ._colorIndex .length) + return this ._colorIndex [index]; + + return index; + }, + getNormalPerVertexIndex (index) + { + if (index < this ._normalIndex .length) + return this ._normalIndex [index]; + + return this ._coordIndex [index]; + }, + getNormalIndex (index) + { + if (index < this ._normalIndex .length) + return this ._normalIndex [index]; + + return index; + }, + build () + { + // Triangulate + + const polygons = this .triangulate (); + + // Build arrays + + if (polygons .length === 0) + return; + + // Fill GeometryNode + + const + colorPerVertex = this ._colorPerVertex .getValue (), + normalPerVertex = this ._normalPerVertex .getValue (), + coordIndex = this ._coordIndex .getValue (), + coordIndicesArray = this .getCoordIndices (), + attribNodes = this .getAttrib (), + numAttribNodes = attribNodes .length, + attribArrays = this .getAttribs (), + fogCoordNode = this .getFogCoord (), + colorNode = this .getColor (), + texCoordNode = this .getTexCoord (), + normalNode = this .getNormal (), + coordNode = this .getCoord (), + fogDepthArray = this .getFogDepths (), + colorArray = this .getColors (), + multiTexCoordArray = this .getMultiTexCoords (), + normalArray = this .getNormals (), + vertexArray = this .getVertices (); + + texCoordNode ?.init (multiTexCoordArray); + + for (const polygon of polygons) + { + const { triangles, face } = polygon; + + for (const i of triangles) + { + const index = coordIndex [i]; + + coordIndicesArray .push (index); + + for (let a = 0; a < numAttribNodes; ++ a) + attribNodes [a] .addValue (index, attribArrays [a]); + + fogCoordNode ?.addDepth (index, fogDepthArray); + + if (colorNode) + { + if (colorPerVertex) + colorNode .addColor (this .getColorPerVertexIndex (i), colorArray); + else + colorNode .addColor (this .getColorIndex (face), colorArray); + } + + texCoordNode ?.addPoint (this .getTexCoordPerVertexIndex (i), multiTexCoordArray); + + if (normalNode) + { + if (normalPerVertex) + normalNode .addVector (this .getNormalPerVertexIndex (i), normalArray); + + else + normalNode .addVector (this .getNormalIndex (face), normalArray); + } + + coordNode .addPoint (index, vertexArray); + } + } + + // Autogenerate normal if not specified. + + if (!this .getNormal ()) + this .buildNormals (polygons); + + this .setSolid (this ._solid .getValue ()); + this .setCCW (this ._ccw .getValue ()); + }, + triangulate () + { + const + convex = this ._convex .getValue (), + coordLength = this ._coordIndex .length, + polygons = [ ]; + + if (!this .getCoord ()) + return polygons; + + // Add -1 (polygon end marker) to coordIndex if not present. + if (coordLength && this ._coordIndex [coordLength - 1] > -1) + this ._coordIndex .push (-1); + + if (coordLength) + { + const + coordIndex = this ._coordIndex .getValue (), + coordLength = this ._coordIndex .length; + + // Construct triangle array and determine the number of used points. + + for (let i = 0, face = 0, vertices = [ ]; i < coordLength; ++ i) + { + const index = coordIndex [i]; + + if (index > -1) + { + // Add vertex index. + vertices .push (i); + } + else + { + // Negative index. + + switch (vertices .length) + { + case 0: + case 1: + case 2: + { + vertices .length = 0; + break; + } + case 3: + { + // Add polygon with one triangle. + polygons .push ({ vertices: vertices, triangles: vertices, face: face }); + vertices = [ ]; + break; + } + default: + { + // Triangulate polygon. + + const + triangles = [ ], + polygon = { vertices: vertices, triangles: triangles, face: face }; + + if (convex) + Geometry_Triangle3 .triangulateConvexPolygon (vertices, triangles); + else + this .triangulatePolygon (vertices, triangles); + + if (triangles .length < 3) + { + vertices .length = 0; + } + else + { + polygons .push (polygon); + vertices = [ ]; + } + + break; + } + } + + ++ face; + } + } + } + + return polygons; + }, + triangulatePolygon: (() => + { + const polygon = [ ]; + + return function (vertices, triangles) + { + const + coordIndex = this ._coordIndex .getValue (), + coord = this .getCoord (), + length = vertices .length; + + for (let i = polygon .length; i < length; ++ i) + polygon .push (new Numbers_Vector3 (0, 0, 0)); + + for (let i = 0; i < length; ++ i) + { + const + index = vertices [i], + point = polygon [i]; + + point .index = index; + + coord .get1Point (coordIndex [index], point); + } + + polygon .length = length; + + Geometry_Triangle3 .triangulatePolygon (polygon, triangles); + }; + })(), + buildNormals (polygons) + { + const + normals = this .createNormals (polygons), + normalArray = this .getNormals (); + + for (const polygon of polygons) + { + for (const i of polygon .triangles) + { + const normal = normals [i]; + + normalArray .push (normal .x, normal .y, normal .z); + } + } + }, + createNormals (polygons) + { + const + cw = !this ._ccw .getValue (), + coordIndex = this ._coordIndex .getValue (), + coord = this .getCoord (), + normalIndex = new Map (), + normals = [ ]; + + for (const polygon of polygons) + { + const + vertices = polygon .vertices, + length = vertices .length; + + switch (length) + { + case 3: + { + var normal = coord .getNormal (coordIndex [vertices [0]], + coordIndex [vertices [1]], + coordIndex [vertices [2]]); + break; + } + case 4: + { + var normal = coord .getQuadNormal (coordIndex [vertices [0]], + coordIndex [vertices [1]], + coordIndex [vertices [2]], + coordIndex [vertices [3]]); + break; + } + default: + { + var normal = this .getPolygonNormal (vertices, coordIndex, coord); + break; + } + } + + // Add a normal index for each point. + + for (const index of vertices) + { + const point = coordIndex [index]; + + let pointNormals = normalIndex .get (point); + + if (!pointNormals) + normalIndex .set (point, pointNormals = [ ]); + + pointNormals .push (index); + + normals [index] = normal; + } + + if (cw) + normal .negate (); + } + + if (!this ._normalPerVertex .getValue ()) + return normals; + + return this .refineNormals (normalIndex, normals, this ._creaseAngle .getValue ()); + }, + getPolygonNormal: (() => + { + let + current = new Numbers_Vector3 (0, 0, 0), + next = new Numbers_Vector3 (0, 0, 0); + + return function (vertices, coordIndex, coord) + { + // Determine polygon normal. + // We use Newell's method https://www.opengl.org/wiki/Calculating_a_Surface_Normal here: + + const normal = new Numbers_Vector3 (0, 0, 0); + + coord .get1Point (coordIndex [vertices [0]], next); + + for (let i = 0, length = vertices .length; i < length; ++ i) + { + const tmp = current; + current = next; + next = tmp; + + coord .get1Point (coordIndex [vertices [(i + 1) % length]], next); + + normal .x += (current .y - next .y) * (current .z + next .z); + normal .y += (current .z - next .z) * (current .x + next .x); + normal .z += (current .x - next .x) * (current .y + next .y); + } + + return normal .normalize (); + }; + })(), +}); + +Object .defineProperties (IndexedFaceSet, +{ + typeName: + { + value: "IndexedFaceSet", + enumerable: true, + }, + componentName: + { + value: "Geometry3D", + enumerable: true, + }, + containerField: + { + value: "geometry", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_colorIndex", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_texCoordIndex", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_normalIndex", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_coordIndex", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "solid", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "ccw", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "convex", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "creaseAngle", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "colorPerVertex", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "normalPerVertex", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "colorIndex", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "texCoordIndex", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "normalIndex", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "coordIndex", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "attrib", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "fogCoord", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "color", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "texCoord", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normal", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "coord", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +const IndexedFaceSet_default_ = IndexedFaceSet; +; + +x_ite_Namespace .add ("IndexedFaceSet", "x_ite/Components/Geometry3D/IndexedFaceSet", IndexedFaceSet_default_); +/* harmony default export */ const Geometry3D_IndexedFaceSet = (IndexedFaceSet_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Geometry3D/Sphere.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function Sphere (executionContext) +{ + Rendering_X3DGeometryNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Sphere); + + this ._radius .setUnit ("length"); +} + +Object .assign (Object .setPrototypeOf (Sphere .prototype, Rendering_X3DGeometryNode .prototype), +{ + set_live__ () + { + Rendering_X3DGeometryNode .prototype .set_live__ .call (this); + + if (this .getLive () .getValue ()) + this .getBrowser () .getSphereOptions () .addInterest ("requestRebuild", this); + else + this .getBrowser () .getSphereOptions () .removeInterest ("requestRebuild", this); + }, + build () + { + const + options = this .getBrowser () .getSphereOptions (), + geometry = options .getGeometry (), + radius = Math .abs (this ._radius .getValue ()); + + this .setMultiTexCoords (geometry .getMultiTexCoords ()); + this .setNormals (geometry .getNormals ()); + + if (radius === 1) + { + this .setVertices (geometry .getVertices ()); + + this .getMin () .assign (geometry .getMin ()); + this .getMax () .assign (geometry .getMax ()); + } + else + { + const + defaultVertices = geometry .getVertices () .getValue (), + vertexArray = this .getVertices (); + + for (let i = 0, length = defaultVertices .length; i < length; i += 4) + { + vertexArray .push (radius * defaultVertices [i], + radius * defaultVertices [i + 1], + radius * defaultVertices [i + 2], + 1); + } + + this .getMin () .set (-radius, -radius, -radius); + this .getMax () .set ( radius, radius, radius); + } + + this .setSolid (this ._solid .getValue ()); + }, +}); + +Object .defineProperties (Sphere, +{ + typeName: + { + value: "Sphere", + enumerable: true, + }, + componentName: + { + value: "Geometry3D", + enumerable: true, + }, + containerField: + { + value: "geometry", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "radius", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "solid", new x_ite_Fields .SFBool (true)), + ]), + enumerable: true, + }, +}); + +const Sphere_default_ = Sphere; +; + +x_ite_Namespace .add ("Sphere", "x_ite/Components/Geometry3D/Sphere", Sphere_default_); +/* harmony default export */ const Geometry3D_Sphere = (Sphere_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Geometry3D.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +const Geometry3D_default_ = { + name: "Geometry3D", + concreteNodes: + [ + Geometry3D_Box, + Geometry3D_Cone, + Geometry3D_Cylinder, + Geometry3D_ElevationGrid, + Geometry3D_Extrusion, + Geometry3D_IndexedFaceSet, + Geometry3D_Sphere, + ], + abstractNodes: + [ + ], +}; +; + +x_ite_Namespace .add ("Geometry3D", "x_ite/Components/Geometry3D", Geometry3D_default_); +/* harmony default export */ const Geometry3D = (Geometry3D_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Grouping/StaticGroup.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + +// No support for X3DBindableNode nodes, local lights. X3DLocalFog, local ClipPlane nodes, LOD, Billboard, Switch node. + +const + _pointingShapes = Symbol (), + _collisionShapes = Symbol (), + _shadowShapes = Symbol (), + _opaqueShapes = Symbol (), + _transparentShapes = Symbol (); + +function StaticGroup (executionContext) +{ + Core_X3DChildNode .call (this, executionContext); + Grouping_X3DBoundedObject .call (this, executionContext); + + this .addType (Base_X3DConstants .StaticGroup); + + this .groupNode = new Grouping_Group (this .getExecutionContext ()); + this .bbox = new Geometry_Box3 (); + this .shadowBBox = new Geometry_Box3 (); +} + +Object .assign (Object .setPrototypeOf (StaticGroup .prototype, Core_X3DChildNode .prototype), + Grouping_X3DBoundedObject .prototype, +{ + initialize () + { + Core_X3DChildNode .prototype .initialize .call (this); + Grouping_X3DBoundedObject .prototype .initialize .call (this); + + this ._bboxSize .addFieldInterest (this .groupNode ._bboxSize); + this ._bboxCenter .addFieldInterest (this .groupNode ._bboxCenter); + this ._children .addFieldInterest (this .groupNode ._children); + + this .groupNode ._bboxSize = this ._bboxSize; + this .groupNode ._bboxCenter = this ._bboxCenter; + this .groupNode ._children = this ._children; + this .groupNode .setPrivate (true); + this .groupNode .setup (); + + // Connect after Group setup. + this .groupNode ._isCameraObject .addFieldInterest (this ._isCameraObject); + this .groupNode ._isPickableObject .addFieldInterest (this ._isPickableObject); + this .groupNode ._children .addInterest ("set_children__", this); + + this .setCameraObject (this .groupNode .isCameraObject ()); + this .setPickableObject (this .groupNode .isPickableObject ()); + + this .set_children__ (); + }, + getBBox (bbox, shadows) + { + return bbox .assign (shadows ? this .shadowBBox : this .bbox); + }, + set_children__ () + { + this .groupNode .getBBox (this .bbox); + this .groupNode .getBBox (this .shadowBBox, true); + + this [_pointingShapes] = null; + this [_collisionShapes] = null; + this [_shadowShapes] = null; + this [_opaqueShapes] = null; + this [_transparentShapes] = null; + }, + traverse (type, renderObject) + { + switch (type) + { + case Rendering_TraverseType .CAMERA: + { + return; + } + case Rendering_TraverseType .POINTER: + { + this .traverseObjects (_pointingShapes, "Pointing", type, renderObject); + return; + } + case Rendering_TraverseType .COLLISION: + { + this .traverseObjects (_collisionShapes, "Collision", type, renderObject); + return; + } + case Rendering_TraverseType .SHADOW: + { + this .traverseObjects (_shadowShapes, "Shadow", type, renderObject); + return; + } + case Rendering_TraverseType .DISPLAY: + { + this .traverseObjects (_opaqueShapes, "Opaque", type, renderObject); + this .traverseObjects (_transparentShapes, "Transparent", type, renderObject); + return; + } + } + }, + traverseObjects: (() => + { + const viewVolume = new Geometry_ViewVolume (); + + viewVolume .intersectsSphere = function () { return true; }; + + return function (staticShapes, Static, type, renderObject) + { + if (!this [staticShapes]) + { + //console .log (`Rebuilding StaticGroup ${Static}.`); + + const + viewVolumes = renderObject .getViewVolumes (), + viewport = renderObject .getViewport (), + projectionMatrix = renderObject .getProjectionMatrix (), + modelViewMatrix = renderObject .getModelViewMatrix (), + firstShape = renderObject [`getNum${Static}Shapes`] (); + + viewVolumes .push (viewVolume .set (projectionMatrix, viewport, viewport)); + + modelViewMatrix .push (); + modelViewMatrix .identity (); + + this .groupNode .traverse (type, renderObject); + + modelViewMatrix .pop (); + viewVolumes .pop (); + + const lastShape = renderObject [`getNum${Static}Shapes`] (); + + this [staticShapes] = renderObject [`get${Static}Shapes`] () .splice (firstShape, lastShape - firstShape); + + renderObject [`setNum${Static}Shapes`] (firstShape); + } + + const modelViewMatrix = renderObject .getModelViewMatrix (); + + for (const { modelViewMatrix: modelMatrix, shapeNode } of this [staticShapes]) + { + modelViewMatrix .push (); + modelViewMatrix .multLeft (modelMatrix); + shapeNode .traverse (type, renderObject); + modelViewMatrix .pop (); + } + }; + })(), + dispose () + { + Grouping_X3DBoundedObject .prototype .dispose .call (this); + Core_X3DChildNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (StaticGroup, +{ + typeName: + { + value: "StaticGroup", + enumerable: true, + }, + componentName: + { + value: "Grouping", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "visible", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "bboxDisplay", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxSize", new x_ite_Fields .SFVec3f (-1, -1, -1)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxCenter", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const StaticGroup_default_ = StaticGroup; +; + +x_ite_Namespace .add ("StaticGroup", "x_ite/Components/Grouping/StaticGroup", StaticGroup_default_); +/* harmony default export */ const Grouping_StaticGroup = (StaticGroup_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Grouping/Switch.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +function Switch (executionContext) +{ + Grouping_X3DGroupingNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Switch); + + if (executionContext .getSpecificationVersion () == 2.0) + this .addAlias ("choice", this ._children); + + this .childNode = null; + this .visibleNode = null; + this .boundedObject = null; +} + +Object .assign (Object .setPrototypeOf (Switch .prototype, Grouping_X3DGroupingNode .prototype), +{ + initialize () + { + Grouping_X3DGroupingNode .prototype .initialize .call (this); + + this ._whichChoice .addInterest ("set_child__", this); + this ._children .addInterest ("set_child__", this); + + this .set_child__ (); + }, + getSubBBox (bbox, shadows) + { + if (this ._bboxSize .getValue () .equals (this .getDefaultBBoxSize ())) + { + const boundedObject = Base_X3DCast (Base_X3DConstants .X3DBoundedObject, this .visibleNode); + + return boundedObject ?.getBBox (bbox, shadows) ?? bbox .set (); + } + + return bbox .set (this ._bboxSize .getValue (), this ._bboxCenter .getValue ()); + }, + clear () { }, + add () { }, + remove () { }, + set_child__ () + { + if (this .childNode) + { + this .childNode ._isCameraObject .removeInterest ("set_cameraObject__", this); + this .childNode ._isPickableObject .removeInterest ("set_transformSensors__", this); + } + + if (Base_X3DCast (Base_X3DConstants .X3DBoundedObject, this .childNode)) + { + this .childNode ._display .removeInterest ("set_display__", this); + this .childNode ._bboxDisplay .removeInterest ("set_bboxDisplay__", this); + } + + const whichChoice = this ._whichChoice .getValue (); + + if (whichChoice >= 0 && whichChoice < this ._children .length) + { + this .childNode = Base_X3DCast (Base_X3DConstants .X3DChildNode, this ._children [whichChoice]); + + if (this .childNode) + { + this .childNode ._isCameraObject .addInterest ("set_cameraObject__", this); + this .childNode ._isPickableObject .addInterest ("set_transformSensors__", this); + + if (Base_X3DCast (Base_X3DConstants .X3DBoundedObject, this .childNode)) + { + this .childNode ._display .addInterest ("set_display__", this); + this .childNode ._bboxDisplay .addInterest ("set_bboxDisplay__", this); + } + + delete this .traverse; + } + } + else + { + this .childNode = null; + + this .traverse = Function .prototype; + } + + this .set_display__ (); + this .set_bboxDisplay__ (); + }, + set_cameraObject__ () + { + this .setCameraObject (!!this .visibleNode ?.isCameraObject ()); + }, + set_transformSensors__ () + { + this .setPickableObject (!!(this .getTransformSensors () .size || this .visibleNode ?.isPickableObject ())); + }, + set_display__ () + { + if (Base_X3DCast (Base_X3DConstants .X3DBoundedObject, this .childNode)) + this .visibleNode = this .childNode ._display .getValue () ? this .childNode : null; + else + this .visibleNode = this .childNode; + + this .set_cameraObject__ (); + this .set_transformSensors__ (); + }, + set_bboxDisplay__ () + { + if (Base_X3DCast (Base_X3DConstants .X3DBoundedObject, this .childNode)) + this .boundedObject = this .childNode ._bboxDisplay .getValue () ? this .childNode : null; + else + this .boundedObject = null; + }, + traverse (type, renderObject) + { + switch (type) + { + case Rendering_TraverseType .POINTER: + case Rendering_TraverseType .CAMERA: + case Rendering_TraverseType .SHADOW: + { + this .visibleNode ?.traverse (type, renderObject); + return; + } + case Rendering_TraverseType .PICKING: + { + if (this .getTransformSensors () .size) + { + const modelMatrix = renderObject .getModelViewMatrix () .get (); + + for (const transformSensorNode of this .getTransformSensors ()) + transformSensorNode .collect (modelMatrix); + } + + const visibleNode = this .visibleNode; + + if (visibleNode) + { + const + browser = this .getBrowser (), + pickingHierarchy = browser .getPickingHierarchy (); + + pickingHierarchy .push (this); + + visibleNode .traverse (type, renderObject); + + pickingHierarchy .pop (); + } + + return; + } + case Rendering_TraverseType .COLLISION: + { + this .visibleNode ?.traverse (type, renderObject); + return; + } + case Rendering_TraverseType .DISPLAY: + { + this .visibleNode ?.traverse (type, renderObject); + + this .boundedObject ?.displayBBox (type, renderObject); + return; + } + } + }, +}); + +Object .defineProperties (Switch, +{ + typeName: + { + value: "Switch", + enumerable: true, + }, + componentName: + { + value: "Grouping", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "whichChoice", new x_ite_Fields .SFInt32 (-1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "visible", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "bboxDisplay", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxSize", new x_ite_Fields .SFVec3f (-1, -1, -1)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxCenter", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "addChildren", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "removeChildren", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const Switch_default_ = Switch; +; + +x_ite_Namespace .add ("Switch", "x_ite/Components/Grouping/Switch", Switch_default_); +/* harmony default export */ const Grouping_Switch = (Switch_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Grouping/X3DTransformMatrix3DNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function X3DTransformMatrix3DNode (executionContext) +{ + Grouping_X3DGroupingNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DTransformMatrix3DNode); + + this .matrix = new Numbers_Matrix4 (); +} + +Object .assign (Object .setPrototypeOf (X3DTransformMatrix3DNode .prototype, Grouping_X3DGroupingNode .prototype), +{ + setMatrix (matrix) + { + if (matrix .equals (Numbers_Matrix4 .Identity)) + { + this .matrix .identity (); + + this .getBBox = this .getSubBBox; + this .traverse = this .groupTraverse; + } + else + { + this .matrix .assign (matrix); + + delete this .getBBox; + delete this .traverse; + } + }, + getMatrix () + { + return this .matrix; + }, + setTransform (t, r, s, so, c) + { + if (t .equals (Numbers_Vector3 .Zero) && r .equals (Numbers_Rotation4 .Identity) && s .equals (Numbers_Vector3 .One)) + { + this .matrix .identity (); + + this .getBBox = this .getSubBBox; + this .traverse = this .groupTraverse; + } + else + { + this .matrix .set (t, r, s, so, c); + + delete this .getBBox; + delete this .traverse; + } + }, + getBBox (bbox, shadows) + { + return this .getSubBBox (bbox, shadows) .multRight (this .matrix); + }, + traverse (type, renderObject) + { + const modelViewMatrix = renderObject .getModelViewMatrix (); + + modelViewMatrix .push (); + modelViewMatrix .multLeft (this .matrix); + + Grouping_X3DGroupingNode .prototype .traverse .call (this, type, renderObject); + + modelViewMatrix .pop (); + }, + groupTraverse: Grouping_X3DGroupingNode .prototype .traverse, +}); + +Object .defineProperties (X3DTransformMatrix3DNode, +{ + typeName: + { + value: "X3DTransformMatrix3DNode", + enumerable: true, + }, + componentName: + { + value: "Grouping", + enumerable: true, + }, +}); + +const X3DTransformMatrix3DNode_default_ = X3DTransformMatrix3DNode; +; + +x_ite_Namespace .add ("X3DTransformMatrix3DNode", "x_ite/Components/Grouping/X3DTransformMatrix3DNode", X3DTransformMatrix3DNode_default_); +/* harmony default export */ const Grouping_X3DTransformMatrix3DNode = (X3DTransformMatrix3DNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Grouping/X3DTransformNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function X3DTransformNode (executionContext) +{ + Grouping_X3DTransformMatrix3DNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DTransformNode); + + this ._translation .setUnit ("length"); + this ._center .setUnit ("length"); +} + +Object .assign (Object .setPrototypeOf (X3DTransformNode .prototype, Grouping_X3DTransformMatrix3DNode .prototype), +{ + initialize () + { + Grouping_X3DTransformMatrix3DNode .prototype .initialize .call (this); + + this .addInterest ("eventsProcessed", this); + + this .eventsProcessed (); + }, + eventsProcessed () + { + this .setTransform (this ._translation .getValue (), + this ._rotation .getValue (), + this ._scale .getValue (), + this ._scaleOrientation .getValue (), + this ._center .getValue ()); + }, +}); + +Object .defineProperties (X3DTransformNode, +{ + typeName: + { + value: "X3DTransformNode", + enumerable: true, + }, + componentName: + { + value: "Grouping", + enumerable: true, + }, +}); + +const X3DTransformNode_default_ = X3DTransformNode; +; + +x_ite_Namespace .add ("X3DTransformNode", "x_ite/Components/Grouping/X3DTransformNode", X3DTransformNode_default_); +/* harmony default export */ const Grouping_X3DTransformNode = (X3DTransformNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Grouping/Transform.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function Transform (executionContext) +{ + Grouping_X3DTransformNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Transform); +} + +Object .setPrototypeOf (Transform .prototype, Grouping_X3DTransformNode .prototype); + +Object .defineProperties (Transform, +{ + typeName: + { + value: "Transform", + enumerable: true, + }, + componentName: + { + value: "Grouping", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "translation", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "rotation", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "scale", new x_ite_Fields .SFVec3f (1, 1, 1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "scaleOrientation", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "center", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "visible", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "bboxDisplay", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxSize", new x_ite_Fields .SFVec3f (-1, -1, -1)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxCenter", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "addChildren", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "removeChildren", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const Transform_default_ = Transform; +; + +x_ite_Namespace .add ("Transform", "x_ite/Components/Grouping/Transform", Transform_default_); +/* harmony default export */ const Grouping_Transform = (Transform_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Grouping.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + +const Grouping_default_ = { + name: "Grouping", + concreteNodes: + [ + Grouping_Group, + Grouping_StaticGroup, + Grouping_Switch, + Grouping_Transform, + ], + abstractNodes: + [ + Grouping_X3DBoundedObject, + Grouping_X3DGroupingNode, + Grouping_X3DTransformMatrix3DNode, + Grouping_X3DTransformNode, + ], +}; +; + +x_ite_Namespace .add ("Grouping", "x_ite/Components/Grouping", Grouping_default_); +/* harmony default export */ const Grouping = (Grouping_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Interpolation/ColorInterpolator.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function ColorInterpolator (executionContext) +{ + Interpolation_X3DInterpolatorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .ColorInterpolator); + + this .hsv = [ ]; +} + +Object .assign (Object .setPrototypeOf (ColorInterpolator .prototype, Interpolation_X3DInterpolatorNode .prototype), +{ + initialize () + { + Interpolation_X3DInterpolatorNode .prototype .initialize .call (this); + + this ._keyValue .addInterest ("set_keyValue__", this); + }, + set_keyValue__ () + { + const keyValue = this ._keyValue; + + if (keyValue .length < this ._key .length) + this ._keyValue .resize (this ._key .length, keyValue .length ? keyValue [this ._keyValue .length - 1] : new x_ite_Fields .SFColor ()); + + this .hsv .length = 0; + + for (const value of keyValue) + this .hsv .push (value .getHSV ()); + }, + interpolate: (() => + { + const value = [ ]; + + return function (index0, index1, weight) + { + Numbers_Color3 .lerp (this .hsv [index0], this .hsv [index1], weight, value); + + this ._value_changed .setHSV (value [0], value [1], value [2]); + }; + })(), +}); + +Object .defineProperties (ColorInterpolator, +{ + typeName: + { + value: "ColorInterpolator", + enumerable: true, + }, + componentName: + { + value: "Interpolation", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_fraction", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "key", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "keyValue", new x_ite_Fields .MFColor ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .SFColor ()), + ]), + enumerable: true, + }, +}); + +const ColorInterpolator_default_ = ColorInterpolator; +; + +x_ite_Namespace .add ("ColorInterpolator", "x_ite/Components/Interpolation/ColorInterpolator", ColorInterpolator_default_); +/* harmony default export */ const Interpolation_ColorInterpolator = (ColorInterpolator_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Interpolation/CoordinateInterpolator.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function CoordinateInterpolator (executionContext) +{ + Interpolation_X3DInterpolatorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .CoordinateInterpolator); +} + +Object .assign (Object .setPrototypeOf (CoordinateInterpolator .prototype, Interpolation_X3DInterpolatorNode .prototype), +{ + set_keyValue__ () { }, + interpolate (index0, index1, weight) + { + const keyValue = this ._keyValue .getValue (); + + let size = this ._key .length ? Math .floor (this ._keyValue .length / this ._key .length) : 0; + + this ._value_changed .length = size; + + const value_changed = this ._value_changed .getValue (); + + index0 *= size; + index1 = index0 + (this ._key .length > 1 ? size : 0); + + index0 *= 3; + index1 *= 3; + size *= 3; + + for (let i0 = 0; i0 < size; i0 += 3) + { + const + i1 = i0 + 1, + i2 = i0 + 2; + + value_changed [i0] = Math_Algorithm .lerp (keyValue [index0 + i0], keyValue [index1 + i0], weight); + value_changed [i1] = Math_Algorithm .lerp (keyValue [index0 + i1], keyValue [index1 + i1], weight); + value_changed [i2] = Math_Algorithm .lerp (keyValue [index0 + i2], keyValue [index1 + i2], weight); + } + + this ._value_changed .addEvent (); + }, +}); + +Object .defineProperties (CoordinateInterpolator, +{ + typeName: + { + value: "CoordinateInterpolator", + enumerable: true, + }, + componentName: + { + value: "Interpolation", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_fraction", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "key", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "keyValue", new x_ite_Fields .MFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .MFVec3f ()), + ]), + enumerable: true, + }, +}); + +const CoordinateInterpolator_default_ = CoordinateInterpolator; +; + +x_ite_Namespace .add ("CoordinateInterpolator", "x_ite/Components/Interpolation/CoordinateInterpolator", CoordinateInterpolator_default_); +/* harmony default export */ const Interpolation_CoordinateInterpolator = (CoordinateInterpolator_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Interpolation/CoordinateInterpolator2D.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function CoordinateInterpolator2D (executionContext) +{ + Interpolation_X3DInterpolatorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .CoordinateInterpolator2D); +} + +Object .assign (Object .setPrototypeOf (CoordinateInterpolator2D .prototype, Interpolation_X3DInterpolatorNode .prototype), +{ + set_keyValue__ () { }, + interpolate (index0, index1, weight) + { + const keyValue = this ._keyValue .getValue (); + + let size = this ._key .length ? Math .floor (this ._keyValue .length / this ._key .length) : 0; + + this ._value_changed .length = size; + + const value_changed = this ._value_changed .getValue (); + + index0 *= size; + index1 = index0 + (this ._key .length > 1 ? size : 0); + + index0 *= 2; + index1 *= 2; + size *= 2; + + for (let i0 = 0; i0 < size; i0 += 2) + { + const i1 = i0 + 1; + + value_changed [i0] = Math_Algorithm .lerp (keyValue [index0 + i0], keyValue [index1 + i0], weight); + value_changed [i1] = Math_Algorithm .lerp (keyValue [index0 + i1], keyValue [index1 + i1], weight); + } + + this ._value_changed .addEvent (); + }, +}); + +Object .defineProperties (CoordinateInterpolator2D, +{ + typeName: + { + value: "CoordinateInterpolator2D", + enumerable: true, + }, + componentName: + { + value: "Interpolation", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_fraction", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "key", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "keyValue", new x_ite_Fields .MFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .MFVec2f ()), + ]), + enumerable: true, + }, +}); + +const CoordinateInterpolator2D_default_ = CoordinateInterpolator2D; +; + +x_ite_Namespace .add ("CoordinateInterpolator2D", "x_ite/Components/Interpolation/CoordinateInterpolator2D", CoordinateInterpolator2D_default_); +/* harmony default export */ const Interpolation_CoordinateInterpolator2D = (CoordinateInterpolator2D_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Interpolation/NormalInterpolator.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +function NormalInterpolator (executionContext) +{ + Interpolation_X3DInterpolatorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .NormalInterpolator); +} + +Object .assign (Object .setPrototypeOf (NormalInterpolator .prototype, Interpolation_X3DInterpolatorNode .prototype), +{ + initialize () + { + Interpolation_X3DInterpolatorNode .prototype .initialize .call (this); + + this ._keyValue .addInterest ("set_keyValue__", this); + }, + set_keyValue__ () { }, + interpolate: (() => + { + const + keyValue0 = new Numbers_Vector3 (0, 0, 0), + keyValue1 = new Numbers_Vector3 (0, 0, 0); + + return function (index0, index1, weight) + { + const keyValue = this ._keyValue .getValue (); + + let size = this ._key .length > 1 ? Math .floor (this ._keyValue .length / this ._key .length) : 0; + + this ._value_changed .length = size; + + const value_changed = this ._value_changed .getValue (); + + index0 *= size; + index1 = index0 + size; + + index0 *= 3; + index1 *= 3; + size *= 3; + + for (let i0 = 0; i0 < size; i0 += 3) + { + try + { + const + i1 = i0 + 1, + i2 = i0 + 2; + + keyValue0 .set (keyValue [index0 + i0], keyValue [index0 + i1], keyValue [index0 + i2]); + keyValue1 .set (keyValue [index1 + i0], keyValue [index1 + i1], keyValue [index1 + i2]); + + const value = Math_Algorithm .simpleSlerp (keyValue0, keyValue1, weight); + + value_changed [i0] = value [0]; + value_changed [i1] = value [1]; + value_changed [i2] = value [2]; + } + catch (error) + { + //console .log (error); + } + } + + this ._value_changed .addEvent (); + }; + })(), +}); + +Object .defineProperties (NormalInterpolator, +{ + typeName: + { + value: "NormalInterpolator", + enumerable: true, + }, + componentName: + { + value: "Interpolation", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_fraction", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "key", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "keyValue", new x_ite_Fields .MFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .MFVec3f ()), + ]), + enumerable: true, + }, +}); + +const NormalInterpolator_default_ = NormalInterpolator; +; + +x_ite_Namespace .add ("NormalInterpolator", "x_ite/Components/Interpolation/NormalInterpolator", NormalInterpolator_default_); +/* harmony default export */ const Interpolation_NormalInterpolator = (NormalInterpolator_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Interpolation/PositionInterpolator2D.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function PositionInterpolator2D (executionContext) +{ + Interpolation_X3DInterpolatorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .PositionInterpolator2D); +} + +Object .assign (Object .setPrototypeOf (PositionInterpolator2D .prototype, Interpolation_X3DInterpolatorNode .prototype), +{ + initialize () + { + Interpolation_X3DInterpolatorNode .prototype .initialize .call (this); + + this ._keyValue .addInterest ("set_keyValue__", this); + }, + set_keyValue__ () + { + const + key = this ._key, + keyValue = this ._keyValue; + + if (keyValue .length < key .length) + keyValue .resize (key .length, keyValue .length ? keyValue [keyValue .length - 1] : new x_ite_Fields .SFVec2f ()); + }, + interpolate: (() => + { + const keyValue = new Numbers_Vector2 (0, 0); + + return function (index0, index1, weight) + { + this ._value_changed = keyValue .assign (this ._keyValue [index0] .getValue ()) .lerp (this ._keyValue [index1] .getValue (), weight); + }; + })(), +}); + +Object .defineProperties (PositionInterpolator2D, +{ + typeName: + { + value: "PositionInterpolator2D", + enumerable: true, + }, + componentName: + { + value: "Interpolation", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_fraction", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "key", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "keyValue", new x_ite_Fields .MFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .SFVec2f ()), + ]), + enumerable: true, + }, +}); + +const PositionInterpolator2D_default_ = PositionInterpolator2D; +; + +x_ite_Namespace .add ("PositionInterpolator2D", "x_ite/Components/Interpolation/PositionInterpolator2D", PositionInterpolator2D_default_); +/* harmony default export */ const Interpolation_PositionInterpolator2D = (PositionInterpolator2D_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function CatmullRomSplineInterpolator () +{ + this .T0 = [ ]; + this .T1 = [ ]; +} + +Object .assign (CatmullRomSplineInterpolator .prototype, +{ + generate: (() => + { + const + T = [ ], + Fp = [ ], + Fm = [ ]; + + return function (closed, key, keyValue, keyVelocity, normalizeVelocity) + { + const + T0 = this .T0, + T1 = this .T1; + + T0 .length = 0; + T1 .length = 0; + + T .length = 0; + Fp .length = 0; + Fm .length = 0; + + if (key .length > 1) + { + // T + + if (keyVelocity .length === 0) + { + if (closed) + T .push (this .divide (this .subtract (keyValue [1], keyValue [keyValue .length - 2]), 2)); + + else + T .push (this .create ()); + + for (let i = 1, length = keyValue .length - 1; i < length; ++ i) + T .push (this .divide (this .subtract (keyValue [i + 1], keyValue [i - 1]), 2)); + + T .push (this .copy (T [0])); + } + else + { + for (let i = 0, length = keyVelocity .length; i < length; ++ i) + T .push (this .copy (keyVelocity [i])); + + if (normalizeVelocity) + { + let Dtot = 0; + + for (let i = 0, length = keyValue .length - 1; i < length; ++ i) + Dtot += this .magnitude (this .subtract (keyValue [i], keyValue [i + 1])); + + for (let i = 0, length = T .length - 1; i < length; ++ i) + { + const Tia = this .magnitude (T [i]); + + if (Tia) + T [i] = this .multiply (T [i], Dtot / Tia); + } + } + } + + // Fm, Fp + + if (closed) + { + const i_1 = key .length - 1; + const i_2 = key .length - 2; + + const d = key [1] - key [0] + key [i_1] - key [i_2]; + + Fm .push (2 * (key [1] - key [0]) / d); + Fp .push (2 * (key [i_1] - key [i_2]) / d); + } + else + { + Fm .push (1); + Fp .push (1); + } + + for (let i = 1, length = key .length - 1; i < length; ++ i) + { + const d = key [i + 1] - key [i - 1]; + + Fm .push (2 * (key [i + 1] - key [i]) / d); + Fp .push (2 * (key [i] - key [i - 1]) / d); + } + + Fm .push (Fm [0]); + Fp .push (Fp [0]); + + // T0, T1 + + for (let i = 0, length = T .length; i < length; ++ i) + { + T0 .push (this .multiply (T [i], Fp [i])); + T1 .push (this .multiply (T [i], Fm [i])); + } + } + else + { + T0 .push (this .create ()); + T1 .push (this .create ()); + } + }; + })(), + interpolate: (() => + { + const S = new Numbers_Vector4 (0, 0, 0, 0); + + const H = new Numbers_Matrix4 ( 2, -2, 1, 1, + -3, 3, -2, -1, + 0, 0, 1, 0, + 1, 0, 0, 0); + + return function (index0, index1, weight, keyValue) + { + S .set (weight ** 3, weight ** 2, weight, 1); + + // Taking dot product from SH and C; + + return this .dot (H .multVecMatrix (S), + keyValue [index0], + keyValue [index1], + this .T0 [index0], + this .T1 [index1]); + }; + })(), +}); + +const CatmullRomSplineInterpolator_default_ = CatmullRomSplineInterpolator; +; + +x_ite_Namespace .add ("CatmullRomSplineInterpolator", "x_ite/Browser/Interpolation/CatmullRomSplineInterpolator", CatmullRomSplineInterpolator_default_); +/* harmony default export */ const Interpolation_CatmullRomSplineInterpolator = (CatmullRomSplineInterpolator_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolatorTemplate.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function CatmullRomSplineInterpolatorTemplate (Type) +{ + function CatmullRomSplineInterpolatorInstance () + { + this .T0 = [ ]; + this .T1 = [ ]; + } + + Object .assign (Object .setPrototypeOf (CatmullRomSplineInterpolatorInstance .prototype, Interpolation_CatmullRomSplineInterpolator .prototype), + { + create () + { + return Type .Zero .copy (); + }, + copy (value) + { + return value .copy (); + }, + subtract (lhs, rhs) + { + return lhs .copy () .subtract (rhs); + }, + multiply (lhs, rhs) + { + return lhs .copy () .multiply (rhs); + }, + divide (lhs, rhs) + { + return lhs .copy () .divide (rhs); + }, + magnitude (value) + { + return value .magnitude (); + }, + dot: (() => + { + const + c0 = new Type (0, 0, 0, 0), + c1 = new Type (0, 0, 0, 0), + c2 = new Type (0, 0, 0, 0), + c3 = new Type (0, 0, 0, 0); + + return function (SH, C0, C1, C2, C3) + { + c0 .assign (C0) .multiply (SH [0]); + c1 .assign (C1) .multiply (SH [1]); + c2 .assign (C2) .multiply (SH [2]); + c3 .assign (C3) .multiply (SH [3]); + + return c0 .add (c1) .add (c2) .add (c3); + }; + })(), + }); + + return CatmullRomSplineInterpolatorInstance; +} + +const CatmullRomSplineInterpolatorTemplate_default_ = CatmullRomSplineInterpolatorTemplate; +; + +x_ite_Namespace .add ("CatmullRomSplineInterpolatorTemplate", "x_ite/Browser/Interpolation/CatmullRomSplineInterpolatorTemplate", CatmullRomSplineInterpolatorTemplate_default_); +/* harmony default export */ const Interpolation_CatmullRomSplineInterpolatorTemplate = (CatmullRomSplineInterpolatorTemplate_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator3.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +const CatmullRomSplineInterpolator3 = Interpolation_CatmullRomSplineInterpolatorTemplate (Numbers_Vector3); + +const CatmullRomSplineInterpolator3_default_ = CatmullRomSplineInterpolator3; +; + +x_ite_Namespace .add ("CatmullRomSplineInterpolator3", "x_ite/Browser/Interpolation/CatmullRomSplineInterpolator3", CatmullRomSplineInterpolator3_default_); +/* harmony default export */ const Interpolation_CatmullRomSplineInterpolator3 = (CatmullRomSplineInterpolator3_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Interpolation/SplinePositionInterpolator.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function SplinePositionInterpolator (executionContext) +{ + Interpolation_X3DInterpolatorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .SplinePositionInterpolator); + + this .spline = new Interpolation_CatmullRomSplineInterpolator3 (); +} + +Object .assign (Object .setPrototypeOf (SplinePositionInterpolator .prototype, Interpolation_X3DInterpolatorNode .prototype), +{ + initialize () + { + Interpolation_X3DInterpolatorNode .prototype .initialize .call (this); + + this ._keyValue .addInterest ("set_keyValue__", this); + this ._keyVelocity .addInterest ("set_keyVelocity__", this); + this ._normalizeVelocity .addInterest ("set_normalizeVelocity__", this); + }, + set_keyValue__ () + { + const + key = this ._key, + keyValue = this ._keyValue; + + if (keyValue .length < key .length) + keyValue .resize (key .length, keyValue .length ? keyValue [keyValue .length - 1] : new x_ite_Fields .SFVec3f ()); + + this .set_keyVelocity__ (); + }, + set_keyVelocity__ () + { + if (this ._keyVelocity .length) + { + if (this ._keyVelocity .length < this ._key .length) + this ._keyVelocity .resize (this ._key .length, new x_ite_Fields .SFVec3f ()); + } + + this .set_normalizeVelocity__ (); + }, + set_normalizeVelocity__ () + { + this .spline .generate (this ._closed .getValue (), + this ._key, + this ._keyValue, + this ._keyVelocity, + this ._normalizeVelocity .getValue ()); + }, + interpolate (index0, index1, weight) + { + this ._value_changed = this .spline .interpolate (index0, index1, weight, this ._keyValue); + }, +}); + +Object .defineProperties (SplinePositionInterpolator, +{ + typeName: + { + value: "SplinePositionInterpolator", + enumerable: true, + }, + componentName: + { + value: "Interpolation", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_fraction", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "closed", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "key", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "keyValue", new x_ite_Fields .MFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "keyVelocity", new x_ite_Fields .MFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normalizeVelocity", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .SFVec3f ()), + ]), + enumerable: true, + }, +}); + +const SplinePositionInterpolator_default_ = SplinePositionInterpolator; +; + +x_ite_Namespace .add ("SplinePositionInterpolator", "x_ite/Components/Interpolation/SplinePositionInterpolator", SplinePositionInterpolator_default_); +/* harmony default export */ const Interpolation_SplinePositionInterpolator = (SplinePositionInterpolator_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator2.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +const CatmullRomSplineInterpolator2 = Interpolation_CatmullRomSplineInterpolatorTemplate (Numbers_Vector2); + +const CatmullRomSplineInterpolator2_default_ = CatmullRomSplineInterpolator2; +; + +x_ite_Namespace .add ("CatmullRomSplineInterpolator2", "x_ite/Browser/Interpolation/CatmullRomSplineInterpolator2", CatmullRomSplineInterpolator2_default_); +/* harmony default export */ const Interpolation_CatmullRomSplineInterpolator2 = (CatmullRomSplineInterpolator2_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Interpolation/SplinePositionInterpolator2D.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function SplinePositionInterpolator2D (executionContext) +{ + Interpolation_X3DInterpolatorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .SplinePositionInterpolator2D); + + this .spline = new Interpolation_CatmullRomSplineInterpolator2 (); +} + +Object .assign (Object .setPrototypeOf (SplinePositionInterpolator2D .prototype, Interpolation_X3DInterpolatorNode .prototype), +{ + initialize () + { + Interpolation_X3DInterpolatorNode .prototype .initialize .call (this); + + this ._keyValue .addInterest ("set_keyValue__", this); + this ._keyVelocity .addInterest ("set_keyVelocity__", this); + this ._normalizeVelocity .addInterest ("set_normalizeVelocity__", this); + }, + set_keyValue__ () + { + const + key = this ._key, + keyValue = this ._keyValue; + + if (keyValue .length < key .length) + keyValue .resize (key .length, keyValue .length ? keyValue [keyValue .length - 1] : new x_ite_Fields .SFVec2f ()); + + this .set_keyVelocity__ (); + }, + set_keyVelocity__ () + { + if (this ._keyVelocity .length) + { + if (this ._keyVelocity .length < this ._key .length) + this ._keyVelocity .resize (this ._key .length, new x_ite_Fields .SFVec2f ()); + } + + this .set_normalizeVelocity__ (); + }, + set_normalizeVelocity__ () + { + this .spline .generate (this ._closed .getValue (), + this ._key, + this ._keyValue, + this ._keyVelocity, + this ._normalizeVelocity .getValue ()); + }, + interpolate (index0, index1, weight) + { + this ._value_changed = this .spline .interpolate (index0, index1, weight, this ._keyValue); + }, +}); + +Object .defineProperties (SplinePositionInterpolator2D, +{ + typeName: + { + value: "SplinePositionInterpolator2D", + enumerable: true, + }, + componentName: + { + value: "Interpolation", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_fraction", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "closed", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "key", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "keyValue", new x_ite_Fields .MFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "keyVelocity", new x_ite_Fields .MFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normalizeVelocity", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .SFVec2f ()), + ]), + enumerable: true, + }, +}); + +const SplinePositionInterpolator2D_default_ = SplinePositionInterpolator2D; +; + +x_ite_Namespace .add ("SplinePositionInterpolator2D", "x_ite/Components/Interpolation/SplinePositionInterpolator2D", SplinePositionInterpolator2D_default_); +/* harmony default export */ const Interpolation_SplinePositionInterpolator2D = (SplinePositionInterpolator2D_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator1.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function CatmullRomSplineInterpolator1 () +{ + Interpolation_CatmullRomSplineInterpolator .call (this); +} + +Object .assign (Object .setPrototypeOf (CatmullRomSplineInterpolator1 .prototype, Interpolation_CatmullRomSplineInterpolator .prototype), +{ + create () + { + return 0; + }, + copy (value) + { + return value; + }, + subtract (lhs, rhs) + { + return lhs - rhs; + }, + multiply (lhs, rhs) + { + return lhs * rhs; + }, + divide (lhs, rhs) + { + return lhs / rhs; + }, + magnitude (value) + { + return Math .abs (value); + }, + dot (SH, C0, C1, C2, C3) + { + return C0 * SH [0] + C1 * SH [1] + C2 * SH [2] + C3 * SH [3]; + }, +}); + +const CatmullRomSplineInterpolator1_default_ = CatmullRomSplineInterpolator1; +; + +x_ite_Namespace .add ("CatmullRomSplineInterpolator1", "x_ite/Browser/Interpolation/CatmullRomSplineInterpolator1", CatmullRomSplineInterpolator1_default_); +/* harmony default export */ const Interpolation_CatmullRomSplineInterpolator1 = (CatmullRomSplineInterpolator1_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Interpolation/SplineScalarInterpolator.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function SplineScalarInterpolator (executionContext) +{ + Interpolation_X3DInterpolatorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .SplineScalarInterpolator); + + this .spline = new Interpolation_CatmullRomSplineInterpolator1 (); +} + +Object .assign (Object .setPrototypeOf (SplineScalarInterpolator .prototype, Interpolation_X3DInterpolatorNode .prototype), +{ + initialize () + { + Interpolation_X3DInterpolatorNode .prototype .initialize .call (this); + + this ._keyValue .addInterest ("set_keyValue__", this); + this ._keyVelocity .addInterest ("set_keyVelocity__", this); + this ._normalizeVelocity .addInterest ("set_normalizeVelocity__", this); + }, + set_keyValue__ () + { + const + key = this ._key, + keyValue = this ._keyValue; + + if (keyValue .length < key .length) + keyValue .resize (key .length, keyValue .length ? keyValue [keyValue .length - 1] : new x_ite_Fields .SFFloat ()); + + this .set_keyVelocity__ (); + }, + set_keyVelocity__ () + { + if (this ._keyVelocity .length) + { + if (this ._keyVelocity .length < this ._key .length) + this ._keyVelocity .resize (this ._key .length, new x_ite_Fields .SFFloat ()); + } + + this .set_normalizeVelocity__ (); + }, + set_normalizeVelocity__ () + { + this .spline .generate (this ._closed .getValue (), + this ._key, + this ._keyValue, + this ._keyVelocity, + this ._normalizeVelocity .getValue ()); + }, + interpolate (index0, index1, weight) + { + this ._value_changed = this .spline .interpolate (index0, index1, weight, this ._keyValue); + }, +}); + +Object .defineProperties (SplineScalarInterpolator, +{ + typeName: + { + value: "SplineScalarInterpolator", + enumerable: true, + }, + componentName: + { + value: "Interpolation", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_fraction", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "closed", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "key", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "keyValue", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "keyVelocity", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normalizeVelocity", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .SFFloat ()), + ]), + enumerable: true, + }, +}); + +const SplineScalarInterpolator_default_ = SplineScalarInterpolator; +; + +x_ite_Namespace .add ("SplineScalarInterpolator", "x_ite/Components/Interpolation/SplineScalarInterpolator", SplineScalarInterpolator_default_); +/* harmony default export */ const Interpolation_SplineScalarInterpolator = (SplineScalarInterpolator_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Interpolation/SquatInterpolator.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function SquatInterpolator () +{ + this .s = [ ]; +} + +Object .assign (SquatInterpolator .prototype, +{ + generate (closed, key, keyValue) + { + const s = this .s; + + s .length = 0; + + if (key .length > 1) + { + if (closed) + { + s .push (Numbers_Rotation4 .spline (keyValue [key .length - 2] .getValue (), + keyValue [0] .getValue (), + keyValue [1] .getValue ())); + } + else + { + s .push (keyValue [0] .getValue ()); + } + + for (let i = 1, length = key .length - 1; i < length; ++ i) + { + s .push (Numbers_Rotation4 .spline (keyValue [i - 1] .getValue (), + keyValue [i] .getValue (), + keyValue [i + 1] .getValue ())); + } + + if (closed) + { + s .push (Numbers_Rotation4 .spline (keyValue [key .length - 2] .getValue (), + keyValue [key .length - 1] .getValue (), + keyValue [1] .getValue ())); + } + else + { + s .push (keyValue [key .length - 1] .getValue ()); + } + } + else if (key .length > 0) + { + s .push (keyValue [0] .getValue () .copy ()); + } + }, + interpolate: (() => + { + const result = new Numbers_Rotation4 (); + + return function (index0, index1, weight, keyValue) + { + return result .assign (keyValue [index0] .getValue ()) .squad (this .s [index0], + this .s [index1], + keyValue [index1] .getValue (), weight); + }; + })(), +}); + +const SquatInterpolator_default_ = SquatInterpolator; +; + +x_ite_Namespace .add ("SquatInterpolator", "x_ite/Browser/Interpolation/SquatInterpolator", SquatInterpolator_default_); +/* harmony default export */ const Interpolation_SquatInterpolator = (SquatInterpolator_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Interpolation/SquadOrientationInterpolator.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function SquadOrientationInterpolator (executionContext) +{ + Interpolation_X3DInterpolatorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .SquadOrientationInterpolator); + + this ._keyValue .setUnit ("angle"); + this ._value_changed .setUnit ("angle"); + + this .squad = new Interpolation_SquatInterpolator (); +} + +Object .assign (Object .setPrototypeOf (SquadOrientationInterpolator .prototype, Interpolation_X3DInterpolatorNode .prototype), +{ + initialize () + { + Interpolation_X3DInterpolatorNode .prototype .initialize .call (this); + + this ._keyValue .addInterest ("set_keyValue__", this); + }, + set_keyValue__ () + { + const + key = this ._key, + keyValue = this ._keyValue; + + if (keyValue .length < key .length) + keyValue .resize (key .length, keyValue .length ? keyValue [keyValue .length - 1] : new x_ite_Fields .SFRotation ()); + + this .squad .generate (this ._closed .getValue (), + this ._key, + this ._keyValue); + }, + interpolate (index0, index1, weight) + { + try + { + this ._value_changed = this .squad .interpolate (index0, index1, weight, this ._keyValue); + } + catch (error) + { + console .error (error); + } + }, +}); + +Object .defineProperties (SquadOrientationInterpolator, +{ + typeName: + { + value: "SquadOrientationInterpolator", + enumerable: true, + }, + componentName: + { + value: "Interpolation", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_fraction", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "closed", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "key", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "keyValue", new x_ite_Fields .MFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "value_changed", new x_ite_Fields .SFRotation ()), + ]), + enumerable: true, + }, +}); + +const SquadOrientationInterpolator_default_ = SquadOrientationInterpolator; +; + +x_ite_Namespace .add ("SquadOrientationInterpolator", "x_ite/Components/Interpolation/SquadOrientationInterpolator", SquadOrientationInterpolator_default_); +/* harmony default export */ const Interpolation_SquadOrientationInterpolator = (SquadOrientationInterpolator_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Interpolation.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + +const Interpolation_default_ = { + name: "Interpolation", + concreteNodes: + [ + Interpolation_ColorInterpolator, + Interpolation_CoordinateInterpolator, + Interpolation_CoordinateInterpolator2D, + Interpolation_EaseInEaseOut, + Interpolation_NormalInterpolator, + Interpolation_OrientationInterpolator, + Interpolation_PositionInterpolator, + Interpolation_PositionInterpolator2D, + Interpolation_ScalarInterpolator, + Interpolation_SplinePositionInterpolator, + Interpolation_SplinePositionInterpolator2D, + Interpolation_SplineScalarInterpolator, + Interpolation_SquadOrientationInterpolator, + ], + abstractNodes: + [ + Interpolation_X3DInterpolatorNode, + ], +}; +; + +x_ite_Namespace .add ("Interpolation", "x_ite/Components/Interpolation", Interpolation_default_); +/* harmony default export */ const Interpolation = (Interpolation_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Layering/X3DViewportNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function X3DViewportNode (executionContext) +{ + Grouping_X3DGroupingNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DViewportNode); +} + +Object .setPrototypeOf (X3DViewportNode .prototype, Grouping_X3DGroupingNode .prototype); + +Object .defineProperties (X3DViewportNode, +{ + typeName: + { + value: "X3DViewportNode", + enumerable: true, + }, + componentName: + { + value: "Layering", + enumerable: true, + }, +}); + +const X3DViewportNode_default_ = X3DViewportNode; +; + +x_ite_Namespace .add ("X3DViewportNode", "x_ite/Components/Layering/X3DViewportNode", X3DViewportNode_default_); +/* harmony default export */ const Layering_X3DViewportNode = (X3DViewportNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Layering/Viewport.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + +const ViewVolumes = Utility_ObjectCache (Geometry_ViewVolume); + +function Viewport (executionContext) +{ + Layering_X3DViewportNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Viewport); + + this .rectangle = new Numbers_Vector4 (0, 0, 0, 0); +} + +Object .assign (Object .setPrototypeOf (Viewport .prototype, Layering_X3DViewportNode .prototype), +{ + getRectangle () + { + const + viewport = this .getBrowser () .getViewport (), + left = Math .floor (viewport [2] * this .getLeft ()), + right = Math .floor (viewport [2] * this .getRight ()), + bottom = Math .floor (viewport [3] * this .getBottom ()), + top = Math .floor (viewport [3] * this .getTop ()); + + this .rectangle .set (left, + bottom, + Math .max (0, right - left), + Math .max (0, top - bottom)); + + return this .rectangle; + }, + getLeft () + { + return this ._clipBoundary .length > 0 ? this ._clipBoundary [0] : 0; + }, + getRight () + { + return this ._clipBoundary .length > 1 ? this ._clipBoundary [1] : 1; + }, + getBottom () + { + return this ._clipBoundary .length > 2 ? this ._clipBoundary [2] : 0; + }, + getTop () + { + return this ._clipBoundary .length > 3 ? this ._clipBoundary [3] : 1; + }, + traverse (type, renderObject) + { + this .push (renderObject); + + switch (type) + { + case Rendering_TraverseType .POINTER: + { + if (this .getBrowser () .isPointerInRectangle (this .rectangle)) + Layering_X3DViewportNode .prototype .traverse .call (this, type, renderObject); + + break; + } + default: + Layering_X3DViewportNode .prototype .traverse .call (this, type, renderObject); + break; + } + + this .pop (renderObject); + }, + push (renderObject) + { + const + viewVolumes = renderObject .getViewVolumes (), + rectangle = this .getRectangle (), + viewport = viewVolumes .length ? viewVolumes .at (-1) .getViewport () : rectangle, + viewVolume = ViewVolumes .pop (); + + viewVolume .set (renderObject .getProjectionMatrix () .get (), viewport, rectangle); + + viewVolumes .push (viewVolume); + }, + pop (renderObject) + { + ViewVolumes .push (renderObject .getViewVolumes () .pop ()); + }, +}); + +Object .defineProperties (Viewport, +{ + typeName: + { + value: "Viewport", + enumerable: true, + }, + componentName: + { + value: "Layering", + enumerable: true, + }, + containerField: + { + value: "viewport", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "clipBoundary", new x_ite_Fields .MFFloat (0, 1, 0, 1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "visible", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "bboxDisplay", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxSize", new x_ite_Fields .SFVec3f (-1, -1, -1)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxCenter", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "addChildren", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "removeChildren", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const Viewport_default_ = Viewport; +; + +x_ite_Namespace .add ("Viewport", "x_ite/Components/Layering/Viewport", Viewport_default_); +/* harmony default export */ const Layering_Viewport = (Viewport_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Layering.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +const Layering_default_ = { + name: "Layering", + concreteNodes: + [ + Layering_Layer, + Layering_LayerSet, + Layering_Viewport, + ], + abstractNodes: + [ + Layering_X3DLayerNode, + Layering_X3DViewportNode, + ], +}; +; + +x_ite_Namespace .add ("Layering", "x_ite/Components/Layering", Layering_default_); +/* harmony default export */ const Layering = (Layering_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Lighting/X3DLightNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + +function X3DLightNode (executionContext) +{ + Core_X3DChildNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DLightNode); +} + +Object .assign (Object .setPrototypeOf (X3DLightNode .prototype, Core_X3DChildNode .prototype), +{ + initialize () + { + Core_X3DChildNode .prototype .initialize .call (this); + + this ._on .addInterest ("set_on__", this); + this ._intensity .addInterest ("set_on__", this); + + this .set_on__ (); + }, + set_on__ () + { + if (this ._on .getValue () && this .getIntensity () > 0) + { + delete this .push; + delete this .pop; + } + else + { + this .push = Function .prototype; + this .pop = Function .prototype; + } + }, + getGlobal () + { + return this ._global .getValue (); + }, + getColor () + { + return this ._color .getValue (); + }, + getIntensity () + { + return Math .max (this ._intensity .getValue (), 0); + }, + getAmbientIntensity () + { + return Math_Algorithm .clamp (this ._ambientIntensity .getValue (), 0, 1); + }, + getDirection () + { + return this ._direction .getValue (); + }, + getShadows () + { + return this ._shadows .getValue (); + }, + getShadowColor () + { + return this ._shadowColor .getValue (); + }, + getShadowIntensity () + { + return this .getShadows () ? Math_Algorithm .clamp (this ._shadowIntensity .getValue (), 0, 1) : 0; + }, + getShadowBias () + { + return Math_Algorithm .clamp (this ._shadowBias .getValue (), 0, 1); + }, + getShadowMapSize () + { + return Math .min (this ._shadowMapSize .getValue (), this .getBrowser () .getMaxTextureSize ()); + }, + getBiasMatrix: (() => + { + // Transforms normalized coords from range (-1, 1) to (0, 1). + const biasMatrix = new Numbers_Matrix4 (0.5, 0.0, 0.0, 0.0, + 0.0, 0.5, 0.0, 0.0, + 0.0, 0.0, 0.5, 0.0, + 0.5, 0.5, 0.5, 1.0); + + return function () + { + return biasMatrix; + }; + })(), + push (renderObject, groupNode) + { + if (renderObject .isIndependent ()) + { + const lightContainer = this .getLights () .pop (); + + if (this ._global .getValue ()) + { + lightContainer .set (this, + renderObject .getLayer () .getGroup (), + renderObject .getModelViewMatrix () .get ()); + + renderObject .getGlobalObjects () .push (lightContainer); + renderObject .getLights () .push (lightContainer); + + renderObject .pushGlobalShadows (!! this .getShadowIntensity ()); + } + else + { + lightContainer .set (this, + groupNode, + renderObject .getModelViewMatrix () .get ()); + + renderObject .getLocalObjects () .push (lightContainer); + renderObject .getLights () .push (lightContainer); + + renderObject .pushLocalShadows (!! this .getShadowIntensity ()); + + ++ renderObject .getLocalObjectsCount () [1]; + } + } + else + { + const lightContainer = renderObject .getLightContainer (); + + lightContainer .modelViewMatrix .pushMatrix (renderObject .getModelViewMatrix () .get ()); + + if (this ._global .getValue ()) + { + renderObject .getGlobalObjects () .push (lightContainer); + renderObject .getLights () .push (lightContainer); + + renderObject .pushGlobalShadows (!! this .getShadowIntensity ()); + } + else + { + renderObject .getLocalObjects () .push (lightContainer); + renderObject .getLights () .push (lightContainer); + + renderObject .pushLocalShadows (!! this .getShadowIntensity ()); + + ++ renderObject .getLocalObjectsCount () [1]; + } + } + }, + pop (renderObject) + { + if (this ._global .getValue ()) + return; + + const lightContainer = renderObject .getLocalObjects () .pop (); + + if (renderObject .isIndependent ()) + this .getBrowser () .getLocalObjects () .push (lightContainer); + + renderObject .popLocalShadows (); + + -- renderObject .getLocalObjectsCount () [1]; + }, +}); + +Object .defineProperties (X3DLightNode, +{ + typeName: + { + value: "X3DLightNode", + enumerable: true, + }, + componentName: + { + value: "Lighting", + enumerable: true, + }, +}); + +const X3DLightNode_default_ = X3DLightNode; +; + +x_ite_Namespace .add ("X3DLightNode", "x_ite/Components/Lighting/X3DLightNode", X3DLightNode_default_); +/* harmony default export */ const Lighting_X3DLightNode = (X3DLightNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Lighting/DirectionalLight.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + + + +const DirectionalLights = Utility_ObjectCache (DirectionalLightContainer); + +function DirectionalLightContainer () +{ + this .direction = new Numbers_Vector3 (0, 0, 0); + this .shadowBuffer = null; + this .bbox = new Geometry_Box3 (); + this .viewVolume = new Geometry_ViewVolume (); + this .viewport = new Numbers_Vector4 (0, 0, 0, 0); + this .projectionMatrix = new Numbers_Matrix4 (); + this .modelViewMatrix = new Utility_MatrixStack (Numbers_Matrix4); + this .modelMatrix = new Numbers_Matrix4 (); + this .invLightSpaceMatrix = new Numbers_Matrix4 (); + this .invLightSpaceProjectionMatrix = new Numbers_Matrix4 (); + this .shadowMatrix = new Numbers_Matrix4 (); + this .shadowMatrixArray = new Float32Array (16); + this .rotation = new Numbers_Rotation4 (); + this .textureUnit = undefined; +} + +Object .assign (DirectionalLightContainer .prototype, +{ + set (lightNode, groupNode, modelViewMatrix) + { + const shadowMapSize = lightNode .getShadowMapSize (); + + this .browser = lightNode .getBrowser (); + this .lightNode = lightNode; + this .groupNode = groupNode; + this .global = lightNode .getGlobal (); + + this .modelViewMatrix .pushMatrix (modelViewMatrix); + + // Get shadow buffer from browser. + + if (lightNode .getShadowIntensity () > 0 && shadowMapSize > 0) + { + this .shadowBuffer = this .browser .popShadowBuffer (shadowMapSize); + + if (! this .shadowBuffer) + console .warn ("Couldn't create shadow buffer."); + } + }, + renderShadowMap (renderObject) + { + if (! this .shadowBuffer) + return; + + const + lightNode = this .lightNode, + cameraSpaceMatrix = renderObject .getCameraSpaceMatrix () .get (), + modelMatrix = this .modelMatrix .assign (this .modelViewMatrix .get ()) .multRight (cameraSpaceMatrix), + invLightSpaceMatrix = this .invLightSpaceMatrix .assign (this .global ? modelMatrix : Numbers_Matrix4 .Identity); + + invLightSpaceMatrix .rotate (this .rotation .setFromToVec (Numbers_Vector3 .zAxis, this .direction .assign (lightNode .getDirection ()) .negate ())); + invLightSpaceMatrix .inverse (); + + const + groupBBox = this .groupNode .getSubBBox (this .bbox, true), // Group bbox. + lightBBox = groupBBox .multRight (invLightSpaceMatrix), // Group bbox from the perspective of the light. + shadowMapSize = lightNode .getShadowMapSize (), + viewport = this .viewport .set (0, 0, shadowMapSize, shadowMapSize), + projectionMatrix = Geometry_Camera .orthoBox (lightBBox, this .projectionMatrix); + + this .shadowBuffer .bind (); + + renderObject .getViewVolumes () .push (this .viewVolume .set (projectionMatrix, viewport, viewport)); + renderObject .getProjectionMatrix () .pushMatrix (projectionMatrix); + renderObject .getModelViewMatrix () .pushMatrix (invLightSpaceMatrix); + + renderObject .render (Rendering_TraverseType .SHADOW, Grouping_X3DGroupingNode .prototype .traverse, this .groupNode); + + renderObject .getModelViewMatrix () .pop (); + renderObject .getProjectionMatrix () .pop (); + renderObject .getViewVolumes () .pop (); + + this .shadowBuffer .unbind (); + + if (!this .global) + invLightSpaceMatrix .multLeft (modelMatrix .inverse ()); + + this .invLightSpaceProjectionMatrix .assign (invLightSpaceMatrix) .multRight (projectionMatrix) .multRight (lightNode .getBiasMatrix ()); + }, + setGlobalVariables (renderObject) + { + this .modelViewMatrix .get () .multDirMatrix (this .direction .assign (this .lightNode .getDirection ())) .normalize (); + + if (! this .shadowBuffer) + return; + + this .shadowMatrix .assign (renderObject .getCameraSpaceMatrix () .get ()) .multRight (this .invLightSpaceProjectionMatrix); + this .shadowMatrixArray .set (this .shadowMatrix); + }, + setShaderUniforms (gl, shaderObject) + { + const i = shaderObject .numLights ++; + + if (this .shadowBuffer) + { + const textureUnit = this .global + ? (this .textureUnit = this .textureUnit ?? this .browser .popTexture2DUnit ()) + : this .browser .getTexture2DUnit (); + + if (textureUnit !== undefined) + { + gl .activeTexture (gl .TEXTURE0 + textureUnit); + + if (gl .HAS_FEATURE_DEPTH_TEXTURE) + gl .bindTexture (gl .TEXTURE_2D, this .shadowBuffer .getDepthTexture ()); + else + gl .bindTexture (gl .TEXTURE_2D, this .shadowBuffer .getColorTexture ()); + + gl .uniform1i (shaderObject .x3d_ShadowMap [i], textureUnit); + } + else + { + console .warn ("Not enough combined texture units for shadow map available."); + } + } + + if (shaderObject .hasLight (i, this)) + return; + + const + lightNode = this .lightNode, + color = lightNode .getColor (), + direction = this .direction; + + gl .uniform1i (shaderObject .x3d_LightType [i], 1); + gl .uniform3f (shaderObject .x3d_LightColor [i], color .r, color .g, color .b); + gl .uniform1f (shaderObject .x3d_LightIntensity [i], lightNode .getIntensity ()); + gl .uniform1f (shaderObject .x3d_LightAmbientIntensity [i], lightNode .getAmbientIntensity ()); + gl .uniform3f (shaderObject .x3d_LightDirection [i], direction .x, direction .y, direction .z); + + if (this .shadowBuffer) + { + const shadowColor = lightNode .getShadowColor (); + + gl .uniform3f (shaderObject .x3d_ShadowColor [i], shadowColor .r, shadowColor .g, shadowColor .b); + gl .uniform1f (shaderObject .x3d_ShadowIntensity [i], lightNode .getShadowIntensity ()); + gl .uniform1f (shaderObject .x3d_ShadowBias [i], lightNode .getShadowBias ()); + gl .uniformMatrix4fv (shaderObject .x3d_ShadowMatrix [i], false, this .shadowMatrixArray); + gl .uniform1i (shaderObject .x3d_ShadowMapSize [i], lightNode .getShadowMapSize ()); + } + else + { + gl .uniform1f (shaderObject .x3d_ShadowIntensity [i], 0); + } + }, + dispose () + { + this .browser .pushShadowBuffer (this .shadowBuffer); + this .browser .pushTexture2DUnit (this .textureUnit); + + this .modelViewMatrix .clear (); + + this .shadowBuffer = null; + this .textureUnit = undefined; + + // Return container + + DirectionalLights .push (this); + }, +}); + +function DirectionalLight (executionContext) +{ + Lighting_X3DLightNode .call (this, executionContext); + + this .addType (Base_X3DConstants .DirectionalLight); + + if (executionContext .getSpecificationVersion () == 2.0) + this ._global = true; +} + +Object .assign (Object .setPrototypeOf (DirectionalLight .prototype, Lighting_X3DLightNode .prototype), +{ + getLights () + { + return DirectionalLights; + }, +}); + +Object .defineProperties (DirectionalLight, +{ + typeName: + { + value: "DirectionalLight", + enumerable: true, + }, + componentName: + { + value: "Lighting", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "global", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "on", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "color", new x_ite_Fields .SFColor (1, 1, 1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "intensity", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "ambientIntensity", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "direction", new x_ite_Fields .SFVec3f (0, 0, -1)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shadows", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shadowColor", new x_ite_Fields .SFColor ()), // Color of shadows. + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shadowIntensity", new x_ite_Fields .SFFloat (1)), // Intensity of shadow color in the range (0, 1). + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shadowBias", new x_ite_Fields .SFFloat (0.005)), // Bias of the shadow. + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "shadowMapSize", new x_ite_Fields .SFInt32 (1024)), // Size of the shadow map in pixels in the range (0, inf). + ]), + enumerable: true, + }, +}); + +const DirectionalLight_default_ = DirectionalLight; +; + +x_ite_Namespace .add ("DirectionalLight", "x_ite/Components/Lighting/DirectionalLight", DirectionalLight_default_); +/* harmony default export */ const Lighting_DirectionalLight = (DirectionalLight_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Lighting/EnvironmentLight.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + +const EnvironmentLights = Utility_ObjectCache (EnvironmentLightContainer); + +function EnvironmentLightContainer () +{ + this .modelViewMatrix = new Utility_MatrixStack (Numbers_Matrix4); +} + +Object .assign (EnvironmentLightContainer .prototype, +{ + set (lightNode, groupNode, modelViewMatrix) + { + }, + getModelViewMatrix () + { + return this .modelViewMatrix; + }, + renderShadowMap (renderObject) + { + }, + setGlobalVariables (renderObject) + { + }, + setShaderUniforms (gl, shaderObject) + { + }, + dispose () + { + // Return container + + EnvironmentLights .push (this); + }, +}); + +function EnvironmentLight (executionContext) +{ + Lighting_X3DLightNode .call (this, executionContext); + + this .addType (Base_X3DConstants .EnvironmentLight); +} + +Object .assign (Object .setPrototypeOf (EnvironmentLight .prototype, Lighting_X3DLightNode .prototype), +{ + getLights () + { + return EnvironmentLights; + }, +}); + +Object .defineProperties (EnvironmentLight, +{ + typeName: + { + value: "EnvironmentLight", + enumerable: true, + }, + componentName: + { + value: "Lighting", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "global", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "on", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "rotation", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "color", new x_ite_Fields .SFColor (1, 1, 1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "intensity", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "ambientIntensity", new x_ite_Fields .SFFloat ()), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "diffuseCoefficients", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "diffuse", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "diffuseTexture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "specularTexture", new x_ite_Fields .SFNode ()), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shadows", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shadowColor", new x_ite_Fields .SFColor ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shadowIntensity", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shadowBias", new x_ite_Fields .SFFloat (0.005)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "shadowMapSize", new x_ite_Fields .SFInt32 (1024)), + ]), + enumerable: true, + }, +}); + +const EnvironmentLight_default_ = EnvironmentLight; +; + +x_ite_Namespace .add ("EnvironmentLight", "x_ite/Components/Lighting/EnvironmentLight", EnvironmentLight_default_); +/* harmony default export */ const Lighting_EnvironmentLight = (EnvironmentLight_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Lighting/PointLight.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + + + + +// Shadow map layout +// Compact layout: +// +// xzXZ Char: Axis +// yyYY Case: Sign + +const orientationMatrices = [ + new Numbers_Matrix4 () .setRotation (new Numbers_Rotation4 (new Numbers_Vector3 ( 1, 0, 0), Numbers_Vector3 .zAxis)), // left + new Numbers_Matrix4 () .setRotation (new Numbers_Rotation4 (new Numbers_Vector3 (-1, 0, 0), Numbers_Vector3 .zAxis)), // right + new Numbers_Matrix4 () .setRotation (new Numbers_Rotation4 (new Numbers_Vector3 ( 0, 0, -1), Numbers_Vector3 .zAxis)), // front + new Numbers_Matrix4 () .setRotation (new Numbers_Rotation4 (new Numbers_Vector3 ( 0, 0, 1), Numbers_Vector3 .zAxis)), // back + new Numbers_Matrix4 () .setRotation (new Numbers_Rotation4 (new Numbers_Vector3 ( 0, 1, 0), Numbers_Vector3 .zAxis)), // bottom + new Numbers_Matrix4 () .setRotation (new Numbers_Rotation4 (new Numbers_Vector3 ( 0, -1, 0), Numbers_Vector3 .zAxis)), // top +]; + +const viewports = [ + new Numbers_Vector4 (0, 0.5, 0.25, 0.5), // left + new Numbers_Vector4 (0.5, 0.5, 0.25, 0.5), // right + new Numbers_Vector4 (0.75, 0.5, 0.25, 0.5), // front + new Numbers_Vector4 (0.25, 0.5, 0.25, 0.5), // back + new Numbers_Vector4 (0.0, 0, 0.5, 0.5), // bottom + new Numbers_Vector4 (0.5, 0, 0.5, 0.5), // top +]; + +const PointLights = Utility_ObjectCache (PointLightContainer); + +function PointLightContainer () +{ + this .location = new Numbers_Vector3 (0, 0, 0); + this .matrixArray = new Float32Array (9); + this .shadowBuffer = null; + this .viewVolume = new Geometry_ViewVolume (); + this .viewport = new Numbers_Vector4 (0, 0, 0, 0); + this .projectionMatrix = new Numbers_Matrix4 (); + this .modelViewMatrix = new Utility_MatrixStack (Numbers_Matrix4); + this .modelMatrix = new Numbers_Matrix4 (); + this .invLightSpaceMatrix = new Numbers_Matrix4 (); + this .invLightSpaceProjectionMatrix = new Numbers_Matrix4 (); + this .shadowMatrix = new Numbers_Matrix4 (); + this .shadowMatrixArray = new Float32Array (16); + this .rotation = new Numbers_Rotation4 (); + this .rotationMatrix = new Numbers_Matrix4 (); + this .textureUnit = undefined; +} + +Object .assign (PointLightContainer .prototype, +{ + set (lightNode, groupNode, modelViewMatrix) + { + const shadowMapSize = lightNode .getShadowMapSize (); + + this .browser = lightNode .getBrowser (); + this .lightNode = lightNode; + this .groupNode = groupNode; + this .global = lightNode .getGlobal (); + + this .matrixArray .set (modelViewMatrix .submatrix .inverse ()); + + this .modelViewMatrix .pushMatrix (modelViewMatrix); + + // Get shadow buffer from browser. + + if (lightNode .getShadowIntensity () > 0 && shadowMapSize > 0) + { + this .shadowBuffer = this .browser .popShadowBuffer (shadowMapSize); + + if (!this .shadowBuffer) + console .warn ("Couldn't create shadow buffer."); + } + }, + renderShadowMap (renderObject) + { + if (! this .shadowBuffer) + return; + + const + lightNode = this .lightNode, + cameraSpaceMatrix = renderObject .getCameraSpaceMatrix () .get (), + modelMatrix = this .modelMatrix .assign (this .modelViewMatrix .get ()) .multRight (cameraSpaceMatrix), + invLightSpaceMatrix = this .invLightSpaceMatrix .assign (this .global ? modelMatrix : Numbers_Matrix4 .Identity); + + invLightSpaceMatrix .translate (lightNode .getLocation ()); + invLightSpaceMatrix .inverse (); + + const shadowMapSize = lightNode .getShadowMapSize (); + + this .shadowBuffer .bind (); + + for (let i = 0; i < 6; ++ i) + { + const + v = viewports [i], + viewport = this .viewport .set (v [0] * shadowMapSize, v [1] * shadowMapSize, v [2] * shadowMapSize, v [3] * shadowMapSize), + projectionMatrix = Geometry_Camera .perspective2 (Math_Algorithm .radians (90), 0.125, 10000, viewport [2], viewport [3], this .projectionMatrix); // Use higher far value for better precision. + + renderObject .getViewVolumes () .push (this .viewVolume .set (projectionMatrix, viewport, viewport)); + renderObject .getProjectionMatrix () .pushMatrix (this .projectionMatrix); + renderObject .getModelViewMatrix () .pushMatrix (orientationMatrices [i]); + renderObject .getModelViewMatrix () .multLeft (invLightSpaceMatrix); + + renderObject .render (Rendering_TraverseType .SHADOW, Grouping_X3DGroupingNode .prototype .traverse, this .groupNode); + + renderObject .getModelViewMatrix () .pop (); + renderObject .getProjectionMatrix () .pop (); + renderObject .getViewVolumes () .pop (); + } + + this .shadowBuffer .unbind (); + + if (!this .global) + invLightSpaceMatrix .multLeft (modelMatrix .inverse ()); + + this .invLightSpaceProjectionMatrix .assign (invLightSpaceMatrix); + }, + setGlobalVariables (renderObject) + { + this .modelViewMatrix .get () .multVecMatrix (this .location .assign (this .lightNode ._location .getValue ())); + + if (! this .shadowBuffer) + return; + + this .shadowMatrix .assign (renderObject .getCameraSpaceMatrix () .get ()) .multRight (this .invLightSpaceProjectionMatrix); + this .shadowMatrixArray .set (this .shadowMatrix); + }, + setShaderUniforms (gl, shaderObject) + { + const i = shaderObject .numLights ++; + + if (this .shadowBuffer) + { + const textureUnit = this .global + ? (this .textureUnit = this .textureUnit ?? this .browser .popTexture2DUnit ()) + : this .browser .getTexture2DUnit (); + + if (textureUnit !== undefined) + { + gl .activeTexture (gl .TEXTURE0 + textureUnit); + + if (gl .HAS_FEATURE_DEPTH_TEXTURE) + gl .bindTexture (gl .TEXTURE_2D, this .shadowBuffer .getDepthTexture ()); + else + gl .bindTexture (gl .TEXTURE_2D, this .shadowBuffer .getColorTexture ()); + + gl .uniform1i (shaderObject .x3d_ShadowMap [i], textureUnit); + } + else + { + console .warn ("Not enough combined texture units for shadow map available."); + } + } + + if (shaderObject .hasLight (i, this)) + return; + + const + lightNode = this .lightNode, + color = lightNode .getColor (), + attenuation = lightNode .getAttenuation (), + location = this .location; + + gl .uniform1i (shaderObject .x3d_LightType [i], 2); + gl .uniform3f (shaderObject .x3d_LightColor [i], color .r, color .g, color .b); + gl .uniform1f (shaderObject .x3d_LightIntensity [i], lightNode .getIntensity ()); + gl .uniform1f (shaderObject .x3d_LightAmbientIntensity [i], lightNode .getAmbientIntensity ()); + gl .uniform3f (shaderObject .x3d_LightAttenuation [i], Math .max (0, attenuation .x), Math .max (0, attenuation .y), Math .max (0, attenuation .z)); + gl .uniform3f (shaderObject .x3d_LightLocation [i], location .x, location .y, location .z); + gl .uniform1f (shaderObject .x3d_LightRadius [i], lightNode .getRadius ()); + gl .uniformMatrix3fv (shaderObject .x3d_LightMatrix [i], false, this .matrixArray); + + if (this .shadowBuffer) + { + const shadowColor = lightNode .getShadowColor (); + + gl .uniform3f (shaderObject .x3d_ShadowColor [i], shadowColor .r, shadowColor .g, shadowColor .b); + gl .uniform1f (shaderObject .x3d_ShadowIntensity [i], lightNode .getShadowIntensity ()); + gl .uniform1f (shaderObject .x3d_ShadowBias [i], lightNode .getShadowBias ()); + gl .uniformMatrix4fv (shaderObject .x3d_ShadowMatrix [i], false, this .shadowMatrixArray); + gl .uniform1i (shaderObject .x3d_ShadowMapSize [i], lightNode .getShadowMapSize ()); + } + else + { + gl .uniform1f (shaderObject .x3d_ShadowIntensity [i], 0); + } + }, + dispose () + { + this .browser .pushShadowBuffer (this .shadowBuffer); + this .browser .pushTexture2DUnit (this .textureUnit); + + this .modelViewMatrix .clear (); + + this .shadowBuffer = null; + this .textureUnit = undefined; + + // Return container + + PointLights .push (this); + }, +}); + +function PointLight (executionContext) +{ + Lighting_X3DLightNode .call (this, executionContext); + + this .addType (Base_X3DConstants .PointLight); + + this ._location .setUnit ("length"); + this ._radius .setUnit ("length"); +} + +Object .assign (Object .setPrototypeOf (PointLight .prototype, Lighting_X3DLightNode .prototype), +{ + getAttenuation () + { + return this ._attenuation .getValue (); + }, + getLocation () + { + return this ._location .getValue (); + }, + getRadius () + { + return Math .max (0, this ._radius .getValue ()); + }, + getLights () + { + return PointLights; + }, +}); + +Object .defineProperties (PointLight, +{ + typeName: + { + value: "PointLight", + enumerable: true, + }, + componentName: + { + value: "Lighting", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "global", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "on", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "color", new x_ite_Fields .SFColor (1, 1, 1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "intensity", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "ambientIntensity", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "attenuation", new x_ite_Fields .SFVec3f (1, 0, 0)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "location", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "radius", new x_ite_Fields .SFFloat (100)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shadows", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shadowColor", new x_ite_Fields .SFColor ()), // Color of shadows. + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shadowIntensity", new x_ite_Fields .SFFloat (1)), // Intensity of shadow color in the range (0, 1). + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shadowBias", new x_ite_Fields .SFFloat (0.005)), // Bias of the shadow. + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "shadowMapSize", new x_ite_Fields .SFInt32 (1024)), // Size of the shadow map in pixels in the range (0, inf). + ]), + enumerable: true, + }, +}); + +const PointLight_default_ = PointLight; +; + +x_ite_Namespace .add ("PointLight", "x_ite/Components/Lighting/PointLight", PointLight_default_); +/* harmony default export */ const Lighting_PointLight = (PointLight_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Lighting/SpotLight.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + + + + + +const SpotLights = Utility_ObjectCache (SpotLightContainer); + +function SpotLightContainer () +{ + this .location = new Numbers_Vector3 (0, 0, 0); + this .direction = new Numbers_Vector3 (0, 0, 0); + this .matrixArray = new Float32Array (9); + this .renderShadow = true; + this .shadowBuffer = null; + this .bbox = new Geometry_Box3 (); + this .viewVolume = new Geometry_ViewVolume (); + this .viewport = new Numbers_Vector4 (0, 0, 0, 0); + this .projectionMatrix = new Numbers_Matrix4 (); + this .modelViewMatrix = new Utility_MatrixStack (Numbers_Matrix4); + this .modelMatrix = new Numbers_Matrix4 (); + this .invLightSpaceMatrix = new Numbers_Matrix4 (); + this .invLightSpaceProjectionMatrix = new Numbers_Matrix4 (); + this .shadowMatrix = new Numbers_Matrix4 (); + this .shadowMatrixArray = new Float32Array (16); + this .rotation = new Numbers_Rotation4 (); + this .lightBBoxMin = new Numbers_Vector3 (0, 0, 0); + this .lightBBoxMax = new Numbers_Vector3 (0, 0, 0); + this .textureUnit = undefined; +} + +Object .assign (SpotLightContainer .prototype, +{ + set (lightNode, groupNode, modelViewMatrix) + { + const shadowMapSize = lightNode .getShadowMapSize (); + + this .browser = lightNode .getBrowser (); + this .lightNode = lightNode; + this .groupNode = groupNode; + this .global = lightNode .getGlobal (); + + this .matrixArray .set (modelViewMatrix .submatrix .inverse ()); + + this .modelViewMatrix .pushMatrix (modelViewMatrix); + + // Get shadow buffer from browser. + + if (lightNode .getShadowIntensity () > 0 && shadowMapSize > 0) + { + this .shadowBuffer = this .browser .popShadowBuffer (shadowMapSize); + + if (!this .shadowBuffer) + console .warn ("Couldn't create shadow buffer."); + } + }, + renderShadowMap (renderObject) + { + if (! this .shadowBuffer) + return; + + const + lightNode = this .lightNode, + cameraSpaceMatrix = renderObject .getCameraSpaceMatrix () .get (), + modelMatrix = this .modelMatrix .assign (this .modelViewMatrix .get ()) .multRight (cameraSpaceMatrix), + invLightSpaceMatrix = this .invLightSpaceMatrix .assign (this .global ? modelMatrix : Numbers_Matrix4 .Identity); + + invLightSpaceMatrix .translate (lightNode .getLocation ()); + invLightSpaceMatrix .rotate (this .rotation .setFromToVec (Numbers_Vector3 .zAxis, this .direction .assign (lightNode .getDirection ()) .negate ())); + invLightSpaceMatrix .inverse (); + + const + groupBBox = this .groupNode .getSubBBox (this .bbox, true), // Group bbox. + lightBBox = groupBBox .multRight (invLightSpaceMatrix), // Group bbox from the perspective of the light. + lightBBoxExtents = lightBBox .getExtents (this .lightBBoxMin, this .lightBBoxMax), // Result not used, but arguments. + shadowMapSize = lightNode .getShadowMapSize (), + farValue = Math .min (lightNode .getRadius (), -this .lightBBoxMin .z), + viewport = this .viewport .set (0, 0, shadowMapSize, shadowMapSize), + projectionMatrix = Geometry_Camera .perspective (lightNode .getCutOffAngle () * 2, 0.125, Math .max (10000, farValue), shadowMapSize, shadowMapSize, this .projectionMatrix); // Use higher far value for better precision. + + this .renderShadow = farValue > 0; + + this .shadowBuffer .bind (); + + renderObject .getViewVolumes () .push (this .viewVolume .set (projectionMatrix, viewport, viewport)); + renderObject .getProjectionMatrix () .pushMatrix (projectionMatrix); + renderObject .getModelViewMatrix () .pushMatrix (invLightSpaceMatrix); + + renderObject .render (Rendering_TraverseType .SHADOW, Grouping_X3DGroupingNode .prototype .traverse, this .groupNode); + + renderObject .getModelViewMatrix () .pop (); + renderObject .getProjectionMatrix () .pop (); + renderObject .getViewVolumes () .pop (); + + this .shadowBuffer .unbind (); + + if (!this .global) + invLightSpaceMatrix .multLeft (modelMatrix .inverse ()); + + this .invLightSpaceProjectionMatrix .assign (invLightSpaceMatrix) .multRight (projectionMatrix) .multRight (lightNode .getBiasMatrix ()); + }, + setGlobalVariables (renderObject) + { + const + lightNode = this .lightNode, + modelViewMatrix = this .modelViewMatrix .get (); + + modelViewMatrix .multVecMatrix (this .location .assign (lightNode ._location .getValue ())); + modelViewMatrix .multDirMatrix (this .direction .assign (lightNode ._direction .getValue ())) .normalize (); + + if (! this .shadowBuffer) + return; + + this .shadowMatrix .assign (renderObject .getCameraSpaceMatrix () .get ()) .multRight (this .invLightSpaceProjectionMatrix); + this .shadowMatrixArray .set (this .shadowMatrix); + }, + setShaderUniforms (gl, shaderObject) + { + const i = shaderObject .numLights ++; + + if (this .shadowBuffer) + { + const textureUnit = this .global + ? (this .textureUnit = this .textureUnit ?? this .browser .popTexture2DUnit ()) + : this .browser .getTexture2DUnit (); + + if (textureUnit !== undefined) + { + gl .activeTexture (gl .TEXTURE0 + textureUnit); + + if (gl .HAS_FEATURE_DEPTH_TEXTURE) + gl .bindTexture (gl .TEXTURE_2D, this .shadowBuffer .getDepthTexture ()); + else + gl .bindTexture (gl .TEXTURE_2D, this .shadowBuffer .getColorTexture ()); + + gl .uniform1i (shaderObject .x3d_ShadowMap [i], textureUnit); + } + else + { + console .warn ("Not enough combined texture units for shadow map available."); + } + } + + if (shaderObject .hasLight (i, this)) + return; + + const + lightNode = this .lightNode, + color = lightNode .getColor (), + attenuation = lightNode .getAttenuation (), + location = this .location, + direction = this .direction; + + gl .uniform1i (shaderObject .x3d_LightType [i], 3); + gl .uniform3f (shaderObject .x3d_LightColor [i], color .r, color .g, color .b); + gl .uniform1f (shaderObject .x3d_LightIntensity [i], lightNode .getIntensity ()); + gl .uniform1f (shaderObject .x3d_LightAmbientIntensity [i], lightNode .getAmbientIntensity ()); + gl .uniform3f (shaderObject .x3d_LightAttenuation [i], Math .max (0, attenuation .x), Math .max (0, attenuation .y), Math .max (0, attenuation .z)); + gl .uniform3f (shaderObject .x3d_LightLocation [i], location .x, location .y, location .z); + gl .uniform3f (shaderObject .x3d_LightDirection [i], direction .x, direction .y, direction .z); + gl .uniform1f (shaderObject .x3d_LightRadius [i], lightNode .getRadius ()); + gl .uniform1f (shaderObject .x3d_LightBeamWidth [i], lightNode .getBeamWidth ()); + gl .uniform1f (shaderObject .x3d_LightCutOffAngle [i], lightNode .getCutOffAngle ()); + gl .uniformMatrix3fv (shaderObject .x3d_LightMatrix [i], false, this .matrixArray); + + if (this .renderShadow && this .shadowBuffer) + { + const shadowColor = lightNode .getShadowColor (); + + gl .uniform3f (shaderObject .x3d_ShadowColor [i], shadowColor .r, shadowColor .g, shadowColor .b); + gl .uniform1f (shaderObject .x3d_ShadowIntensity [i], lightNode .getShadowIntensity ()); + gl .uniform1f (shaderObject .x3d_ShadowBias [i], lightNode .getShadowBias ()); + gl .uniformMatrix4fv (shaderObject .x3d_ShadowMatrix [i], false, this .shadowMatrixArray); + gl .uniform1i (shaderObject .x3d_ShadowMapSize [i], lightNode .getShadowMapSize ()); + } + else + { + gl .uniform1f (shaderObject .x3d_ShadowIntensity [i], 0); + } + }, + dispose () + { + this .browser .pushShadowBuffer (this .shadowBuffer); + this .browser .pushTexture2DUnit (this .textureUnit); + + this .modelViewMatrix .clear (); + + this .shadowBuffer = null; + this .textureUnit = undefined; + + // Return container + + SpotLights .push (this); + }, +}); + +function SpotLight (executionContext) +{ + Lighting_X3DLightNode .call (this, executionContext); + + this .addType (Base_X3DConstants .SpotLight); + + if (executionContext .getSpecificationVersion () <= 3.2) + { + this ._beamWidth = 1.5708; + this ._cutOffAngle = 0.785398; + } + + this ._location .setUnit ("length"); + this ._radius .setUnit ("length"); + this ._beamWidth .setUnit ("angle"); + this ._cutOffAngle .setUnit ("angle"); +} + +Object .assign (Object .setPrototypeOf (SpotLight .prototype, Lighting_X3DLightNode .prototype), +{ + getAttenuation () + { + return this ._attenuation .getValue (); + }, + getLocation () + { + return this ._location .getValue (); + }, + getRadius () + { + return Math .max (0, this ._radius .getValue ()); + }, + getBeamWidth () + { + // If the beamWidth is greater than the cutOffAngle, beamWidth is defined to be equal to the cutOffAngle. + + const + beamWidth = this ._beamWidth .getValue (), + cutOffAngle = this .getCutOffAngle (); + + if (beamWidth > cutOffAngle) + return cutOffAngle; + + return Math_Algorithm .clamp (beamWidth, 0, Math .PI / 2); + }, + getCutOffAngle () + { + return Math_Algorithm .clamp (this ._cutOffAngle .getValue (), 0, Math .PI / 2); + }, + getLights () + { + return SpotLights; + }, +}); + +Object .defineProperties (SpotLight, +{ + typeName: + { + value: "SpotLight", + enumerable: true, + }, + componentName: + { + value: "Lighting", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "global", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "on", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "color", new x_ite_Fields .SFColor (1, 1, 1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "intensity", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "ambientIntensity", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "attenuation", new x_ite_Fields .SFVec3f (1, 0, 0)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "location", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "direction", new x_ite_Fields .SFVec3f (0, 0, -1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "radius", new x_ite_Fields .SFFloat (100)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "beamWidth", new x_ite_Fields .SFFloat (0.785398)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "cutOffAngle", new x_ite_Fields .SFFloat (1.5708)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shadows", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shadowColor", new x_ite_Fields .SFColor ()), // Color of shadows. + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shadowIntensity", new x_ite_Fields .SFFloat (1)), // Intensity of shadow color in the range (0, 1). + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shadowBias", new x_ite_Fields .SFFloat (0.005)), // Bias of the shadow. + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "shadowMapSize", new x_ite_Fields .SFInt32 (1024)), // Size of the shadow map in pixels in the range (0, inf). + ]), + enumerable: true, + }, +}); + +const SpotLight_default_ = SpotLight; +; + +x_ite_Namespace .add ("SpotLight", "x_ite/Components/Lighting/SpotLight", SpotLight_default_); +/* harmony default export */ const Lighting_SpotLight = (SpotLight_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Lighting.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +const Lighting_default_ = { + name: "Lighting", + concreteNodes: + [ + Lighting_DirectionalLight, + Lighting_EnvironmentLight, + Lighting_PointLight, + Lighting_SpotLight, + ], + abstractNodes: + [ + Lighting_X3DLightNode, + ], +}; +; + +x_ite_Namespace .add ("Lighting", "x_ite/Components/Lighting", Lighting_default_); +/* harmony default export */ const Lighting = (Lighting_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Navigation/Billboard.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + +function Billboard (executionContext) +{ + Grouping_X3DGroupingNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Billboard); + + this .matrix = new Numbers_Matrix4 (); +} + +Object .assign (Object .setPrototypeOf (Billboard .prototype, Grouping_X3DGroupingNode .prototype), +{ + getBBox (bbox, shadows) + { + return Grouping_X3DGroupingNode .prototype .getBBox .call (this, bbox, shadows) .multRight (this .matrix); + }, + getMatrix () + { + return this .matrix; + }, + rotate: (() => + { + const + inverseModelViewMatrix = new Numbers_Matrix4 (), + viewerYAxis = new Numbers_Vector3 (0, 0, 0), + y = new Numbers_Vector3 (0, 0, 0), + N1 = new Numbers_Vector3 (0, 0, 0), + N2 = new Numbers_Vector3 (0, 0, 0), + rotation = new Numbers_Rotation4 (); + + return function (modelViewMatrix) + { + // throws domain error + + inverseModelViewMatrix .assign (modelViewMatrix) .inverse (); + + const billboardToViewer = inverseModelViewMatrix .origin .normalize (); // Normalized to get work with Geo + + if (this ._axisOfRotation .getValue () .equals (Numbers_Vector3 .Zero)) + { + inverseModelViewMatrix .multDirMatrix (viewerYAxis .assign (Numbers_Vector3 .yAxis)) .normalize (); // Normalized to get work with Geo + + const x = viewerYAxis .cross (billboardToViewer); + y .assign (billboardToViewer) .cross (x); + const z = billboardToViewer; + + // Compose rotation + + x .normalize (); + y .normalize (); + + this .matrix .set (x .x, x .y, x .z, 0, + y .x, y .y, y .z, 0, + z .x, z .y, z .z, 0, + 0, 0, 0, 1); + } + else + { + N1 .assign (this ._axisOfRotation .getValue ()) .cross (billboardToViewer); // Normal vector of plane as in specification + N2 .assign (this ._axisOfRotation .getValue ()) .cross (Numbers_Vector3 .zAxis); // Normal vector of plane between axisOfRotation and zAxis + + this .matrix .setRotation (rotation .setFromToVec (N2, N1)); // Rotate zAxis in plane + } + + return this .matrix; + }; + })(), + traverse (type, renderObject) + { + const modelViewMatrix = renderObject .getModelViewMatrix (); + + modelViewMatrix .push (); + + switch (type) + { + case Rendering_TraverseType .CAMERA: + case Rendering_TraverseType .PICKING: + case Rendering_TraverseType .SHADOW: + // No clone support for shadows, generated cube map texture, and bbox + modelViewMatrix .multLeft (this .matrix); + break; + default: + modelViewMatrix .multLeft (this .rotate (modelViewMatrix .get ())); + break; + } + + Grouping_X3DGroupingNode .prototype .traverse .call (this, type, renderObject); + + modelViewMatrix .pop (); + }, +}); + +Object .defineProperties (Billboard, +{ + typeName: + { + value: "Billboard", + enumerable: true, + }, + componentName: + { + value: "Navigation", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "axisOfRotation", new x_ite_Fields .SFVec3f (0, 1, 0)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "visible", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "bboxDisplay", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxSize", new x_ite_Fields .SFVec3f (-1, -1, -1)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxCenter", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "addChildren", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "removeChildren", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const Billboard_default_ = Billboard; +; + +x_ite_Namespace .add ("Billboard", "x_ite/Components/Navigation/Billboard", Billboard_default_); +/* harmony default export */ const Navigation_Billboard = (Billboard_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Navigation/Collision.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + +function Collision (executionContext) +{ + Grouping_X3DGroupingNode .call (this, executionContext); + Core_X3DSensorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Collision); + + if (executionContext .getSpecificationVersion () == 2.0) + this .addAlias ("collide", this ._enabled); // VRML2 +} + +Object .assign (Object .setPrototypeOf (Collision .prototype, Grouping_X3DGroupingNode .prototype), + Core_X3DSensorNode .prototype, +{ + initialize () + { + Grouping_X3DGroupingNode .prototype .initialize .call (this); + // X3DSensorNode .prototype .initialize .call (this); // We can only call the base of a *Objects. + + this .getLive () .addInterest ("set_live__", this); + this ._enabled .addInterest ("set_live__", this); + this ._proxy .addInterest ("set_proxy__", this); + + this .set_live__ (); + this .set_proxy__ (); + }, + set_live__ () + { + if (this .getLive () .getValue () && this ._enabled .getValue ()) + this .getBrowser () .addCollision (this); + + else + this .getBrowser () .removeCollision (this); + }, + set_active (value) + { + if (this ._isActive .getValue () !== value) + { + this ._isActive = value; + + if (value) + this ._collideTime = this .getBrowser () .getCurrentTime (); + } + }, + set_proxy__ () + { + this .proxyNode = Base_X3DCast (Base_X3DConstants .X3DChildNode, this ._proxy); + }, + traverse (type, renderObject) + { + switch (type) + { + case Rendering_TraverseType .COLLISION: + { + if (this ._enabled .getValue ()) + { + const collisions = renderObject .getCollisions (); + + collisions .push (this); + + if (this .proxyNode) + this .proxyNode .traverse (type, renderObject); + + else + Grouping_X3DGroupingNode .prototype .traverse .call (this, type, renderObject); + + collisions .pop (); + } + + return; + } + default: + { + Grouping_X3DGroupingNode .prototype .traverse .call (this, type, renderObject); + return; + } + } + }, + dispose () + { + // X3DSensorNode .prototype .dispose .call (this); // We can only call the base of a *Objects. + Grouping_X3DGroupingNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (Collision, +{ + typeName: + { + value: "Collision", + enumerable: true, + }, + componentName: + { + value: "Navigation", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "collideTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "visible", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "bboxDisplay", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxSize", new x_ite_Fields .SFVec3f (-1, -1, -1)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxCenter", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "proxy", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "addChildren", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "removeChildren", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const Collision_default_ = Collision; +; + +x_ite_Namespace .add ("Collision", "x_ite/Components/Navigation/Collision", Collision_default_); +/* harmony default export */ const Navigation_Collision = (Collision_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Navigation/LOD.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + +function LOD (executionContext) +{ + Grouping_X3DGroupingNode .call (this, executionContext); + + this .addType (Base_X3DConstants .LOD); + + if (executionContext .getSpecificationVersion () == 2.0) + this .addAlias ("level", this ._children); // VRML2 + + this ._center .setUnit ("length"); + this ._range .setUnit ("length"); + + this .frameRate = 60; + this .keepCurrentLevel = false; + this .childNode = null; + this .visibleNode = null; + this .boundedObject = null; +} + +Object .assign (Object .setPrototypeOf (LOD .prototype, Grouping_X3DGroupingNode .prototype), +{ + initialize () + { + Grouping_X3DGroupingNode .prototype .initialize .call (this); + + this ._children .addInterest ("set_child__", this); + }, + getSubBBox (bbox, shadows) + { + if (this ._bboxSize .getValue () .equals (this .getDefaultBBoxSize ())) + { + const boundedObject = Base_X3DCast (Base_X3DConstants .X3DBoundedObject, this .visibleNode); + + return boundedObject ?.getBBox (bbox, shadows) ?? bbox .set (); + } + + return bbox .set (this ._bboxSize .getValue (), this ._bboxCenter .getValue ()); + }, + clear () { }, + add () { }, + remove () { }, + set_child__ () + { + this .set_level__ (Math .min (this ._level_changed .getValue (), this ._children .length - 1)); + }, + set_level__ (level) + { + if (this .childNode) + { + this .childNode ._isCameraObject .removeInterest ("set_cameraObject__", this); + this .childNode ._isPickableObject .removeInterest ("set_transformSensors__", this); + } + + if (Base_X3DCast (Base_X3DConstants .X3DBoundedObject, this .childNode)) + { + this .childNode ._display .removeInterest ("set_display__", this); + this .childNode ._bboxDisplay .removeInterest ("set_bboxDisplay__", this); + } + + if (level >= 0 && level < this ._children .length) + { + this .childNode = Base_X3DCast (Base_X3DConstants .X3DChildNode, this ._children [level]); + + if (this .childNode) + { + this .childNode ._isCameraObject .addInterest ("set_cameraObject__", this); + this .childNode ._isPickableObject .addInterest ("set_transformSensors__", this); + + if (Base_X3DCast (Base_X3DConstants .X3DBoundedObject, this .childNode)) + { + this .childNode ._display .addInterest ("set_display__", this); + this .childNode ._bboxDisplay .addInterest ("set_bboxDisplay__", this); + } + + //delete this .traverse; + } + } + else + { + this .childNode = null; + + //this .traverse = Function .prototype; // Don't do that. + } + + this .set_display__ (); + this .set_bboxDisplay__ (); + }, + set_cameraObject__ () + { + this .setCameraObject (!!this .visibleNode ?.isCameraObject ()); + }, + set_transformSensors__ () + { + this .setPickableObject (!!(this .getTransformSensors () .size || this .visibleNode ?.isPickableObject ())); + }, + set_display__ () + { + if (Base_X3DCast (Base_X3DConstants .X3DBoundedObject, this .childNode)) + this .visibleNode = this .childNode ._display .getValue () ? this .childNode : null; + else + this .visibleNode = this .childNode; + + this .set_cameraObject__ (); + this .set_transformSensors__ (); + }, + set_bboxDisplay__ () + { + if (Base_X3DCast (Base_X3DConstants .X3DBoundedObject, this .childNode)) + { + this .boundedObject = this .childNode ._bboxDisplay .getValue () ? this .childNode : null; + } + else + { + this .boundedObject = null; + } + }, + getLevel: (() => + { + const + FRAMES = 180, // Number of frames after wich a level change takes in affect. + FRAME_RATE_MIN = 20, // Lowest level of detail. + FRAME_RATE_MAX = 55; // Highest level of detail. + + return function (browser, modelViewMatrix) + { + if (this ._range .length === 0) + { + this .frameRate = ((FRAMES - 1) * this .frameRate + browser .currentFrameRate) / FRAMES; + + const size = this ._children .length; + + switch (size) + { + case 0: + return -1; + case 1: + return 0; + case 2: + return +(this .frameRate > FRAME_RATE_MAX); + default: + { + const fraction = 1 - Math_Algorithm .clamp ((this .frameRate - FRAME_RATE_MIN) / (FRAME_RATE_MAX - FRAME_RATE_MIN), 0, 1); + + return Math .min (Math .floor (fraction * size), size - 1); + } + } + } + + const distance = modelViewMatrix .translate (this ._center .getValue ()) .origin .magnitude (); + + return Math_Algorithm .upperBound (this ._range, 0, this ._range .length, distance); + }; + })(), + traverse: (() => + { + const modelViewMatrix = new Numbers_Matrix4 (); + + return function (type, renderObject) + { + switch (type) + { + case Rendering_TraverseType .POINTER: + case Rendering_TraverseType .CAMERA: + case Rendering_TraverseType .SHADOW: + { + this .visibleNode ?.traverse (type, renderObject); + return; + } + case Rendering_TraverseType .PICKING: + { + if (this .getTransformSensors () .size) + { + const modelMatrix = renderObject .getModelViewMatrix () .get (); + + for (const transformSensorNode of this .getTransformSensors ()) + transformSensorNode .collect (modelMatrix); + } + + const visibleNode = this .visibleNode; + + if (visibleNode) + { + const + browser = this .getBrowser (), + pickingHierarchy = browser .getPickingHierarchy (); + + pickingHierarchy .push (this); + + visibleNode .traverse (type, renderObject); + + pickingHierarchy .pop (); + } + + return; + } + case Rendering_TraverseType .COLLISION: + { + this .visibleNode ?.traverse (type, renderObject); + return; + } + case Rendering_TraverseType .DISPLAY: + { + if (! this .keepCurrentLevel) + { + let + level = this .getLevel (this .getBrowser (), modelViewMatrix .assign (renderObject .getModelViewMatrix () .get ())), + currentLevel = this ._level_changed .getValue (); + + if (this ._forceTransitions .getValue ()) + { + if (level > currentLevel) + level = currentLevel + 1; + + else if (level < currentLevel) + level = currentLevel - 1; + } + + if (level !== currentLevel) + { + this ._level_changed = level; + + this .set_level__ (Math .min (level, this ._children .length - 1)); + } + } + + this .visibleNode ?.traverse (type, renderObject); + + this .boundedObject ?.displayBBox (type, renderObject); + return; + } + } + }; + })(), +}); + +Object .defineProperties (LOD, +{ + typeName: + { + value: "LOD", + enumerable: true, + }, + componentName: + { + value: "Navigation", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "forceTransitions", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "center", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "range", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "level_changed", new x_ite_Fields .SFInt32 (-1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "visible", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "bboxDisplay", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxSize", new x_ite_Fields .SFVec3f (-1, -1, -1)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxCenter", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "addChildren", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "removeChildren", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const LOD_default_ = LOD; +; + +x_ite_Namespace .add ("LOD", "x_ite/Components/Navigation/LOD", LOD_default_); +/* harmony default export */ const Navigation_LOD = (LOD_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Navigation/OrthoViewpoint.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + +function OrthoViewpoint (executionContext) +{ + Navigation_X3DViewpointNode .call (this, executionContext); + + this .addType (Base_X3DConstants .OrthoViewpoint); + + this .addChildObjects (Base_X3DConstants .inputOutput, "fieldOfViewOffset", new x_ite_Fields .MFFloat (0, 0, 0, 0)); + + this ._position .setUnit ("length"); + this ._centerOfRotation .setUnit ("length"); + this ._fieldOfView .setUnit ("length"); + + this .projectionMatrix = new Numbers_Matrix4 (); + this .fieldOfViewOffsetInterpolator0 = new Interpolation_ScalarInterpolator (this .getBrowser () .getPrivateScene ()); + this .fieldOfViewOffsetInterpolator1 = new Interpolation_ScalarInterpolator (this .getBrowser () .getPrivateScene ()); + this .fieldOfViewOffsetInterpolator2 = new Interpolation_ScalarInterpolator (this .getBrowser () .getPrivateScene ()); + this .fieldOfViewOffsetInterpolator3 = new Interpolation_ScalarInterpolator (this .getBrowser () .getPrivateScene ()); +} + +Object .assign (Object .setPrototypeOf (OrthoViewpoint .prototype, Navigation_X3DViewpointNode .prototype), +{ + initialize () + { + Navigation_X3DViewpointNode .prototype .initialize .call (this); + + this .fieldOfViewOffsetInterpolator0 ._key = new x_ite_Fields .MFFloat (0, 1); + this .fieldOfViewOffsetInterpolator1 ._key = new x_ite_Fields .MFFloat (0, 1); + this .fieldOfViewOffsetInterpolator2 ._key = new x_ite_Fields .MFFloat (0, 1); + this .fieldOfViewOffsetInterpolator3 ._key = new x_ite_Fields .MFFloat (0, 1); + + this .fieldOfViewOffsetInterpolator0 .setup (); + this .fieldOfViewOffsetInterpolator1 .setup (); + this .fieldOfViewOffsetInterpolator2 .setup (); + this .fieldOfViewOffsetInterpolator3 .setup (); + + this .easeInEaseOut ._modifiedFraction_changed .addFieldInterest (this .fieldOfViewOffsetInterpolator0 ._set_fraction); + this .easeInEaseOut ._modifiedFraction_changed .addFieldInterest (this .fieldOfViewOffsetInterpolator1 ._set_fraction); + this .easeInEaseOut ._modifiedFraction_changed .addFieldInterest (this .fieldOfViewOffsetInterpolator2 ._set_fraction); + this .easeInEaseOut ._modifiedFraction_changed .addFieldInterest (this .fieldOfViewOffsetInterpolator3 ._set_fraction); + + this .fieldOfViewOffsetInterpolator0 ._value_changed .addInterest ("set_fieldOfViewOffset__", this); + this .fieldOfViewOffsetInterpolator1 ._value_changed .addInterest ("set_fieldOfViewOffset__", this); + this .fieldOfViewOffsetInterpolator2 ._value_changed .addInterest ("set_fieldOfViewOffset__", this); + this .fieldOfViewOffsetInterpolator3 ._value_changed .addInterest ("set_fieldOfViewOffset__", this); + }, + set_fieldOfViewOffset__ () + { + this ._fieldOfViewOffset [0] = this .fieldOfViewOffsetInterpolator0 ._value_changed .getValue (); + this ._fieldOfViewOffset [1] = this .fieldOfViewOffsetInterpolator1 ._value_changed .getValue (); + this ._fieldOfViewOffset [2] = this .fieldOfViewOffsetInterpolator2 ._value_changed .getValue (); + this ._fieldOfViewOffset [3] = this .fieldOfViewOffsetInterpolator3 ._value_changed .getValue (); + }, + resetUserOffsets () + { + Navigation_X3DViewpointNode .prototype .resetUserOffsets .call (this); + + this ._fieldOfViewOffset [0] = 0; + this ._fieldOfViewOffset [1] = 0; + this ._fieldOfViewOffset [2] = 0; + this ._fieldOfViewOffset [3] = 0; + }, + getRelativeTransformation (fromViewpointNode) + { + const relative = Navigation_X3DViewpointNode .prototype .getRelativeTransformation .call (this, fromViewpointNode); + + if (fromViewpointNode .constructor === this .constructor) + { + relative .userMinimumX = fromViewpointNode .getUserMinimumX (); + relative .userMinimumY = fromViewpointNode .getUserMinimumY (); + relative .userMaximumX = fromViewpointNode .getUserMaximumX (); + relative .userMaximumY = fromViewpointNode .getUserMaximumY (); + } + + return relative; + }, + setInterpolators (fromViewpointNode, relative) + { + if (fromViewpointNode .constructor === this .constructor) + { + const + offset0 = relative .userMinimumX - this .getMinimumX (), + offset1 = relative .userMinimumY - this .getMinimumY (), + offset2 = relative .userMaximumX - this .getMaximumX (), + offset3 = relative .userMaximumY - this .getMaximumY (); + + this .fieldOfViewOffsetInterpolator0 ._keyValue = new x_ite_Fields .MFFloat (offset0, this ._fieldOfViewOffset [0]); + this .fieldOfViewOffsetInterpolator1 ._keyValue = new x_ite_Fields .MFFloat (offset1, this ._fieldOfViewOffset [1]); + this .fieldOfViewOffsetInterpolator2 ._keyValue = new x_ite_Fields .MFFloat (offset2, this ._fieldOfViewOffset [2]); + this .fieldOfViewOffsetInterpolator3 ._keyValue = new x_ite_Fields .MFFloat (offset3, this ._fieldOfViewOffset [3]); + this .fieldOfViewScaleInterpolator ._keyValue = new x_ite_Fields .MFFloat (1, this ._fieldOfViewScale .getValue ()); + + this ._fieldOfViewOffset [0] = relative .offset0; + this ._fieldOfViewOffset [1] = relative .offset1; + this ._fieldOfViewOffset [2] = relative .offset2; + this ._fieldOfViewOffset [3] = relative .offset3; + this ._fieldOfViewScale = 1; + } + else + { + this .fieldOfViewOffsetInterpolator0 ._keyValue = new x_ite_Fields .MFFloat (this ._fieldOfViewOffset [0], this ._fieldOfViewOffset [0]); + this .fieldOfViewOffsetInterpolator1 ._keyValue = new x_ite_Fields .MFFloat (this ._fieldOfViewOffset [1], this ._fieldOfViewOffset [1]); + this .fieldOfViewOffsetInterpolator2 ._keyValue = new x_ite_Fields .MFFloat (this ._fieldOfViewOffset [2], this ._fieldOfViewOffset [2]); + this .fieldOfViewOffsetInterpolator3 ._keyValue = new x_ite_Fields .MFFloat (this ._fieldOfViewOffset [3], this ._fieldOfViewOffset [3]); + this .fieldOfViewScaleInterpolator ._keyValue = new x_ite_Fields .MFFloat (1, this ._fieldOfViewOffset .getValue ()); + + this ._fieldOfViewOffset = this ._fieldOfViewOffset .getValue (); + this ._fieldOfViewScale = 1; + } + }, + getLogarithmicDepthBuffer () + { + return false; + }, + getMinimumX () + { + return this ._fieldOfView .length > 0 ? this ._fieldOfView [0] : -1; + }, + getUserMinimumX () + { + return (this .getMinimumX () + this ._fieldOfViewOffset [0]) * this ._fieldOfViewScale .getValue (); + }, + getMinimumY () + { + return this ._fieldOfView .length > 1 ? this ._fieldOfView [1] : -1; + }, + getUserMinimumY () + { + return (this .getMinimumY () + this ._fieldOfViewOffset [1]) * this ._fieldOfViewScale .getValue (); + }, + getMaximumX () + { + return this ._fieldOfView .length > 2 ? this ._fieldOfView [2] : 1; + }, + getUserMaximumX () + { + return (this .getMaximumX () + this ._fieldOfViewOffset [2]) * this ._fieldOfViewScale .getValue (); + }, + getMaximumY () + { + return this ._fieldOfView .length > 3 ? this ._fieldOfView [3] : 1; + }, + getUserMaximumY () + { + return (this .getMaximumY () + this ._fieldOfViewOffset [3]) * this ._fieldOfViewScale .getValue (); + }, + getSizeX () + { + return this .getMaximumX () - this .getMinimumX (); + }, + getUserSizeX () + { + return this .getUserMaximumX () - this .getUserMinimumX (); + }, + getSizeY () + { + return this .getMaximumY () - this .getMinimumY (); + }, + getUserSizeY () + { + return this .getUserMaximumY () - this .getUserMinimumY (); + }, + getMaxFarValue () + { + return 1e4; + }, + getScreenScale (point, viewport, screenScale) + { + const + width = viewport [2], + height = viewport [3], + sizeX = this .getUserSizeX (), + sizeY = this .getUserSizeY (), + aspect = width / height; + + if (aspect > sizeX / sizeY) + { + const s = sizeY / height; + + return screenScale .set (s, s, s); + } + else + { + const s = sizeX / width; + + return screenScale .set (s, s, s); + } + }, + getViewportSize: (() => + { + const viewportSize = new Numbers_Vector2 (0, 0); + + return function (viewport, nearValue) + { + const + width = viewport [2], + height = viewport [3], + sizeX = this .getUserSizeX (), + sizeY = this .getUserSizeY (), + aspect = width / height; + + if (aspect > sizeX / sizeY) + return viewportSize .set (sizeY * aspect, sizeY); + + return viewportSize .set (sizeX, sizeX / aspect); + }; + })(), + getLookAtDistance (bbox) + { + return bbox .size .magnitude () / 2 + 10; + }, + getProjectionMatrixWithLimits (nearValue, farValue, viewport) + { + const + width = viewport [2], + height = viewport [3], + aspect = width / height, + sizeX = this .getUserSizeX (), + sizeY = this .getUserSizeY (); + + if (aspect > sizeX / sizeY) + { + const + center = (this .getUserMinimumX () + this .getUserMaximumX ()) / 2, + size1_2 = (sizeY * aspect) / 2; + + return Geometry_Camera .ortho (center - size1_2, center + size1_2, this .getUserMinimumY (), this .getUserMaximumY (), nearValue, farValue, this .projectionMatrix); + } + else + { + const + center = (this .getUserMinimumY () + this .getUserMaximumY ()) / 2, + size1_2 = (sizeX / aspect) / 2; + + return Geometry_Camera .ortho (this .getUserMinimumX (), this .getUserMaximumX (), center - size1_2, center + size1_2, nearValue, farValue, this .projectionMatrix); + } + }, + viewAll (bbox) + { + Navigation_X3DViewpointNode .prototype .viewAll .call (this, bbox); + + const + size = bbox .size, + scaleX = size .x / this .getSizeX (), + scaleY = size .y / this .getSizeY (), + scale = Math .max (scaleX, scaleY) * 1.1; + + this ._fieldOfViewOffset [0] = this .getMinimumX () * scale - this .getMinimumX (); + this ._fieldOfViewOffset [1] = this .getMinimumY () * scale - this .getMinimumY (); + this ._fieldOfViewOffset [2] = this .getMaximumX () * scale - this .getMaximumX (); + this ._fieldOfViewOffset [3] = this .getMaximumY () * scale - this .getMaximumY (); + }, +}); + +Object .defineProperties (OrthoViewpoint, +{ + typeName: + { + value: "OrthoViewpoint", + enumerable: true, + }, + componentName: + { + value: "Navigation", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_bind", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "position", new x_ite_Fields .SFVec3f (0, 0, 10)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "orientation", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "centerOfRotation", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "fieldOfView", new x_ite_Fields .MFFloat (-1, -1, 1, 1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "nearDistance", new x_ite_Fields .SFFloat (-1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "farDistance", new x_ite_Fields .SFFloat (-1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "viewAll", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "jump", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "retainUserOffsets", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isBound", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "bindTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "navigationInfo", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +const OrthoViewpoint_default_ = OrthoViewpoint; +; + +x_ite_Namespace .add ("OrthoViewpoint", "x_ite/Components/Navigation/OrthoViewpoint", OrthoViewpoint_default_); +/* harmony default export */ const Navigation_OrthoViewpoint = (OrthoViewpoint_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Navigation/ViewpointGroup.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + +function ViewpointGroup (executionContext) +{ + Core_X3DChildNode .call (this, executionContext); + + this .addType (Base_X3DConstants .ViewpointGroup); + + this ._size .setUnit ("length"); + this ._center .setUnit ("length"); + + this .setCameraObject (true); + + this .proximitySensor = new EnvironmentalSensor_ProximitySensor (executionContext); + this .cameraObjects = [ ]; + this .viewpointGroups = [ ]; +} + +Object .assign (Object .setPrototypeOf (ViewpointGroup .prototype, Core_X3DChildNode .prototype), +{ + initialize () + { + Core_X3DChildNode .prototype .initialize .call (this); + + this .proximitySensor .setup (); + + this ._size .addFieldInterest (this .proximitySensor ._size); + this ._center .addFieldInterest (this .proximitySensor ._center); + + this .proximitySensor ._size = this ._size; + this .proximitySensor ._center = this ._center; + + this ._size .addInterest ("set_size__", this); + this ._children .addInterest ("set_children__", this); + + this .set_size__ (); + this .set_children__ (); + }, + set_size__ () + { + this .proximitySensor ._enabled = !this ._size .getValue () .equals (Numbers_Vector3 .Zero); + }, + set_children__ () + { + this .cameraObjects .length = 0; + this .viewpointGroups .length = 0; + + for (const child of this ._children) + { + const childNode = Base_X3DCast (Base_X3DConstants .X3DChildNode, child); + + if (!childNode) + continue; + + const type = childNode .getType (); + + for (let t = type .length - 1; t >= 0; -- t) + { + switch (type [t]) + { + case Base_X3DConstants .X3DViewpointNode: + { + this .cameraObjects .push (childNode); + break; + } + case Base_X3DConstants .ViewpointGroup: + { + this .cameraObjects .push (childNode); + this .viewpointGroups .push (childNode); + break; + } + } + } + } + }, + traverse (type, renderObject) + { + const proximitySensor = this .proximitySensor; + + switch (type) + { + case Rendering_TraverseType .CAMERA: + { + proximitySensor .traverse (type, renderObject); + + if (proximitySensor ._isActive .getValue () || !proximitySensor ._enabled .getValue ()) + { + renderObject .getViewpointGroups () .push (this); + + for (const cameraObject of this .cameraObjects) + cameraObject .traverse (type, renderObject); + + renderObject .getViewpointGroups () .pop (); + } + + return; + } + case Rendering_TraverseType .DISPLAY: + { + proximitySensor .traverse (type, renderObject); + + if (proximitySensor ._isActive .getValue () || !proximitySensor ._enabled .getValue ()) + { + for (const viewpointGroup of this .viewpointGroups) + viewpointGroup .traverse (type, renderObject); + } + + return; + } + } + }, +}); + +Object .defineProperties (ViewpointGroup, +{ + typeName: + { + value: "ViewpointGroup", + enumerable: true, + }, + componentName: + { + value: "Navigation", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "displayed", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "retainUserOffsets", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "size", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "center", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const ViewpointGroup_default_ = ViewpointGroup; +; + +x_ite_Namespace .add ("ViewpointGroup", "x_ite/Components/Navigation/ViewpointGroup", ViewpointGroup_default_); +/* harmony default export */ const Navigation_ViewpointGroup = (ViewpointGroup_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Navigation.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + +const Navigation_default_ = { + name: "Navigation", + concreteNodes: + [ + Navigation_Billboard, + Navigation_Collision, + Navigation_LOD, + Navigation_NavigationInfo, + Navigation_OrthoViewpoint, + Navigation_Viewpoint, + Navigation_ViewpointGroup, + ], + abstractNodes: + [ + Navigation_X3DViewpointNode, + ], +}; +; + +x_ite_Namespace .add ("Navigation", "x_ite/Components/Navigation", Navigation_default_); +/* harmony default export */ const Navigation = (Navigation_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/PointingDeviceSensor/PointingDeviceSensorContainer.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function PointingDeviceSensorContainer (node, modelViewMatrix, projectionMatrix, viewport) +{ + this .node = null; + this .modelViewMatrix = new Numbers_Matrix4 (); + this .projectionMatrix = new Numbers_Matrix4 (); + this .viewport = new Numbers_Vector4 (0, 0, 0, 0); + + this .set (node, modelViewMatrix, projectionMatrix, viewport); +} + +Object .assign (PointingDeviceSensorContainer .prototype, +{ + set (node, modelViewMatrix, projectionMatrix, viewport) + { + this .node = node; + + this .modelViewMatrix .assign (modelViewMatrix); + this .projectionMatrix .assign (projectionMatrix); + this .viewport .assign (viewport); + }, + set_over__ (over, hit) + { + this .node .set_over__ (over, hit, this .modelViewMatrix, this .projectionMatrix, this .viewport); + }, + set_active__ (active, hit) + { + this .node .set_active__ (active, hit, this .modelViewMatrix, this .projectionMatrix, this .viewport); + }, + set_motion__ (hit) + { + this .node .set_motion__ (hit, this .modelViewMatrix, this .projectionMatrix, this .viewport); + }, +}); + +const PointingDeviceSensorContainer_default_ = PointingDeviceSensorContainer; +; + +x_ite_Namespace .add ("PointingDeviceSensorContainer", "x_ite/Browser/PointingDeviceSensor/PointingDeviceSensorContainer", PointingDeviceSensorContainer_default_); +/* harmony default export */ const PointingDeviceSensor_PointingDeviceSensorContainer = (PointingDeviceSensorContainer_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/PointingDeviceSensor/X3DPointingDeviceSensorNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function X3DPointingDeviceSensorNode (executionContext) +{ + Core_X3DSensorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DPointingDeviceSensorNode); +} + +Object .assign (Object .setPrototypeOf (X3DPointingDeviceSensorNode .prototype, Core_X3DSensorNode .prototype), +{ + initialize () + { + Core_X3DSensorNode .prototype .initialize .call (this); + + this .getLive () .addInterest ("set_live__", this); + + this ._enabled .addInterest ("set_live__", this); + + this .set_live__ (); + }, + set_live__ () + { + if (this .getLive () .getValue () && this ._enabled .getValue ()) + { + this .getBrowser () .addPointingDeviceSensor (this); + + delete this .push; + } + else + { + this .getBrowser () .removePointingDeviceSensor (this); + + if (this ._isActive .getValue ()) + this ._isActive = false; + + if (this ._isOver .getValue ()) + this ._isOver = false; + + this .push = Function .prototype; + } + }, + set_over__ (over, hit) + { + if (over !== this ._isOver .getValue ()) + { + this ._isOver = over; + + if (over) + this .getBrowser () .getNotification () ._string = this ._description; + } + }, + set_active__ (active, hit) + { + if (active !== this ._isActive .getValue ()) + this ._isActive = active + }, + set_motion__ (hit) + { }, + push (renderObject, sensors) + { + sensors .push (new PointingDeviceSensor_PointingDeviceSensorContainer (this, + renderObject .getModelViewMatrix () .get (), + renderObject .getProjectionMatrix () .get (), + renderObject .getViewVolume () .getViewport ())); + }, +}); + +Object .defineProperties (X3DPointingDeviceSensorNode, +{ + typeName: + { + value: "X3DPointingDeviceSensorNode", + enumerable: true, + }, + componentName: + { + value: "PointingDeviceSensor", + enumerable: true, + }, +}); + +const X3DPointingDeviceSensorNode_default_ = X3DPointingDeviceSensorNode; +; + +x_ite_Namespace .add ("X3DPointingDeviceSensorNode", "x_ite/Components/PointingDeviceSensor/X3DPointingDeviceSensorNode", X3DPointingDeviceSensorNode_default_); +/* harmony default export */ const PointingDeviceSensor_X3DPointingDeviceSensorNode = (X3DPointingDeviceSensorNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/PointingDeviceSensor/X3DTouchSensorNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + +function X3DTouchSensorNode (executionContext) +{ + PointingDeviceSensor_X3DPointingDeviceSensorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DTouchSensorNode); +} + +Object .assign (Object .setPrototypeOf (X3DTouchSensorNode .prototype, PointingDeviceSensor_X3DPointingDeviceSensorNode .prototype), +{ + set_active__ (active, hit) + { + PointingDeviceSensor_X3DPointingDeviceSensorNode .prototype .set_active__ .call (this, active, hit); + + if (this ._enabled .getValue () && this ._isOver .getValue () && ! active) + this ._touchTime = this .getBrowser () .getCurrentTime (); + }, + set_over__: (() => + { + const + invModelViewMatrix = new Numbers_Matrix4 (), + texCoord = new Numbers_Vector2 (0, 0); + + return function (over, hit, modelViewMatrix, projectionMatrix, viewport) + { + PointingDeviceSensor_X3DPointingDeviceSensorNode .prototype .set_over__ .call (this, over, hit, modelViewMatrix, projectionMatrix, viewport); + + if (this ._isOver .getValue ()) + { + texCoord .set (hit .texCoord .x, hit .texCoord .y) .divide (hit .texCoord .w); + invModelViewMatrix .assign (modelViewMatrix) .inverse (); + + this ._hitTexCoord_changed = texCoord; + this ._hitNormal_changed = modelViewMatrix .multMatrixDir (hit .normal .copy ()) .normalize (); + this ._hitPoint_changed = invModelViewMatrix .multVecMatrix (hit .point .copy ()); + } + }; + })(), +}); + +Object .defineProperties (X3DTouchSensorNode, +{ + typeName: + { + value: "X3DTouchSensorNode", + enumerable: true, + }, + componentName: + { + value: "PointingDeviceSensor", + enumerable: true, + }, +}); + +const X3DTouchSensorNode_default_ = X3DTouchSensorNode; +; + +x_ite_Namespace .add ("X3DTouchSensorNode", "x_ite/Components/PointingDeviceSensor/X3DTouchSensorNode", X3DTouchSensorNode_default_); +/* harmony default export */ const PointingDeviceSensor_X3DTouchSensorNode = (X3DTouchSensorNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/PointingDeviceSensor/TouchSensor.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function TouchSensor (executionContext) +{ + PointingDeviceSensor_X3DTouchSensorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .TouchSensor); + + this ._hitPoint_changed .setUnit ("length"); +} + +Object .setPrototypeOf (TouchSensor .prototype, PointingDeviceSensor_X3DTouchSensorNode .prototype); + +Object .defineProperties (TouchSensor, +{ + typeName: + { + value: "TouchSensor", + enumerable: true, + }, + componentName: + { + value: "PointingDeviceSensor", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "hitTexCoord_changed", new x_ite_Fields .SFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "hitNormal_changed", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "hitPoint_changed", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isOver", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "touchTime", new x_ite_Fields .SFTime ()), + ]), + enumerable: true, + }, +}); + +const TouchSensor_default_ = TouchSensor; +; + +x_ite_Namespace .add ("TouchSensor", "x_ite/Components/PointingDeviceSensor/TouchSensor", TouchSensor_default_); +/* harmony default export */ const PointingDeviceSensor_TouchSensor = (TouchSensor_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Networking/Anchor.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + +function Anchor (executionContext) +{ + Grouping_X3DGroupingNode .call (this, executionContext); + Networking_X3DUrlObject .call (this, executionContext); + + this .addType (Base_X3DConstants .Anchor); + + this .touchSensorNode = new PointingDeviceSensor_TouchSensor (executionContext); + this .anchorSensors = [ ]; +} + +Object .assign (Object .setPrototypeOf (Anchor .prototype, Grouping_X3DGroupingNode .prototype), + Networking_X3DUrlObject .prototype, +{ + initialize () + { + Grouping_X3DGroupingNode .prototype .initialize .call (this); + Networking_X3DUrlObject .prototype .initialize .call (this); + + this ._description .addFieldInterest (this .touchSensorNode ._description); + this ._load .addFieldInterest (this .touchSensorNode ._enabled); + + this .touchSensorNode ._description = this ._description; + this .touchSensorNode ._enabled = this ._load; + this .touchSensorNode .setup (); + + // Modify set_active__ to get immediate response to user action (click event), + // otherwise links are not opened in this window. + + this .touchSensorNode .set_active__ = (active, hit) => + { + PointingDeviceSensor_TouchSensor .prototype .set_active__ .call (this .touchSensorNode, active, hit); + + if (this .touchSensorNode ._isOver .getValue () && !active) + this .requestImmediateLoad () .catch (Function .prototype); + }; + }, + set_load__ () + { }, + set_url__ () + { }, + requestImmediateLoad (cache = true) + { + this .setCache (cache); + this .setLoadState (Base_X3DConstants .IN_PROGRESS_STATE, false); + + return new Promise ((resolve, reject) => + { + new InputOutput_FileLoader (this) .createX3DFromURL (this ._url, this ._parameter, + (scene) => + { + if (scene) + { + this .getBrowser () .replaceWorld (scene); + this .setLoadState (Base_X3DConstants .COMPLETE_STATE, false); + resolve (); + } + else + { + this .setLoadState (Base_X3DConstants .FAILED_STATE, false); + reject (); + } + }, + (viewpointName) => + { + this .getBrowser () .changeViewpoint (viewpointName); + this .setLoadState (Base_X3DConstants .COMPLETE_STATE, false); + resolve (); + }, + (url, target) => + { + if (target) + window .open (url, target); + else + location = url; + + this .setLoadState (Base_X3DConstants .COMPLETE_STATE, false); + resolve (); + }); + }); + }, + requestUnload () + { }, + traverse (type, renderObject) + { + if (type === Rendering_TraverseType .POINTER) + { + const sensors = this .anchorSensors; + + sensors .length = 0; + + this .touchSensorNode .push (renderObject, sensors); + + if (sensors .length) + { + renderObject .getSensors () .push (sensors); + + Grouping_X3DGroupingNode .prototype .traverse .call (this, type, renderObject); + + renderObject .getSensors () .pop (); + } + else + { + Grouping_X3DGroupingNode .prototype .traverse .call (this, type, renderObject); + } + } + else + { + Grouping_X3DGroupingNode .prototype .traverse .call (this, type, renderObject); + } + }, + dispose () + { + Networking_X3DUrlObject .prototype .dispose .call (this); + Grouping_X3DGroupingNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (Anchor, +{ + typeName: + { + value: "Anchor", + enumerable: true, + }, + componentName: + { + value: "Networking", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "load", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "url", new x_ite_Fields .MFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "parameter", new x_ite_Fields .MFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoRefresh", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoRefreshTimeLimit", new x_ite_Fields .SFTime (3600)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "visible", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "bboxDisplay", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxSize", new x_ite_Fields .SFVec3f (-1, -1, -1)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxCenter", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "addChildren", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "removeChildren", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const Anchor_default_ = Anchor; +; + +x_ite_Namespace .add ("Anchor", "x_ite/Components/Networking/Anchor", Anchor_default_); +/* harmony default export */ const Networking_Anchor = (Anchor_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Networking/Inline.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + +function Inline (executionContext) +{ + Core_X3DChildNode .call (this, executionContext); + Networking_X3DUrlObject .call (this, executionContext); + Grouping_X3DBoundedObject .call (this, executionContext); + + this .addType (Base_X3DConstants .Inline); + + if (executionContext .getSpecificationVersion () < 4.0) + this ._global = true; + + this .scene = this .getBrowser () .getDefaultScene (); + this .groupNode = new Grouping_Group (executionContext); + this .localObjects = [ ]; + this .localShadows = false; +} + +Object .assign (Object .setPrototypeOf (Inline .prototype, Core_X3DChildNode .prototype), + Networking_X3DUrlObject .prototype, + Grouping_X3DBoundedObject .prototype, +{ + initialize () + { + Core_X3DChildNode .prototype .initialize .call (this); + Networking_X3DUrlObject .prototype .initialize .call (this); + Grouping_X3DBoundedObject .prototype .initialize .call (this); + + this .groupNode .setPrivate (true); + this .groupNode .setup (); + + this .groupNode ._isCameraObject .addFieldInterest (this ._isCameraObject); + this .groupNode ._isPickableObject .addFieldInterest (this ._isPickableObject); + + this .requestImmediateLoad () .catch (Function .prototype); + }, + getBBox (bbox, shadows) + { + if (this ._bboxSize .getValue () .equals (this .getDefaultBBoxSize ())) + return this .groupNode .getBBox (bbox, shadows); + + return bbox .set (this ._bboxSize .getValue (), this ._bboxCenter .getValue ()); + }, + set_live__ () + { + Networking_X3DUrlObject .prototype .set_live__ .call (this); + + this .scene .setLive (this .getLive () .getValue ()); + }, + unloadData () + { + this .abortLoading (); + this .setInternalScene (this .getBrowser () .getDefaultScene ()); + }, + loadData () + { + this .abortLoading (); + this .fileLoader = new InputOutput_FileLoader (this) .createX3DFromURL (this ._url, null, this .setInternalSceneAsync .bind (this)); + }, + abortLoading () + { + this .scene ._loadCount .removeInterest ("checkLoadCount", this); + + if (this .fileLoader) + this .fileLoader .abort (); + }, + setInternalSceneAsync (scene) + { + if (scene) + { + scene ._loadCount .addInterest ("checkLoadCount", this); + this .setInternalScene (scene); + this .checkLoadCount (scene ._loadCount); + } + else + { + this .setInternalScene (this .getBrowser () .getDefaultScene ()); + this .setLoadState (Base_X3DConstants .FAILED_STATE); + } + }, + checkLoadCount (loadCount) + { + if (loadCount .getValue ()) + return; + + loadCount .removeInterest ("checkLoadCount", this); + + this .setLoadState (Base_X3DConstants .COMPLETE_STATE); + }, + setInternalScene (scene) + { + this .scene .setLive (false); + this .scene .rootNodes .removeFieldInterest (this .groupNode ._children); + + // Set new scene. + + this .scene = scene; + this .scene .setExecutionContext (this .getExecutionContext ()); + + this .scene .rootNodes .addFieldInterest (this .groupNode ._children); + this .groupNode ._children = this .scene .rootNodes; + + this .set_live__ (); + + this .getBrowser () .addBrowserEvent (); + }, + getInternalScene () + { + /// Returns the internal X3DScene of this inline, that is loaded from the url given. + /// If the load field was false an empty scene is returned. This empty scene is the same for all Inline + /// nodes (due to performance reasons). + + return this .scene; + }, + traverse (type, renderObject) + { + switch (type) + { + case Rendering_TraverseType .PICKING: + { + const + browser = this .getBrowser (), + pickingHierarchy = browser .getPickingHierarchy (); + + pickingHierarchy .push (this); + + this .groupNode .traverse (type, renderObject); + + pickingHierarchy .pop (); + return; + } + case Rendering_TraverseType .DISPLAY: + { + if (this ._global .getValue ()) + { + this .groupNode .traverse (type, renderObject); + } + else + { + const + globalObjects = renderObject .getGlobalObjects (), + globalShadows = renderObject .getGlobalShadows (), + globalsBegin = globalObjects .length, + shadowsBegin = globalShadows .length, + localObjects = this .localObjects, + numLocalObjects = localObjects .length, + numLights = localObjects .reduce ((n, c) => n + !!c .lightNode, 0), + numTextureProjectors = localObjects .reduce ((n, c) => n + !!c .textureProjectorNode, 0); + + if (numLocalObjects) + { + renderObject .getLocalObjects () .push (... localObjects); + renderObject .pushLocalShadows (this .localShadows); + renderObject .getLocalObjectsCount () [1] += numLights; + renderObject .getLocalObjectsCount () [2] += numTextureProjectors; + } + + this .groupNode .traverse (type, renderObject); + + if (numLocalObjects) + { + if (renderObject .isIndependent ()) + { + const browser = this .getBrowser (); + + for (let i = 0; i < numLocalObjects; ++ i) + browser .getLocalObjects () .push (renderObject .getLocalObjects () .pop ()); + } + else + { + for (let i = 0; i < numLocalObjects; ++ i) + renderObject .getLocalObjects () .pop (); + } + + renderObject .popLocalShadows (); + renderObject .getLocalObjectsCount () [1] -= numLights; + renderObject .getLocalObjectsCount () [2] -= numTextureProjectors; + } + + const numGlobalObjects = globalObjects .length - globalsBegin; + + for (let i = 0; i < numGlobalObjects; ++ i) + { + const globalObject = globalObjects [globalsBegin + i]; + + globalObject .groupNode = this .groupNode; + globalObject .global = false; + + localObjects [i] = globalObject; + } + + localObjects .length = numGlobalObjects; + this .localShadows = globalShadows .at (-1); + + globalObjects .length = globalsBegin; + globalShadows .length = shadowsBegin; + } + + return; + } + default: + { + this .groupNode .traverse (type, renderObject); + return; + } + } + }, + dispose () + { + Grouping_X3DBoundedObject .prototype .dispose .call (this); + Networking_X3DUrlObject .prototype .dispose .call (this); + Core_X3DChildNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (Inline, +{ + typeName: + { + value: "Inline", + enumerable: true, + }, + componentName: + { + value: "Networking", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "global", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "load", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "url", new x_ite_Fields .MFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoRefresh", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoRefreshTimeLimit", new x_ite_Fields .SFTime (3600)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "visible", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "bboxDisplay", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxSize", new x_ite_Fields .SFVec3f (-1, -1, -1)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxCenter", new x_ite_Fields .SFVec3f ()), + ]), + enumerable: true, + }, +}); + +const Inline_default_ = Inline; +; + +x_ite_Namespace .add ("Inline", "x_ite/Components/Networking/Inline", Inline_default_); +/* harmony default export */ const Networking_Inline = (Inline_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Networking/X3DNetworkSensorNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function X3DNetworkSensorNode (executionContext) +{ + Core_X3DSensorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DNetworkSensorNode); +} + +Object .setPrototypeOf (X3DNetworkSensorNode .prototype, Core_X3DSensorNode .prototype); + +Object .defineProperties (X3DNetworkSensorNode, +{ + typeName: + { + value: "X3DNetworkSensorNode", + enumerable: true, + }, + componentName: + { + value: "Networking", + enumerable: true, + }, +}); + +const X3DNetworkSensorNode_default_ = X3DNetworkSensorNode; +; + +x_ite_Namespace .add ("X3DNetworkSensorNode", "x_ite/Components/Networking/X3DNetworkSensorNode", X3DNetworkSensorNode_default_); +/* harmony default export */ const Networking_X3DNetworkSensorNode = (X3DNetworkSensorNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Networking/LoadSensor.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function LoadSensor (executionContext) +{ + Networking_X3DNetworkSensorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .LoadSensor); + + if (executionContext .getSpecificationVersion () <= 3.3) + this .addAlias ("watchList", this ._children); + + this .urlObjects = [ ]; + this .aborted = false; + this .timeOutId = undefined; +} + +Object .assign (Object .setPrototypeOf (LoadSensor .prototype, Networking_X3DNetworkSensorNode .prototype), +{ + initialize () + { + Networking_X3DNetworkSensorNode .prototype .initialize .call (this); + + this ._enabled .addInterest ("set_enabled__", this); + this ._timeOut .addInterest ("set_timeOut__", this); + this ._children .addInterest ("set_children__", this); + + this .set_children__ (); + }, + set_enabled__ () + { + if (this ._enabled .getValue ()) + this .reset (); + + else + { + this .abort (); + this .remove (); + } + }, + set_timeOut__ () + { + if (this ._isActive .getValue ()) + { + this .clearTimeout (); + + this .aborted = false; + + if (this ._timeOut .getValue () > 0) + this .timeOutId = setTimeout (this .abort .bind (this), this ._timeOut .getValue () * 1000); + } + }, + set_children__ () + { + this .reset (); + }, + set_loadState__ (urlObject) + { + switch (urlObject .checkLoadState ()) + { + case Base_X3DConstants .NOT_STARTED_STATE: + break; + case Base_X3DConstants .IN_PROGRESS_STATE: + case Base_X3DConstants .COMPLETE_STATE: + case Base_X3DConstants .FAILED_STATE: + { + this .count (); + break; + } + } + }, + count () + { + const urlObjects = this .urlObjects; + + if (urlObjects .length) + { + let + complete = 0, + failed = 0; + + for (const urlObject of urlObjects) + { + complete += urlObject .checkLoadState () == Base_X3DConstants .COMPLETE_STATE; + failed += urlObject .checkLoadState () == Base_X3DConstants .FAILED_STATE; + } + + const + loaded = complete === urlObjects .length, + progress = complete / urlObjects .length; + + if (this .aborted || failed || loaded) + { + this .clearTimeout (); + + this ._isActive = false; + this ._isLoaded = loaded; + this ._progress = progress; + + if (loaded) + this ._loadTime = this .getBrowser () .getCurrentTime (); + } + else + { + if (this ._isActive .getValue ()) + { + this ._progress = progress; + } + else + { + this ._isActive = true; + this ._progress = progress; + + this .set_timeOut__ (); + } + } + } + else + { + this ._isActive = false; + this ._isLoaded = false; + this ._progress = 0; + } + }, + abort () + { + this .clearTimeout (); + + this .aborted = true; + + if (this ._enabled .getValue ()) + this .count (); + }, + reset () + { + this .remove (); + + if (! this ._enabled .getValue ()) + return; + + const urlObjects = this .urlObjects; + + for (const node of this ._children) + { + const urlObject = Base_X3DCast (Base_X3DConstants .X3DUrlObject, node); + + if (urlObject) + { + urlObjects .push (urlObject); + + urlObject ._loadState .addInterest ("set_loadState__", this, urlObject); + } + } + + this .count (); + }, + remove () + { + this .clearTimeout (); + + const urlObjects = this .urlObjects; + + for (const urlObject of urlObjects) + urlObject ._loadState .removeInterest ("set_loadState__", this); + + urlObjects .length = 0; + }, + clearTimeout () + { + clearTimeout (this .timeOutId); + + this .timeOutId = undefined; + }, +}); + +Object .defineProperties (LoadSensor, +{ + typeName: + { + value: "LoadSensor", + enumerable: true, + }, + componentName: + { + value: "Networking", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "timeOut", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isLoaded", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "progress", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "loadTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const LoadSensor_default_ = LoadSensor; +; + +x_ite_Namespace .add ("LoadSensor", "x_ite/Components/Networking/LoadSensor", LoadSensor_default_); +/* harmony default export */ const Networking_LoadSensor = (LoadSensor_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Networking.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +const Networking_default_ = { + name: "Networking", + concreteNodes: + [ + Networking_Anchor, + Networking_Inline, + Networking_LoadSensor, + ], + abstractNodes: + [ + Networking_X3DNetworkSensorNode, + Networking_X3DUrlObject, + ], +}; +; + +x_ite_Namespace .add ("Networking", "x_ite/Components/Networking", Networking_default_); +/* harmony default export */ const Networking = (Networking_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/PointingDeviceSensor/X3DDragSensorNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function X3DDragSensorNode (executionContext) +{ + PointingDeviceSensor_X3DPointingDeviceSensorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DDragSensorNode); + + this ._trackPoint_changed .setUnit ("length"); +} + +Object .setPrototypeOf (X3DDragSensorNode .prototype, PointingDeviceSensor_X3DPointingDeviceSensorNode .prototype); + +Object .defineProperties (X3DDragSensorNode, +{ + typeName: + { + value: "X3DDragSensorNode", + enumerable: true, + }, + componentName: + { + value: "PointingDeviceSensor", + enumerable: true, + }, +}); + +const X3DDragSensorNode_default_ = X3DDragSensorNode; +; + +x_ite_Namespace .add ("X3DDragSensorNode", "x_ite/Components/PointingDeviceSensor/X3DDragSensorNode", X3DDragSensorNode_default_); +/* harmony default export */ const PointingDeviceSensor_X3DDragSensorNode = (X3DDragSensorNode_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Geometry/Cylinder3.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + +function Cylinder3 (axis, radius) +{ + this .axis = axis .copy (); + this .radius = radius; +} + +Object .assign (Cylinder3 .prototype, +{ + intersectsLine (line, enter, exit) + { + //////////////////////////////////////////////////////////////////////// + // + // Description: + // Intersect given line with this cylinder, returning the + // results in enter and exit. Returns TRUE if there was an + // intersection (and results are valid). + // + // Taken from Inventor SbCylinder.c++ + + // The intersection will actually be done on a radius 1 cylinder + // aligned with the y axis, so we transform the line into that + // space, then intersect, then transform the results back. + + // rotation to y axis + const + rotToYAxis = new Numbers_Rotation4 (this .axis .direction, new Numbers_Vector3 (0, 1, 0)), + mtxToYAxis = Numbers_Matrix4 .Rotation (rotToYAxis); + + // scale to unit space + const + scaleFactor = 1 / this .radius, + toUnitCylSpace = new Numbers_Matrix4 (); + + toUnitCylSpace .scale (new Numbers_Vector3 (scaleFactor, scaleFactor, scaleFactor)); + toUnitCylSpace .multLeft (mtxToYAxis); + + // find the given line un-translated + const + point = line .point .copy () .subtract (this .axis .point), + noTranslationLine = new Geometry_Line3 (point, line .direction); + + // find the un-translated line in unit cylinder's space + const cylLine = noTranslationLine .multLineMatrix (toUnitCylSpace); + + // find the intersection on the unit cylinder + const intersected = this .unitCylinderIntersectsLine (cylLine, enter, exit); + + if (intersected) + { + // transform back to original space + const fromUnitCylSpace = toUnitCylSpace .inverse (); + + fromUnitCylSpace .multVecMatrix (enter); + enter .add (this .axis .point); + + fromUnitCylSpace .multVecMatrix (exit); + exit .add (this .axis .point); + } + + return intersected; + }, + unitCylinderIntersectsLine (line, enter, exit) + { + let t0, t1; + + const + pos = line .point, + dir = line .direction; + + const + A = dir [0] * dir [0] + dir [2] * dir [2], + B = 2 * (pos [0] * dir [0] + pos [2] * dir [2]), + C = pos [0] * pos [0] + pos [2] * pos [2] - 1; + + // discriminant = B^2 - 4AC + const discr = B * B - 4 * A * C; + + // if discriminant is negative, no intersection + if (discr < 0) + return false; + + const sqroot = Math .sqrt (discr); + + // magic to stabilize the answer + if (B > 0) + { + t0 = -(2 * C) / (sqroot + B); + t1 = -(sqroot + B) / (2 * A); + } + else + { + t0 = (2 * C) / (sqroot - B); + t1 = (sqroot - B) / (2 * A); + } + + enter .assign (dir) .multiply (t0) .add (pos); + exit .assign (dir) .multiply (t1) .add (pos); + + return true; + }, + toString () + { + return `${this .axis}, ${this .radius}`; + }, +}); + +const Cylinder3_default_ = Cylinder3; +; + +x_ite_Namespace .add ("Cylinder3", "standard/Math/Geometry/Cylinder3", Cylinder3_default_); +/* harmony default export */ const Geometry_Cylinder3 = (Cylinder3_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/PointingDeviceSensor/CylinderSensor.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + +function CylinderSensor (executionContext) +{ + PointingDeviceSensor_X3DDragSensorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .CylinderSensor); + + this ._diskAngle .setUnit ("angle"); + this ._minAngle .setUnit ("angle"); + this ._maxAngle .setUnit ("angle"); + this ._offset .setUnit ("angle"); +} + +Object .assign (Object .setPrototypeOf (CylinderSensor .prototype, PointingDeviceSensor_X3DDragSensorNode .prototype), +{ + initialize () + { + PointingDeviceSensor_X3DDragSensorNode .prototype .initialize .call (this); + + this .modelViewMatrix = new Numbers_Matrix4 (); + this .invModelViewMatrix = new Numbers_Matrix4 (); + + this .cylinder = new Geometry_Cylinder3 (new Geometry_Line3 (new Numbers_Vector3 (0, 0, 0), new Numbers_Vector3 (0, 0, 0)), 0); + this .disk = false; + this .yPlane = null; + this .zPlane = null; + this .sxPlane = null; + this .szNormal = null; + this .behind = false; + this .fromVector = new Numbers_Vector3 (0, 0, 0); + this .startOffset = new Numbers_Rotation4 (); + }, + isBehind (hitRay, hitPoint) + { + const + enter = new Numbers_Vector3 (0, 0 ,0), + exit = new Numbers_Vector3 (0, 0, 0); + + this .cylinder .intersectsLine (hitRay, enter, exit); + + return hitPoint .distance (enter) > hitPoint .distance (exit); + }, + getTrackPoint (hitRay, trackPoint) + { + const zPoint = new Numbers_Vector3 (0, 0, 0); + + this .zPlane .intersectsLine (hitRay, zPoint); + + const + axisPoint = zPoint .copy () .add (this .cylinder .axis .getPerpendicularVectorToPoint (zPoint, new Numbers_Vector3 (0, 0, 0))), + distance = this .sxPlane .getDistanceToPoint (zPoint) / this .cylinder .radius, + section = Math .floor ((distance + 1) / 2); + + // Use asin on the cylinder and outside linear angle. + const + sinp = Math_Algorithm .interval (distance, -1, 1), + phi = section === 0 ? Math .asin (sinp) : sinp * Math .PI / 2, + angle = phi + section * Math .PI; + + const rotation = new Numbers_Rotation4 (this .cylinder .axis .direction, angle); + + rotation .multVecRot (trackPoint .assign (this .szNormal) .multiply (this .cylinder .radius)); + trackPoint .add (axisPoint); + }, + getAngle (rotation) + { + if (rotation .getAxis (new Numbers_Vector3 (0, 0, 0)) .dot (this .cylinder .axis .direction) > 0) + return rotation .angle; + + else + return -rotation .angle; + }, + set_active__ (active, hit, modelViewMatrix, projectionMatrix, viewport) + { + PointingDeviceSensor_X3DDragSensorNode .prototype .set_active__ .call (this, active, hit, modelViewMatrix, projectionMatrix, viewport); + + if (this ._isActive .getValue ()) + { + this .modelViewMatrix .assign (modelViewMatrix); + this .invModelViewMatrix .assign (modelViewMatrix) .inverse (); + + const + hitRay = hit .hitRay .copy () .multLineMatrix (this .invModelViewMatrix), + hitPoint = this .invModelViewMatrix .multVecMatrix (hit .point .copy ()); + + const + yAxis = this ._axisRotation .getValue () .multVecRot (new Numbers_Vector3 (0, 1, 0)), + cameraBack = this .invModelViewMatrix .multDirMatrix (new Numbers_Vector3 (0, 0, 1)) .normalize (); + + const + axis = new Geometry_Line3 (new Numbers_Vector3 (0, 0, 0), yAxis), + radius = axis .getPerpendicularVectorToPoint (hitPoint, new Numbers_Vector3 (0, 0, 0)) .magnitude (); + + this .cylinder = new Geometry_Cylinder3 (axis, radius); + this .disk = Math .abs (cameraBack .dot (yAxis)) > Math .cos (this ._diskAngle .getValue ()); + this .behind = this .isBehind (hitRay, hitPoint); + this .yPlane = new Geometry_Plane3 (hitPoint, yAxis); // Sensor aligned y-plane + this .zPlane = new Geometry_Plane3 (hitPoint, cameraBack); // Screen aligned z-plane + + // Compute normal like in Billboard with yAxis as axis of rotation. + const + billboardToViewer = this .invModelViewMatrix .origin, + sxNormal = yAxis .copy () .cross (billboardToViewer) .normalize (); + + this .sxPlane = new Geometry_Plane3 (new Numbers_Vector3 (0, 0, 0), sxNormal); // Billboarded special x-plane made parallel to sensors axis. + this .szNormal = sxNormal .copy () .cross (yAxis) .normalize (); // Billboarded special z-normal made parallel to sensors axis. + + const trackPoint = new Numbers_Vector3 (0, 0, 0); + + if (this .disk) + this .yPlane .intersectsLine (hitRay, trackPoint); + else + this .getTrackPoint (hitRay, trackPoint); + + this .fromVector = this .cylinder .axis .getPerpendicularVectorToPoint (trackPoint, new Numbers_Vector3 (0, 0, 0)) .negate (); + this .startOffset = new Numbers_Rotation4 (yAxis, this ._offset .getValue ()); + + this ._trackPoint_changed = trackPoint; + this ._rotation_changed = this .startOffset; + + // For min/max angle. + + this .angle = this ._offset .getValue (); + this .startVector = this ._rotation_changed .getValue () .multVecRot (this ._axisRotation .getValue () .multVecRot (new Numbers_Vector3 (0, 0, 1))); + } + else + { + if (this ._autoOffset .getValue ()) + this ._offset = this .getAngle (this ._rotation_changed .getValue ()); + } + }, + set_motion__ (hit) + { + const + hitRay = hit .hitRay .copy () .multLineMatrix (this .invModelViewMatrix), + trackPoint = new Numbers_Vector3 (0, 0, 0); + + if (this .disk) + this .yPlane .intersectsLine (hitRay, trackPoint); + else + this .getTrackPoint (hitRay, trackPoint); + + this ._trackPoint_changed = trackPoint; + + const + toVector = this .cylinder .axis .getPerpendicularVectorToPoint (trackPoint, new Numbers_Vector3 (0, 0, 0)) .negate (), + rotation = new Numbers_Rotation4 (this .fromVector, toVector); + + if (this .disk) + { + // The trackpoint can swap behind the viewpoint if viewpoint is a Viewpoint node + // as the viewing volume is not a cube where the picking ray goes straight up. + // This phenomenon is very clear on the viewport corners. + + const trackPoint_ = this .modelViewMatrix .multVecMatrix (trackPoint .copy ()); + + if (trackPoint_ .z > 0) + rotation .multRight (new Numbers_Rotation4 (this .yPlane .normal, Math .PI)); + } + else + { + if (this .behind) + rotation .inverse (); + } + + rotation .multLeft (this .startOffset); + + if (this ._minAngle .getValue () > this ._maxAngle .getValue ()) + { + this ._rotation_changed = rotation; + } + else + { + const + endVector = rotation .multVecRot (this ._axisRotation .getValue () .multVecRot (new Numbers_Vector3 (0, 0, 1))), + deltaRotation = new Numbers_Rotation4 (this .startVector, endVector), + axis = this ._axisRotation .getValue () .multVecRot (new Numbers_Vector3 (0, 1, 0)), + sign = axis .dot (deltaRotation .getAxis (new Numbers_Vector3 (0, 0, 0))) > 0 ? 1 : -1, + min = this ._minAngle .getValue (), + max = this ._maxAngle .getValue (); + + this .angle += sign * deltaRotation .angle; + + this .startVector .assign (endVector); + + //console .log (this .angle, min, max); + + if (this .angle < min) + rotation .setAxisAngle (this .cylinder .axis .direction, min); + else if (this .angle > max) + rotation .setAxisAngle (this .cylinder .axis .direction, max); + else + rotation .setAxisAngle (this .cylinder .axis .direction, this .angle); + + if (! this ._rotation_changed .getValue () .equals (rotation)) + this ._rotation_changed = rotation; + } + }, +}); + +Object .defineProperties (CylinderSensor, +{ + typeName: + { + value: "CylinderSensor", + enumerable: true, + }, + componentName: + { + value: "PointingDeviceSensor", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "axisRotation", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "diskAngle", new x_ite_Fields .SFFloat (0.261792)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "minAngle", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "maxAngle", new x_ite_Fields .SFFloat (-1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "offset", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoOffset", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "trackPoint_changed", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "rotation_changed", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isOver", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + ]), + enumerable: true, + }, +}); + +const CylinderSensor_default_ = CylinderSensor; +; + +x_ite_Namespace .add ("CylinderSensor", "x_ite/Components/PointingDeviceSensor/CylinderSensor", CylinderSensor_default_); +/* harmony default export */ const PointingDeviceSensor_CylinderSensor = (CylinderSensor_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Geometry/Line2.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function Line2 (point, direction) +{ + this .point = point .copy (); + this .direction = direction .copy (); +} + +Object .assign (Line2 .prototype, +{ + copy () + { + const copy = Object .create (Line2 .prototype); + copy .point = this .point .copy (); + copy .direction = this .direction .copy (); + return copy; + }, + assign (line) + { + this .point .assign (line .point); + this .direction .assign (line .direction); + return this; + }, + set (point, direction) + { + this .point .assign (point); + this .direction .assign (direction); + return this; + }, + setPoints (point1, point2) + { + this .point .assign (point1); + this .direction .assign (point2) .subtract (point1) .normalize (); + return this; + }, + multMatrixLine (matrix) + { + matrix .multMatrixVec (this .point); + matrix .multMatrixDir (this .direction) .normalize (); + return this; + }, + multLineMatrix (matrix) + { + matrix .multVecMatrix (this .point); + matrix .multDirMatrix (this .direction) .normalize (); + return this; + }, + getClosestPointToPoint (point, result) + { + const + r = result .assign (point) .subtract (this .point), + d = r .dot (this .direction); + + return result .assign (this .direction) .multiply (d) .add (this .point); + }, + getPerpendicularVectorToPoint: (() => + { + const t = new Numbers_Vector2 (0, 0); + + return function (point, result) + { + result .assign (this .point) .subtract (point); + + return result .subtract (t .assign (this .direction) .multiply (result .dot (this .direction))); + }; + })(), + intersectsLine: (() => + { + const u = new Numbers_Vector2 (0, 0); + + return function (line, point) + { + const + { point: p1, direction: d1 } = this, + { point: p2, direction: d2 } = line; + + const theta = d1 .dot (d2); // angle between both lines + + if (Math .abs (theta) >= 1) + return false; // lines are parallel + + u .assign (p2) .subtract (p1); + + const t = (u .dot (d1) - theta * u .dot (d2)) / (1 - theta * theta); + + point .assign (d1) .multiply (t) .add (p1); + + return true; + }; + })(), + toString () + { + return `${this .point}, ${this .direction}`; + }, +}); + +Object .assign (Line2, +{ + Points (point1, point2) + { + const line = Object .create (Line2 .prototype); + line .point = point1 .copy (); + line .direction = point2 .copy () .subtract (point1) .normalize (); + return line; + }, +}); + +const Line2_default_ = Line2; +; + +x_ite_Namespace .add ("Line2", "standard/Math/Geometry/Line2", Line2_default_); +/* harmony default export */ const Geometry_Line2 = (Line2_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/PointingDeviceSensor/PlaneSensor.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + + +const + screenLine = new Geometry_Line2 (Numbers_Vector2 .Zero, Numbers_Vector2 .Zero), + trackPoint1 = new Numbers_Vector2 (0, 0, 0), + trackPointLine = new Geometry_Line3 (Numbers_Vector3 .Zero, Numbers_Vector3 .Zero); + +function PlaneSensor (executionContext) +{ + PointingDeviceSensor_X3DDragSensorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .PlaneSensor); + + this ._offset .setUnit ("length"); + this ._minPosition .setUnit ("length"); + this ._maxPosition .setUnit ("length"); + this ._translation_changed .setUnit ("length"); +} + +Object .assign (Object .setPrototypeOf (PlaneSensor .prototype, PointingDeviceSensor_X3DDragSensorNode .prototype), +{ + initialize () + { + PointingDeviceSensor_X3DDragSensorNode .prototype .initialize .call (this); + + this .modelViewMatrix = new Numbers_Matrix4 (); + this .invModelViewMatrix = new Numbers_Matrix4 (); + this .projectionMatrix = new Numbers_Matrix4 (); + this .viewport = new Numbers_Vector4 (); + + this .planeSensor = true; + this .plane = null; + this .line = null; + this .startOffset = new Numbers_Vector3 (0, 0, 0); + this .startPoint = new Numbers_Vector3 (0, 0, 0); + }, + getLineTrackPoint (hit, line, trackPoint) + { + Geometry_ViewVolume .projectLine (line, this .modelViewMatrix, this .projectionMatrix, this .viewport, screenLine); + screenLine .getClosestPointToPoint (hit .pointer, trackPoint1); + Geometry_ViewVolume .unProjectRay (trackPoint1 .x, trackPoint1 .y, this .modelViewMatrix, this .projectionMatrix, this .viewport, trackPointLine); + + return line .getClosestPointToLine (trackPointLine, trackPoint); + }, + set_active__ (active, hit, modelViewMatrix, projectionMatrix, viewport) + { + PointingDeviceSensor_X3DDragSensorNode .prototype .set_active__ .call (this, active, hit, modelViewMatrix, projectionMatrix, viewport); + + if (this ._isActive .getValue ()) + { + this .modelViewMatrix .assign (modelViewMatrix); + this .projectionMatrix .assign (projectionMatrix); + this .viewport .assign (viewport); + this .invModelViewMatrix .assign (modelViewMatrix) .inverse (); + + const + hitRay = hit .hitRay .copy () .multLineMatrix (this .invModelViewMatrix), + hitPoint = this .invModelViewMatrix .multVecMatrix (hit .point .copy ()); + + const axisRotation = this ._axisRotation .getValue (); + + if (this ._minPosition .x === this ._maxPosition .x) + { + this .planeSensor = false; + + const direction = axisRotation .multVecRot (new Numbers_Vector3 (0, Math .abs (this ._maxPosition .y - this ._minPosition .y), 0)); + + this .line = new Geometry_Line3 (hitPoint, direction .normalize ()); + } + else if (this ._minPosition .y === this ._maxPosition .y) + { + this .planeSensor = false; + + const direction = axisRotation .multVecRot (new Numbers_Vector3 (Math .abs (this ._maxPosition .x - this ._minPosition .x), 0, 0)); + + this .line = new Geometry_Line3 (hitPoint, direction .normalize ()); + } + else + { + this .planeSensor = true; + this .plane = new Geometry_Plane3 (hitPoint, axisRotation .multVecRot (new Numbers_Vector3 (0, 0, 1))); + } + + if (this .planeSensor) + { + if (this .plane .intersectsLine (hitRay, this .startPoint)) + { + this .trackStart (this .startPoint); + } + +// new Plane3 (new Vector3 (0, 0, 0), this .plane .normal) .intersectsLine (hitRay, trackPoint); + } + else + { + if (this .getLineTrackPoint (hit, this .line, this .startPoint)) + { + const trackPoint = new Numbers_Vector3 (0, 0, 0); + + try + { + this .getLineTrackPoint (hit, new Geometry_Line3 (this .line .direction, this .line .direction), trackPoint); + } + catch + { + trackPoint .assign (this .startPoint); + } + + this .trackStart (trackPoint); + } + } + } + else + { + if (this ._autoOffset .getValue ()) + this ._offset = this ._translation_changed; + } + }, + trackStart (trackPoint) + { + this .startOffset .assign (this ._offset .getValue ()); + + this ._trackPoint_changed = trackPoint; + this ._translation_changed = this ._offset .getValue (); + }, + set_motion__ (hit) + { + try + { + if (this .planeSensor) + { + const + hitRay = hit .hitRay .copy () .multLineMatrix (this .invModelViewMatrix), + endPoint = new Numbers_Vector3 (0, 0, 0); + + if (this .plane .intersectsLine (hitRay, endPoint)) + { + this .track (endPoint, endPoint .copy ()); + } + else + throw new Error ("Plane and line are parallel."); + } + else + { + const + endPoint = new Numbers_Vector3 (0, 0, 0), + trackPoint = new Numbers_Vector3 (0, 0, 0); + + if (this .getLineTrackPoint (hit, this .line, endPoint)) + { + try + { + this .getLineTrackPoint (hit, new Geometry_Line3 (Numbers_Vector3 .Zero, this .line .direction), trackPoint); + } + catch + { + trackPoint .assign (endPoint); + } + + this .track (endPoint, trackPoint); + } + else + throw new Error ("Lines are parallel."); + } + } + catch + { + this ._trackPoint_changed .addEvent (); + this ._translation_changed .addEvent (); + } + }, + track (endPoint, trackPoint) + { + const + axisRotation = this ._axisRotation .getValue (), + translation = axisRotation .copy () .inverse () .multVecRot (endPoint .add (this .startOffset) .subtract (this .startPoint)); + + // X component + + if (! (this ._minPosition .x > this ._maxPosition .x)) + translation .x = Math_Algorithm .clamp (translation .x, this ._minPosition .x, this ._maxPosition .x); + + // Y component + + if (! (this ._minPosition .y > this ._maxPosition .y)) + translation .y = Math_Algorithm .clamp (translation .y, this ._minPosition .y, this ._maxPosition .y); + + axisRotation .multVecRot (translation); + + if (! this ._trackPoint_changed .getValue () .equals (trackPoint)) + this ._trackPoint_changed = trackPoint; + + if (! this ._translation_changed .getValue () .equals (translation)) + this ._translation_changed = translation; + }, +}); + +Object .defineProperties (PlaneSensor, +{ + typeName: + { + value: "PlaneSensor", + enumerable: true, + }, + componentName: + { + value: "PointingDeviceSensor", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "axisRotation", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoOffset", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "offset", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "minPosition", new x_ite_Fields .SFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "maxPosition", new x_ite_Fields .SFVec2f (-1, -1)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "trackPoint_changed", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "translation_changed", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isOver", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + ]), + enumerable: true, + }, +}); + +const PlaneSensor_default_ = PlaneSensor; +; + +x_ite_Namespace .add ("PlaneSensor", "x_ite/Components/PointingDeviceSensor/PlaneSensor", PlaneSensor_default_); +/* harmony default export */ const PointingDeviceSensor_PlaneSensor = (PlaneSensor_default_); +;// CONCATENATED MODULE: ./src/standard/Math/Geometry/Sphere3.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function Sphere3 (radius, center) +{ + this .radius = radius; + this .center = center .copy (); +} + +Object .assign (Sphere3 .prototype, +{ + set (radius, center) + { + this .radius = radius; + this .center .assign (center); + }, + intersectsLine (line, enterPoint, exitPoint) + { + // https://github.com/Alexpux/Coin3D/blob/master/src/base/SbSphere.cpp + + const + { point, direction } = line, + { center, radius } = this; + + const + b = 2 * (point .dot (direction) - center .dot (direction)), + c = (point .x * point .x + point .y * point .y + point .z * point .z) + + (center .x * center .x + center .y * center .y + center .z * center .z) - + 2 * point .dot (center) - radius * radius; + + const core = b * b - 4 * c; + + if (core >= 0) + { + let + t1 = (-b + Math .sqrt (core)) / 2, + t2 = (-b - Math .sqrt (core)) / 2; + + if (t1 > t2) + { + const tmp = t1; + t1 = t2; + t2 = tmp; + } + + enterPoint .assign (direction) .multiply (t1) .add (point); + exitPoint .assign (direction) .multiply (t2) .add (point); + + return true; + } + else + { + return false; + } + }, + intersectsTriangle: (() => + { + const + AB = new Numbers_Vector3 (0, 0, 0), + AC = new Numbers_Vector3 (0, 0, 0), + BC = new Numbers_Vector3 (0, 0, 0), + CA = new Numbers_Vector3 (0, 0, 0), + Q1 = new Numbers_Vector3 (0, 0, 0), + Q2 = new Numbers_Vector3 (0, 0, 0), + Q3 = new Numbers_Vector3 (0, 0, 0); + + return function (A, B, C) + { + const + P = this .center, + r = this .radius; + + A .subtract (P); + B .subtract (P); + C .subtract (P); + + // Testing if sphere lies outside the triangle plane. + + AB .assign (B) .subtract (A); + AC .assign (C) .subtract (A); + + const + rr = r * r, + V = AB .cross (AC), + d = A .dot (V), + e = V .dot (V), + sep1 = d * d > rr * e; + + if (sep1) + return false; + + // Testing if sphere lies outside a triangle vertex. + const + aa = A .dot (A), + ab = A .dot (B), + ac = A .dot (C), + bb = B .dot (B), + bc = B .dot (C), + cc = C .dot (C), + sep2 = (aa > rr) && (ab > aa) && (ac > aa), + sep3 = (bb > rr) && (ab > bb) && (bc > bb), + sep4 = (cc > rr) && (ac > cc) && (bc > cc); + + if (sep2 || sep3 || sep4) + return false; + + // Testing if sphere lies outside a triangle edge. + + AB .assign (B) .subtract (A); + BC .assign (C) .subtract (B); + CA .assign (A) .subtract (C); + + const + d1 = ab - aa, + d2 = bc - bb, + d3 = ac - cc, + e1 = AB .dot (AB), + e2 = BC .dot (BC), + e3 = CA .dot (CA); + + Q1 .assign (A) .multiply (e1) .subtract (AB .multiply (d1)); + Q2 .assign (B) .multiply (e2) .subtract (BC .multiply (d2)); + Q3 .assign (C) .multiply (e3) .subtract (CA .multiply (d3)); + + const + QC = C .multiply (e1) .subtract (Q1), + QA = A .multiply (e2) .subtract (Q2), + QB = B .multiply (e3) .subtract (Q3), + sep5 = (Q1 .dot (Q1) > rr * e1 * e1) && (Q1 .dot (QC) > 0), + sep6 = (Q2 .dot (Q2) > rr * e2 * e2) && (Q2 .dot (QA) > 0), + sep7 = (Q3 .dot (Q3) > rr * e3 * e3) && (Q3 .dot (QB) > 0); + + if (sep5 || sep6 || sep7) + return false; + + return true; + }; + })(), + toString () + { + return `${this .radius} ${this .center}`; + }, +}); + +const Sphere3_default_ = Sphere3; +; + +x_ite_Namespace .add ("Sphere3", "standard/Math/Geometry/Sphere3", Sphere3_default_); +/* harmony default export */ const Geometry_Sphere3 = (Sphere3_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/PointingDeviceSensor/SphereSensor.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + +function SphereSensor (executionContext) +{ + PointingDeviceSensor_X3DDragSensorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .SphereSensor); +} + +Object .assign (Object .setPrototypeOf (SphereSensor .prototype, PointingDeviceSensor_X3DDragSensorNode .prototype), +{ + initialize () + { + PointingDeviceSensor_X3DDragSensorNode .prototype .initialize .call (this); + + this .modelViewMatrix = new Numbers_Matrix4 (); + this .invModelViewMatrix = new Numbers_Matrix4 (); + + this .sphere = null; + this .zPlane = null; + this .behind = false; + this .fromVector = new Numbers_Vector3 (0, 0, 0); + this .startPoint = new Numbers_Vector3 (0, 0, 0); + this .startOffset = new Numbers_Rotation4 (); + }, + getTrackPoint (hitRay, trackPoint, behind) + { + const exit = new Numbers_Vector3 (0, 0, 0); + + if (this .sphere .intersectsLine (hitRay, trackPoint, exit)) + { + if ((hitRay .point .distance (exit) < hitRay .point .distance (trackPoint)) - behind) + trackPoint .assign (exit); + + return true; + } + + return false; + }, + set_active__ (active, hit, modelViewMatrix, projectionMatrix, viewport) + { + PointingDeviceSensor_X3DDragSensorNode .prototype .set_active__ .call (this, active, hit, modelViewMatrix, projectionMatrix, viewport); + + if (this ._isActive .getValue ()) + { + this .modelViewMatrix .assign (modelViewMatrix); + this .invModelViewMatrix .assign (modelViewMatrix) .inverse (); + + const + hitPoint = this .invModelViewMatrix .multVecMatrix (hit .point .copy ()), + center = new Numbers_Vector3 (0, 0, 0); + + this .zPlane = new Geometry_Plane3 (center, this .invModelViewMatrix .multDirMatrix (new Numbers_Vector3 (0, 0, 1)) .normalize ()); // Screen aligned Z-plane + this .sphere = new Geometry_Sphere3 (hitPoint .magnitude (), center); + this .behind = this .zPlane .getDistanceToPoint (hitPoint) < 0; + + this .fromVector .assign (hitPoint); + this .startPoint .assign (hitPoint); + this .startOffset .assign (this ._offset .getValue ()); + + this ._trackPoint_changed = hitPoint; + this ._rotation_changed = this ._offset .getValue (); + } + else + { + if (this ._autoOffset .getValue ()) + this ._offset = this ._rotation_changed; + } + }, + set_motion__ (hit) + { + const + hitRay = hit .hitRay .copy () .multLineMatrix (this .invModelViewMatrix), + trackPoint = new Numbers_Vector3 (0, 0, 0); + + if (this .getTrackPoint (hitRay, trackPoint, this .behind)) + { + const zAxis = this .invModelViewMatrix .multDirMatrix (new Numbers_Vector3 (0, 0, 1)) .normalize (); // Camera direction + + this .zPlane = new Geometry_Plane3 (trackPoint, zAxis); // Screen aligned Z-plane + } + else + { + // Find trackPoint on the plane with sphere + + const tangentPoint = new Numbers_Vector3 (0, 0, 0); + + this .zPlane .intersectsLine (hitRay, tangentPoint); + + hitRay .set (tangentPoint, this .sphere .center .copy () .subtract (tangentPoint) .normalize ()); + + //console .log (hitRay .toString ()); + + this .getTrackPoint (hitRay, trackPoint, false); + + // Find trackPoint behind sphere + + const + triNormal = Geometry_Triangle3 .normal (this .sphere .center, trackPoint, this .startPoint, new Numbers_Vector3 (0, 0, 0)), + dirFromCenter = trackPoint .copy () .subtract (this .sphere .center) .normalize (), + normal = triNormal .copy () .cross (dirFromCenter) .normalize (); + + const point1 = trackPoint .copy () .subtract (normal .multiply (tangentPoint .copy () .subtract (trackPoint) .magnitude ())); + + hitRay .set (point1, this .sphere .center .copy () .subtract (point1) .normalize ()); + + this .getTrackPoint (hitRay, trackPoint, false); + } + + this ._trackPoint_changed = trackPoint; + + const + toVector = trackPoint .copy () .subtract (this .sphere .center), + rotation = new Numbers_Rotation4 (this .fromVector, toVector); + + if (this .behind) + rotation .inverse (); + + this ._rotation_changed = this .startOffset .copy () .multRight (rotation); + }, +}); + +Object .defineProperties (SphereSensor, +{ + typeName: + { + value: "SphereSensor", + enumerable: true, + }, + componentName: + { + value: "PointingDeviceSensor", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoOffset", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "offset", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "trackPoint_changed", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "rotation_changed", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isOver", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + ]), + enumerable: true, + }, +}); + +const SphereSensor_default_ = SphereSensor; +; + +x_ite_Namespace .add ("SphereSensor", "x_ite/Components/PointingDeviceSensor/SphereSensor", SphereSensor_default_); +/* harmony default export */ const PointingDeviceSensor_SphereSensor = (SphereSensor_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/PointingDeviceSensor.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +const PointingDeviceSensor_default_ = { + name: "PointingDeviceSensor", + concreteNodes: + [ + PointingDeviceSensor_CylinderSensor, + PointingDeviceSensor_PlaneSensor, + PointingDeviceSensor_SphereSensor, + PointingDeviceSensor_TouchSensor, + ], + abstractNodes: + [ + PointingDeviceSensor_X3DDragSensorNode, + PointingDeviceSensor_X3DPointingDeviceSensorNode, + PointingDeviceSensor_X3DTouchSensorNode, + ], +}; +; + +x_ite_Namespace .add ("PointingDeviceSensor", "x_ite/Components/PointingDeviceSensor", PointingDeviceSensor_default_); +/* harmony default export */ const PointingDeviceSensor = (PointingDeviceSensor_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/ClipPlane.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + +const ClipPlanes = Utility_ObjectCache (ClipPlaneContainer); + +function ClipPlaneContainer () +{ + this .plane = new Geometry_Plane3 (Numbers_Vector3 .Zero, Numbers_Vector3 .Zero); +} + +Object .assign (ClipPlaneContainer .prototype, +{ + isClipped (point) + { + return this .plane .getDistanceToPoint (point) < 0; + }, + set (clipPlane, modelViewMatrix) + { + const + plane = this .plane, + localPlane = clipPlane .plane; + + plane .normal .assign (localPlane); + plane .distanceFromOrigin = -localPlane .w; + + plane .multRight (modelViewMatrix); + }, + setShaderUniforms (gl, shaderObject) + { + const + plane = this .plane, + normal = plane .normal; + + gl .uniform4f (shaderObject .x3d_ClipPlane [shaderObject .numClipPlanes ++], normal .x, normal .y, normal .z, plane .distanceFromOrigin); + }, + dispose () + { + ClipPlanes .push (this); + }, +}); + +function ClipPlane (executionContext) +{ + Core_X3DChildNode .call (this, executionContext); + + this .addType (Base_X3DConstants .ClipPlane); + + this .enabled = false; + this .plane = new Numbers_Vector4 (0, 0, 0, 0); +} + +Object .assign (Object .setPrototypeOf (ClipPlane .prototype, Core_X3DChildNode .prototype), +{ + initialize () + { + Core_X3DChildNode .prototype .initialize .call (this); + + this ._enabled .addInterest ("set_enabled__", this); + this ._plane .addInterest ("set_enabled__", this); + + this .set_enabled__ (); + }, + set_enabled__ () + { + this .plane .assign (this ._plane .getValue ()); + + this .enabled = this ._enabled .getValue () && ! this .plane .equals (Numbers_Vector4 .Zero); + }, + push (renderObject) + { + if (this .enabled) + { + const clipPlaneContainer = ClipPlanes .pop (); + + clipPlaneContainer .set (this, renderObject .getModelViewMatrix () .get ()); + + renderObject .getLocalObjects () .push (clipPlaneContainer); + + ++ renderObject .getLocalObjectsCount () [0]; + } + }, + pop (renderObject) + { + if (this .enabled) + { + this .getBrowser () .getLocalObjects () .push (renderObject .getLocalObjects () .pop ()); + + -- renderObject .getLocalObjectsCount () [0]; + } + }, +}); + +Object .defineProperties (ClipPlane, +{ + typeName: + { + value: "ClipPlane", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "plane", new x_ite_Fields .SFVec4f (0, 1, 0, 0)), + ]), + enumerable: true, + }, +}); + +const ClipPlane_default_ = ClipPlane; +; + +x_ite_Namespace .add ("ClipPlane", "x_ite/Components/Rendering/ClipPlane", ClipPlane_default_); +/* harmony default export */ const Rendering_ClipPlane = (ClipPlane_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/X3DColorNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function X3DColorNode (executionContext) +{ + Rendering_X3DGeometricPropertyNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DColorNode); + + this .addChildObjects (Base_X3DConstants .outputOnly, "transparent", new x_ite_Fields .SFBool ()); +} + +Object .assign (Object .setPrototypeOf (X3DColorNode .prototype, Rendering_X3DGeometricPropertyNode .prototype), +{ + setTransparent (value) + { + if (value !== this ._transparent .getValue ()) + this ._transparent = value; + }, + isTransparent () + { + return this ._transparent .getValue (); + }, +}); + +Object .defineProperties (X3DColorNode, +{ + typeName: + { + value: "X3DColorNode", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, +}); + +const X3DColorNode_default_ = X3DColorNode; +; + +x_ite_Namespace .add ("X3DColorNode", "x_ite/Components/Rendering/X3DColorNode", X3DColorNode_default_); +/* harmony default export */ const Rendering_X3DColorNode = (X3DColorNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/Color.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function Color (executionContext) +{ + Rendering_X3DColorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Color); +} + +Object .assign (Object .setPrototypeOf (Color .prototype, Rendering_X3DColorNode .prototype), +{ + initialize () + { + Rendering_X3DColorNode .prototype .initialize .call (this); + + this ._color .addInterest ("set_color__", this); + + this .set_color__ (); + }, + set_color__ () + { + this .color = this ._color .getValue (); + this .length = this ._color .length; + }, + addColor (index, array) + { + if (index >= 0 && this .length) + { + const + color = this .color, + i = (index % this .length) * 3; + + return array .push (color [i], color [i + 1], color [i + 2], 1); + } + else + { + array .push (1, 1, 1, 1); + } + }, + addColors (array, min = this .length) + { + const length = this .length; + + if (length) + { + const color = this .color; + + for (let index = 0; index < min; ++ index) + { + const i = (index % length) * 3; + + array .push (color [i], color [i + 1], color [i + 2], 1); + } + } + else + { + for (let index = 0; index < min; ++ index) + array .push (1, 1, 1, 1); + } + + return array; + }, +}); + +Object .defineProperties (Color, +{ + typeName: + { + value: "Color", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, + containerField: + { + value: "color", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "color", new x_ite_Fields .MFColor ()), + ]), + enumerable: true, + }, +}); + +const Color_default_ = Color; +; + +x_ite_Namespace .add ("Color", "x_ite/Components/Rendering/Color", Color_default_); +/* harmony default export */ const Rendering_Color = (Color_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/ColorRGBA.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function ColorRGBA (executionContext) +{ + Rendering_X3DColorNode .call (this, executionContext); + + this .addType (Base_X3DConstants .ColorRGBA); + + this .setTransparent (true); +} + +Object .assign (Object .setPrototypeOf (ColorRGBA .prototype, Rendering_X3DColorNode .prototype), +{ + initialize () + { + Rendering_X3DColorNode .prototype .initialize .call (this); + + this ._color .addInterest ("set_color__", this); + + this .set_color__ (); + }, + set_color__ () + { + this .color = this ._color .getValue (); + this .length = this ._color .length; + }, + addColor (index, array) + { + if (index >= 0 && this .length) + { + const + color = this .color, + i = (index % this .length) * 4; + + return array .push (color [i], color [i + 1], color [i + 2], color [i + 3]); + } + else + { + array .push (1, 1, 1, 1); + } + }, + addColors (array, min = this .length) + { + const length = this .length; + + if (length) + { + const color = this .color; + + for (let index = 0; index < min; ++ index) + { + const i = (index % length) * 4; + + array .push (color [i], color [i + 1], color [i + 2], color [i + 3]); + } + } + else + { + for (let index = 0; index < min; ++ index) + array .push (1, 1, 1, 1); + } + + return array; + }, +}); + +Object .defineProperties (ColorRGBA, +{ + typeName: + { + value: "ColorRGBA", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, + containerField: + { + value: "color", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "color", new x_ite_Fields .MFColorRGBA ()), + ]), + enumerable: true, + }, +}); + +const ColorRGBA_default_ = ColorRGBA; +; + +x_ite_Namespace .add ("ColorRGBA", "x_ite/Components/Rendering/ColorRGBA", ColorRGBA_default_); +/* harmony default export */ const Rendering_ColorRGBA = (ColorRGBA_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/X3DCoordinateNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + +function X3DCoordinateNode (executionContext) +{ + Rendering_X3DGeometricPropertyNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DCoordinateNode); +} + +Object .assign (Object .setPrototypeOf (X3DCoordinateNode .prototype, Rendering_X3DGeometricPropertyNode .prototype), +{ + initialize () + { + Rendering_X3DGeometricPropertyNode .prototype .initialize .call (this); + + this ._point .addInterest ("set_point__", this); + + this .set_point__ (); + }, + set_point__ () + { + this .point = this ._point .getValue (); + this .length = this ._point .length; + }, + isEmpty () + { + return this .length === 0; + }, + getSize () + { + return this .length; + }, + set1Point (index, point) + { + this ._point [index] = point; + }, + get1Point (index, result) + { + if (index < this .length) + { + const point = this .point; + + index *= 3; + + return result .set (point [index], point [index + 1], point [index + 2]); + } + else + { + return result .set (0, 0, 0); + } + }, + addPoint (index, array) + { + if (index < this .length) + { + const point = this .point; + + index *= 3; + + array .push (point [index], point [index + 1], point [index + 2], 1); + } + else + { + array .push (0, 0, 0, 1); + } + }, + addPoints (array) + { + const + point = this .point, + length = this .length * 3; + + for (let index = 0; index < length; index += 3) + array .push (point [index], point [index + 1], point [index + 2], 1); + + return array; + }, + getNormal: (() => + { + const + point1 = new Numbers_Vector3 (0, 0, 0), + point2 = new Numbers_Vector3 (0, 0, 0), + point3 = new Numbers_Vector3 (0, 0, 0); + + return function (index1, index2, index3) + { + // The index[1,2,3] cannot be less than 0. + + const length = this .length; + + if (index1 < length && index2 < length && index3 < length) + { + return Geometry_Triangle3 .normal (this .get1Point (index1, point1), + this .get1Point (index2, point2), + this .get1Point (index3, point3), + new Numbers_Vector3 (0, 0, 0)); + } + + return new Numbers_Vector3 (0, 0, 0); + }; + })(), + getQuadNormal: (() => + { + const + point1 = new Numbers_Vector3 (0, 0, 0), + point2 = new Numbers_Vector3 (0, 0, 0), + point3 = new Numbers_Vector3 (0, 0, 0), + point4 = new Numbers_Vector3 (0, 0, 0); + + return function (index1, index2, index3, index4) + { + // The index[1,2,3,4] cannot be less than 0. + + const length = this .length; + + if (index1 < length && index2 < length && index3 < length && index4 < length) + { + return Geometry_Triangle3 .quadNormal (this .get1Point (index1, point1), + this .get1Point (index2, point2), + this .get1Point (index3, point3), + this .get1Point (index4, point4), + new Numbers_Vector3 (0, 0, 0)); + } + + return new Numbers_Vector3 (0, 0, 0); + }; + })(), +}); + +Object .defineProperties (X3DCoordinateNode, +{ + typeName: + { + value: "X3DCoordinateNode", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, +}); + +const X3DCoordinateNode_default_ = X3DCoordinateNode; +; + +x_ite_Namespace .add ("X3DCoordinateNode", "x_ite/Components/Rendering/X3DCoordinateNode", X3DCoordinateNode_default_); +/* harmony default export */ const Rendering_X3DCoordinateNode = (X3DCoordinateNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/Coordinate.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function Coordinate (executionContext) +{ + Rendering_X3DCoordinateNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Coordinate); + + this ._point .setUnit ("length"); +} + +Object .setPrototypeOf (Coordinate .prototype, Rendering_X3DCoordinateNode .prototype); + +Object .defineProperties (Coordinate, +{ + typeName: + { + value: "Coordinate", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, + containerField: + { + value: "coord", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "point", new x_ite_Fields .MFVec3f ()), + ]), + enumerable: true, + }, +}); + +const Coordinate_default_ = Coordinate; +; + +x_ite_Namespace .add ("Coordinate", "x_ite/Components/Rendering/Coordinate", Coordinate_default_); +/* harmony default export */ const Rendering_Coordinate = (Coordinate_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/X3DLineGeometryNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function X3DLineGeometryNode (executionContext) +{ + if (!this .getExecutionContext ()) + Rendering_X3DGeometryNode .call (this, executionContext); + + const + browser = this .getBrowser (), + gl = browser .getContext (); + + this .lineStipples = new Float32Array (); + this .lineStippleBuffer = gl .createBuffer (); + this .trianglesBuffer = gl .createBuffer (); + this .thickVertexArrayObject = new Rendering_VertexArray (gl); + + this .setGeometryType (1); + this .setPrimitiveMode (gl .LINES); + this .setSolid (false); +} + +Object .assign (Object .setPrototypeOf (X3DLineGeometryNode .prototype, Rendering_X3DGeometryNode .prototype), +{ + intersectsLine () + { + return false; + }, + intersectsBox () + { + return false; + }, + updateVertexArrays () + { + Rendering_X3DGeometryNode .prototype .updateVertexArrays .call (this); + + this .thickVertexArrayObject .update (); + }, + buildTexCoords () + { + // Line stipple support. + + if (this .lineStipples .length / 6 === this .getVertices () .length / 8) + return; + + const + gl = this .getBrowser () .getContext (), + numLines = this .getVertices () .length / 8; + + this .lineStipples = new Float32Array (numLines * 6); + + gl .bindBuffer (gl .ARRAY_BUFFER, this .lineStippleBuffer); + gl .bufferData (gl .ARRAY_BUFFER, this .lineStipples, gl .DYNAMIC_DRAW); + + gl .bindBuffer (gl .ARRAY_BUFFER, this .trianglesBuffer); + gl .bufferData (gl .ARRAY_BUFFER, new Float32Array (16 * 6 * numLines), gl .DYNAMIC_DRAW); + }, + updateLengthSoFar: (() => + { + const + modelViewProjectionMatrix = new Numbers_Matrix4 (), + point0 = new Numbers_Vector4 (0, 0, 0, 0), + point1 = new Numbers_Vector4 (0, 0, 0, 0), + projectedPoint0 = new Numbers_Vector2 (0, 0), + projectedPoint1 = new Numbers_Vector2 (0, 0); + + return function (gl, renderContext) + { + const + viewport = renderContext .renderObject .getViewVolume () .getViewport (), + projectionMatrix = renderContext .renderObject .getProjectionMatrix () .get (), + lineStipples = this .lineStipples, + vertices = this .getVertices () .getValue (), + numVertices = vertices .length; + + modelViewProjectionMatrix .assign (renderContext .modelViewMatrix) .multRight (projectionMatrix); + + let lengthSoFar = 0; + + for (let i = 0, l = 0; i < numVertices; i += 8, l += 6) + { + point0 .set (vertices [i], vertices [i + 1], vertices [i + 2], vertices [i + 3]); + point1 .set (vertices [i + 4], vertices [i + 5], vertices [i + 6], vertices [i + 7]); + + Geometry_ViewVolume .projectPointMatrix (point0, modelViewProjectionMatrix, viewport, projectedPoint0); + Geometry_ViewVolume .projectPointMatrix (point1, modelViewProjectionMatrix, viewport, projectedPoint1); + + lineStipples [l] = projectedPoint1 .x; + lineStipples [l + 1] = projectedPoint1 .y; + + lineStipples [l + 3] = projectedPoint0 .x; + lineStipples [l + 4] = projectedPoint0 .y; + lineStipples [l + 5] = lengthSoFar; + + lengthSoFar += projectedPoint1 .subtract (projectedPoint0) .magnitude (); + } + + gl .bindBuffer (gl .ARRAY_BUFFER, this .lineStippleBuffer); + gl .bufferData (gl .ARRAY_BUFFER, lineStipples, gl .DYNAMIC_DRAW); + }; + })(), + displaySimple (gl, renderContext, shaderNode) + { + const linePropertiesNode = renderContext .shapeNode .getAppearance () .getStyleProperties (1); + + if (linePropertiesNode) + { + if (linePropertiesNode .getTransformLines ()) + { + // Setup vertex attributes. + + if (this .thickVertexArrayObject .enable (shaderNode)) + { + const + stride = 16 * Float32Array .BYTES_PER_ELEMENT, + coordIndexOffset = 0, + lineStippleOffset = 1 * Float32Array .BYTES_PER_ELEMENT, + normalOffset = 9 * Float32Array .BYTES_PER_ELEMENT, + vertexOffset = 12 * Float32Array .BYTES_PER_ELEMENT; + + shaderNode .enableCoordIndexAttribute (gl, this .trianglesBuffer, stride, coordIndexOffset); + shaderNode .enableLineStippleAttribute (gl, this .trianglesBuffer, stride, lineStippleOffset); + + if (this .hasNormals) + shaderNode .enableNormalAttribute (gl, this .trianglesBuffer, stride, normalOffset); + + shaderNode .enableVertexAttribute (gl, this .trianglesBuffer, stride, vertexOffset); + + gl .bindBuffer (gl .ARRAY_BUFFER, null); + } + + gl .frontFace (gl .CCW); + gl .enable (gl .CULL_FACE); + gl .drawArrays (gl .TRIANGLES, 0, this .vertexCount * 3); + + return; + } + } + + if (this .vertexArrayObject .enable (shaderNode)) + { + if (this .coordIndices .length) + shaderNode .enableCoordIndexAttribute (gl, this .coordIndexBuffer, 0, 0); + + shaderNode .enableLineStippleAttribute (gl, this .lineStippleBuffer, 0, 0); + + if (this .hasNormals) + shaderNode .enableNormalAttribute (gl, this .normalBuffer, 0, 0); + + shaderNode .enableVertexAttribute (gl, this .vertexBuffer, 0, 0); + } + + gl .drawArrays (this .primitiveMode, 0, this .vertexCount); + gl .lineWidth (1); + }, + display: (() => + { + const + matrix = new Numbers_Matrix4 (), + modelViewProjectionMatrixArray = new Float32Array (16), + invModelViewProjectionMatrixArray = new Float32Array (16); + + return function (gl, renderContext) + { + const + browser = this .getBrowser (), + appearanceNode = renderContext .appearanceNode, + linePropertiesNode = appearanceNode .getLineProperties (), + shaderNode = appearanceNode .getShader (this, renderContext), + blendModeNode = appearanceNode .getBlendMode (), + attribNodes = this .getAttrib (), + attribBuffers = this .getAttribBuffers (); + + if (linePropertiesNode) + { + if (linePropertiesNode .getApplied () && linePropertiesNode .getLinetype () !== 1) + this .updateLengthSoFar (gl, renderContext); + + if (linePropertiesNode .getTransformLines ()) + { + const + renderObject = renderContext .renderObject, + viewport = renderObject .getViewVolume () .getViewport (), + projectionMatrix = renderObject .getProjectionMatrix () .get (), + primitiveMode = browser .getWireframe () ? gl .TRIANGLES : browser .getPrimitiveMode (gl .TRIANGLES), + transformShaderNode = browser .getLineTransformShader (); + + modelViewProjectionMatrixArray .set (matrix .assign (renderContext .modelViewMatrix) .multRight (projectionMatrix)); + invModelViewProjectionMatrixArray .set (matrix .inverse ()); + + // Start + + transformShaderNode .enable (gl); + + gl .uniform4f (transformShaderNode .viewport, viewport .x, viewport .y, viewport .z, viewport .w); + gl .uniformMatrix4fv (transformShaderNode .modelViewProjectionMatrix, false, modelViewProjectionMatrixArray); + gl .uniformMatrix4fv (transformShaderNode .invModelViewProjectionMatrix, false, invModelViewProjectionMatrixArray); + gl .uniform1f (transformShaderNode .scale, linePropertiesNode .getLinewidthScaleFactor () / 2); + + // Setup vertex attributes. + + if (this .thickVertexArrayObject .enable (transformShaderNode)) + { + const + coordIndexStride = 2 * Float32Array .BYTES_PER_ELEMENT, + coordIndexOffset0 = 0, + coordIndexOffset1 = 1 * Float32Array .BYTES_PER_ELEMENT, + lineStippleStride = 6 * Float32Array .BYTES_PER_ELEMENT, + lineStippleOffset0 = 0, + lineStippleOffset1 = 3 * Float32Array .BYTES_PER_ELEMENT, + fogDepthStride = 2 * Float32Array .BYTES_PER_ELEMENT, + fogDepthOffset0 = 0, + fogDepthOffset1 = 1 * Float32Array .BYTES_PER_ELEMENT, + colorStride = 8 * Float32Array .BYTES_PER_ELEMENT, + colorOffset0 = 0, + colorOffset1 = 4 * Float32Array .BYTES_PER_ELEMENT, + normalStride = 6 * Float32Array .BYTES_PER_ELEMENT, + normalOffset0 = 0, + normalOffset1 = 3 * Float32Array .BYTES_PER_ELEMENT, + vertexStride = 8 * Float32Array .BYTES_PER_ELEMENT, + vertexOffset0 = 0, + vertexOffset1 = 4 * Float32Array .BYTES_PER_ELEMENT; + + // for (let i = 0, length = attribNodes .length; i < length; ++ i) + // attribNodes [i] .enable (gl, shaderNode, attribBuffers [i]); + + if (this .coordIndices .length) + { + transformShaderNode .enableFloatAttrib (gl, "x3d_CoordIndex0", this .coordIndexBuffer, 1, coordIndexStride, coordIndexOffset0); + transformShaderNode .enableFloatAttrib (gl, "x3d_CoordIndex1", this .coordIndexBuffer, 1, coordIndexStride, coordIndexOffset1); + } + + transformShaderNode .enableFloatAttrib (gl, "x3d_LineStipple0", this .lineStippleBuffer, 3, lineStippleStride, lineStippleOffset0); + transformShaderNode .enableFloatAttrib (gl, "x3d_LineStipple1", this .lineStippleBuffer, 3, lineStippleStride, lineStippleOffset1); + + if (this .hasFogCoords) + { + transformShaderNode .enableFloatAttrib (gl, "x3d_FogDepth0", this .fogDepthBuffer, 1, fogDepthStride, fogDepthOffset0); + transformShaderNode .enableFloatAttrib (gl, "x3d_FogDepth1", this .fogDepthBuffer, 1, fogDepthStride, fogDepthOffset1); + } + + if (this .colorMaterial) + { + transformShaderNode .enableFloatAttrib (gl, "x3d_Color0", this .colorBuffer, 4, colorStride, colorOffset0); + transformShaderNode .enableFloatAttrib (gl, "x3d_Color1", this .colorBuffer, 4, colorStride, colorOffset1); + } + + if (this .hasNormals) + { + transformShaderNode .enableFloatAttrib (gl, "x3d_Normal0", this .normalBuffer, 3, normalStride, normalOffset0); + transformShaderNode .enableFloatAttrib (gl, "x3d_Normal1", this .normalBuffer, 3, normalStride, normalOffset1); + } + + transformShaderNode .enableFloatAttrib (gl, "x3d_Vertex0", this .vertexBuffer, 4, vertexStride, vertexOffset0); + transformShaderNode .enableFloatAttrib (gl, "x3d_Vertex1", this .vertexBuffer, 4, vertexStride, vertexOffset1); + } + + // Transform lines. + + gl .bindTransformFeedback (gl .TRANSFORM_FEEDBACK, browser .getLineTransformFeedback ()); + gl .bindBufferBase (gl .TRANSFORM_FEEDBACK_BUFFER, 0, this .trianglesBuffer); + gl .enable (gl .RASTERIZER_DISCARD); + gl .beginTransformFeedback (gl .POINTS); + gl .drawArraysInstanced (gl .POINTS, 0, this .vertexCount / 2, 2); + gl .endTransformFeedback (); + gl .disable (gl .RASTERIZER_DISCARD); + gl .bindTransformFeedback (gl .TRANSFORM_FEEDBACK, null); + + // DEBUG + + // const data = new Float32Array (16 * 6 * this .vertexCount / 2); + // gl .bindBuffer (gl .ARRAY_BUFFER, this .trianglesBuffer); + // gl .getBufferSubData (gl .ARRAY_BUFFER, 0, data); + // console .log (data); + + // Render triangles. + + blendModeNode ?.enable (gl); + + // Setup shader. + + shaderNode .enable (gl); + shaderNode .setUniforms (gl, this, renderContext); + + // Setup vertex attributes. + + if (this .thickVertexArrayObject .enable (shaderNode)) + { + const + stride = 16 * Float32Array .BYTES_PER_ELEMENT, + coordIndexOffset = 0, + lineStippleOffset = 1 * Float32Array .BYTES_PER_ELEMENT, + fogCoordOffset = 4 * Float32Array .BYTES_PER_ELEMENT, + colorOffset = 5 * Float32Array .BYTES_PER_ELEMENT, + normalOffset = 9 * Float32Array .BYTES_PER_ELEMENT, + vertexOffset = 12 * Float32Array .BYTES_PER_ELEMENT; + + // for (let i = 0, length = attribNodes .length; i < length; ++ i) + // attribNodes [i] .enable (gl, shaderNode, attribBuffers [i]); + + shaderNode .enableCoordIndexAttribute (gl, this .trianglesBuffer, stride, coordIndexOffset); + shaderNode .enableLineStippleAttribute (gl, this .trianglesBuffer, stride, lineStippleOffset); + + if (this .hasFogCoords) + shaderNode .enableFogDepthAttribute (gl, this .trianglesBuffer, stride, fogCoordOffset); + + if (this .colorMaterial) + shaderNode .enableColorAttribute (gl, this .trianglesBuffer, stride, colorOffset); + + if (this .hasNormals) + shaderNode .enableNormalAttribute (gl, this .trianglesBuffer, stride, normalOffset); + + shaderNode .enableVertexAttribute (gl, this .trianglesBuffer, stride, vertexOffset); + + gl .bindBuffer (gl .ARRAY_BUFFER, null); + } + + gl .frontFace (gl .CCW); + gl .enable (gl .CULL_FACE); + gl .drawArrays (primitiveMode, 0, this .vertexCount * 3); + + blendModeNode ?.disable (gl); + + return; + } + } + + const primitiveMode = browser .getPrimitiveMode (this .getPrimitiveMode ()); + + blendModeNode ?.enable (gl); + + // Setup shader. + + shaderNode .enable (gl); + shaderNode .setUniforms (gl, this, renderContext); + + // Setup vertex attributes. + + if (this .vertexArrayObject .enable (shaderNode)) + { + if (this .coordIndices .length) + shaderNode .enableCoordIndexAttribute (gl, this .coordIndexBuffer, 0, 0); + + for (let i = 0, length = attribNodes .length; i < length; ++ i) + attribNodes [i] .enable (gl, shaderNode, attribBuffers [i]); + + shaderNode .enableLineStippleAttribute (gl, this .lineStippleBuffer, 0, 0); + + if (this .hasFogCoords) + shaderNode .enableFogDepthAttribute (gl, this .fogDepthBuffer, 0, 0); + + if (this .colorMaterial) + shaderNode .enableColorAttribute (gl, this .colorBuffer, 0, 0); + + if (this .hasNormals) + shaderNode .enableNormalAttribute (gl, this .normalBuffer, 0, 0); + + shaderNode .enableVertexAttribute (gl, this .vertexBuffer, 0, 0); + } + + gl .drawArrays (primitiveMode, 0, this .vertexCount); + + blendModeNode ?.disable (gl); + + gl .lineWidth (1); + }; + })(), + displayParticles (gl, renderContext, particleSystem) + { + const + browser = this .getBrowser (), + appearanceNode = renderContext .appearanceNode, + shaderNode = appearanceNode .getShader (this, renderContext), + blendModeNode = appearanceNode .getBlendMode (), + attribNodes = this .getAttrib (), + attribBuffers = this .getAttribBuffers (), + primitiveMode = browser .getPrimitiveMode (this .getPrimitiveMode ()); + + blendModeNode ?.enable (gl); + + // Setup shader. + + shaderNode .enable (gl); + shaderNode .setUniforms (gl, this, renderContext); + + // Setup vertex attributes. + + const outputParticles = particleSystem .outputParticles; + + if (outputParticles .vertexArrayObject .update (this .updateParticles) .enable (shaderNode)) + { + const particleStride = particleSystem .particleStride; + + shaderNode .enableParticleAttribute (gl, outputParticles, particleStride, particleSystem .particleOffset, 1); + shaderNode .enableParticleMatrixAttribute (gl, outputParticles, particleStride, particleSystem .matrixOffset, 1); + + for (let i = 0, length = attribNodes .length; i < length; ++ i) + attribNodes [i] .enable (gl, shaderNode, attribBuffers [i]); + + if (this .hasFogCoords) + shaderNode .enableFogDepthAttribute (gl, this .fogDepthBuffer, 0, 0); + + if (this .colorMaterial) + shaderNode .enableColorAttribute (gl, this .colorBuffer, 0, 0); + + if (this .hasNormals) + shaderNode .enableNormalAttribute (gl, this .normalBuffer, 0, 0); + + shaderNode .enableVertexAttribute (gl, this .vertexBuffer, 0, 0); + + this .updateParticles = false; + } + + // Wireframes are always solid so only one drawing call is needed. + + gl .drawArraysInstanced (primitiveMode, 0, this .vertexCount, particleSystem .numParticles); + + blendModeNode ?.disable (gl); + + gl .lineWidth (1); + }, +}); + +Object .defineProperties (X3DLineGeometryNode, +{ + typeName: + { + value: "X3DLineGeometryNode", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, +}); + +const X3DLineGeometryNode_default_ = X3DLineGeometryNode; +; + +x_ite_Namespace .add ("X3DLineGeometryNode", "x_ite/Components/Rendering/X3DLineGeometryNode", X3DLineGeometryNode_default_); +/* harmony default export */ const Rendering_X3DLineGeometryNode = (X3DLineGeometryNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/IndexedLineSet.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function IndexedLineSet (executionContext) +{ + Rendering_X3DLineGeometryNode .call (this, executionContext); + + this .addType (Base_X3DConstants .IndexedLineSet); + + this .fogCoordNode = null; + this .colorNode = null; + this .normalNode = null; + this .coordNode = null; +} + +Object .assign (Object .setPrototypeOf (IndexedLineSet .prototype, Rendering_X3DLineGeometryNode .prototype), +{ + initialize () + { + Rendering_X3DLineGeometryNode .prototype .initialize .call (this); + + this ._set_colorIndex .addFieldInterest (this ._colorIndex); + this ._set_coordIndex .addFieldInterest (this ._coordIndex); + this ._attrib .addInterest ("set_attrib__", this); + this ._fogCoord .addInterest ("set_fogCoord__", this); + this ._color .addInterest ("set_color__", this); + this ._normal .addInterest ("set_normal__", this); + this ._coord .addInterest ("set_coord__", this); + + this .set_attrib__ (); + this .set_fogCoord__ (); + this .set_color__ (); + this .set_normal__ (); + this .set_coord__ (); + }, + set_attrib__ () + { + const attribNodes = this .getAttrib (); + + for (const attribNode of attribNodes) + { + attribNode .removeInterest ("requestRebuild", this); + attribNode ._attribute_changed .removeInterest ("updateVertexArrays", this); + } + + attribNodes .length = 0; + + for (const node of this ._attrib) + { + const attribNode = Base_X3DCast (Base_X3DConstants .X3DVertexAttributeNode, node); + + if (attribNode) + attribNodes .push (attribNode); + } + + for (const attribNode of attribNodes) + { + attribNode .addInterest ("requestRebuild", this); + attribNode ._attribute_changed .addInterest ("updateVertexArrays", this); + } + + this .updateVertexArrays (); + }, + set_fogCoord__ () + { + this .fogCoordNode ?.removeInterest ("requestRebuild", this); + + this .fogCoordNode = Base_X3DCast (Base_X3DConstants .FogCoordinate, this ._fogCoord); + + this .fogCoordNode ?.addInterest ("requestRebuild", this); + }, + set_color__ () + { + this .colorNode ?.removeInterest ("requestRebuild", this); + + this .colorNode = Base_X3DCast (Base_X3DConstants .X3DColorNode, this ._color); + + this .colorNode ?.addInterest ("requestRebuild", this); + + this .setTransparent (this .colorNode ?.isTransparent () ?? false); + }, + set_normal__ () + { + this .normalNode ?.removeInterest ("requestRebuild", this); + + this .normalNode = Base_X3DCast (Base_X3DConstants .X3DNormalNode, this ._normal); + + this .normalNode ?.addInterest ("requestRebuild", this); + }, + set_coord__ () + { + this .coordNode ?.removeInterest ("requestRebuild", this); + + this .coordNode = Base_X3DCast (Base_X3DConstants .X3DCoordinateNode, this ._coord); + + this .coordNode ?.addInterest ("requestRebuild", this); + }, + getColorPerVertexIndex (index) + { + if (index < this ._colorIndex .length) + return this ._colorIndex [index]; + + return this ._coordIndex [index]; + }, + getColorIndex (index) + { + if (index < this ._colorIndex .length) + return this ._colorIndex [index]; + + return index; + }, + getPolylineIndices () + { + const + coordIndex = this ._coordIndex, + polylines = [ ]; + + let polyline = [ ]; + + if (coordIndex .length) + { + for (let i = 0, length = coordIndex .length; i < length; ++ i) + { + const index = coordIndex [i]; + + if (index >= 0) + // Add vertex. + polyline .push (i); + + else + { + // Negativ index. + // Add polylines. + polylines .push (polyline); + + polyline = [ ]; + } + } + + if (coordIndex [coordIndex .length - 1] >= 0) + { + polylines .push (polyline); + } + } + + return polylines; + }, + build () + { + if (! this .coordNode || this .coordNode .isEmpty ()) + return; + + const + coordIndex = this ._coordIndex, + polylines = this .getPolylineIndices (), + colorPerVertex = this ._colorPerVertex .getValue (), + coordIndicesArray = this .getCoordIndices (), + attribNodes = this .getAttrib (), + numAttribNodes = attribNodes .length, + attribArrays = this .getAttribs (), + fogCoordNode = this .fogCoordNode, + colorNode = this .colorNode, + coordNode = this .coordNode, + normalNode = this .normalNode, + fogDepthArray = this .getFogDepths (), + colorArray = this .getColors (), + normalArray = this .getNormals (), + vertexArray = this .getVertices (); + + // Fill GeometryNode + + let face = 0; + + for (const polyline of polylines) + { + // Create two vertices for each line. + + if (polyline .length > 1) + { + for (let line = 0, l_end = polyline .length - 1; line < l_end; ++ line) + { + for (let l = line, i_end = line + 2; l < i_end; ++ l) + { + const + i = polyline [l], + index = coordIndex [i]; + + coordIndicesArray .push (index); + + for (let a = 0; a < numAttribNodes; ++ a) + attribNodes [a] .addValue (index, attribArrays [a]); + + fogCoordNode ?.addDepth (index, fogDepthArray); + + if (colorNode) + { + if (colorPerVertex) + colorNode .addColor (this .getColorPerVertexIndex (i), colorArray); + else + colorNode .addColor (this .getColorIndex (face), colorArray); + } + + normalNode ?.addVector (index, normalArray); + + coordNode .addPoint (index, vertexArray); + } + } + } + + ++ face; + } + }, +}); + +Object .defineProperties (IndexedLineSet, +{ + typeName: + { + value: "IndexedLineSet", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, + containerField: + { + value: "geometry", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_colorIndex", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_coordIndex", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "colorPerVertex", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "colorIndex", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "coordIndex", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "attrib", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "fogCoord", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "color", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normal", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "coord", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +const IndexedLineSet_default_ = IndexedLineSet; +; + +x_ite_Namespace .add ("IndexedLineSet", "x_ite/Components/Rendering/IndexedLineSet", IndexedLineSet_default_); +/* harmony default export */ const Rendering_IndexedLineSet = (IndexedLineSet_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/IndexedTriangleFanSet.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function IndexedTriangleFanSet (executionContext) +{ + Rendering_X3DComposedGeometryNode .call (this, executionContext); + + this .addType (Base_X3DConstants .IndexedTriangleFanSet); + + this .triangleIndex = [ ]; +} + +Object .assign (Object .setPrototypeOf (IndexedTriangleFanSet .prototype, Rendering_X3DComposedGeometryNode .prototype), +{ + initialize () + { + Rendering_X3DComposedGeometryNode .prototype .initialize .call (this); + + this ._set_index .addFieldInterest (this ._index); + this ._index .addInterest ("set_index__", this); + + this .set_index__ (); + }, + set_index__ () + { + // Build coordIndex + + const + index = this ._index, + triangleIndex = this .triangleIndex; + + triangleIndex .length = 0; + + for (let i = 0, length = index .length; i < length; ++ i) + { + const first = index [i]; + + if (first < 0) + continue; + + if (++ i < length) + { + let second = index [i]; + + if (second < 0) + continue; + + for (++ i; i < length; ++ i) + { + const third = index [i]; + + if (third < 0) + break; + + triangleIndex .push (first, second, third); + + second = third; + } + } + } + }, + getPolygonIndex (index) + { + return this .triangleIndex [index]; + }, + build () + { + Rendering_X3DComposedGeometryNode .prototype .build .call (this, 3, this .triangleIndex .length, 3, this .triangleIndex .length); + }, +}); + +Object .defineProperties (IndexedTriangleFanSet, +{ + typeName: + { + value: "IndexedTriangleFanSet", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, + containerField: + { + value: "geometry", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_index", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "solid", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "ccw", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "colorPerVertex", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "normalPerVertex", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "index", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "attrib", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "fogCoord", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "color", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "texCoord", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normal", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "coord", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +const IndexedTriangleFanSet_default_ = IndexedTriangleFanSet; +; + +x_ite_Namespace .add ("IndexedTriangleFanSet", "x_ite/Components/Rendering/IndexedTriangleFanSet", IndexedTriangleFanSet_default_); +/* harmony default export */ const Rendering_IndexedTriangleFanSet = (IndexedTriangleFanSet_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/IndexedTriangleSet.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function IndexedTriangleSet (executionContext) +{ + Rendering_X3DComposedGeometryNode .call (this, executionContext); + + this .addType (Base_X3DConstants .IndexedTriangleSet); +} + +Object .assign (Object .setPrototypeOf (IndexedTriangleSet .prototype, Rendering_X3DComposedGeometryNode .prototype), +{ + getPolygonIndex (i) + { + return this ._index [i]; + }, + initialize () + { + Rendering_X3DComposedGeometryNode .prototype .initialize .call (this); + + this ._set_index .addFieldInterest (this ._index); + }, + build () + { + Rendering_X3DComposedGeometryNode .prototype .build .call (this, 3, this ._index .length, 3, this ._index .length); + }, +}); + +Object .defineProperties (IndexedTriangleSet, +{ + typeName: + { + value: "IndexedTriangleSet", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, + containerField: + { + value: "geometry", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_index", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "solid", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "ccw", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "colorPerVertex", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "normalPerVertex", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "index", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "attrib", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "fogCoord", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "color", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "texCoord", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normal", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "coord", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +const IndexedTriangleSet_default_ = IndexedTriangleSet; +; + +x_ite_Namespace .add ("IndexedTriangleSet", "x_ite/Components/Rendering/IndexedTriangleSet", IndexedTriangleSet_default_); +/* harmony default export */ const Rendering_IndexedTriangleSet = (IndexedTriangleSet_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/IndexedTriangleStripSet.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function IndexedTriangleStripSet (executionContext) +{ + Rendering_X3DComposedGeometryNode .call (this, executionContext); + + this .addType (Base_X3DConstants .IndexedTriangleStripSet); + + this .triangleIndex = [ ]; +} + +Object .assign (Object .setPrototypeOf (IndexedTriangleStripSet .prototype, Rendering_X3DComposedGeometryNode .prototype), +{ + initialize () + { + Rendering_X3DComposedGeometryNode .prototype .initialize .call (this); + + this ._set_index .addFieldInterest (this ._index); + this ._index .addInterest ("set_index__", this); + + this .set_index__ (); + }, + set_index__ () + { + // Build coordIndex + + const + index = this ._index, + triangleIndex = this .triangleIndex; + + triangleIndex .length = 0; + + // Build coordIndex + + for (let i = 0, length = index .length; i < length; ++ i) + { + let first = index [i]; + + if (first < 0) + continue; + + if (++ i < length) + { + let second = index [i]; + + if (second < 0) + continue; + + ++ i; + + for (let face = 0; i < length; ++ i, ++ face) + { + const third = index [i]; + + if (third < 0) + break; + + triangleIndex .push (first, second, third); + + if (face & 1) + second = third; + + else + first = third; + } + } + } + }, + getPolygonIndex (index) + { + return this .triangleIndex [index]; + }, + build () + { + Rendering_X3DComposedGeometryNode .prototype .build .call (this, 3, this .triangleIndex .length, 3, this .triangleIndex .length); + }, +}); + +Object .defineProperties (IndexedTriangleStripSet, +{ + typeName: + { + value: "IndexedTriangleStripSet", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, + containerField: + { + value: "geometry", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "set_index", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "solid", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "ccw", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "colorPerVertex", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "normalPerVertex", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "index", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "attrib", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "fogCoord", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "color", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "texCoord", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normal", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "coord", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +const IndexedTriangleStripSet_default_ = IndexedTriangleStripSet; +; + +x_ite_Namespace .add ("IndexedTriangleStripSet", "x_ite/Components/Rendering/IndexedTriangleStripSet", IndexedTriangleStripSet_default_); +/* harmony default export */ const Rendering_IndexedTriangleStripSet = (IndexedTriangleStripSet_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/LineSet.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function LineSet (executionContext) +{ + Rendering_X3DLineGeometryNode .call (this, executionContext); + + this .addType (Base_X3DConstants .LineSet); + + this .fogCoordNode = null; + this .colorNode = null; + this .normalNode = null; + this .coordNode = null; +} + +Object .assign (Object .setPrototypeOf (LineSet .prototype, Rendering_X3DLineGeometryNode .prototype), +{ + initialize () + { + Rendering_X3DLineGeometryNode .prototype .initialize .call (this); + + this ._attrib .addInterest ("set_attrib__", this); + this ._fogCoord .addInterest ("set_fogCoord__", this); + this ._color .addInterest ("set_color__", this); + this ._normal .addInterest ("set_normal__", this); + this ._coord .addInterest ("set_coord__", this); + + this .set_attrib__ (); + this .set_fogCoord__ (); + this .set_color__ (); + this .set_normal__ (); + this .set_coord__ (); + }, + set_attrib__ () + { + const attribNodes = this .getAttrib (); + + for (const attribNode of attribNodes) + { + attribNode .removeInterest ("requestRebuild", this); + attribNode ._attribute_changed .removeInterest ("updateVertexArrays", this); + } + + attribNodes .length = 0; + + for (const node of this ._attrib) + { + const attribNode = Base_X3DCast (Base_X3DConstants .X3DVertexAttributeNode, node); + + if (attribNode) + attribNodes .push (attribNode); + } + + for (const attribNode of attribNodes) + { + attribNode .addInterest ("requestRebuild", this); + attribNode ._attribute_changed .addInterest ("updateVertexArrays", this); + } + + this .updateVertexArrays (); + }, + set_fogCoord__ () + { + this .fogCoordNode ?.removeInterest ("requestRebuild", this); + + this .fogCoordNode = Base_X3DCast (Base_X3DConstants .FogCoordinate, this ._fogCoord); + + this .fogCoordNode ?.addInterest ("requestRebuild", this); + }, + set_color__ () + { + this .colorNode ?.removeInterest ("requestRebuild", this); + + this .colorNode = Base_X3DCast (Base_X3DConstants .X3DColorNode, this ._color); + + this .colorNode ?.addInterest ("requestRebuild", this); + + this .setTransparent (this .colorNode ?.isTransparent () ?? false); + }, + set_normal__ () + { + this .normalNode ?.removeInterest ("requestRebuild", this); + + this .normalNode = Base_X3DCast (Base_X3DConstants .X3DNormalNode, this ._normal); + + this .normalNode ?.addInterest ("requestRebuild", this); + }, + set_coord__ () + { + this .coordNode ?.removeInterest ("requestRebuild", this); + + this .coordNode = Base_X3DCast (Base_X3DConstants .X3DCoordinateNode, this ._coord); + + this .coordNode ?.addInterest ("requestRebuild", this); + }, + build () + { + if (! this .coordNode || this .coordNode .isEmpty ()) + return; + + // Fill GeometryNode + + const + vertexCount = this ._vertexCount, + coordIndicesArray = this .getCoordIndices (), + attribNodes = this .getAttrib (), + numAttribNodes = attribNodes .length, + attribArrays = this .getAttribs (), + fogCoordNode = this .fogCoordNode, + colorNode = this .colorNode, + normalNode = this .normalNode, + coordNode = this .coordNode, + fogDepthArray = this .getFogDepths (), + colorArray = this .getColors (), + normalArray = this .getNormals (), + vertexArray = this .getVertices (), + size = coordNode .getSize (); + + let index = 0; + + for (let count of vertexCount) + { + if (index + count > size) + break; + + if (count > 1) + { + count = 2 * count - 2; // numVertices for line lines trip + + for (let i = 0; i < count; ++ i, index += i & 1) + { + coordIndicesArray .push (index); + + for (let a = 0; a < numAttribNodes; ++ a) + attribNodes [a] .addValue (index, attribArrays [a]); + + fogCoordNode ?.addDepth (index, fogDepthArray); + colorNode ?.addColor (index, colorArray); + normalNode ?.addVector (index, normalArray); + + coordNode .addPoint (index, vertexArray); + } + + ++ index; + } + else + index += count; + } + }, +}); + +Object .defineProperties (LineSet, +{ + typeName: + { + value: "LineSet", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, + containerField: + { + value: "geometry", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "vertexCount", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "attrib", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "fogCoord", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "color", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normal", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "coord", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +const LineSet_default_ = LineSet; +; + +x_ite_Namespace .add ("LineSet", "x_ite/Components/Rendering/LineSet", LineSet_default_); +/* harmony default export */ const Rendering_LineSet = (LineSet_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/X3DNormalNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function X3DNormalNode (executionContext) +{ + Rendering_X3DGeometricPropertyNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DNormalNode); +} + +Object .setPrototypeOf (X3DNormalNode .prototype, Rendering_X3DGeometricPropertyNode .prototype); + +Object .defineProperties (X3DNormalNode, +{ + typeName: + { + value: "X3DNormalNode", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, +}); + +const X3DNormalNode_default_ = X3DNormalNode; +; + +x_ite_Namespace .add ("X3DNormalNode", "x_ite/Components/Rendering/X3DNormalNode", X3DNormalNode_default_); +/* harmony default export */ const Rendering_X3DNormalNode = (X3DNormalNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/Normal.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function Normal (executionContext) +{ + Rendering_X3DNormalNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Normal); +} + +Object .assign (Object .setPrototypeOf (Normal .prototype, Rendering_X3DNormalNode .prototype), +{ + initialize () + { + Rendering_X3DNormalNode .prototype .initialize .call (this); + + this ._vector .addInterest ("set_vector__", this); + + this .set_vector__ (); + }, + set_vector__ () + { + this .vector = this ._vector .getValue (); + this .length = this ._vector .length; + }, + addVector (index, array) + { + if (index >= 0 && this .length) + { + const + vector = this .vector, + i = (index % this .length) * 3; + + array .push (vector [i], vector [i + 1], vector [i + 2]); + } + else + { + return array .push (0, 0, 0); + } + }, + addNormals (array, min = this .length) + { + const length = this .length; + + if (length) + { + const vector = this .vector; + + for (let index = 0; index < min; ++ index) + { + const i = (index % length) * 3; + + array .push (vector [i], vector [i + 1], vector [i + 2]); + } + } + else + { + for (let index = 0; index < min; ++ index) + array .push (0, 0, 0); + } + + return array; + }, +}); + +Object .defineProperties (Normal, +{ + typeName: + { + value: "Normal", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, + containerField: + { + value: "normal", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "vector", new x_ite_Fields .MFVec3f ()), + ]), + enumerable: true, + }, +}); + +const Normal_default_ = Normal; +; + +x_ite_Namespace .add ("Normal", "x_ite/Components/Rendering/Normal", Normal_default_); +/* harmony default export */ const Rendering_Normal = (Normal_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/X3DPointGeometryNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function X3DPointGeometryNode (executionContext) +{ + Rendering_X3DGeometryNode .call (this, executionContext); + + const browser = this .getBrowser (); + + this .setGeometryType (0); + this .setPrimitiveMode (browser .getContext () .POINTS); + this .setSolid (false); + this .setTransparent (true); +} + +Object .assign (Object .setPrototypeOf (X3DPointGeometryNode .prototype, Rendering_X3DGeometryNode .prototype), +{ + intersectsLine () + { + return false; + }, + intersectsBox () + { + return false; + }, + buildTexCoords () + { }, + display (gl, renderContext) + { + const + appearanceNode = renderContext .appearanceNode, + shaderNode = appearanceNode .getShader (this, renderContext), + blendModeNode = appearanceNode .getBlendMode (), + attribNodes = this .getAttrib (), + attribBuffers = this .getAttribBuffers (); + + blendModeNode ?.enable (gl); + + // Setup shader. + + shaderNode .enable (gl); + shaderNode .setUniforms (gl, this, renderContext); + + // Setup vertex attributes. + + if (this .vertexArrayObject .enable (shaderNode)) + { + if (this .coordIndices .length) + shaderNode .enableCoordIndexAttribute (gl, this .coordIndexBuffer, 0, 0); + + for (let i = 0, length = attribNodes .length; i < length; ++ i) + attribNodes [i] .enable (gl, shaderNode, attribBuffers [i]); + + if (this .hasFogCoords) + shaderNode .enableFogDepthAttribute (gl, this .fogDepthBuffer, 0, 0); + + if (this .colorMaterial) + shaderNode .enableColorAttribute (gl, this .colorBuffer, 0, 0); + + if (this .hasNormals) + shaderNode .enableNormalAttribute (gl, this .normalBuffer, 0, 0); + + shaderNode .enableVertexAttribute (gl, this .vertexBuffer, 0, 0); + } + + gl .drawArrays (this .primitiveMode, 0, this .vertexCount); + + blendModeNode ?.disable (gl); + }, + displayParticles (gl, renderContext, particleSystem) + { + const + appearanceNode = renderContext .appearanceNode, + shaderNode = appearanceNode .getShader (this, renderContext), + blendModeNode = appearanceNode .getBlendMode (), + attribNodes = this .getAttrib (), + attribBuffers = this .getAttribBuffers (); + + blendModeNode ?.enable (gl); + + // Setup shader. + + shaderNode .enable (gl); + shaderNode .setUniforms (gl, this, renderContext); + + // Setup vertex attributes. + + const outputParticles = particleSystem .outputParticles; + + if (outputParticles .vertexArrayObject .update (this .updateParticles) .enable (shaderNode)) + { + const particleStride = particleSystem .particleStride; + + shaderNode .enableParticleAttribute (gl, outputParticles, particleStride, particleSystem .particleOffset, 1); + shaderNode .enableParticleMatrixAttribute (gl, outputParticles, particleStride, particleSystem .matrixOffset, 1); + + for (let i = 0, length = attribNodes .length; i < length; ++ i) + attribNodes [i] .enable (gl, shaderNode, attribBuffers [i]); + + if (this .hasFogCoords) + shaderNode .enableFogDepthAttribute (gl, this .fogDepthBuffer, 0, 0); + + if (this .colorMaterial) + shaderNode .enableColorAttribute (gl, this .colorBuffer, 0, 0); + + if (this .hasNormals) + shaderNode .enableNormalAttribute (gl, this .normalBuffer, 0, 0); + + shaderNode .enableVertexAttribute (gl, this .vertexBuffer, 0, 0); + + this .updateParticles = false; + } + + // Wireframes are always solid so only one drawing call is needed. + + gl .drawArraysInstanced (this .primitiveMode, 0, this .vertexCount, particleSystem .numParticles); + + blendModeNode ?.disable (gl); + }, +}); + +Object .defineProperties (X3DPointGeometryNode, +{ + typeName: + { + value: "X3DPointGeometryNode", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, +}); + +const X3DPointGeometryNode_default_ = X3DPointGeometryNode; +; + +x_ite_Namespace .add ("X3DPointGeometryNode", "x_ite/Components/Rendering/X3DPointGeometryNode", X3DPointGeometryNode_default_); +/* harmony default export */ const Rendering_X3DPointGeometryNode = (X3DPointGeometryNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/PointSet.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function PointSet (executionContext) +{ + Rendering_X3DPointGeometryNode .call (this, executionContext); + + this .addType (Base_X3DConstants .PointSet); + + this .fogCoordNode = null; + this .colorNode = null; + this .normalNode = null; + this .coordNode = null; +} + +Object .assign (Object .setPrototypeOf (PointSet .prototype, Rendering_X3DPointGeometryNode .prototype), +{ + initialize () + { + Rendering_X3DPointGeometryNode .prototype .initialize .call (this); + + this ._attrib .addInterest ("set_attrib__", this); + this ._fogCoord .addInterest ("set_fogCoord__", this); + this ._color .addInterest ("set_color__", this); + this ._normal .addInterest ("set_normal__", this); + this ._coord .addInterest ("set_coord__", this); + + this .set_attrib__ (); + this .set_fogCoord__ (); + this .set_color__ (); + this .set_normal__ (); + this .set_coord__ (); + }, + getCoord () + { + return this .coordNode; + }, + set_attrib__ () + { + const attribNodes = this .getAttrib (); + + for (const attribNode of attribNodes) + { + attribNode .removeInterest ("requestRebuild", this); + attribNode ._attribute_changed .removeInterest ("updateVertexArrays", this); + } + + attribNodes .length = 0; + + for (const node of this ._attrib) + { + const attribNode = Base_X3DCast (Base_X3DConstants .X3DVertexAttributeNode, node); + + if (attribNode) + attribNodes .push (attribNode); + } + + for (const attribNode of attribNodes) + { + attribNode .addInterest ("requestRebuild", this); + attribNode ._attribute_changed .addInterest ("updateVertexArrays", this); + } + + this .updateVertexArrays (); + }, + set_fogCoord__ () + { + this .fogCoordNode ?.removeInterest ("requestRebuild", this); + + this .fogCoordNode = Base_X3DCast (Base_X3DConstants .FogCoordinate, this ._fogCoord); + + this .fogCoordNode ?.addInterest ("requestRebuild", this); + }, + set_color__ () + { + this .colorNode ?.removeInterest ("requestRebuild", this); + + this .colorNode = Base_X3DCast (Base_X3DConstants .X3DColorNode, this ._color); + + this .colorNode ?.addInterest ("requestRebuild", this); + }, + set_normal__ () + { + this .normalNode ?.removeInterest ("requestRebuild", this); + + this .normalNode = Base_X3DCast (Base_X3DConstants .X3DNormalNode, this ._normal); + + this .normalNode ?.addInterest ("requestRebuild", this); + }, + set_coord__ () + { + this .coordNode ?.removeInterest ("requestRebuild", this); + + this .coordNode = Base_X3DCast (Base_X3DConstants .X3DCoordinateNode, this ._coord); + + this .coordNode ?.addInterest ("requestRebuild", this); + }, + build () + { + if (! this .coordNode || this .coordNode .isEmpty ()) + return; + + const + coordIndicesArray = this .getCoordIndices (), + attribNodes = this .getAttrib (), + numAttribNodes = attribNodes .length, + attribArrays = this .getAttribs (), + fogCoordNode = this .fogCoordNode, + fogDepthArray = this .getFogDepths (), + colorNode = this .colorNode, + colorArray = this .getColors (), + coordNode = this .coordNode, + normalArray = this .getNormals (), + normalNode = this .normalNode, + vertexArray = this .getVertices (), + numPoints = coordNode ._point .length; + + for (let i = 0; i < numPoints; ++ i) + coordIndicesArray .push (i); + + for (let a = 0; a < numAttribNodes; ++ a) + { + for (let i = 0; i < numPoints; ++ i) + attribNodes [a] .addValue (i, attribArrays [a]); + } + + fogCoordNode ?.addDepths (fogDepthArray, numPoints); + colorNode ?.addColors (colorArray, numPoints); + normalNode ?.addNormals (normalArray, numPoints); + + coordNode .addPoints (vertexArray); + }, +}); + +Object .defineProperties (PointSet, +{ + typeName: + { + value: "PointSet", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, + containerField: + { + value: "geometry", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "attrib", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "fogCoord", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "color", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normal", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "coord", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +const PointSet_default_ = PointSet; +; + +x_ite_Namespace .add ("PointSet", "x_ite/Components/Rendering/PointSet", PointSet_default_); +/* harmony default export */ const Rendering_PointSet = (PointSet_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/TriangleFanSet.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function TriangleFanSet (executionContext) +{ + Rendering_X3DComposedGeometryNode .call (this, executionContext); + + this .addType (Base_X3DConstants .TriangleFanSet); + + this .triangleIndex = [ ]; +} + +Object .assign (Object .setPrototypeOf (TriangleFanSet .prototype, Rendering_X3DComposedGeometryNode .prototype), +{ + initialize () + { + Rendering_X3DComposedGeometryNode .prototype .initialize .call (this); + + this ._fanCount .addInterest ("set_fanCount__", this); + + this .set_fanCount__ (); + }, + set_fanCount__ () + { + // Build coordIndex + + const + fanCount = this ._fanCount, + triangleIndex = this .triangleIndex; + + triangleIndex .length = 0; + + let index = 0; + + for (const vertexCount of fanCount) + { + for (let i = 1, length = vertexCount - 1; i < length; ++ i) + { + triangleIndex .push (index, index + i, index + i + 1); + } + + index += vertexCount; + } + }, + getPolygonIndex (index) + { + return this .triangleIndex [index]; + }, + build () + { + Rendering_X3DComposedGeometryNode .prototype .build .call (this, 3, this .triangleIndex .length, 3, this .triangleIndex .length); + }, +}); + +Object .defineProperties (TriangleFanSet, +{ + typeName: + { + value: "TriangleFanSet", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, + containerField: + { + value: "geometry", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "solid", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "ccw", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "colorPerVertex", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "normalPerVertex", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "fanCount", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "attrib", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "fogCoord", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "color", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "texCoord", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normal", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "coord", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +const TriangleFanSet_default_ = TriangleFanSet; +; + +x_ite_Namespace .add ("TriangleFanSet", "x_ite/Components/Rendering/TriangleFanSet", TriangleFanSet_default_); +/* harmony default export */ const Rendering_TriangleFanSet = (TriangleFanSet_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/TriangleSet.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function TriangleSet (executionContext) +{ + Rendering_X3DComposedGeometryNode .call (this, executionContext); + + this .addType (Base_X3DConstants .TriangleSet); +} + +Object .assign (Object .setPrototypeOf (TriangleSet .prototype, Rendering_X3DComposedGeometryNode .prototype), +{ + build () + { + if (! this .getCoord ()) + return; + + Rendering_X3DComposedGeometryNode .prototype .build .call (this, 3, this .getCoord () .getSize (), 3, this .getCoord () .getSize ()); + }, + createNormals (verticesPerPolygon, polygonsSize) + { + return this .createFaceNormals (verticesPerPolygon, polygonsSize); + }, +}); + +Object .defineProperties (TriangleSet, +{ + typeName: + { + value: "TriangleSet", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, + containerField: + { + value: "geometry", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "solid", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "ccw", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "colorPerVertex", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "normalPerVertex", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "attrib", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "fogCoord", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "color", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "texCoord", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normal", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "coord", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +const TriangleSet_default_ = TriangleSet; +; + +x_ite_Namespace .add ("TriangleSet", "x_ite/Components/Rendering/TriangleSet", TriangleSet_default_); +/* harmony default export */ const Rendering_TriangleSet = (TriangleSet_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering/TriangleStripSet.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function TriangleStripSet (executionContext) +{ + Rendering_X3DComposedGeometryNode .call (this, executionContext); + + this .addType (Base_X3DConstants .TriangleStripSet); + + this .triangleIndex = [ ]; +} + +Object .assign (Object .setPrototypeOf (TriangleStripSet .prototype, Rendering_X3DComposedGeometryNode .prototype), +{ + initialize () + { + Rendering_X3DComposedGeometryNode .prototype .initialize .call (this); + + this ._stripCount .addInterest ("set_stripCount__", this); + + this .set_stripCount__ (); + }, + set_stripCount__ () + { + // Build coordIndex + + const + stripCount = this ._stripCount, + triangleIndex = this .triangleIndex; + + triangleIndex .length = 0; + + let index = 0; + + for (const vertexCount of stripCount) + { + for (let i = 0, count = vertexCount - 2; i < count; ++ i) + { + const is_odd = i & 1; + + triangleIndex .push (index + (is_odd ? i + 1 : i), + index + (is_odd ? i : i + 1), + index + (i + 2)); + } + + index += vertexCount; + } + }, + getPolygonIndex (index) + { + return this .triangleIndex [index]; + }, + build () + { + Rendering_X3DComposedGeometryNode .prototype .build .call (this, 3, this .triangleIndex .length, 3, this .triangleIndex .length); + }, +}); + +Object .defineProperties (TriangleStripSet, +{ + typeName: + { + value: "TriangleStripSet", + enumerable: true, + }, + componentName: + { + value: "Rendering", + enumerable: true, + }, + containerField: + { + value: "geometry", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "solid", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "ccw", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "colorPerVertex", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "normalPerVertex", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "stripCount", new x_ite_Fields .MFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "attrib", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "fogCoord", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "color", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "texCoord", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normal", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "coord", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +const TriangleStripSet_default_ = TriangleStripSet; +; + +x_ite_Namespace .add ("TriangleStripSet", "x_ite/Components/Rendering/TriangleStripSet", TriangleStripSet_default_); +/* harmony default export */ const Rendering_TriangleStripSet = (TriangleStripSet_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Rendering.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + + + + + + + + +const Rendering_default_ = { + name: "Rendering", + concreteNodes: + [ + Rendering_ClipPlane, + Rendering_Color, + Rendering_ColorRGBA, + Rendering_Coordinate, + Rendering_IndexedLineSet, + Rendering_IndexedTriangleFanSet, + Rendering_IndexedTriangleSet, + Rendering_IndexedTriangleStripSet, + Rendering_LineSet, + Rendering_Normal, + Rendering_PointSet, + Rendering_TriangleFanSet, + Rendering_TriangleSet, + Rendering_TriangleStripSet, + ], + abstractNodes: + [ + Rendering_X3DColorNode, + Rendering_X3DComposedGeometryNode, + Rendering_X3DCoordinateNode, + Rendering_X3DGeometricPropertyNode, + Rendering_X3DGeometryNode, + Rendering_X3DLineGeometryNode, + Rendering_X3DNormalNode, + ], +}; +; + +x_ite_Namespace .add ("Rendering", "x_ite/Components/Rendering", Rendering_default_); +/* harmony default export */ const Rendering = (Rendering_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shaders/X3DShaderNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function X3DShaderNode (executionContext) +{ + Shape_X3DAppearanceChildNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DShaderNode); + + this .valid = false; + this .selected = 0; +} + +Object .assign (Object .setPrototypeOf (X3DShaderNode .prototype, Shape_X3DAppearanceChildNode .prototype), +{ + setValid (value) + { + this ._isValid = this .valid = value; + }, + isValid () + { + return this .valid; + }, + select () + { + ++ this .selected; + + if (! this ._isSelected .getValue ()) + this ._isSelected = true; + }, + deselect () + { + -- this .selected; + + if (this .selected === 0) + { + if (this ._isSelected .getValue ()) + this ._isSelected = false; + } + }, +}); + +Object .defineProperties (X3DShaderNode, +{ + typeName: + { + value: "X3DShaderNode", + enumerable: true, + }, + componentName: + { + value: "Shaders", + enumerable: true, + }, +}); + +const X3DShaderNode_default_ = X3DShaderNode; +; + +x_ite_Namespace .add ("X3DShaderNode", "x_ite/Components/Shaders/X3DShaderNode", X3DShaderNode_default_); +/* harmony default export */ const Shaders_X3DShaderNode = (X3DShaderNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +/* provided dependency */ var X3DProgrammableShaderObject_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +const X3DProgrammableShaderObject_uniformLocation = Symbol .for ("X_ITE.X3DField.uniformLocation"); + +function X3DProgrammableShaderObject (executionContext) +{ + this .addType (Base_X3DConstants .X3DProgrammableShaderObject); + + this .uniformNames = [ ]; + + this .x3d_ClipPlane = [ ]; + this .x3d_LightType = [ ]; + this .x3d_LightOn = [ ]; + this .x3d_LightColor = [ ]; + this .x3d_LightIntensity = [ ]; + this .x3d_LightAmbientIntensity = [ ]; + this .x3d_LightAttenuation = [ ]; + this .x3d_LightLocation = [ ]; + this .x3d_LightDirection = [ ]; + this .x3d_LightBeamWidth = [ ]; + this .x3d_LightCutOffAngle = [ ]; + this .x3d_LightRadius = [ ]; + this .x3d_LightMatrix = [ ]; + this .x3d_ShadowIntensity = [ ]; + this .x3d_ShadowColor = [ ]; + this .x3d_ShadowBias = [ ]; + this .x3d_ShadowMatrix = [ ]; + this .x3d_ShadowMapSize = [ ]; + this .x3d_ShadowMap = [ ]; + this .x3d_Texture = [ ]; + this .x3d_MultiTextureMode = [ ]; + this .x3d_MultiTextureAlphaMode = [ ]; + this .x3d_MultiTextureSource = [ ]; + this .x3d_MultiTextureFunction = [ ]; + this .x3d_TextureCoordinateGeneratorMode = [ ]; + this .x3d_TextureCoordinateGeneratorParameter = [ ]; + this .x3d_ProjectiveTexture = [ ]; + this .x3d_ProjectiveTextureMatrix = [ ]; + this .x3d_ProjectiveTextureLocation = [ ]; + this .x3d_TexCoord = [ ]; + this .x3d_TextureMatrix = [ ]; + + this .numClipPlanes = 0; + this .fogNode = null; + this .numLights = 0; + this .numGlobalLights = 0; + this .lightNodes = [ ]; + this .numProjectiveTextures = 0; + this .numGlobalProjectiveTextures = 0; + this .projectiveTextureNodes = [ ]; + this .textures = new Set (); +} + +Object .assign (X3DProgrammableShaderObject .prototype, +{ + initialize () + { + const browser = this .getBrowser (); + + browser .getRenderingProperties () ._LogarithmicDepthBuffer .addInterest ("set_logarithmicDepthBuffer__", this); + + this .set_logarithmicDepthBuffer__ (); + }, + set_logarithmicDepthBuffer__ () + { + this .logarithmicDepthBuffer = this .getBrowser () .getRenderingProperty ("LogarithmicDepthBuffer"); + }, + canUserDefinedFields () + { + return true; + }, + getUniformNames () + { + return this .uniformNames; + }, + setUniformNames (value) + { + this .uniformNames = value; + }, + getDefaultUniformsAndAttributes () + { + // Get uniforms and attributes. + + const + program = this .getProgram (), + browser = this .getBrowser (), + gl = browser .getContext (), + maxClipPlanes = browser .getMaxClipPlanes (), + maxLights = browser .getMaxLights (), + maxTextures = browser .getMaxTextures (), + maxTextureTransforms = browser .getMaxTextureTransforms (), + maxTexCoords = browser .getMaxTexCoords (); + + gl .useProgram (program); + + for (const name of this .uniformNames) + this [name] = gl .getUniformLocation (program, name); + + /* + * Uniforms. + */ + + this .x3d_Id = gl .getUniformLocation (program, "x3d_Id"); + this .x3d_LogarithmicFarFactor1_2 = gl .getUniformLocation (program, "x3d_LogarithmicFarFactor1_2"); + + for (let i = 0; i < maxClipPlanes; ++ i) + this .x3d_ClipPlane [i] = gl .getUniformLocation (program, "x3d_ClipPlane[" + i + "]"); + + this .x3d_FogColor = this .getUniformLocation (gl, program, "x3d_Fog.color", "x3d_FogColor"); + this .x3d_FogVisibilityRange = this .getUniformLocation (gl, program, "x3d_Fog.visibilityRange", "x3d_FogVisibilityRange"); + this .x3d_FogMatrix = this .getUniformLocation (gl, program, "x3d_Fog.matrix", "x3d_FogMatrix"); + + this .x3d_AlphaCutoff = gl .getUniformLocation (program, "x3d_AlphaCutoff"); + + this .x3d_PointPropertiesPointSizeScaleFactor = gl .getUniformLocation (program, "x3d_PointProperties.pointSizeScaleFactor"); + this .x3d_PointPropertiesPointSizeMinValue = gl .getUniformLocation (program, "x3d_PointProperties.pointSizeMinValue"); + this .x3d_PointPropertiesPointSizeMaxValue = gl .getUniformLocation (program, "x3d_PointProperties.pointSizeMaxValue"); + this .x3d_PointPropertiesAttenuation = gl .getUniformLocation (program, "x3d_PointProperties.attenuation"); + + this .x3d_LinePropertiesLinetype = gl .getUniformLocation (program, "x3d_LineProperties.linetype"); + this .x3d_LineStippleScale = gl .getUniformLocation (program, "x3d_LineProperties.lineStippleScale"); + this .x3d_LinePropertiesTexture = gl .getUniformLocation (program, "x3d_LineProperties.texture"); + + this .x3d_FillPropertiesFilled = gl .getUniformLocation (program, "x3d_FillProperties.filled"); + this .x3d_FillPropertiesHatched = gl .getUniformLocation (program, "x3d_FillProperties.hatched"); + this .x3d_FillPropertiesHatchColor = gl .getUniformLocation (program, "x3d_FillProperties.hatchColor"); + this .x3d_FillPropertiesTexture = gl .getUniformLocation (program, "x3d_FillProperties.texture"); + this .x3d_FillPropertiesScale = gl .getUniformLocation (program, "x3d_FillProperties.scale"); + + for (let i = 0; i < maxLights; ++ i) + { + this .x3d_LightType [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].type", "x3d_LightType[" + i + "]"); + this .x3d_LightColor [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].color", "x3d_LightColor[" + i + "]"); + this .x3d_LightAmbientIntensity [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].ambientIntensity", "x3d_LightAmbientIntensity[" + i + "]"); + this .x3d_LightIntensity [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].intensity", "x3d_LightIntensity[" + i + "]"); + this .x3d_LightAttenuation [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].attenuation", "x3d_LightAttenuation[" + i + "]"); + this .x3d_LightLocation [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].location", "x3d_LightLocation[" + i + "]"); + this .x3d_LightDirection [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].direction", "x3d_LightDirection[" + i + "]"); + this .x3d_LightBeamWidth [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].beamWidth", "x3d_LightBeamWidth[" + i + "]"); + this .x3d_LightCutOffAngle [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].cutOffAngle", "x3d_LightCutOffAngle[" + i + "]"); + this .x3d_LightRadius [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].radius", "x3d_LightRadius[" + i + "]"); + this .x3d_LightMatrix [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].matrix", "x3d_LightMatrix[" + i + "]"); + + this .x3d_ShadowIntensity [i] = gl .getUniformLocation (program, "x3d_LightSource[" + i + "].shadowIntensity"); + this .x3d_ShadowColor [i] = gl .getUniformLocation (program, "x3d_LightSource[" + i + "].shadowColor"); + this .x3d_ShadowBias [i] = gl .getUniformLocation (program, "x3d_LightSource[" + i + "].shadowBias"); + this .x3d_ShadowMatrix [i] = gl .getUniformLocation (program, "x3d_LightSource[" + i + "].shadowMatrix"); + this .x3d_ShadowMapSize [i] = gl .getUniformLocation (program, "x3d_LightSource[" + i + "].shadowMapSize"); + this .x3d_ShadowMap [i] = gl .getUniformLocation (program, "x3d_ShadowMap[" + i + "]"); + } + + this .x3d_AmbientIntensity = this .getUniformLocation (gl, program, "x3d_Material.ambientIntensity", "x3d_FrontMaterial.ambientIntensity"); + this .x3d_DiffuseColor = this .getUniformLocation (gl, program, "x3d_Material.diffuseColor", "x3d_FrontMaterial.diffuseColor"); + this .x3d_SpecularColor = this .getUniformLocation (gl, program, "x3d_Material.specularColor", "x3d_FrontMaterial.specularColor"); + this .x3d_EmissiveColor = this .getUniformLocation (gl, program, "x3d_Material.emissiveColor", "x3d_FrontMaterial.emissiveColor"); + this .x3d_Shininess = this .getUniformLocation (gl, program, "x3d_Material.shininess", "x3d_FrontMaterial.shininess"); + this .x3d_BaseColor = gl .getUniformLocation (program, "x3d_Material.baseColor"); + this .x3d_Metallic = gl .getUniformLocation (program, "x3d_Material.metallic"); + this .x3d_Roughness = gl .getUniformLocation (program, "x3d_Material.roughness"); + this .x3d_OcclusionStrength = gl .getUniformLocation (program, "x3d_Material.occlusionStrength"); + this .x3d_NormalScale = gl .getUniformLocation (program, "x3d_Material.normalScale"); + this .x3d_Transparency = this .getUniformLocation (gl, program, "x3d_Material.transparency", "x3d_FrontMaterial.transparency"); + + const materialTextures = [ + "x3d_AmbientTexture", + "x3d_DiffuseTexture", + "x3d_SpecularTexture", + "x3d_EmissiveTexture", + "x3d_ShininessTexture", + "x3d_BaseTexture", + "x3d_MetallicRoughnessTexture", + "x3d_OcclusionTexture", + "x3d_NormalTexture", + ]; + + for (const materialTexture of materialTextures) + { + this [materialTexture] = { + textureTransformMapping: gl .getUniformLocation (program, materialTexture + ".textureTransformMapping"), + textureCoordinateMapping: gl .getUniformLocation (program, materialTexture + ".textureCoordinateMapping"), + texture2D: gl .getUniformLocation (program, materialTexture + ".texture2D"), + texture3D: gl .getUniformLocation (program, materialTexture + ".texture3D"), + textureCube: gl .getUniformLocation (program, materialTexture + ".textureCube"), + }; + } + + this .x3d_MultiTextureColor = gl .getUniformLocation (program, "x3d_MultiTextureColor"); + + this .x3d_TexCoord .length = 0; + + for (let i = 0; i < maxTextures; ++ i) + { + this .x3d_TextureCoordinateGeneratorMode [i] = gl .getUniformLocation (program, "x3d_TextureCoordinateGenerator[" + i + "].mode"); + this .x3d_TextureCoordinateGeneratorParameter [i] = gl .getUniformLocation (program, "x3d_TextureCoordinateGenerator[" + i + "].parameter"); + + this .x3d_Texture [i] = { + texture2D: gl .getUniformLocation (program, "x3d_Texture2D[" + i + "]"), + texture3D: gl .getUniformLocation (program, "x3d_Texture3D[" + i + "]"), + textureCube: this .getUniformLocation (gl, program, "x3d_TextureCube[" + i + "]", "x3d_CubeMapTexture[" + i + "]"), + } + + this .x3d_MultiTextureMode [i] = gl .getUniformLocation (program, "x3d_MultiTexture[" + i + "].mode"); + this .x3d_MultiTextureAlphaMode [i] = gl .getUniformLocation (program, "x3d_MultiTexture[" + i + "].alphaMode"); + this .x3d_MultiTextureSource [i] = gl .getUniformLocation (program, "x3d_MultiTexture[" + i + "].source"); + this .x3d_MultiTextureFunction [i] = gl .getUniformLocation (program, "x3d_MultiTexture[" + i + "].function"); + + this .x3d_ProjectiveTexture [i] = gl .getUniformLocation (program, "x3d_ProjectiveTexture[" + i + "]"); + this .x3d_ProjectiveTextureMatrix [i] = gl .getUniformLocation (program, "x3d_ProjectiveTextureMatrix[" + i + "]"); + this .x3d_ProjectiveTextureLocation [i] = gl .getUniformLocation (program, "x3d_ProjectiveTextureLocation[" + i + "]"); + } + + for (let i = 0; i < maxTextureTransforms; ++ i) + { + const uniform = gl .getUniformLocation (program, "x3d_TextureMatrix[" + i + "]"); + + if (uniform !== null) + this .x3d_TextureMatrix [i] = uniform; + } + + for (let i = 0; i < maxTexCoords; ++ i) + { + const x3d_TexCoord = this .getAttribLocation (gl, program, "x3d_TexCoord" + i, i ? "" : "x3d_TexCoord"); + + if (x3d_TexCoord !== -1) + this .x3d_TexCoord .push ([i, x3d_TexCoord]); + } + + this .x3d_TexCoordRamp = gl .getUniformLocation (program, "x3d_TexCoordRamp"); + this .x3d_JointsTexture = gl .getUniformLocation (program, "x3d_JointsTexture"); + this .x3d_DisplacementsTexture = gl .getUniformLocation (program, "x3d_DisplacementsTexture"); + this .x3d_JointMatricesTexture = gl .getUniformLocation (program, "x3d_JointMatricesTexture"); + + this .x3d_Viewport = gl .getUniformLocation (program, "x3d_Viewport"); + this .x3d_ProjectionMatrix = gl .getUniformLocation (program, "x3d_ProjectionMatrix"); + this .x3d_ModelViewMatrix = gl .getUniformLocation (program, "x3d_ModelViewMatrix"); + this .x3d_NormalMatrix = gl .getUniformLocation (program, "x3d_NormalMatrix"); + this .x3d_CameraSpaceMatrix = gl .getUniformLocation (program, "x3d_CameraSpaceMatrix"); + + /* + * Attributes. + */ + + const attributes = [ + "CoordIndex", + "LineStipple", + "FogDepth", + "Color", + "Normal", + "Vertex", + "Particle", + "ParticleMatrix", + ]; + + for (const name of attributes) + { + const attribute = gl .getAttribLocation (program, `x3d_${name}`); + + this [`x3d_${name}`] = attribute; + + if (attribute < 0) + { + this [`enable${name}Attribute`] = Function .prototype; + this [`${X3DProgrammableShaderObject_$.toLowerCaseFirst (name)}AttributeDivisor`] = Function .prototype; + } + else + { + delete this [`enable${name}Attribute`]; + delete this [`${X3DProgrammableShaderObject_$.toLowerCaseFirst (name)}AttributeDivisor`]; + } + } + + if (this .x3d_TexCoord .length === 0) + { + this .enableTexCoordAttribute = Function .prototype; + this .texCoordAttributeDivisor = Function .prototype; + } + else + { + delete this .enableTexCoordAttribute; + delete this .texCoordAttributeDivisor; + } + + /* + * Fill uniforms with defaults. + */ + + // Fill special uniforms with default values, textures for units are created in X3DTexturingContext. + + gl .uniform1i (this .x3d_LinePropertiesTexture, browser .getDefaultTexture2DUnit ()); + gl .uniform1i (this .x3d_FillPropertiesTexture, browser .getDefaultTexture2DUnit ()); + + for (const materialTexture of materialTextures) + { + gl .uniform1i (this [materialTexture] .texture2D, browser .getDefaultTexture2DUnit ()); + gl .uniform1i (this [materialTexture] .texture3D, browser .getDefaultTexture3DUnit ()); + gl .uniform1i (this [materialTexture] .textureCube, browser .getDefaultTextureCubeUnit ()); + } + + for (const uniforms of this .x3d_Texture) + { + gl .uniform1i (uniforms .texture2D, browser .getDefaultTexture2DUnit ()); + + if (gl .getVersion () >= 2) + gl .uniform1i (uniforms .texture3D, browser .getDefaultTexture3DUnit ()); + + gl .uniform1i (uniforms .textureCube, browser .getDefaultTextureCubeUnit ()); + } + + for (const uniform of this .x3d_ShadowMap) + gl .uniform1i (uniform, browser .getDefaultTexture2DUnit ()); + + for (const uniform of this .x3d_ProjectiveTexture) + gl .uniform1i (uniform, browser .getDefaultTexture2DUnit ()); + + gl .uniform1i (this .x3d_TexCoordRamp, browser .getDefaultTexture2DUnit ()); + gl .uniform1i (this .x3d_JointsTexture, browser .getDefaultTexture2DUnit ()); + gl .uniform1i (this .x3d_DisplacementsTexture, browser .getDefaultTexture2DUnit ()); + gl .uniform1i (this .x3d_JointMatricesTexture, browser .getDefaultTexture2DUnit ()); + }, + getUniformLocation (gl, program, name, depreciated) + { + // Legacy function to get uniform location. + + let location = gl .getUniformLocation (program, name); + + if (location) + return location; + + // Look for depreciated location. + + if (depreciated) + { + location = gl .getUniformLocation (program, depreciated); + + if (location) + { + console .warn (this .getTypeName (), this .getName (), "Using uniform location name '" + depreciated + "' is depreciated, use '" + name + "'. See https://create3000.github.io/x_ite/custom-shaders."); + } + + return location; + } + + return 0; + }, + getAttribLocation (gl, program, name, depreciated) + { + // Legacy function to get uniform location. + + let location = gl .getAttribLocation (program, name); + + if (location >= 0) + return location; + + // Look for depreciated location. + + if (depreciated) + { + location = gl .getAttribLocation (program, depreciated); + + if (location >= 0) + { + console .warn (this .getTypeName (), this .getName (), "Using attribute location name '" + depreciated + "' is depreciated, use '" + name + "'. See https://create3000.github.io/x_ite/custom-shaders."); + } + + return location; + } + + return -1; + }, + addShaderFields () + { + const + program = this .getProgram (), + gl = this .getBrowser () .getContext (); + + gl .useProgram (program); + + this .textures .clear (); + + for (const field of this .getUserDefinedFields ()) + { + if (field .getAccessType () === Base_X3DConstants .outputOnly) + continue; + + const location = gl .getUniformLocation (program, field .getName ()); + + if (!location) + continue; + + switch (field .getType ()) + { + case Base_X3DConstants .SFImage: + { + location .array = new Int32Array (3 + field .array .length); + break; + } + case Base_X3DConstants .SFMatrix3d: + case Base_X3DConstants .SFMatrix3f: + case Base_X3DConstants .SFRotation: + { + location .array = new Float32Array (9); + break; + } + case Base_X3DConstants .SFMatrix4d: + case Base_X3DConstants .SFMatrix4f: + { + location .array = new Float32Array (16); + break; + } + case Base_X3DConstants .SFNode: + { + break; + } + case Base_X3DConstants .MFBool: + case Base_X3DConstants .MFInt32: + { + location .array = new Int32Array (this .getLocationLength (gl, program, field)); + break; + } + case Base_X3DConstants .MFFloat: + case Base_X3DConstants .MFDouble: + case Base_X3DConstants .MFTime: + { + location .array = new Float32Array (this .getLocationLength (gl, program, field)); + break; + } + case Base_X3DConstants .MFImage: + { + location .array = new Int32Array (this .getImagesLength (field)); + break; + } + case Base_X3DConstants .MFMatrix3d: + case Base_X3DConstants .MFMatrix3f: + case Base_X3DConstants .MFRotation: + { + location .array = new Float32Array (9 * this .getLocationLength (gl, program, field)); + break; + } + case Base_X3DConstants .MFMatrix4d: + case Base_X3DConstants .MFMatrix4f: + { + location .array = new Float32Array (16 * this .getLocationLength (gl, program, field)); + break; + } + case Base_X3DConstants .MFNode: + { + const locations = location .locations = [ ]; + + for (let i = 0;; ++ i) + { + const l = gl .getUniformLocation (program, field .getName () + "[" + i + "]"); + + if (! l) + break; + + locations .push (l); + } + + break; + } + case Base_X3DConstants .MFVec2d: + case Base_X3DConstants .MFVec2f: + { + location .array = new Float32Array (2 * this .getLocationLength (gl, program, field)); + break; + } + case Base_X3DConstants .MFVec3d: + case Base_X3DConstants .MFVec3f: + case Base_X3DConstants .MFColor: + { + location .array = new Float32Array (3 * this .getLocationLength (gl, program, field)); + break; + } + case Base_X3DConstants .MFVec4d: + case Base_X3DConstants .MFVec4f: + case Base_X3DConstants .MFColorRGBA: + { + location .array = new Float32Array (4 * this .getLocationLength (gl, program, field)); + break; + } + } + + if (location .array) + field [X3DProgrammableShaderObject_uniformLocation] = location .array .length ? location : null; + else + field [X3DProgrammableShaderObject_uniformLocation] = location; + + field .addInterest ("set_field__", this); + + this .set_field__ (field); + } + }, + removeShaderFields () + { + for (const field of this .getUserDefinedFields ()) + field .removeInterest ("set_field__", this); + }, + set_field__: (() => + { + const rotation = new Float32Array (9); + + return function (field) + { + const + program = this .getProgram (), + gl = this .getBrowser () .getContext (), + location = field [X3DProgrammableShaderObject_uniformLocation]; + + gl .useProgram (program); + + if (!location) + return; + + switch (field .getType ()) + { + case Base_X3DConstants .SFBool: + case Base_X3DConstants .SFInt32: + { + gl .uniform1i (location, field .getValue ()); + return; + } + case Base_X3DConstants .SFColor: + { + const value = field .getValue (); + gl .uniform3f (location, value .r, value .g, value .b); + return; + } + case Base_X3DConstants .SFColorRGBA: + { + const value = field .getValue (); + gl .uniform4f (location, value .r, value .g, value .b, value .a); + return; + } + case Base_X3DConstants .SFDouble: + case Base_X3DConstants .SFFloat: + case Base_X3DConstants .SFTime: + { + gl .uniform1f (location, field .getValue ()); + return; + } + case Base_X3DConstants .SFImage: + { + let array = location .array; + + const + pixels = field .array, + length = 3 + pixels .length; + + if (length !== array .length) + array = location .array = new Int32Array (length); + + array [0] = field .width; + array [1] = field .height; + array [2] = field .comp; + + for (let a = 3, p = 0, pl = pixels .length; p < pl; ++ p, ++ a) + array [a] = pixels [p]; + + gl .uniform1iv (location, array); + return; + } + case Base_X3DConstants .SFMatrix3d: + case Base_X3DConstants .SFMatrix3f: + { + location .array .set (field .getValue ()); + + gl .uniformMatrix3fv (location, false, location .array); + return; + } + case Base_X3DConstants .SFMatrix4d: + case Base_X3DConstants .SFMatrix4f: + { + location .array .set (field .getValue ()); + + gl .uniformMatrix4fv (location, false, location .array); + return; + } + case Base_X3DConstants .SFNode: + { + const texture = Base_X3DCast (Base_X3DConstants .X3DTextureNode, field); + + if (texture) + { + location .name = field .getName (); + location .texture = texture; + + this .textures .add (location); + } + else + { + this .textures .delete (location); + } + + return; + } + case Base_X3DConstants .SFRotation: + { + field .getValue () .getMatrix (location .array); + + gl .uniformMatrix3fv (location, false, location .array); + return; + } + case Base_X3DConstants .SFString: + { + return; + } + case Base_X3DConstants .SFVec2d: + case Base_X3DConstants .SFVec2f: + { + const value = field .getValue (); + gl .uniform2f (location, value .x, value .y); + return; + } + case Base_X3DConstants .SFVec3d: + case Base_X3DConstants .SFVec3f: + { + const value = field .getValue (); + gl .uniform3f (location, value .x, value .y, value .z); + return; + } + case Base_X3DConstants .SFVec4d: + case Base_X3DConstants .SFVec4f: + { + const value = field .getValue (); + gl .uniform4f (location, value .x, value .y, value .z, value .w); + return; + } + case Base_X3DConstants .MFBool: + case Base_X3DConstants .MFInt32: + { + const array = location .array; + + for (var i = 0, length = field .length; i < length; ++ i) + array [i] = field [i]; + + for (let length = array .length; i < length; ++ i) + array [i] = 0; + + gl .uniform1iv (location, array); + return; + } + case Base_X3DConstants .MFColor: + { + const array = location .array; + + for (var i = 0, k = 0, length = field .length; i < length; ++ i) + { + const color = field [i]; + + array [k++] = color .r; + array [k++] = color .g; + array [k++] = color .b; + } + + for (let length = array .length; k < length; ++ k) + array [k] = 0; + + gl .uniform3fv (location, array); + return; + } + case Base_X3DConstants .MFColorRGBA: + { + const array = location .array; + + for (var i = 0, k = 0, length = field .length; i < length; ++ i) + { + const color = field [i]; + + array [k++] = color .r; + array [k++] = color .g; + array [k++] = color .b; + array [k++] = color .a; + } + + for (let length = array .length; k < length; ++ k) + array [k] = 0; + + gl .uniform4fv (location, array); + return; + } + case Base_X3DConstants .MFDouble: + case Base_X3DConstants .MFFloat: + case Base_X3DConstants .MFTime: + { + const array = location .array; + + for (var i = 0, length = field .length; i < length; ++ i) + array [i] = field [i]; + + for (let length = array .length; i < length; ++ i) + array [i] = 0; + + gl .uniform1fv (location, array); + return; + } + case Base_X3DConstants .MFImage: + { + const array = location .array; + + for (let i = 0, a = 0, length = field .length; i < length; ++ i) + { + const + value = field [i], + pixels = value .array; + + array [a ++] = value .width; + array [a ++] = value .height; + array [a ++] = value .comp; + + for (let p = 0, pl = pixels .length; p < pl; ++ p) + array [a ++] = pixels [p]; + } + + gl .uniform1iv (location, array); + return; + } + case Base_X3DConstants .MFMatrix3d: + case Base_X3DConstants .MFMatrix3f: + { + const array = location .array; + + for (var i = 0, k = 0, length = field .length; i < length; ++ i) + { + const matrix = field [i]; + + for (let m = 0; m < 9; ++ m) + array [k++] = matrix [m]; + } + + for (let length = array .length; k < length; ++ k) + array [k] = 0; + + gl .uniformMatrix3fv (location, false, array); + return; + } + case Base_X3DConstants .MFMatrix4d: + case Base_X3DConstants .MFMatrix4f: + { + const array = location .array; + + for (var i = 0, k = 0, length = field .length; i < length; ++ i) + { + const matrix = field [i]; + + for (let m = 0; m < 16; ++ m) + array [k++] = matrix [m]; + } + + for (let length = array .length; k < length; ++ k) + array [k] = 0; + + gl .uniformMatrix4fv (location, false, array); + return; + } + case Base_X3DConstants .MFNode: + { + const locations = location .locations; + + for (let i = 0, length = field .length; i < length; ++ i) + { + const texture = Base_X3DCast (Base_X3DConstants .X3DTextureNode, field [i]); + + if (texture) + { + locations [i] .name = field .getName (); + locations [i] .texture = texture; + + this .textures .add (locations [i]); + } + else + { + this .textures .delete (locations [i]); + } + } + + return; + } + case Base_X3DConstants .MFRotation: + { + const array = location .array; + + for (var i = 0, k = 0, length = field .length; i < length; ++ i) + { + field [i] .getValue () .getMatrix (rotation); + + array [k++] = rotation [0]; + array [k++] = rotation [1]; + array [k++] = rotation [2]; + array [k++] = rotation [3]; + array [k++] = rotation [4]; + array [k++] = rotation [5]; + array [k++] = rotation [6]; + array [k++] = rotation [7]; + array [k++] = rotation [8]; + } + + for (let length = array .length; k < length; ++ k) + array [k] = 0; + + gl .uniformMatrix3fv (location, false, array); + return; + } + case Base_X3DConstants .MFString: + { + return; + } + case Base_X3DConstants .MFVec2d: + case Base_X3DConstants .MFVec2f: + { + const array = location .array; + + for (var i = 0, k = 0, length = field .length; i < length; ++ i) + { + const vector = field [i]; + + array [k++] = vector .x; + array [k++] = vector .y; + } + + for (let length = array .length; k < length; ++ k) + array [k] = 0; + + gl .uniform2fv (location, array); + return; + } + case Base_X3DConstants .MFVec3d: + case Base_X3DConstants .MFVec3f: + { + const array = location .array; + + for (var i = 0, k = 0, length = field .length; i < length; ++ i) + { + const vector = field [i]; + + array [k++] = vector .x; + array [k++] = vector .y; + array [k++] = vector .z; + } + + for (let length = array .length; k < length; ++ k) + array [k] = 0; + + gl .uniform3fv (location, array); + return; + } + case Base_X3DConstants .MFVec4d: + case Base_X3DConstants .MFVec4f: + { + const array = location .array; + + for (var i = 0, k = 0, length = field .length; i < length; ++ i) + { + const vector = field [i]; + + array [k++] = vector .x; + array [k++] = vector .y; + array [k++] = vector .z; + array [k++] = vector .w; + } + + for (let length = array .length; k < length; ++ k) + array [k] = 0; + + gl .uniform4fv (location, array); + return; + } + } + }; + })(), + getImagesLength (field) + { + const images = field .getValue (); + + let length = 3 * images .length; + + for (const image of images) + length += image .array .length; + + return length; + }, + getLocationLength (gl, program, field) + { + const name = field .getName (); + + for (let i = 0; ; ++ i) + { + const location = gl .getUniformLocation (program, name + "[" + i + "]"); + + if (! location) + return i; + } + }, + hasFog (fogNode) + { + if (this .fogNode === fogNode) + return true; + + this .fogNode = fogNode; + + return false; + }, + hasLight (i, lightNode) + { + if (this .lightNodes [i] === lightNode) + return true; + + this .lightNodes [i] = lightNode; + + return false; + }, + hasTextureProjector (i, textureProjectorNode) + { + if (this .projectiveTextureNodes [i] === textureProjectorNode) + return true; + + this .projectiveTextureNodes [i] = textureProjectorNode; + + return false; + }, + setClipPlanes (gl, clipPlanes) + { + this .numClipPlanes = 0; + + for (const clipPlane of clipPlanes) + clipPlane .setShaderUniforms (gl, this); + }, + setUniforms: (() => + { + const normalMatrix = new Float32Array (9); + + return function (gl, geometryContext, renderContext, front = true) + { + const { renderObject, fogNode, appearanceNode, humanoidNode, modelViewMatrix } = renderContext; + + const + stylePropertiesNode = appearanceNode .getStyleProperties (geometryContext .geometryType), + materialNode = front ? appearanceNode .getMaterial () : appearanceNode .getBackMaterial (), + textureNode = renderContext .textureNode || appearanceNode .getTexture (); + + // Set global uniforms. + + if (this .renderCount !== renderObject .getRenderCount ()) + { + this .renderCount = renderObject .getRenderCount (); + + // Set viewport. + + gl .uniform4iv (this .x3d_Viewport, renderObject .getViewportArray ()); + + // Set projection matrix. + + gl .uniformMatrix4fv (this .x3d_ProjectionMatrix, false, renderObject .getProjectionMatrixArray ()); + gl .uniformMatrix4fv (this .x3d_CameraSpaceMatrix, false, renderObject .getCameraSpaceMatrixArray ()); + + // Fog + + this .fogNode = null; + + // Set global lights and global texture projectors. + + this .numLights = 0; + this .numProjectiveTextures = 0; + this .lightNodes .length = 0; + this .projectiveTextureNodes .length = 0; + + const globalObjects = renderObject .getGlobalObjects (); + + for (const globalObject of globalObjects) + globalObject .setShaderUniforms (gl, this, renderObject); + + this .numGlobalLights = this .numLights; + this .numGlobalProjectiveTextures = this .numProjectiveTextures; + + // Logarithmic depth buffer support + + const viewpoint = renderObject .getViewpoint (); + + if (this .logarithmicDepthBuffer || viewpoint .getLogarithmicDepthBuffer ()) + { + const navigationInfo = renderObject .getNavigationInfo (); + + gl .uniform1f (this .x3d_LogarithmicFarFactor1_2, 1 / Math .log2 (navigationInfo .getFarValue (viewpoint) + 1)); + } + } + + // Model view matrix + + gl .uniformMatrix4fv (this .x3d_ModelViewMatrix, false, modelViewMatrix); + + // Normal matrix + + if (geometryContext .hasNormals) + { + normalMatrix [0] = modelViewMatrix [0]; normalMatrix [3] = modelViewMatrix [1]; normalMatrix [6] = modelViewMatrix [ 2]; + normalMatrix [1] = modelViewMatrix [4]; normalMatrix [4] = modelViewMatrix [5]; normalMatrix [7] = modelViewMatrix [ 6]; + normalMatrix [2] = modelViewMatrix [8]; normalMatrix [5] = modelViewMatrix [9]; normalMatrix [8] = modelViewMatrix [10]; + + Numbers_Matrix3 .prototype .inverse .call (normalMatrix); + + gl .uniformMatrix3fv (this .x3d_NormalMatrix, false, normalMatrix); + } + + // Fog + + fogNode ?.setShaderUniforms (gl, this); + + // Clip planes and local lights + + this .numClipPlanes = 0; + this .numLights = this .numGlobalLights; + this .numProjectiveTextures = this .numGlobalProjectiveTextures; + + for (const localObject of renderContext .localObjects) + localObject .setShaderUniforms (gl, this, renderObject); + + // Alpha + + gl .uniform1f (this .x3d_AlphaCutoff, appearanceNode .getAlphaCutoff ()); + + // Style Properties + + stylePropertiesNode ?.setShaderUniforms (gl, this); + + // Material + + materialNode .setShaderUniforms (gl, this, renderObject, appearanceNode .getTextureTransformMapping (), geometryContext .getTextureCoordinateMapping (), front); + + // Texture + + textureNode ?.setShaderUniforms (gl, this, renderObject); + + appearanceNode .getTextureTransform () .setShaderUniforms (gl, this); + geometryContext .getTextureCoordinate () .setShaderUniforms (gl, this); + + // Skinning + + humanoidNode ?.setShaderUniforms (gl, this); + }; + })(), + enable (gl) + { + gl .useProgram (this .getProgram ()); + + for (const location of this .textures) + { + const + texture = location .texture, + textureUnit = this .getBrowser () .getTextureUnit (texture .getTextureType ()); + + if (textureUnit === undefined) + { + console .warn ("Not enough combined texture units for uniform variable '" + location .name + "' available."); + return; + } + + gl .activeTexture (gl .TEXTURE0 + textureUnit); + gl .bindTexture (texture .getTarget (), texture .getTexture ()); + gl .uniform1i (location, textureUnit); + } + }, + enableFloatAttrib (gl, name, buffer, components, stride, offset) + { + const location = gl .getAttribLocation (this .getProgram (), name); + + if (location === -1) + return; + + gl .bindBuffer (gl .ARRAY_BUFFER, buffer); + gl .enableVertexAttribArray (location); + gl .vertexAttribPointer (location, components, gl .FLOAT, false, stride, offset); + }, + enableMatrix3Attrib (gl, name, buffer, stride, offset) + { + const location0 = gl .getAttribLocation (this .getProgram (), name); + + if (location0 === -1) + return; + + stride = stride || 36; + + gl .bindBuffer (gl .ARRAY_BUFFER, buffer); + + for (let i = 0; i < 3; ++ i) + { + const location = location0 + i; + + gl .enableVertexAttribArray (location); + gl .vertexAttribPointer (location, 3, gl .FLOAT, false, stride, offset + 12 * i); + } + }, + enableMatrix4Attrib (gl, name, buffer, stride, offset) + { + const location0 = gl .getAttribLocation (this .getProgram (), name); + + if (location0 === -1) + return; + + stride = stride || 64; + + gl .bindBuffer (gl .ARRAY_BUFFER, buffer); + + for (let i = 0; i < 4; ++ i) + { + const location = location0 + i; + + gl .enableVertexAttribArray (location); + gl .vertexAttribPointer (location, 4, gl .FLOAT, false, stride, offset + 16 * i); + } + }, + enableCoordIndexAttribute (gl, buffer, stride, offset) + { + const location = this .x3d_CoordIndex; + + gl .bindBuffer (gl .ARRAY_BUFFER, buffer); + gl .enableVertexAttribArray (location); + gl .vertexAttribPointer (location, 1, gl .FLOAT, false, stride, offset); // gl .UNSIGNED_INT + }, + enableLineStippleAttribute (gl, buffer, stride, offset) + { + const location = this .x3d_LineStipple; + + gl .bindBuffer (gl .ARRAY_BUFFER, buffer); + gl .enableVertexAttribArray (location); + gl .vertexAttribPointer (location, 3, gl .FLOAT, false, stride, offset); + }, + enableFogDepthAttribute (gl, buffer, stride, offset) + { + const location = this .x3d_FogDepth; + + gl .bindBuffer (gl .ARRAY_BUFFER, buffer); + gl .enableVertexAttribArray (location); + gl .vertexAttribPointer (location, 1, gl .FLOAT, false, stride, offset); + }, + enableColorAttribute (gl, buffer, stride, offset) + { + const location = this .x3d_Color; + + gl .bindBuffer (gl .ARRAY_BUFFER, buffer); + gl .enableVertexAttribArray (location); + gl .vertexAttribPointer (location, 4, gl .FLOAT, false, stride, offset); + }, + colorAttributeDivisor (gl, divisor) + { + gl .vertexAttribDivisor (this .x3d_Color, divisor); + }, + enableTexCoordAttribute (gl, buffers, stride, offset) + { + for (const [i, location] of this .x3d_TexCoord) + { + gl .bindBuffer (gl .ARRAY_BUFFER, buffers [i]); + gl .enableVertexAttribArray (location); + gl .vertexAttribPointer (location, 4, gl .FLOAT, false, stride, offset); + } + }, + texCoordAttributeDivisor (gl, divisor) + { + for (const [i, location] of this .x3d_TexCoord) + { + gl .vertexAttribDivisor (location, divisor); + } + }, + enableNormalAttribute (gl, buffer, stride, offset) + { + const location = this .x3d_Normal; + + gl .bindBuffer (gl .ARRAY_BUFFER, buffer); + gl .enableVertexAttribArray (location); + gl .vertexAttribPointer (location, 3, gl .FLOAT, false, stride, offset); + }, + normalAttributeDivisor (gl, divisor) + { + gl .vertexAttribDivisor (this .x3d_Normal, divisor); + }, + enableVertexAttribute (gl, buffer, stride, offset) + { + const location = this .x3d_Vertex; + + gl .bindBuffer (gl .ARRAY_BUFFER, buffer); + gl .enableVertexAttribArray (location); + gl .vertexAttribPointer (location, 4, gl .FLOAT, false, stride, offset); + }, + vertexAttributeDivisor (gl, divisor) + { + gl .vertexAttribDivisor (this .x3d_Vertex, divisor); + }, + enableParticleAttribute (gl, buffer, stride, offset, divisor) + { + const location = this .x3d_Particle; + + gl .bindBuffer (gl .ARRAY_BUFFER, buffer); + gl .enableVertexAttribArray (location); + gl .vertexAttribPointer (location, 4, gl .FLOAT, false, stride, offset); + gl .vertexAttribDivisor (location, divisor); + }, + enableParticleMatrixAttribute (gl, buffer, stride, offset, divisor) + { + const location0 = this .x3d_ParticleMatrix; + + stride = stride || 64; + + gl .bindBuffer (gl .ARRAY_BUFFER, buffer); + + for (let i = 0; i < 4; ++ i) + { + const location = location0 + i; + + gl .enableVertexAttribArray (location); + gl .vertexAttribPointer (location, 4, gl .FLOAT, false, stride, offset + 16 * i); + gl .vertexAttribDivisor (location, divisor); + } + }, + getProgramInfo () + { + function cmp (lhs, rhs) { return lhs < rhs ? -1 : lhs > rhs ? 1 : 0; } + + const + program = this .getProgram (), + gl = this .getBrowser () .getContext (); + + const + result = { + attributes: [ ], + uniforms: [ ], + attributeCount: 0, + uniformCount: 0, + }, + activeUniforms = gl .getProgramParameter (program, gl .ACTIVE_UNIFORMS), + activeAttributes = gl .getProgramParameter (program, gl .ACTIVE_ATTRIBUTES); + + // Taken from the WebGl spec: + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14 + const enums = { + 0x8B50: 'vec2', + 0x8B51: 'vec3', + 0x8B52: 'vec4', + 0x8B53: 'ivec2', + 0x8B54: 'ivec3', + 0x8B55: 'ivec4', + 0x8B56: 'bool', + 0x8B57: 'bvec2', + 0x8B58: 'bvec3', + 0x8B59: 'bvec4', + 0x8B5A: 'mat2', + 0x8B5B: 'mat3', + 0x8B5C: 'mat4', + 0x8B5E: 'sampler2D', + 0x8B60: 'samplerCube', + 0x1400: 'byte', + 0x1401: 'ubyte', + 0x1402: 'short', + 0x1403: 'ushort', + 0x1404: 'int', + 0x1405: 'uint', + 0x1406: 'float', + }; + + // Loop through active uniforms + for (let i = 0; i < activeUniforms; ++ i) + { + const uniform = gl .getActiveUniform (program, i); + uniform .typeName = enums [uniform.type]; + result .uniforms .push (Object .assign ({ }, uniform)); + result .uniformCount += uniform .size; + } + + // Loop through active attributes + for (let i = 0; i < activeAttributes; ++ i) + { + const attribute = gl .getActiveAttrib (program, i); + attribute .typeName = enums [attribute .type]; + result .attributes .push (Object .assign ({ }, attribute)); + result .attributeCount += attribute .size; + } + + result .uniforms .sort ((a, b) => cmp (a .name, b .name)); + result .attributes .sort ((a, b) => cmp (a .name, b .name)); + + return result; + }, + printProgramInfo () + { + const programInfo = this .getProgramInfo (); + + console .log (this .getName ()); + console .table (programInfo .attributes); + console .log (this .getName (), "attributeCount", programInfo .attributeCount); + console .log (this .getName ()); + console .table (programInfo .uniforms); + console .log (this .getName (), "uniformCount", programInfo .uniformCount); + }, + dispose () { }, +}); + +Object .defineProperties (X3DProgrammableShaderObject, +{ + typeName: + { + value: "X3DProgrammableShaderObject", + enumerable: true, + }, + componentName: + { + value: "Shaders", + enumerable: true, + }, +}); + +const X3DProgrammableShaderObject_default_ = X3DProgrammableShaderObject; +; + +x_ite_Namespace .add ("X3DProgrammableShaderObject", "x_ite/Components/Shaders/X3DProgrammableShaderObject", X3DProgrammableShaderObject_default_); +/* harmony default export */ const Shaders_X3DProgrammableShaderObject = (X3DProgrammableShaderObject_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shaders/ComposedShader.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + +function ComposedShader (executionContext) +{ + Shaders_X3DShaderNode .call (this, executionContext); + Shaders_X3DProgrammableShaderObject .call (this, executionContext); + + this .addType (Base_X3DConstants .ComposedShader); + + this .loadSensor = new Networking_LoadSensor (executionContext); + this .transformFeedbackVaryings = [ ]; +} + +Object .assign (Object .setPrototypeOf (ComposedShader .prototype, Shaders_X3DShaderNode .prototype), + Shaders_X3DProgrammableShaderObject .prototype, +{ + wireframe: false, + initialize () + { + Shaders_X3DShaderNode .prototype .initialize .call (this); + Shaders_X3DProgrammableShaderObject .prototype .initialize .call (this); + + // https://www.web3d.org/documents/specifications/19775-1/V4.0/Part01/shaders_glsl.html#relinkingprograms + this ._activate .addInterest ("set_activate__", this); + + this ._parts .addFieldInterest (this .loadSensor ._children); + + this .loadSensor ._isLoaded .addInterest ("connectLoaded", this); + this .loadSensor ._children = this ._parts; + this .loadSensor .setPrivate (true); + this .loadSensor .setup (); + + if (this .loadSensor ._isLoaded .getValue ()) + this .set_loaded__ (); + else + this .connectLoaded (); + }, + connectLoaded () + { + this .loadSensor ._isLoaded .removeInterest ("connectLoaded", this); + this .loadSensor ._isLoaded .addInterest ("set_loaded__", this); + }, + addUserDefinedField (accessType, name, field) + { + const shaderFields = this .isInitialized () && this .isValid (); + + if (shaderFields) + this .removeShaderFields (); + + Shaders_X3DShaderNode .prototype .addUserDefinedField .call (this, accessType, name, field); + + if (shaderFields) + this .addShaderFields (); + }, + removeUserDefinedField (name) + { + const shaderFields = this .isInitialized () && this .isValid (); + + if (shaderFields) + this .removeShaderFields (); + + Shaders_X3DShaderNode .prototype .removeUserDefinedField .call (this, name); + + if (shaderFields) + this .addShaderFields (); + }, + setTransformFeedbackVaryings (value) + { + this .transformFeedbackVaryings = value; + }, + getProgram () + { + return this .program; + }, + set_activate__ () + { + if (!this ._activate .getValue ()) + return; + + this .set_loaded__ (); + }, + set_loaded__ () + { + if (this .loadSensor ._isLoaded .getValue () && this ._language .getValue () === "GLSL") + { + const + gl = this .getBrowser () .getContext (), + program = gl .createProgram (); + + if (this .isValid ()) + this .removeShaderFields (); + + gl .deleteProgram (this .program); + + this .program = program; + + for (const node of this ._parts) + { + const partNode = Base_X3DCast (Base_X3DConstants .ShaderPart, node); + + if (partNode ?.getShader ()) + gl .attachShader (program, partNode .getShader ()); + } + + if (this .transformFeedbackVaryings .length) + gl .transformFeedbackVaryings (program, this .transformFeedbackVaryings, gl .INTERLEAVED_ATTRIBS); + + gl .linkProgram (program); + + if (gl .getProgramParameter (program, gl .LINK_STATUS)) + { + this .setValid (true); + this .getDefaultUniformsAndAttributes (); + this .addShaderFields (); + } + else + { + this .setValid (false); + + if (this ._parts .length) + { + console .warn ("Couldn't initialize " + this .getTypeName () + " '" + this .getName () + "': " + gl .getProgramInfoLog (program)); + } + } + } + else + { + this .setValid (false); + } + }, + dispose () + { + Shaders_X3DProgrammableShaderObject .prototype .dispose .call (this); + Shaders_X3DShaderNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (ComposedShader, +{ + typeName: + { + value: "ComposedShader", + enumerable: true, + }, + componentName: + { + value: "Shaders", + enumerable: true, + }, + containerField: + { + value: "shaders", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "activate", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isSelected", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isValid", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "language", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "parts", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const ComposedShader_default_ = ComposedShader; +; + +x_ite_Namespace .add ("ComposedShader", "x_ite/Components/Shaders/ComposedShader", ComposedShader_default_); +/* harmony default export */ const Shaders_ComposedShader = (ComposedShader_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shaders/X3DVertexAttributeNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function X3DVertexAttributeNode (executionContext) +{ + Rendering_X3DGeometricPropertyNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DVertexAttributeNode); + + this .addChildObjects (Base_X3DConstants .outputOnly, "attribute_changed", new x_ite_Fields .SFTime ()); +} + +Object .assign (Object .setPrototypeOf (X3DVertexAttributeNode .prototype, Rendering_X3DGeometricPropertyNode .prototype), +{ + initialize () + { + Rendering_X3DGeometricPropertyNode .prototype .initialize .call (this); + + this ._name .addInterest ("set_attribute__", this); + }, + set_attribute__ () + { + this ._attribute_changed = this .getBrowser () .getCurrentTime (); + }, +}); + +Object .defineProperties (X3DVertexAttributeNode, +{ + typeName: + { + value: "X3DVertexAttributeNode", + enumerable: true, + }, + componentName: + { + value: "Shaders", + enumerable: true, + }, +}); + +const X3DVertexAttributeNode_default_ = X3DVertexAttributeNode; +; + +x_ite_Namespace .add ("X3DVertexAttributeNode", "x_ite/Components/Shaders/X3DVertexAttributeNode", X3DVertexAttributeNode_default_); +/* harmony default export */ const Shaders_X3DVertexAttributeNode = (X3DVertexAttributeNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shaders/FloatVertexAttribute.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function FloatVertexAttribute (executionContext) +{ + Shaders_X3DVertexAttributeNode .call (this, executionContext); + + this .addType (Base_X3DConstants .FloatVertexAttribute); +} + +Object .assign (Object .setPrototypeOf (FloatVertexAttribute .prototype, Shaders_X3DVertexAttributeNode .prototype), +{ + initialize () + { + Shaders_X3DVertexAttributeNode .prototype .initialize .call (this); + + this ._numComponents .addInterest ("set_numComponents__", this); + this ._numComponents .addInterest ("set_attribute__", this); + this ._value .addInterest ("set_value__", this); + + this .set_numComponents__ (); + this .set_value__ (); + }, + set_numComponents__ () + { + this .numComponents = Math_Algorithm .clamp (this ._numComponents .getValue (), 1, 4); + }, + set_value__ () + { + this .value = this ._value .getValue (); + this .length = this ._value .length; + }, + addValue (index, array) + { + const value = this .value; + + let + first = index * this .numComponents, + last = first + this .numComponents; + + if (last <= this .length) + { + for (; first < last; ++ first) + array .push (value [first]); + } + else if (this .numComponents <= this .length) + { + last = value .length; + first = last - this .numComponents; + + for (; first < last; ++ first) + array .push (value [first]); + } + else + { + for (; first < last; ++ first) + array .push (0); + } + }, + enable (gl, shaderNode, buffer) + { + shaderNode .enableFloatAttrib (gl, this ._name .getValue (), buffer, this .numComponents, 0, 0); + }, +}); + +Object .defineProperties (FloatVertexAttribute, +{ + typeName: + { + value: "FloatVertexAttribute", + enumerable: true, + }, + componentName: + { + value: "Shaders", + enumerable: true, + }, + containerField: + { + value: "attrib", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "name", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "numComponents", new x_ite_Fields .SFInt32 (4)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "value", new x_ite_Fields .MFFloat ()), + ]), + enumerable: true, + }, +}); + +const FloatVertexAttribute_default_ = FloatVertexAttribute; +; + +x_ite_Namespace .add ("FloatVertexAttribute", "x_ite/Components/Shaders/FloatVertexAttribute", FloatVertexAttribute_default_); +/* harmony default export */ const Shaders_FloatVertexAttribute = (FloatVertexAttribute_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shaders/Matrix3VertexAttribute.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function Matrix3VertexAttribute (executionContext) +{ + Shaders_X3DVertexAttributeNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Matrix3VertexAttribute); +} + +Object .assign (Object .setPrototypeOf (Matrix3VertexAttribute .prototype, Shaders_X3DVertexAttributeNode .prototype), +{ + initialize () + { + Shaders_X3DVertexAttributeNode .prototype .initialize .call (this); + + this ._value .addInterest ("set_value__", this); + + this .set_value__ (); + }, + set_value__ () + { + this .value = this ._value .getValue (); + this .length = this ._value .length; + }, + addValue (index, array) + { + if (index < this .length) + { + const value = this .value; + + for (let i = index * 9, l = i + 9; i < l; ++ i) + array .push (value [i]); + } + else if (this .length) + { + const value = this .value; + + index = this .length - 1; + + for (let i = index * 9, l = i + 9; i < l; ++ i) + array .push (value [i]); + } + else + { + const value = Numbers_Matrix3 .Identity; + + for (let i = 0; i < 9; ++ i) + array .push (value [i]); + } + }, + enable (gl, shaderNode, buffer) + { + shaderNode .enableMatrix3Attrib (gl, this ._name .getValue (), buffer, 0, 0); + }, +}); + +Object .defineProperties (Matrix3VertexAttribute, +{ + typeName: + { + value: "Matrix3VertexAttribute", + enumerable: true, + }, + componentName: + { + value: "Shaders", + enumerable: true, + }, + containerField: + { + value: "attrib", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "name", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "value", new x_ite_Fields .MFMatrix3f ()), + ]), + enumerable: true, + }, +}); + +const Matrix3VertexAttribute_default_ = Matrix3VertexAttribute; +; + +x_ite_Namespace .add ("Matrix3VertexAttribute", "x_ite/Components/Shaders/Matrix3VertexAttribute", Matrix3VertexAttribute_default_); +/* harmony default export */ const Shaders_Matrix3VertexAttribute = (Matrix3VertexAttribute_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shaders/Matrix4VertexAttribute.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function Matrix4VertexAttribute (executionContext) +{ + Shaders_X3DVertexAttributeNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Matrix4VertexAttribute); +} + +Object .assign (Object .setPrototypeOf (Matrix4VertexAttribute .prototype, Shaders_X3DVertexAttributeNode .prototype), +{ + initialize () + { + Shaders_X3DVertexAttributeNode .prototype .initialize .call (this); + + this ._value .addInterest ("set_value__", this); + + this .set_value__ (); + }, + set_value__ () + { + this .value = this ._value .getValue (); + this .length = this ._value .length; + }, + addValue (index, array) + { + if (index < this .length) + { + const value = this .value; + + for (let i = index * 16, l = i + 16; i < l; ++ i) + array .push (value [i]); + } + else if (this .length) + { + const value = this .value; + + index = this .length - 1; + + for (let i = index * 16, l = i + 16; i < l; ++ i) + array .push (value [i]); + } + else + { + const value = Matrix4 .Identity; + + for (let i = 0; i < 16; ++ i) + array .push (value [i]); + } + }, + enable (gl, shaderNode, buffer) + { + shaderNode .enableMatrix4Attrib (gl, this ._name .getValue (), buffer, 0, 0); + }, +}); + +Object .defineProperties (Matrix4VertexAttribute, +{ + typeName: + { + value: "Matrix4VertexAttribute", + enumerable: true, + }, + componentName: + { + value: "Shaders", + enumerable: true, + }, + containerField: + { + value: "attrib", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "name", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "value", new x_ite_Fields .MFMatrix4f ()), + ]), + enumerable: true, + }, +}); + +const Matrix4VertexAttribute_default_ = Matrix4VertexAttribute; +; + +x_ite_Namespace .add ("Matrix4VertexAttribute", "x_ite/Components/Shaders/Matrix4VertexAttribute", Matrix4VertexAttribute_default_); +/* harmony default export */ const Shaders_Matrix4VertexAttribute = (Matrix4VertexAttribute_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shaders/PackagedShader.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +function PackagedShader (executionContext) +{ + Shaders_X3DShaderNode .call (this, executionContext); + Networking_X3DUrlObject .call (this, executionContext); + Shaders_X3DProgrammableShaderObject .call (this, executionContext); + + this .addType (Base_X3DConstants .PackagedShader); +} + +Object .assign (Object .setPrototypeOf (PackagedShader .prototype, Shaders_X3DShaderNode .prototype), + Networking_X3DUrlObject .prototype, + Shaders_X3DProgrammableShaderObject .prototype, +{ + getSourceText () + { + return this ._url; + }, + requestImmediateLoad (cache = true) + { }, + initialize () + { + Shaders_X3DShaderNode .prototype .initialize .call (this); + Networking_X3DUrlObject .prototype .initialize .call (this); + Shaders_X3DProgrammableShaderObject .prototype .initialize .call (this); + }, + dispose () + { + Shaders_X3DProgrammableShaderObject .prototype .dispose .call (this); + Networking_X3DUrlObject .prototype .dispose .call (this); + Shaders_X3DShaderNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (PackagedShader, +{ + typeName: + { + value: "PackagedShader", + enumerable: true, + }, + componentName: + { + value: "Shaders", + enumerable: true, + }, + containerField: + { + value: "shaders", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "activate", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isSelected", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isValid", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "language", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "load", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "url", new x_ite_Fields .MFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoRefresh", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoRefreshTimeLimit", new x_ite_Fields .SFTime (3600)), + ]), + enumerable: true, + }, +}); + +const PackagedShader_default_ = PackagedShader; +; + +x_ite_Namespace .add ("PackagedShader", "x_ite/Components/Shaders/PackagedShader", PackagedShader_default_); +/* harmony default export */ const Shaders_PackagedShader = (PackagedShader_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shaders/ProgramShader.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function ProgramShader (executionContext) +{ + Shaders_X3DShaderNode .call (this, executionContext); + + this .addType (Base_X3DConstants .ProgramShader); +} + +Object .setPrototypeOf (ProgramShader .prototype, Shaders_X3DShaderNode .prototype); + +Object .defineProperties (ProgramShader, +{ + typeName: + { + value: "ProgramShader", + enumerable: true, + }, + componentName: + { + value: "Shaders", + enumerable: true, + }, + containerField: + { + value: "shaders", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOnly, "activate", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isSelected", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isValid", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "language", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "programs", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const ProgramShader_default_ = ProgramShader; +; + +x_ite_Namespace .add ("ProgramShader", "x_ite/Components/Shaders/ProgramShader", ProgramShader_default_); +/* harmony default export */ const Shaders_ProgramShader = (ProgramShader_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/Types.glsl.js +const Types_glsl_default_ = /* glsl */ `#if defined(X3D_FOG) +struct x3d_FogParameters{mediump int type;mediump vec3 color;mediump float visibilityRange;mediump mat3 matrix;}; +#endif +#if defined(X3D_LIGHTING) +struct x3d_LightSourceParameters{mediump int type;mediump vec3 color;mediump float intensity;mediump float ambientIntensity;mediump vec3 attenuation;mediump vec3 location;mediump vec3 direction;mediump float radius;mediump float beamWidth;mediump float cutOffAngle;mediump mat3 matrix; +#if defined(X3D_SHADOWS) +mediump vec3 shadowColor;mediump float shadowIntensity;mediump float shadowBias;mediump mat4 shadowMatrix;mediump int shadowMapSize; +#endif +}; +#endif +#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES) +struct x3d_PointPropertiesParameters{mediump float pointSizeScaleFactor;mediump float pointSizeMinValue;mediump float pointSizeMaxValue;mediump vec3 attenuation;}; +#endif +#if defined(X3D_GEOMETRY_1D)&&defined(X3D_STYLE_PROPERTIES) +struct x3d_LinePropertiesParameters{mediump int linetype;mediump float lineStippleScale; +#if defined(X3D_STYLE_PROPERTIES_TEXTURE) +sampler2D texture; +#endif +}; +#endif +#if(defined(X3D_GEOMETRY_2D)||defined(X3D_GEOMETRY_3D))&&defined(X3D_STYLE_PROPERTIES) +struct x3d_FillPropertiesParameters{bool filled;bool hatched;mediump vec3 hatchColor; +#if defined(X3D_STYLE_PROPERTIES_TEXTURE) +sampler2D texture; +#endif +mediump float scale;}; +#endif +#if defined(X3D_UNLIT_MATERIAL) +struct x3d_UnlitMaterialParameters{mediump vec3 emissiveColor;mediump float normalScale;mediump float transparency;}; +#endif +#if defined(X3D_MATERIAL) +struct x3d_MaterialParameters{mediump float ambientIntensity;mediump vec3 diffuseColor;mediump vec3 specularColor;mediump vec3 emissiveColor;mediump float shininess;mediump float occlusionStrength;mediump float normalScale;mediump float transparency;}; +#endif +#if defined(X3D_PHYSICAL_MATERIAL) +struct x3d_PhysicalMaterialParameters{mediump vec3 baseColor;mediump vec3 emissiveColor;mediump float metallic;mediump float roughness;mediump float occlusionStrength;mediump float normalScale;mediump float transparency;}; +#endif +#if defined(X3D_AMBIENT_TEXTURE) +struct x3d_AmbientTextureParameters{mediump int textureTransformMapping;mediump int textureCoordinateMapping; +#if defined(X3D_AMBIENT_TEXTURE_2D) +mediump sampler2D texture2D; +#endif +#if defined(X3D_AMBIENT_TEXTURE_3D)&&__VERSION__!=100 +mediump sampler3D texture3D; +#endif +#if defined(X3D_AMBIENT_TEXTURE_CUBE) +mediump samplerCube textureCube; +#endif +}; +#endif +#if defined(X3D_DIFFUSE_TEXTURE) +struct x3d_DiffuseTextureParameters{mediump int textureTransformMapping;mediump int textureCoordinateMapping; +#if defined(X3D_DIFFUSE_TEXTURE_2D) +mediump sampler2D texture2D; +#endif +#if defined(X3D_DIFFUSE_TEXTURE_3D)&&__VERSION__!=100 +mediump sampler3D texture3D; +#endif +#if defined(X3D_DIFFUSE_TEXTURE_CUBE) +mediump samplerCube textureCube; +#endif +}; +#endif +#if defined(X3D_SPECULAR_TEXTURE) +struct x3d_SpecularTextureParameters{mediump int textureTransformMapping;mediump int textureCoordinateMapping; +#if defined(X3D_SPECULAR_TEXTURE_2D) +mediump sampler2D texture2D; +#endif +#if defined(X3D_SPECULAR_TEXTURE_3D)&&__VERSION__!=100 +mediump sampler3D texture3D; +#endif +#if defined(X3D_SPECULAR_TEXTURE_CUBE) +mediump samplerCube textureCube; +#endif +}; +#endif +#if defined(X3D_EMISSIVE_TEXTURE) +struct x3d_EmissiveTextureParameters{mediump int textureTransformMapping;mediump int textureCoordinateMapping; +#if defined(X3D_EMISSIVE_TEXTURE_2D) +mediump sampler2D texture2D; +#endif +#if defined(X3D_EMISSIVE_TEXTURE_3D)&&__VERSION__!=100 +mediump sampler3D texture3D; +#endif +#if defined(X3D_EMISSIVE_TEXTURE_CUBE) +mediump samplerCube textureCube; +#endif +}; +#endif +#if defined(X3D_SHININESS_TEXTURE) +struct x3d_ShininessTextureParameters{mediump int textureTransformMapping;mediump int textureCoordinateMapping; +#if defined(X3D_SHININESS_TEXTURE_2D) +mediump sampler2D texture2D; +#endif +#if defined(X3D_SHININESS_TEXTURE_3D)&&__VERSION__!=100 +mediump sampler3D texture3D; +#endif +#if defined(X3D_SHININESS_TEXTURE_CUBE) +mediump samplerCube textureCube; +#endif +}; +#endif +#if defined(X3D_BASE_TEXTURE) +struct x3d_BaseTextureParameters{mediump int textureTransformMapping;mediump int textureCoordinateMapping; +#if defined(X3D_BASE_TEXTURE_2D) +mediump sampler2D texture2D; +#endif +#if defined(X3D_BASE_TEXTURE_3D)&&__VERSION__!=100 +mediump sampler3D texture3D; +#endif +#if defined(X3D_BASE_TEXTURE_CUBE) +mediump samplerCube textureCube; +#endif +}; +#endif +#if defined(X3D_METALLIC_ROUGHNESS_TEXTURE) +struct x3d_MetallicRoughnessTextureParameters{mediump int textureTransformMapping;mediump int textureCoordinateMapping; +#if defined(X3D_METALLIC_ROUGHNESS_TEXTURE_2D) +mediump sampler2D texture2D; +#endif +#if defined(X3D_METALLIC_ROUGHNESS_TEXTURE_3D)&&__VERSION__!=100 +mediump sampler3D texture3D; +#endif +#if defined(X3D_METALLIC_ROUGHNESS_TEXTURE_CUBE) +mediump samplerCube textureCube; +#endif +}; +#endif +#if defined(X3D_OCCLUSION_TEXTURE) +struct x3d_OcclusionTextureParameters{mediump int textureTransformMapping;mediump int textureCoordinateMapping; +#if defined(X3D_OCCLUSION_TEXTURE_2D) +mediump sampler2D texture2D; +#endif +#if defined(X3D_OCCLUSION_TEXTURE_3D)&&__VERSION__!=100 +mediump sampler3D texture3D; +#endif +#if defined(X3D_OCCLUSION_TEXTURE_CUBE) +mediump samplerCube textureCube; +#endif +}; +#endif +#if defined(X3D_NORMAL_TEXTURE) +struct x3d_NormalTextureParameters{mediump int textureTransformMapping;mediump int textureCoordinateMapping; +#if defined(X3D_NORMAL_TEXTURE_2D) +mediump sampler2D texture2D; +#endif +#if defined(X3D_NORMAL_TEXTURE_3D)&&__VERSION__!=100 +mediump sampler3D texture3D; +#endif +#if defined(X3D_NORMAL_TEXTURE_CUBE) +mediump samplerCube textureCube; +#endif +}; +#endif +#if defined(X3D_MULTI_TEXTURING) +struct x3d_MultiTextureParameters{mediump int mode;mediump int alphaMode;mediump int source;mediump int function;}; +#endif +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +struct x3d_TextureCoordinateGeneratorParameters{mediump int mode;mediump float parameter[6];}; +#endif +` +; + +x_ite_Namespace .add ("Types.glsl", "assets/shaders/Types.glsl", Types_glsl_default_); +/* harmony default export */ const Types_glsl = (Types_glsl_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Texturing/ModeType.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +let ModeType_i = 0; + +const ModeType = +{ + REPLACE: ModeType_i ++, + MODULATE: ModeType_i ++, + MODULATE2X: ModeType_i ++, + MODULATE4X: ModeType_i ++, + ADD: ModeType_i ++, + ADDSIGNED: ModeType_i ++, + ADDSIGNED2X: ModeType_i ++, + ADDSMOOTH: ModeType_i ++, + SUBTRACT: ModeType_i ++, + BLENDDIFFUSEALPHA: ModeType_i ++, + BLENDTEXTUREALPHA: ModeType_i ++, + BLENDFACTORALPHA: ModeType_i ++, + BLENDCURRENTALPHA: ModeType_i ++, + MODULATEALPHA_ADDCOLOR: ModeType_i ++, + MODULATEINVALPHA_ADDCOLOR: ModeType_i ++, + MODULATEINVCOLOR_ADDALPHA: ModeType_i ++, + DOTPRODUCT3: ModeType_i ++, + SELECTARG1: ModeType_i ++, + SELECTARG2: ModeType_i ++, + OFF: ModeType_i ++, +}; + +const ModeType_default_ = ModeType; +; + +x_ite_Namespace .add ("ModeType", "x_ite/Browser/Texturing/ModeType", ModeType_default_); +/* harmony default export */ const Texturing_ModeType = (ModeType_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Texturing/SourceType.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +let SourceType_i = 0; + +const SourceType = +{ + DEFAULT: SourceType_i ++, + DIFFUSE: SourceType_i ++, + SPECULAR: SourceType_i ++, + FACTOR: SourceType_i ++, +}; + +const SourceType_default_ = SourceType; +; + +x_ite_Namespace .add ("SourceType", "x_ite/Browser/Texturing/SourceType", SourceType_default_); +/* harmony default export */ const Texturing_SourceType = (SourceType_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Texturing/FunctionType.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +let FunctionType_i = 0; + +const FunctionType = +{ + DEFAULT: FunctionType_i ++, + COMPLEMENT: FunctionType_i ++, + ALPHAREPLICATE: FunctionType_i ++, +}; + +const FunctionType_default_ = FunctionType; +; + +x_ite_Namespace .add ("FunctionType", "x_ite/Browser/Texturing/FunctionType", FunctionType_default_); +/* harmony default export */ const Texturing_FunctionType = (FunctionType_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Texturing/TextureCoordinateGeneratorModeType.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +let TextureCoordinateGeneratorModeType_i = 0; + +const TextureCoordinateGeneratorModeType_ModeType = +{ + NONE: TextureCoordinateGeneratorModeType_i ++, + SPHERE: TextureCoordinateGeneratorModeType_i ++, + CAMERASPACENORMAL: TextureCoordinateGeneratorModeType_i ++, + CAMERASPACEPOSITION: TextureCoordinateGeneratorModeType_i ++, + CAMERASPACEREFLECTIONVECTOR: TextureCoordinateGeneratorModeType_i ++, + SPHERE_LOCAL: TextureCoordinateGeneratorModeType_i ++, + COORD: TextureCoordinateGeneratorModeType_i ++, + COORD_EYE: TextureCoordinateGeneratorModeType_i ++, + NOISE: TextureCoordinateGeneratorModeType_i ++, + NOISE_EYE: TextureCoordinateGeneratorModeType_i ++, + SPHERE_REFLECT: TextureCoordinateGeneratorModeType_i ++, + SPHERE_REFLECT_LOCAL: TextureCoordinateGeneratorModeType_i ++, +}; + +const TextureCoordinateGeneratorModeType_default_ = TextureCoordinateGeneratorModeType_ModeType; +; + +x_ite_Namespace .add ("TextureCoordinateGeneratorModeType", "x_ite/Browser/Texturing/TextureCoordinateGeneratorModeType", TextureCoordinateGeneratorModeType_default_); +/* harmony default export */ const TextureCoordinateGeneratorModeType = (TextureCoordinateGeneratorModeType_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Shaders/ShaderSource.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +const ShaderSource = +{ + getSource (gl, browser, source, options) + { + const + COMMENTS = "\\s+|/\\*[\\s\\S]*?\\*/|//.*?\\n", + LINE = "#line\\s+.*?\\n", + IF = "#if\\s+.*?\\n", + ELIF = "#elif\\s+.*?\\n", + IFDEF = "#ifdef\\s+.*?\\n", + IFNDEF = "#ifndef\\s+.*?\\n", + ELSE = "#else.*?\\n", + ENDIF = "#endif.*?\\n", + DEFINE = "#define\\s+(?:[^\\n\\\\]|\\\\[^\\r\\n]|\\\\\\r?\\n)*\\n", + UNDEF = "#undef\\s+.*?\\n", + PRAGMA = "#pragma\\s+.*?\\n", + PREPROCESSOR = LINE + "|" + IF + "|" + ELIF + "|" + IFDEF + "|" + IFNDEF + "|" + ELSE + "|" + ENDIF + "|" + DEFINE + "|" + UNDEF + "|" + PRAGMA, + VERSION = "#version\\s+.*?\\n", + EXTENSION = "#extension\\s+.*?\\n", + ANY = "[\\s\\S]*"; + + const + GLSL = new RegExp ("^((?:" + COMMENTS + "|" + PREPROCESSOR + ")*(?:" + VERSION + ")?(?:" + COMMENTS + "|" + PREPROCESSOR + "|" + EXTENSION + ")*)(" + ANY + ")$"), + match = source .match (GLSL); + + // const + // COMMENTS = "\\s+|/\\*.*?\\*/|//.*?\\n", + // VERSION = "#version\\s+.*?\\n", + // ANY = ".*"; + + // const + // GLSL = new RegExp ("^((?:" + COMMENTS + ")?(?:" + VERSION + ")?)(" + ANY + ")$", "s"), + // match = source .match (GLSL); + + if (! match) + return source; + + // Constants + + let constants = ""; + + constants += "#define X_ITE\n"; + + if (gl .HAS_FEATURE_DEPTH_TEXTURE) + constants += "#define X3D_DEPTH_TEXTURE\n"; + + for (const option of options) + constants += "#define " + option + "\n"; + + // Definitions + + let definitions = ""; + + definitions += "#define x3d_None 0\n"; + + definitions += "#define x3d_Points 0\n"; + definitions += "#define x3d_Lines 1\n"; + definitions += "#define x3d_Geometry2D 2\n"; + definitions += "#define x3d_Geometry3D 3\n"; + + definitions += "#define x3d_MaxClipPlanes " + browser .getMaxClipPlanes () + "\n"; + + definitions += "#define x3d_LinearFog 1\n"; + definitions += "#define x3d_ExponentialFog 2\n"; + definitions += "#define x3d_Exponential2Fog 3\n"; + + definitions += "#define x3d_MaxLights " + browser .getMaxLights () + "\n"; + definitions += "#define x3d_DirectionalLight 1\n"; + definitions += "#define x3d_PointLight 2\n"; + definitions += "#define x3d_SpotLight 3\n"; + + definitions += "#define x3d_MaxTextures " + browser .getMaxTextures () + "\n"; + definitions += "#define x3d_TextureType2D 2\n"; + definitions += "#define x3d_TextureType3D 3\n"; + definitions += "#define x3d_TextureTypeCube 4\n"; + + definitions += "#define x3d_Replace " + Texturing_ModeType .REPLACE + "\n"; + definitions += "#define x3d_Modulate " + Texturing_ModeType .MODULATE + "\n"; + definitions += "#define x3d_Modulate2X " + Texturing_ModeType .MODULATE2X + "\n"; + definitions += "#define x3d_Modulate4X " + Texturing_ModeType .MODULATE4X + "\n"; + definitions += "#define x3d_Add " + Texturing_ModeType .ADD + "\n"; + definitions += "#define x3d_AddSigned " + Texturing_ModeType .ADDSIGNED + "\n"; + definitions += "#define x3d_AddSigned2X " + Texturing_ModeType .ADDSIGNED2X + "\n"; + definitions += "#define x3d_AddSmooth " + Texturing_ModeType .ADDSMOOTH + "\n"; + definitions += "#define x3d_Subtract " + Texturing_ModeType .SUBTRACT + "\n"; + definitions += "#define x3d_BlendDiffuseAlpha " + Texturing_ModeType .BLENDDIFFUSEALPHA + "\n"; + definitions += "#define x3d_BlendTextureAlpha " + Texturing_ModeType .BLENDTEXTUREALPHA + "\n"; + definitions += "#define x3d_BlendFactorAlpha " + Texturing_ModeType .BLENDFACTORALPHA + "\n"; + definitions += "#define x3d_BlendCurrentAlpha " + Texturing_ModeType .BLENDCURRENTALPHA + "\n"; + definitions += "#define x3d_ModulateAlphaAddColor " + Texturing_ModeType .MODULATEALPHA_ADDCOLOR + "\n"; + definitions += "#define x3d_ModulateInvAlphaAddColor " + Texturing_ModeType .MODULATEINVALPHA_ADDCOLOR + "\n"; + definitions += "#define x3d_ModulateInvColorAddAlpha " + Texturing_ModeType .MODULATEINVCOLOR_ADDALPHA + "\n"; + definitions += "#define x3d_DotProduct3 " + Texturing_ModeType .DOTPRODUCT3 + "\n"; + definitions += "#define x3d_SelectArg1 " + Texturing_ModeType .SELECTARG1 + "\n"; + definitions += "#define x3d_SelectArg2 " + Texturing_ModeType .SELECTARG2 + "\n"; + definitions += "#define x3d_Off " + Texturing_ModeType .OFF + "\n"; + + definitions += "#define x3d_Diffuse " + Texturing_SourceType .DIFFUSE + "\n"; + definitions += "#define x3d_Specular " + Texturing_SourceType .SPECULAR + "\n"; + definitions += "#define x3d_Factor " + Texturing_SourceType .FACTOR + "\n"; + + definitions += "#define x3d_Complement " + Texturing_FunctionType .COMPLEMENT + "\n"; + definitions += "#define x3d_AlphaReplicate " + Texturing_FunctionType .ALPHAREPLICATE + "\n"; + + definitions += "#define x3d_Sphere " + TextureCoordinateGeneratorModeType .SPHERE + "\n"; + definitions += "#define x3d_CameraSpaceNormal " + TextureCoordinateGeneratorModeType .CAMERASPACENORMAL + "\n"; + definitions += "#define x3d_CameraSpacePosition " + TextureCoordinateGeneratorModeType .CAMERASPACEPOSITION + "\n"; + definitions += "#define x3d_CameraSpaceReflectionVector " + TextureCoordinateGeneratorModeType .CAMERASPACEREFLECTIONVECTOR + "\n"; + definitions += "#define x3d_SphereLocal " + TextureCoordinateGeneratorModeType .SPHERE_LOCAL + "\n"; + definitions += "#define x3d_Coord " + TextureCoordinateGeneratorModeType .COORD + "\n"; + definitions += "#define x3d_CoordEye " + TextureCoordinateGeneratorModeType .COORD_EYE + "\n"; + definitions += "#define x3d_Noise " + TextureCoordinateGeneratorModeType .NOISE + "\n"; + definitions += "#define x3d_NoiseEye " + TextureCoordinateGeneratorModeType .NOISE_EYE + "\n"; + definitions += "#define x3d_SphereReflect " + TextureCoordinateGeneratorModeType .SPHERE_REFLECT + "\n"; + definitions += "#define x3d_SphereReflectLocal " + TextureCoordinateGeneratorModeType .SPHERE_REFLECT_LOCAL + "\n"; + + // Legacy + definitions += "#define x3d_GeometryPoints 0\n"; + definitions += "#define x3d_GeometryLines 1\n"; + definitions += "#define x3d_NoneClipPlane vec4 (88.0, 51.0, 68.0, 33.0)\n"; + definitions += "#define x3d_NoneFog 0\n"; + definitions += "#define x3d_NoneLight 0\n"; + definitions += "#define x3d_NoneTexture 0\n"; + + // Adjust precision of struct types; + + const + matchFloat = source .match (/\s*precision\s+(lowp|mediump|highp)\s+float\s*;/), + matchInt = source .match (/\s*precision\s+(lowp|mediump|highp)\s+int\s*;/), + precisionFloat = matchFloat ? matchFloat [1] : "mediump", + precisionInt = matchInt ? matchInt [1] : "mediump"; + + const types = Types_glsl + .replace (/mediump\s+(float|vec2|vec3|mat3|mat4)/g, precisionFloat + " $1") + .replace (/mediump\s+(int)/g, precisionInt + " $1"); + + const lines = (match [1] .match (/\n/g) || [ ]) .length + 1; + + return match [1] + constants + definitions + types + "#line " + (lines + 1) + " -1\n" + match [2]; + }, +}; + +function depreciatedWarning (source, depreciated, current) +{ + if (source .indexOf (depreciated) === -1) + return; + + console .warn ("Use of '" + depreciated + "' is depreciated, use '" + current + "' instead. See https://create3000.github.io/x_ite/custom-shaders."); +} + +const ShaderSource_default_ = ShaderSource; +; + +x_ite_Namespace .add ("ShaderSource", "x_ite/Browser/Shaders/ShaderSource", ShaderSource_default_); +/* harmony default export */ const Shaders_ShaderSource = (ShaderSource_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl1/include/ClipPlanes1.glsl.js +const ClipPlanes1_glsl_default_ = /* glsl */ `#if defined(X3D_CLIP_PLANES) +uniform vec4 x3d_ClipPlane[X3D_NUM_CLIP_PLANES];void clip(){for(int i=0;i0 +varying vec4 texCoord0; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>1 +varying vec4 texCoord1; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>2 +varying vec4 texCoord2; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>3 +varying vec4 texCoord3; +#endif +#endif +#else +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +#if X3D_NUM_TEXTURE_COORDINATES>0 +vec4 texCoord0=vec4(0.0,0.0,0.0,1.0); +#endif +#if X3D_NUM_TEXTURE_COORDINATES>1 +vec4 texCoord1=vec4(0.0,0.0,0.0,1.0); +#endif +#if X3D_NUM_TEXTURE_COORDINATES>2 +vec4 texCoord2=vec4(0.0,0.0,0.0,1.0); +#endif +#if X3D_NUM_TEXTURE_COORDINATES>3 +vec4 texCoord3=vec4(0.0,0.0,0.0,1.0); +#endif +#endif +#endif +#if defined(X3D_NORMALS) +varying vec3 normal; +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +varying vec3 localNormal; +#endif +#else +const vec3 normal=vec3(0.0,0.0,1.0); +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +const vec3 localNormal=vec3(0.0,0.0,1.0); +#endif +#endif +varying vec3 vertex; +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +varying vec3 localVertex; +#endif +#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER) +uniform float x3d_LogarithmicFarFactor1_2;varying float depth; +#endif +#pragma X3D include "Texture.glsl" +#pragma X3D include "ClipPlanes.glsl" +#pragma X3D include "Point.glsl" +#pragma X3D include "Hatch.glsl" +#pragma X3D include "Fog.glsl" +vec4 getMaterialColor();void fragment_main(){ +#if defined(X3D_CLIP_PLANES) +clip(); +#endif +#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES) +setPointTexCoords(); +#endif +vec4 finalColor=getMaterialColor(); +#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES) +finalColor=getPointColor(finalColor); +#endif +#if(defined(X3D_GEOMETRY_2D)||defined(X3D_GEOMETRY_3D))&&defined(X3D_STYLE_PROPERTIES) +finalColor=getHatchColor(finalColor); +#endif +#if defined(X3D_FOG) +finalColor.rgb=getFogColor(finalColor.rgb); +#endif +#if defined(X3D_ALPHA_MODE_OPAQUE) +finalColor.a=1.0; +#endif +#if defined(X3D_ALPHA_MODE_MASK) +if(finalColor.a0.0?pow(max(dot(N,H),0.0),shininess*128.0):1.0;vec3 specularTerm=specularColor*specularFactor;float attenuationFactor=di?1.0:1.0/max(dot(c,vec3(1.0,dL,dL*dL)),1.0);float spotFactor=light.type==x3d_SpotLight?getSpotFactor(light.cutOffAngle,light.beamWidth,L,d):1.0;float attenuationSpotFactor=attenuationFactor*spotFactor;vec3 ambientTerm=light.ambientIntensity*ambientColor;vec3 diffuseSpecularTerm=light.intensity*(diffuseTerm+specularTerm); +#if defined(X3D_FRAGMENT_SHADER)&&defined(X3D_SHADOWS) +if(lightAngle>0.0&&light.shadowIntensity>0.0)diffuseSpecularTerm=mix(diffuseSpecularTerm,light.shadowColor,getShadowIntensity(i,light)); +#endif +finalColor+=attenuationSpotFactor*light.color*(ambientTerm+diffuseSpecularTerm);}}return finalColor;} +#endif +` +; + +x_ite_Namespace .add ("Material1.glsl", "assets/shaders/webgl1/include/Material1.glsl", Material1_glsl_default_); +/* harmony default export */ const Material1_glsl = (Material1_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl1/include/Normal1.glsl.js +const Normal1_glsl_default_ = /* glsl */ `#if defined(X3D_NORMAL_TEXTURE) +mat3 getTBNMatrix(const in vec2 texCoord){vec3 pos_dx=dFdx(vertex);vec3 pos_dy=dFdy(vertex);vec3 tex_dx=dFdx(vec3(texCoord,0.0));vec3 tex_dy=dFdy(vec3(texCoord,0.0));vec3 t=(tex_dy.t*pos_dx-tex_dx.t*pos_dy)/(tex_dx.s*tex_dy.t-tex_dy.s*tex_dx.t);vec3 N=normalize(normal);vec3 T=normalize(t-N*dot(N,t));vec3 B=normalize(cross(N,T));mat3 tbn=mat3(T,B,N);return tbn;} +#endif +#if defined(X3D_NORMAL_TEXTURE) +uniform x3d_NormalTextureParameters x3d_NormalTexture; +#endif +vec3 getNormalVector(const in float normalScale){float facing=gl_FrontFacing?1.0:-1.0; +#if defined(X3D_NORMAL_TEXTURE)&&!defined(X3D_NORMAL_TEXTURE_3D) +vec3 texCoord=getTexCoord(x3d_NormalTexture.textureTransformMapping,x3d_NormalTexture.textureCoordinateMapping);vec3 scale=vec3(vec2(normalScale),1.0);mat3 tbn=getTBNMatrix(texCoord.st); +#if defined(X3D_NORMAL_TEXTURE_2D) +vec3 n=texture2D(x3d_NormalTexture.texture2D,texCoord.st).rgb; +#elif defined(X3D_NORMAL_TEXTURE_CUBE) +vec3 n=textureCube(x3d_NormalTexture.textureCube,texCoord).rgb; +#endif +return normalize(tbn*((n*2.0-1.0)*scale))*facing; +#else +return normalize(normal)*facing; +#endif +} +` +; + +x_ite_Namespace .add ("Normal1.glsl", "assets/shaders/webgl1/include/Normal1.glsl", Normal1_glsl_default_); +/* harmony default export */ const Normal1_glsl = (Normal1_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl1/include/Perlin1.glsl.js +const Perlin1_glsl_default_ = /* glsl */ `float rand(const in vec2 co){return fract(sin(dot(co.xy,vec2(12.9898,78.233)))*43758.5453);}float rand(const in vec2 co,const in float l){return rand(vec2(rand(co),l));}float rand(const in vec2 co,const in float l,const in float t){return rand(vec2(rand(co,l),t));}float perlin(const in vec2 p,const in float dim,const in float time){const float M_PI=3.14159265358979323846;vec2 pos=floor(p*dim);vec2 posx=pos+vec2(1.0,0.0);vec2 posy=pos+vec2(0.0,1.0);vec2 posxy=pos+vec2(1.0);float c=rand(pos,dim,time);float cx=rand(posx,dim,time);float cy=rand(posy,dim,time);float cxy=rand(posxy,dim,time);vec2 d=fract(p*dim);d=-0.5*cos(d*M_PI)+0.5;float ccx=mix(c,cx,d.x);float cycxy=mix(cy,cxy,d.x);float center=mix(ccx,cycxy,d.y);return center*2.0-1.0;}vec3 perlin(const in vec3 p){return vec3(perlin(p.xy,1.0,0.0),perlin(p.yz,1.0,0.0),perlin(p.zx,1.0,0.0));} +` +; + +x_ite_Namespace .add ("Perlin1.glsl", "assets/shaders/webgl1/include/Perlin1.glsl", Perlin1_glsl_default_); +/* harmony default export */ const Perlin1_glsl = (Perlin1_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl1/include/Point1.glsl.js +const Point1_glsl_default_ = /* glsl */ `#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES) +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +void setPointTexCoords(){vec4 texCoord=vec4(gl_PointCoord.x,1.0-gl_PointCoord.y,0.0,1.0); +#if X3D_NUM_TEXTURE_COORDINATES>0 +texCoord0=texCoord; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>1 +texCoord1=texCoord; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>2 +texCoord2=texCoord; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>3 +texCoord3=texCoord; +#endif +} +#define getPointColor(color)(color) +#else +#define setPointTexCoords() +varying float pointSize;vec4 getPointColor(in vec4 color){if(pointSize>1.0)color.a*=clamp(pointSize*(0.5-distance(vec2(0.5),gl_PointCoord)),0.0,1.0);else color.a*=pointSize;return color;} +#endif +#endif +` +; + +x_ite_Namespace .add ("Point1.glsl", "assets/shaders/webgl1/include/Point1.glsl", Point1_glsl_default_); +/* harmony default export */ const Point1_glsl = (Point1_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl1/include/PointSize1.glsl.js +const PointSize1_glsl_default_ = /* glsl */ `#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES) +uniform x3d_PointPropertiesParameters x3d_PointProperties;varying float pointSize;float getPointSize(const in vec3 vertex){float pointSizeMinValue=x3d_PointProperties.pointSizeMinValue;float pointSizeMaxValue=x3d_PointProperties.pointSizeMaxValue;vec3 attenuation=x3d_PointProperties.attenuation;float dL=length(vertex);float pointSize=0.0;pointSize=x3d_PointProperties.pointSizeScaleFactor;pointSize/=dot(attenuation,vec3(1.0,dL,dL*dL));pointSize=clamp(pointSize,pointSizeMinValue,pointSizeMaxValue); +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURE) +return pointSize; +#else +return pointSize+1.0-step(pointSize,1.0); +#endif +} +#endif +` +; + +x_ite_Namespace .add ("PointSize1.glsl", "assets/shaders/webgl1/include/PointSize1.glsl", PointSize1_glsl_default_); +/* harmony default export */ const PointSize1_glsl = (PointSize1_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl1/include/Shadow1.glsl.js +const Shadow1_glsl_default_ = /* glsl */ `#if defined(X3D_FRAGMENT_SHADER)&&defined(X3D_SHADOWS) +uniform sampler2D x3d_ShadowMap[X3D_NUM_LIGHTS];float getShadowDepth(const in int index,const in vec2 shadowCoord){ +#if X3D_NUM_LIGHTS>0 +if(index==0)return texture2D(x3d_ShadowMap[0],shadowCoord).r; +#endif +#if X3D_NUM_LIGHTS>1 +if(index==1)return texture2D(x3d_ShadowMap[1],shadowCoord).r; +#endif +#if X3D_NUM_LIGHTS>2 +if(index==2)return texture2D(x3d_ShadowMap[2],shadowCoord).r; +#endif +#if X3D_NUM_LIGHTS>3 +if(index==3)return texture2D(x3d_ShadowMap[3],shadowCoord).r; +#endif +#if X3D_NUM_LIGHTS>4 +if(index==4)return texture2D(x3d_ShadowMap[4],shadowCoord).r; +#endif +#if X3D_NUM_LIGHTS>5 +if(index==5)return texture2D(x3d_ShadowMap[5],shadowCoord).r; +#endif +#if X3D_NUM_LIGHTS>6 +if(index==6)return texture2D(x3d_ShadowMap[6],shadowCoord).r; +#endif +#if X3D_NUM_LIGHTS>7 +if(index==7)return texture2D(x3d_ShadowMap[7],shadowCoord).r; +#endif +return 0.0;}float texture2DCompare(const in int index,const in vec2 texCoord,const in float compare){float shadowDepth=getShadowDepth(index,texCoord);return(1.0-step(1.0,shadowDepth))*step(shadowDepth,compare);}float texture2DShadowLerp(const in int index,const in vec2 texelSize,const in float shadowMapSize,const in vec2 texCoord,const in float compare){const vec2 offset=vec2(0.0,1.0);vec2 centroidTexCoord=floor(texCoord*shadowMapSize+0.5)/shadowMapSize;float lb=texture2DCompare(index,centroidTexCoord+texelSize*offset.xx,compare);float lt=texture2DCompare(index,centroidTexCoord+texelSize*offset.xy,compare);float rb=texture2DCompare(index,centroidTexCoord+texelSize*offset.yx,compare);float rt=texture2DCompare(index,centroidTexCoord+texelSize*offset.yy,compare);vec2 f=fract(texCoord*shadowMapSize+0.5);float a=mix(lb,lt,f.y);float b=mix(rb,rt,f.y);float c=mix(a,b,f.x);return c;}vec2 cubeToUVCompact(in vec3 v,const float texelSizeY){vec3 absV=abs(v);float scaleToCube=1.0/max(absV.x,max(absV.y,absV.z));absV*=scaleToCube;v*=scaleToCube*(1.0-2.0*texelSizeY);vec2 planar=v.xy;float almostATexel=1.5*texelSizeY;float almostOne=1.0-almostATexel;if(absV.z>=almostOne){if(v.z>0.0)planar.x=4.0-v.x;}else if(absV.x>=almostOne){float signX=sign(v.x);planar.x=v.z*signX+2.0*signX;}else if(absV.y>=almostOne){float signY=sign(v.y);planar.x=(v.x+0.5+signY)*2.0;planar.y=v.z*signY-2.0;}return vec2(0.125,0.25)*planar+vec2(0.375,0.75);}mat4 getPointLightRotations(const in vec3 vector){mat4 rotations[6];rotations[0]=mat4(0,0,1,0,0,1,0,0,-1,0,0,0,0,0,0,1);rotations[1]=mat4(0,0,-1,0,0,1,0,0,1,0,0,0,0,0,0,1);rotations[2]=mat4(-1,0,0,0,0,1,0,0,0,0,-1,0,0,0,0,1);rotations[3]=mat4(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);rotations[4]=mat4(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1);rotations[5]=mat4(1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1);vec3 a=abs(vector.xyz);if(a.x>a.y){if(a.x>a.z)return vector.x>0.0?rotations[1]:rotations[0];else return vector.z>0.0?rotations[2]:rotations[3];}else{if(a.y>a.z)return vector.y>0.0?rotations[5]:rotations[4];else return vector.z>0.0?rotations[2]:rotations[3];}return rotations[3];}float getShadowIntensity(const in int index,const in x3d_LightSourceParameters light){if(light.type==x3d_PointLight){const mat4 biasMatrix=mat4(0.5,0.0,0.0,0.0,0.0,0.5,0.0,0.0,0.0,0.0,0.5,0.0,0.5,0.5,0.5,1.0);const mat4 projectionMatrix=mat4(1.0,0.0,0.0,0.0,0.0,0.5,0.0,0.0,0.0,0.0,-1.000025000312504,-1.0,0,0.0,-0.25000312503906297,0.0);vec2 texelSize=vec2(1.0)/(float(light.shadowMapSize)*vec2(4.0,2.0));vec4 shadowCoord=light.shadowMatrix*vec4(vertex,1.0);vec3 lightToPosition=shadowCoord.xyz;shadowCoord=biasMatrix*(projectionMatrix*(getPointLightRotations(lightToPosition)*shadowCoord));shadowCoord.z-=light.shadowBias;shadowCoord.xyz/=shadowCoord.w; +#if defined(X3D_PCF_FILTERING)||defined(X3D_PCF_SOFT_FILTERING) +vec2 offset=vec2(-1,1)*(texelSize.y*42.0);float value=(texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.xyy,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.yyy,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.xyx,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.yyx,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.xxy,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.yxy,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.xxx,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.yxx,texelSize.y),shadowCoord.z))*(1.0/9.0);return light.shadowIntensity*value; +#else +float value=texture2DCompare(index,cubeToUVCompact(lightToPosition,texelSize.y),shadowCoord.z);return light.shadowIntensity*value; +#endif +}else{ +#if defined(X3D_PCF_FILTERING) +vec2 texelSize=vec2(1.0)/vec2(light.shadowMapSize);vec4 shadowCoord=light.shadowMatrix*vec4(vertex,1.0);shadowCoord.z-=light.shadowBias;shadowCoord.xyz/=shadowCoord.w;if(any(greaterThan(abs(shadowCoord.xy-0.5),vec2(0.5))))return 0.0;vec2 d0=-texelSize;vec2 d1=texelSize;float value=(texture2DCompare(index,shadowCoord.xy+d0,shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+vec2(0.0,d0.y),shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+vec2(d1.x,d0.y),shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+vec2(d0.x,0.0),shadowCoord.z)+texture2DCompare(index,shadowCoord.xy,shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+vec2(d1.x,0.0),shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+vec2(d0.x,d1.y),shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+vec2(0.0,d1.y),shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+d1,shadowCoord.z))*(1.0/9.0);return light.shadowIntensity*value; +#elif defined(X3D_PCF_SOFT_FILTERING) +vec2 texelSize=vec2(1.0)/vec2(light.shadowMapSize);vec4 shadowCoord=light.shadowMatrix*vec4(vertex,1.0);shadowCoord.z-=light.shadowBias;shadowCoord.xyz/=shadowCoord.w;if(any(greaterThan(abs(shadowCoord.xy-0.5),vec2(0.5))))return 0.0;vec2 d0=-texelSize;vec2 d1=texelSize;float value=(texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+d0,shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+vec2(0.0,d0.y),shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+vec2(d1.x,d0.y),shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+vec2(d0.x,0.0),shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy,shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+vec2(d1.x,0.0),shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+vec2(d0.x,d1.y),shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+vec2(0.0,d1.y),shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+d1,shadowCoord.z))*(1.0/9.0);return light.shadowIntensity*value; +#else +vec4 shadowCoord=light.shadowMatrix*vec4(vertex,1.0);shadowCoord.z-=light.shadowBias;shadowCoord.xyz/=shadowCoord.w;if(any(greaterThan(abs(shadowCoord.xy-0.5),vec2(0.5))))return 0.0;float value=texture2DCompare(index,shadowCoord.xy,shadowCoord.z);return light.shadowIntensity*value; +#endif +}return 0.0;} +#endif +` +; + +x_ite_Namespace .add ("Shadow1.glsl", "assets/shaders/webgl1/include/Shadow1.glsl", Shadow1_glsl_default_); +/* harmony default export */ const Shadow1_glsl = (Shadow1_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl1/include/SpotFactor1.glsl.js +const SpotFactor1_glsl_default_ = /* glsl */ `float getSpotFactor(const in float cutOffAngle,const in float beamWidth,const in vec3 L,const in vec3 d){float spotAngle=acos(clamp(dot(-L,d),-1.0,1.0));if(spotAngle>=cutOffAngle)return 0.0;else if(spotAngle<=beamWidth)return 1.0;return(spotAngle-cutOffAngle)/(beamWidth-cutOffAngle);} +` +; + +x_ite_Namespace .add ("SpotFactor1.glsl", "assets/shaders/webgl1/include/SpotFactor1.glsl", SpotFactor1_glsl_default_); +/* harmony default export */ const SpotFactor1_glsl = (SpotFactor1_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl1/include/Texture1.glsl.js +const Texture1_glsl_default_ = /* glsl */ `#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +#pragma X3D include "Perlin.glsl" +uniform mat4 x3d_TextureMatrix[X3D_NUM_TEXTURE_TRANSFORMS];mat4 getTextureMatrix(const in int i){ +#if X3D_NUM_TEXTURE_TRANSFORMS>1 +mat4 textureMatrix=mat4(0.0); +#if X3D_NUM_TEXTURE_TRANSFORMS>0 +if(i==0)textureMatrix=x3d_TextureMatrix[0]; +#endif +#if X3D_NUM_TEXTURE_TRANSFORMS>1 +else if(i==1)textureMatrix=x3d_TextureMatrix[1]; +#endif +#if X3D_NUM_TEXTURE_TRANSFORMS>2 +else if(i==2)textureMatrix=x3d_TextureMatrix[2]; +#endif +#if X3D_NUM_TEXTURE_TRANSFORMS>3 +else if(i==3)textureMatrix=x3d_TextureMatrix[3]; +#endif +return textureMatrix; +#else +return x3d_TextureMatrix[0]; +#endif +}vec4 getTexCoord(const in int i){ +#if X3D_NUM_TEXTURE_COORDINATES>1 +vec4 texCoord=vec4(0.0); +#if X3D_NUM_TEXTURE_COORDINATES>0 +if(i==0)texCoord=texCoord0; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>1 +else if(i==1)texCoord=texCoord1; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>2 +else if(i==2)texCoord=texCoord2; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>3 +else if(i==3)texCoord=texCoord3; +#endif +return texCoord; +#else +return texCoord0; +#endif +}vec4 getTexCoord(const in x3d_TextureCoordinateGeneratorParameters textureCoordinateGenerator,const in int textureTransformMapping,const in int textureCoordinateMapping){int mode=textureCoordinateGenerator.mode;if(mode==x3d_None){return getTextureMatrix(textureTransformMapping)*getTexCoord(textureCoordinateMapping);}else if(mode==x3d_Sphere){vec2 N=normalize(gl_FrontFacing?normal:-normal).xy;return vec4(N*0.5+0.5,0.0,1.0);}else if(mode==x3d_CameraSpaceNormal){vec3 N=normalize(gl_FrontFacing?normal:-normal);return vec4(N,1.0);}else if(mode==x3d_CameraSpacePosition){return vec4(vertex,1.0);}else if(mode==x3d_CameraSpaceReflectionVector){vec3 N=normalize(gl_FrontFacing?normal:-normal);return vec4(reflect(normalize(vertex),-N),1.0);}else if(mode==x3d_SphereLocal){vec2 N=normalize(gl_FrontFacing?localNormal:-localNormal).xy;return vec4(N*0.5+0.5,0.0,1.0);}else if(mode==x3d_Coord){return vec4(localVertex,1.0);}else if(mode==x3d_CoordEye){return vec4(vertex,1.0);}else if(mode==x3d_Noise){vec3 scale=vec3(textureCoordinateGenerator.parameter[0],textureCoordinateGenerator.parameter[1],textureCoordinateGenerator.parameter[2]);vec3 translation=vec3(textureCoordinateGenerator.parameter[3],textureCoordinateGenerator.parameter[4],textureCoordinateGenerator.parameter[5]);return vec4(perlin(localVertex*scale+translation),1.0);}else if(mode==x3d_NoiseEye){vec3 scale=vec3(textureCoordinateGenerator.parameter[0],textureCoordinateGenerator.parameter[1],textureCoordinateGenerator.parameter[2]);vec3 translation=vec3(textureCoordinateGenerator.parameter[3],textureCoordinateGenerator.parameter[4],textureCoordinateGenerator.parameter[5]);return vec4(perlin(vertex*scale+translation),1.0);}else if(mode==x3d_SphereReflect){vec3 N=normalize(gl_FrontFacing?normal:-normal);float eta=textureCoordinateGenerator.parameter[0];return vec4(refract(normalize(vertex),-N,eta),1.0);}else if(mode==x3d_SphereReflectLocal){vec3 N=normalize(gl_FrontFacing?localNormal:-localNormal);float eta=textureCoordinateGenerator.parameter[0];vec3 eye=vec3(textureCoordinateGenerator.parameter[1],textureCoordinateGenerator.parameter[2],textureCoordinateGenerator.parameter[3]);return vec4(refract(normalize(localVertex-eye),-N,eta),1.0);}return getTextureMatrix(textureTransformMapping)*getTexCoord(textureCoordinateMapping);}uniform x3d_TextureCoordinateGeneratorParameters x3d_TextureCoordinateGenerator[X3D_NUM_TEXTURE_COORDINATES];vec3 getTexCoord(const in int textureTransformMapping,const in int textureCoordinateMapping){vec4 texCoord; +#if X3D_NUM_TEXTURE_COORDINATES>0 +if(textureCoordinateMapping==0)texCoord=getTexCoord(x3d_TextureCoordinateGenerator[0],textureTransformMapping,textureCoordinateMapping); +#endif +#if X3D_NUM_TEXTURE_COORDINATES>1 +else if(textureCoordinateMapping==1)texCoord=getTexCoord(x3d_TextureCoordinateGenerator[1],textureTransformMapping,textureCoordinateMapping); +#endif +#if X3D_NUM_TEXTURE_COORDINATES>2 +else if(textureCoordinateMapping==2)texCoord=getTexCoord(x3d_TextureCoordinateGenerator[2],textureTransformMapping,textureCoordinateMapping); +#endif +#if X3D_NUM_TEXTURE_COORDINATES>3 +else if(textureCoordinateMapping==3)texCoord=getTexCoord(x3d_TextureCoordinateGenerator[3],textureTransformMapping,textureCoordinateMapping); +#endif +texCoord.stp/=texCoord.q; +#if defined(X3D_GEOMETRY_2D) +if(gl_FrontFacing==false)texCoord.s=1.0-texCoord.s; +#endif +return texCoord.stp;} +#endif +#if defined(X3D_TEXTURE) +uniform sampler2D x3d_Texture2D[X3D_NUM_TEXTURES];uniform samplerCube x3d_TextureCube[X3D_NUM_TEXTURES]; +#if defined(X3D_MULTI_TEXTURING) +vec4 getTexture(const in int i,const in vec3 texCoord){vec4 textureColor=vec4(0.0); +#if X3D_NUM_TEXTURES>0 +if(i==0){ +#if defined(X3D_TEXTURE0_2D) +textureColor=texture2D(x3d_Texture2D[0],texCoord.st); +#elif defined(X3D_TEXTURE0_CUBE) +textureColor=textureCube(x3d_TextureCube[0],texCoord.stp); +#endif +} +#endif +#if X3D_NUM_TEXTURES>1 +else if(i==1){ +#if defined(X3D_TEXTURE0_2D) +textureColor=texture2D(x3d_Texture2D[1],texCoord.st); +#elif defined(X3D_TEXTURE0_CUBE) +textureColor=textureCube(x3d_TextureCube[1],texCoord.stp); +#endif +} +#endif +return textureColor;} +#endif +#if defined(X3D_MULTI_TEXTURING) +uniform vec4 x3d_MultiTextureColor;uniform x3d_MultiTextureParameters x3d_MultiTexture[X3D_NUM_TEXTURES]; +#endif +int minI(const in int a,const in int b){return a0 +if(i==0)color=texture2D(x3d_ProjectiveTexture[0],texCoord); +#endif +#if X3D_NUM_TEXTURE_PROJECTORS>1 +else if(i==1)color=texture2D(x3d_ProjectiveTexture[1],texCoord); +#endif +return color;}vec4 getProjectiveTextureColor(in vec4 currentColor){vec3 N=gl_FrontFacing?normal:-normal;for(int i=0;i1.0)continue;if(texCoord.t<0.0||texCoord.t>1.0)continue;if(texCoord.p<0.0||texCoord.p>1.0)continue;vec3 p=x3d_ProjectiveTextureLocation[i]-vertex;if(dot(N,p)<0.0)continue;currentColor*=getProjectiveTexture(i,texCoord.st);}return currentColor;} +#endif +` +; + +x_ite_Namespace .add ("Texture1.glsl", "assets/shaders/webgl1/include/Texture1.glsl", Texture1_glsl_default_); +/* harmony default export */ const Texture1_glsl = (Texture1_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl1/include/Vertex1.glsl.js +const Vertex1_glsl_default_ = /* glsl */ `uniform mat4 x3d_ProjectionMatrix;uniform mat4 x3d_ModelViewMatrix; +#if defined(X3D_FOG)&&defined(X3D_FOG_COORDS) +attribute float x3d_FogDepth; +#endif +#if defined(X3D_COLOR_MATERIAL) +attribute vec4 x3d_Color; +#endif +#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D) +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +#if X3D_NUM_TEXTURE_COORDINATES>0 +attribute vec4 x3d_TexCoord0; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>1 +attribute vec4 x3d_TexCoord1; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>2 +attribute vec4 x3d_TexCoord2; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>3 +attribute vec4 x3d_TexCoord3; +#endif +#endif +#endif +attribute vec4 x3d_Vertex; +#if defined(X3D_FOG)&&defined(X3D_FOG_COORDS) +varying float fogDepth; +#endif +#if defined(X3D_COLOR_MATERIAL) +varying vec4 color; +#endif +#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D) +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +#if X3D_NUM_TEXTURE_COORDINATES>0 +varying vec4 texCoord0; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>1 +varying vec4 texCoord1; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>2 +varying vec4 texCoord2; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>3 +varying vec4 texCoord3; +#endif +#endif +#endif +#if defined(X3D_NORMALS) +uniform mat3 x3d_NormalMatrix;attribute vec3 x3d_Normal;varying vec3 normal; +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +varying vec3 localNormal; +#endif +#endif +varying vec3 vertex; +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +varying vec3 localVertex; +#endif +#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER) +varying float depth; +#endif +#pragma X3D include "PointSize.glsl" +void vertex_main(){vec4 position=x3d_ModelViewMatrix*x3d_Vertex;vertex=position.xyz; +#if defined(X3D_GEOMETRY_0D) +#if defined(X3D_STYLE_PROPERTIES) +gl_PointSize=pointSize=getPointSize(vertex); +#else +gl_PointSize=1.0; +#endif +#endif +#if defined(X3D_FOG)&&defined(X3D_FOG_COORDS) +fogDepth=x3d_FogDepth; +#endif +#if defined(X3D_COLOR_MATERIAL) +color=x3d_Color; +#endif +#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D) +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +#if X3D_NUM_TEXTURE_COORDINATES>0 +texCoord0=x3d_TexCoord0; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>1 +texCoord1=x3d_TexCoord1; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>2 +texCoord2=x3d_TexCoord2; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>3 +texCoord3=x3d_TexCoord3; +#endif +#endif +#endif +#if defined(X3D_NORMALS) +normal=x3d_NormalMatrix*x3d_Normal; +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +localNormal=x3d_Normal; +#endif +#endif +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +localVertex=x3d_Vertex.xyz; +#endif +gl_Position=x3d_ProjectionMatrix*position; +#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER) +depth=1.0+gl_Position.w; +#endif +} +` +; + +x_ite_Namespace .add ("Vertex1.glsl", "assets/shaders/webgl1/include/Vertex1.glsl", Vertex1_glsl_default_); +/* harmony default export */ const Vertex1_glsl = (Vertex1_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/include/ClipPlanes2.glsl.js +const ClipPlanes2_glsl_default_ = /* glsl */ `#if defined(X3D_CLIP_PLANES) +uniform vec4 x3d_ClipPlane[X3D_NUM_CLIP_PLANES];void clip(){for(int i=0;i0 +in vec4 texCoord0; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>1 +in vec4 texCoord1; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>2 +in vec4 texCoord2; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>3 +in vec4 texCoord3; +#endif +#endif +#else +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +#if X3D_NUM_TEXTURE_COORDINATES>0 +vec4 texCoord0=vec4(0.0,0.0,0.0,1.0); +#endif +#if X3D_NUM_TEXTURE_COORDINATES>1 +vec4 texCoord1=vec4(0.0,0.0,0.0,1.0); +#endif +#if X3D_NUM_TEXTURE_COORDINATES>2 +vec4 texCoord2=vec4(0.0,0.0,0.0,1.0); +#endif +#if X3D_NUM_TEXTURE_COORDINATES>3 +vec4 texCoord3=vec4(0.0,0.0,0.0,1.0); +#endif +#endif +#endif +#if defined(X3D_NORMALS) +in vec3 normal; +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +in vec3 localNormal; +#endif +#else +const vec3 normal=vec3(0.0,0.0,1.0); +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +const vec3 localNormal=vec3(0.0,0.0,1.0); +#endif +#endif +in vec3 vertex; +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +in vec3 localVertex; +#endif +#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER) +uniform float x3d_LogarithmicFarFactor1_2;in float depth; +#endif +#if defined(X3D_ORDER_INDEPENDENT_TRANSPARENCY) +layout(location=0)out vec4 x3d_FragData0;layout(location=1)out vec4 x3d_FragData1; +#else +out vec4 x3d_FragColor; +#endif +#pragma X3D include "Texture.glsl" +#pragma X3D include "ClipPlanes.glsl" +#pragma X3D include "Point.glsl" +#pragma X3D include "Stipple.glsl" +#pragma X3D include "Hatch.glsl" +#pragma X3D include "Fog.glsl" +vec4 getMaterialColor(); +#if defined(X3D_ORDER_INDEPENDENT_TRANSPARENCY) +float weight(const in float z,const in float a){return clamp(pow(min(1.0,a*10.0)+0.01,3.0)*1e8*pow(1.0-z*0.9,3.0),1e-2,3e3);} +#endif +void fragment_main(){ +#if defined(X3D_CLIP_PLANES) +clip(); +#endif +#if defined(X3D_GEOMETRY_1D)&&defined(X3D_STYLE_PROPERTIES) +stipple(); +#endif +#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES) +setPointTexCoords(); +#elif defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +setTexCoords(); +#endif +vec4 finalColor=getMaterialColor(); +#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES) +finalColor=getPointColor(finalColor); +#endif +#if(defined(X3D_GEOMETRY_2D)||defined(X3D_GEOMETRY_3D))&&defined(X3D_STYLE_PROPERTIES) +finalColor=getHatchColor(finalColor); +#endif +#if defined(X3D_FOG) +finalColor.rgb=getFogColor(finalColor.rgb); +#endif +#if defined(X3D_ALPHA_MODE_OPAQUE) +finalColor.a=1.0; +#endif +#if defined(X3D_ALPHA_MODE_MASK) +if(finalColor.a0.0?pow(max(dot(N,H),0.0),shininess*128.0):1.0;vec3 specularTerm=specularColor*specularFactor;float attenuationFactor=di?1.0:1.0/max(dot(c,vec3(1.0,dL,dL*dL)),1.0);float spotFactor=light.type==x3d_SpotLight?getSpotFactor(light.cutOffAngle,light.beamWidth,L,d):1.0;float attenuationSpotFactor=attenuationFactor*spotFactor;vec3 ambientTerm=light.ambientIntensity*ambientColor;vec3 diffuseSpecularTerm=light.intensity*(diffuseTerm+specularTerm); +#if defined(X3D_FRAGMENT_SHADER)&&defined(X3D_SHADOWS) +if(lightAngle>0.0&&light.shadowIntensity>0.0)diffuseSpecularTerm=mix(diffuseSpecularTerm,light.shadowColor,getShadowIntensity(i,light)); +#endif +finalColor+=attenuationSpotFactor*light.color*(ambientTerm+diffuseSpecularTerm);}}return finalColor;} +#endif +` +; + +x_ite_Namespace .add ("Material2.glsl", "assets/shaders/webgl2/include/Material2.glsl", Material2_glsl_default_); +/* harmony default export */ const Material2_glsl = (Material2_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/include/Normal2.glsl.js +const Normal2_glsl_default_ = /* glsl */ `#if defined(X3D_NORMAL_TEXTURE) +mat3 getTBNMatrix(const in vec2 texCoord){vec3 pos_dx=dFdx(vertex);vec3 pos_dy=dFdy(vertex);vec3 tex_dx=dFdx(vec3(texCoord,0.0));vec3 tex_dy=dFdy(vec3(texCoord,0.0));vec3 t=(tex_dy.t*pos_dx-tex_dx.t*pos_dy)/(tex_dx.s*tex_dy.t-tex_dy.s*tex_dx.t);vec3 N=normalize(normal);vec3 T=normalize(t-N*dot(N,t));vec3 B=normalize(cross(N,T));mat3 tbn=mat3(T,B,N);return tbn;} +#endif +#if defined(X3D_NORMAL_TEXTURE) +uniform x3d_NormalTextureParameters x3d_NormalTexture; +#endif +vec3 getNormalVector(const in float normalScale){float facing=gl_FrontFacing?1.0:-1.0; +#if defined(X3D_NORMAL_TEXTURE) +vec3 texCoord=getTexCoord(x3d_NormalTexture.textureTransformMapping,x3d_NormalTexture.textureCoordinateMapping);vec3 scale=vec3(vec2(normalScale),1.0);mat3 tbn=getTBNMatrix(texCoord.st); +#if defined(X3D_NORMAL_TEXTURE_2D) +vec3 n=texture(x3d_NormalTexture.texture2D,texCoord.st).rgb; +#elif defined(X3D_NORMAL_TEXTURE_3D) +vec3 n=texture(x3d_NormalTexture.texture3D,texCoord).rgb; +#elif defined(X3D_NORMAL_TEXTURE_CUBE) +vec3 n=texture(x3d_NormalTexture.textureCube,texCoord).rgb; +#endif +return normalize(tbn*((n*2.0-1.0)*scale))*facing; +#else +return normalize(normal)*facing; +#endif +} +` +; + +x_ite_Namespace .add ("Normal2.glsl", "assets/shaders/webgl2/include/Normal2.glsl", Normal2_glsl_default_); +/* harmony default export */ const Normal2_glsl = (Normal2_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/include/Particle2.glsl.js +const Particle2_glsl_default_ = /* glsl */ `#if defined(X3D_PARTICLE_SYSTEM) +#if defined(X3D_TEX_COORD_RAMP) +uniform sampler2D x3d_TexCoordRamp;in vec4 x3d_Particle;vec4 getParticleTexCoord(const in vec4 texCoord){const int map[6]=int[6](0,1,2,0,2,3);int index0=int(x3d_Particle[3]);return texelFetch(x3d_TexCoordRamp,index0+map[gl_VertexID % 6],0);} +#else +#define getParticleTexCoord(texCoord)(texCoord) +#endif +in mat4 x3d_ParticleMatrix;vec4 getParticleVertex(const in vec4 vertex){return x3d_ParticleMatrix*vertex;} +#else +#define getParticleVertex(vertex)(vertex) +#define getParticleTexCoord(texCoord)(texCoord) +#endif +` +; + +x_ite_Namespace .add ("Particle2.glsl", "assets/shaders/webgl2/include/Particle2.glsl", Particle2_glsl_default_); +/* harmony default export */ const Particle2_glsl = (Particle2_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/include/Perlin2.glsl.js +const Perlin2_glsl_default_ = /* glsl */ `float rand(const in vec2 co){return fract(sin(dot(co.xy,vec2(12.9898,78.233)))*43758.5453);}float rand(const in vec2 co,const in float l){return rand(vec2(rand(co),l));}float rand(const in vec2 co,const in float l,const in float t){return rand(vec2(rand(co,l),t));}float perlin(const in vec2 p,const in float dim,const in float time){const float M_PI=3.14159265358979323846;vec2 pos=floor(p*dim);vec2 posx=pos+vec2(1.0,0.0);vec2 posy=pos+vec2(0.0,1.0);vec2 posxy=pos+vec2(1.0);float c=rand(pos,dim,time);float cx=rand(posx,dim,time);float cy=rand(posy,dim,time);float cxy=rand(posxy,dim,time);vec2 d=fract(p*dim);d=-0.5*cos(d*M_PI)+0.5;float ccx=mix(c,cx,d.x);float cycxy=mix(cy,cxy,d.x);float center=mix(ccx,cycxy,d.y);return center*2.0-1.0;}vec3 perlin(const in vec3 p){return vec3(perlin(p.xy,1.0,0.0),perlin(p.yz,1.0,0.0),perlin(p.zx,1.0,0.0));} +` +; + +x_ite_Namespace .add ("Perlin2.glsl", "assets/shaders/webgl2/include/Perlin2.glsl", Perlin2_glsl_default_); +/* harmony default export */ const Perlin2_glsl = (Perlin2_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/include/Point2.glsl.js +const Point2_glsl_default_ = /* glsl */ `#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES) +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +void setPointTexCoords(){vec4 texCoord=vec4(gl_PointCoord.x,1.0-gl_PointCoord.y,0.0,1.0); +#if X3D_NUM_TEXTURE_COORDINATES>0 +texCoords[0]=texCoord; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>1 +texCoords[1]=texCoord; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>2 +texCoords[2]=texCoord; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>3 +texCoords[3]=texCoord; +#endif +} +#define getPointColor(color)(color) +#else +#define setPointTexCoords() +in float pointSize;vec4 getPointColor(in vec4 color){if(pointSize>1.0)color.a*=clamp(pointSize*(0.5-distance(vec2(0.5),gl_PointCoord)),0.0,1.0);else color.a*=pointSize;return color;} +#endif +#endif +` +; + +x_ite_Namespace .add ("Point2.glsl", "assets/shaders/webgl2/include/Point2.glsl", Point2_glsl_default_); +/* harmony default export */ const Point2_glsl = (Point2_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/include/PointSize2.glsl.js +const PointSize2_glsl_default_ = /* glsl */ `#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES) +uniform x3d_PointPropertiesParameters x3d_PointProperties;out float pointSize;float getPointSize(const in vec3 vertex){float pointSizeMinValue=x3d_PointProperties.pointSizeMinValue;float pointSizeMaxValue=x3d_PointProperties.pointSizeMaxValue;vec3 attenuation=x3d_PointProperties.attenuation;float dL=length(vertex);float pointSize=0.0;pointSize=x3d_PointProperties.pointSizeScaleFactor;pointSize/=dot(attenuation,vec3(1.0,dL,dL*dL));pointSize=clamp(pointSize,pointSizeMinValue,pointSizeMaxValue); +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURE) +return pointSize; +#else +return pointSize+1.0-step(pointSize,1.0); +#endif +} +#endif +` +; + +x_ite_Namespace .add ("PointSize2.glsl", "assets/shaders/webgl2/include/PointSize2.glsl", PointSize2_glsl_default_); +/* harmony default export */ const PointSize2_glsl = (PointSize2_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/include/Shadow2.glsl.js +const Shadow2_glsl_default_ = /* glsl */ `#if defined(X3D_FRAGMENT_SHADER)&&defined(X3D_SHADOWS) +uniform sampler2D x3d_ShadowMap[X3D_NUM_LIGHTS];float getShadowDepth(const in int index,const in vec2 shadowCoord){switch(index){ +#if X3D_NUM_LIGHTS>0 +case 0:{return texture(x3d_ShadowMap[0],shadowCoord).r;} +#endif +#if X3D_NUM_LIGHTS>1 +case 1:{return texture(x3d_ShadowMap[1],shadowCoord).r;} +#endif +#if X3D_NUM_LIGHTS>2 +case 2:{return texture(x3d_ShadowMap[2],shadowCoord).r;} +#endif +#if X3D_NUM_LIGHTS>3 +case 3:{return texture(x3d_ShadowMap[3],shadowCoord).r;} +#endif +#if X3D_NUM_LIGHTS>4 +case 4:{return texture(x3d_ShadowMap[4],shadowCoord).r;} +#endif +#if X3D_NUM_LIGHTS>5 +case 5:{return texture(x3d_ShadowMap[5],shadowCoord).r;} +#endif +#if X3D_NUM_LIGHTS>6 +case 6:{return texture(x3d_ShadowMap[6],shadowCoord).r;} +#endif +#if X3D_NUM_LIGHTS>7 +case 7:{return texture(x3d_ShadowMap[7],shadowCoord).r;} +#endif +default:{return 0.0;}}}float texture2DCompare(const in int index,const in vec2 texCoord,const in float compare){float shadowDepth=getShadowDepth(index,texCoord);return(1.0-step(1.0,shadowDepth))*step(shadowDepth,compare);}float texture2DShadowLerp(const in int index,const in vec2 texelSize,const in float shadowMapSize,const in vec2 texCoord,const in float compare){const vec2 offset=vec2(0.0,1.0);vec2 centroidTexCoord=floor(texCoord*shadowMapSize+0.5)/shadowMapSize;float lb=texture2DCompare(index,centroidTexCoord+texelSize*offset.xx,compare);float lt=texture2DCompare(index,centroidTexCoord+texelSize*offset.xy,compare);float rb=texture2DCompare(index,centroidTexCoord+texelSize*offset.yx,compare);float rt=texture2DCompare(index,centroidTexCoord+texelSize*offset.yy,compare);vec2 f=fract(texCoord*shadowMapSize+0.5);float a=mix(lb,lt,f.y);float b=mix(rb,rt,f.y);float c=mix(a,b,f.x);return c;}vec2 cubeToUVCompact(in vec3 v,const float texelSizeY){vec3 absV=abs(v);float scaleToCube=1.0/max(absV.x,max(absV.y,absV.z));absV*=scaleToCube;v*=scaleToCube*(1.0-2.0*texelSizeY);vec2 planar=v.xy;float almostATexel=1.5*texelSizeY;float almostOne=1.0-almostATexel;if(absV.z>=almostOne){if(v.z>0.0)planar.x=4.0-v.x;}else if(absV.x>=almostOne){float signX=sign(v.x);planar.x=v.z*signX+2.0*signX;}else if(absV.y>=almostOne){float signY=sign(v.y);planar.x=(v.x+0.5+signY)*2.0;planar.y=v.z*signY-2.0;}return vec2(0.125,0.25)*planar+vec2(0.375,0.75);}mat4 getPointLightRotations(const in vec3 vector){mat4 rotations[6];rotations[0]=mat4(0,0,1,0,0,1,0,0,-1,0,0,0,0,0,0,1);rotations[1]=mat4(0,0,-1,0,0,1,0,0,1,0,0,0,0,0,0,1);rotations[2]=mat4(-1,0,0,0,0,1,0,0,0,0,-1,0,0,0,0,1);rotations[3]=mat4(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);rotations[4]=mat4(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1);rotations[5]=mat4(1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1);vec3 a=abs(vector.xyz);if(a.x>a.y){if(a.x>a.z)return vector.x>0.0?rotations[1]:rotations[0];else return vector.z>0.0?rotations[2]:rotations[3];}else{if(a.y>a.z)return vector.y>0.0?rotations[5]:rotations[4];else return vector.z>0.0?rotations[2]:rotations[3];}return rotations[3];}float getShadowIntensity(const in int index,const in x3d_LightSourceParameters light){if(light.type==x3d_PointLight){const mat4 biasMatrix=mat4(0.5,0.0,0.0,0.0,0.0,0.5,0.0,0.0,0.0,0.0,0.5,0.0,0.5,0.5,0.5,1.0);const mat4 projectionMatrix=mat4(1.0,0.0,0.0,0.0,0.0,0.5,0.0,0.0,0.0,0.0,-1.000025000312504,-1.0,0,0.0,-0.25000312503906297,0.0);vec2 texelSize=vec2(1.0)/(float(light.shadowMapSize)*vec2(4.0,2.0));vec4 shadowCoord=light.shadowMatrix*vec4(vertex,1.0);vec3 lightToPosition=shadowCoord.xyz;shadowCoord=biasMatrix*(projectionMatrix*(getPointLightRotations(lightToPosition)*shadowCoord));shadowCoord.z-=light.shadowBias;shadowCoord.xyz/=shadowCoord.w; +#if defined(X3D_PCF_FILTERING)||defined(X3D_PCF_SOFT_FILTERING) +vec2 offset=vec2(-1,1)*(texelSize.y*42.0);float value=(texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.xyy,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.yyy,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.xyx,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.yyx,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.xxy,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.yxy,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.xxx,texelSize.y),shadowCoord.z)+texture2DCompare(index,cubeToUVCompact(lightToPosition+offset.yxx,texelSize.y),shadowCoord.z))*(1.0/9.0);return light.shadowIntensity*value; +#else +float value=texture2DCompare(index,cubeToUVCompact(lightToPosition,texelSize.y),shadowCoord.z);return light.shadowIntensity*value; +#endif +}else{ +#if defined(X3D_PCF_FILTERING) +vec2 texelSize=vec2(1.0)/vec2(light.shadowMapSize);vec4 shadowCoord=light.shadowMatrix*vec4(vertex,1.0);shadowCoord.z-=light.shadowBias;shadowCoord.xyz/=shadowCoord.w;if(any(greaterThan(abs(shadowCoord.xy-0.5),vec2(0.5))))return 0.0;vec2 d0=-texelSize;vec2 d1=texelSize;float value=(texture2DCompare(index,shadowCoord.xy+d0,shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+vec2(0.0,d0.y),shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+vec2(d1.x,d0.y),shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+vec2(d0.x,0.0),shadowCoord.z)+texture2DCompare(index,shadowCoord.xy,shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+vec2(d1.x,0.0),shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+vec2(d0.x,d1.y),shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+vec2(0.0,d1.y),shadowCoord.z)+texture2DCompare(index,shadowCoord.xy+d1,shadowCoord.z))*(1.0/9.0);return light.shadowIntensity*value; +#elif defined(X3D_PCF_SOFT_FILTERING) +vec2 texelSize=vec2(1.0)/vec2(light.shadowMapSize);vec4 shadowCoord=light.shadowMatrix*vec4(vertex,1.0);shadowCoord.z-=light.shadowBias;shadowCoord.xyz/=shadowCoord.w;if(any(greaterThan(abs(shadowCoord.xy-0.5),vec2(0.5))))return 0.0;vec2 d0=-texelSize;vec2 d1=texelSize;float value=(texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+d0,shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+vec2(0.0,d0.y),shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+vec2(d1.x,d0.y),shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+vec2(d0.x,0.0),shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy,shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+vec2(d1.x,0.0),shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+vec2(d0.x,d1.y),shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+vec2(0.0,d1.y),shadowCoord.z)+texture2DShadowLerp(index,texelSize,float(shadowMapSize),shadowCoord.xy+d1,shadowCoord.z))*(1.0/9.0);return light.shadowIntensity*value; +#else +vec4 shadowCoord=light.shadowMatrix*vec4(vertex,1.0);shadowCoord.z-=light.shadowBias;shadowCoord.xyz/=shadowCoord.w;if(any(greaterThan(abs(shadowCoord.xy-0.5),vec2(0.5))))return 0.0;float value=texture2DCompare(index,shadowCoord.xy,shadowCoord.z);return light.shadowIntensity*value; +#endif +}return 0.0;} +#endif +` +; + +x_ite_Namespace .add ("Shadow2.glsl", "assets/shaders/webgl2/include/Shadow2.glsl", Shadow2_glsl_default_); +/* harmony default export */ const Shadow2_glsl = (Shadow2_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/include/Skin2.glsl.js +const Skin2_glsl_default_ = /* glsl */ `#if defined(X3D_SKINNING) +in float x3d_CoordIndex;uniform sampler2D x3d_JointsTexture;uniform sampler2D x3d_DisplacementsTexture;uniform sampler2D x3d_JointMatricesTexture;mat4 getJointMatrix(const in int joint){vec4 a=texelFetch(x3d_JointMatricesTexture,joint*8,0);vec4 b=texelFetch(x3d_JointMatricesTexture,joint*8+1,0);vec4 c=texelFetch(x3d_JointMatricesTexture,joint*8+2,0);vec4 d=texelFetch(x3d_JointMatricesTexture,joint*8+3,0);return mat4(a,b,c,d);}mat3 getDisplacementJointMatrix(const in int joint){mat4 m=getJointMatrix(joint);return mat3(m[0].xyz,m[1].xyz,m[2].xyz);} +#if defined(X3D_NORMALS) +vec3 skinNormal=vec3(0.0);mat3 getJointNormalMatrix(const in int joint){vec4 a=texelFetch(x3d_JointMatricesTexture,joint*8+4,0);vec4 b=texelFetch(x3d_JointMatricesTexture,joint*8+5,0);vec4 c=texelFetch(x3d_JointMatricesTexture,joint*8+6,0);return mat3(a.xyz,vec3(a.w,b.xy),vec3(b.zw,c.x));} +#define getSkinNormal(normal)(skinNormal) +#endif +vec4 getSkinVertex(const in vec4 vertex,const in vec3 normal){int coordIndex=int(x3d_CoordIndex);vec4 skin=vertex; +#if defined(X3D_NORMALS) +skinNormal=normal; +#endif +#if X3D_NUM_DISPLACEMENTS>0 +{int coordIndexD=coordIndex*X3D_NUM_DISPLACEMENTS;int width=textureSize(x3d_DisplacementsTexture,0).x;int offset=(width*width)/2;for(int i=0;i=cutOffAngle)return 0.0;else if(spotAngle<=beamWidth)return 1.0;return(spotAngle-cutOffAngle)/(beamWidth-cutOffAngle);} +` +; + +x_ite_Namespace .add ("SpotFactor2.glsl", "assets/shaders/webgl2/include/SpotFactor2.glsl", SpotFactor2_glsl_default_); +/* harmony default export */ const SpotFactor2_glsl = (SpotFactor2_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/include/Stipple2.glsl.js +const Stipple2_glsl_default_ = /* glsl */ `#if defined(X3D_GEOMETRY_1D)&&defined(X3D_STYLE_PROPERTIES) +#pragma X3D include "Line2.glsl" +uniform x3d_LinePropertiesParameters x3d_LineProperties;flat in float lengthSoFar;flat in vec2 startPoint;in vec2 midPoint;void stipple(){vec2 point=closest_point(line2(startPoint,midPoint),gl_FragCoord.xy);float s=(lengthSoFar+length(point-startPoint))*x3d_LineProperties.lineStippleScale; +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +#if X3D_NUM_TEXTURE_COORDINATES>0 +texCoord0=vec4(s,0.0,0.0,1.0); +#endif +#if X3D_NUM_TEXTURE_COORDINATES>1 +texCoord1=vec4(s,0.0,0.0,1.0); +#endif +#endif +#if defined(X3D_STYLE_PROPERTIES_TEXTURE) +if(x3d_LineProperties.linetype==16)return;int linetype=x3d_LineProperties.linetype;int height=textureSize(x3d_LineProperties.texture,0).y;float t=1.0-float(linetype*2+1)/float(height*2);float alpha=texture(x3d_LineProperties.texture,vec2(s,t)).a;if(alpha!=1.0)discard; +#endif +} +#endif +` +; + +x_ite_Namespace .add ("Stipple2.glsl", "assets/shaders/webgl2/include/Stipple2.glsl", Stipple2_glsl_default_); +/* harmony default export */ const Stipple2_glsl = (Stipple2_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/include/Texture2.glsl.js +const Texture2_glsl_default_ = /* glsl */ `#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +#pragma X3D include "Perlin.glsl" +vec4 texCoords[X3D_NUM_TEXTURE_COORDINATES];void setTexCoords(){ +#if X3D_NUM_TEXTURE_COORDINATES>0 +texCoords[0]=texCoord0; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>1 +texCoords[1]=texCoord1; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>2 +texCoords[2]=texCoord2; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>3 +texCoords[3]=texCoord3; +#endif +}uniform mat4 x3d_TextureMatrix[X3D_NUM_TEXTURE_TRANSFORMS];vec4 getTexCoord(const in x3d_TextureCoordinateGeneratorParameters textureCoordinateGenerator,const in int textureTransformMapping,const in int textureCoordinateMapping){int mode=textureCoordinateGenerator.mode;switch(mode){case x3d_None:{return x3d_TextureMatrix[textureTransformMapping]*texCoords[textureCoordinateMapping];}case x3d_Sphere:{vec2 N=normalize(gl_FrontFacing?normal:-normal).xy;return vec4(N*0.5+0.5,0.0,1.0);}case x3d_CameraSpaceNormal:{vec3 N=normalize(gl_FrontFacing?normal:-normal);return vec4(N,1.0);}case x3d_CameraSpacePosition:{return vec4(vertex,1.0);}case x3d_CameraSpaceReflectionVector:{vec3 N=normalize(gl_FrontFacing?normal:-normal);return vec4(reflect(normalize(vertex),-N),1.0);}case x3d_SphereLocal:{vec2 N=normalize(gl_FrontFacing?localNormal:-localNormal).xy;return vec4(N*0.5+0.5,0.0,1.0);}case x3d_Coord:{return vec4(localVertex,1.0);}case x3d_CoordEye:{return vec4(vertex,1.0);}case x3d_Noise:{vec3 scale=vec3(textureCoordinateGenerator.parameter[0],textureCoordinateGenerator.parameter[1],textureCoordinateGenerator.parameter[2]);vec3 translation=vec3(textureCoordinateGenerator.parameter[3],textureCoordinateGenerator.parameter[4],textureCoordinateGenerator.parameter[5]);return vec4(perlin(localVertex*scale+translation),1.0);}case x3d_NoiseEye:{vec3 scale=vec3(textureCoordinateGenerator.parameter[0],textureCoordinateGenerator.parameter[1],textureCoordinateGenerator.parameter[2]);vec3 translation=vec3(textureCoordinateGenerator.parameter[3],textureCoordinateGenerator.parameter[4],textureCoordinateGenerator.parameter[5]);return vec4(perlin(vertex*scale+translation),1.0);}case x3d_SphereReflect:{vec3 N=normalize(gl_FrontFacing?normal:-normal);float eta=textureCoordinateGenerator.parameter[0];return vec4(refract(normalize(vertex),-N,eta),1.0);}case x3d_SphereReflectLocal:{vec3 N=normalize(gl_FrontFacing?localNormal:-localNormal);float eta=textureCoordinateGenerator.parameter[0];vec3 eye=vec3(textureCoordinateGenerator.parameter[1],textureCoordinateGenerator.parameter[2],textureCoordinateGenerator.parameter[3]);return vec4(refract(normalize(localVertex-eye),-N,eta),1.0);}default:{return x3d_TextureMatrix[textureTransformMapping]*texCoords[textureCoordinateMapping];}}}uniform x3d_TextureCoordinateGeneratorParameters x3d_TextureCoordinateGenerator[X3D_NUM_TEXTURE_COORDINATES];vec3 getTexCoord(const in int textureTransformMapping,const in int textureCoordinateMapping){vec4 texCoord=getTexCoord(x3d_TextureCoordinateGenerator[textureCoordinateMapping],textureTransformMapping,textureCoordinateMapping);texCoord.stp/=texCoord.q; +#if defined(X3D_GEOMETRY_2D) +if(gl_FrontFacing==false)texCoord.s=1.0-texCoord.s; +#endif +return texCoord.stp;} +#endif +#if defined(X3D_TEXTURE) +uniform int x3d_TextureType[X3D_NUM_TEXTURES];uniform sampler2D x3d_Texture2D[X3D_NUM_TEXTURES];uniform sampler3D x3d_Texture3D[X3D_NUM_TEXTURES];uniform samplerCube x3d_TextureCube[X3D_NUM_TEXTURES]; +#if defined(X3D_MULTI_TEXTURING) +vec4 getTexture(const in int i,const in vec3 texCoord){switch(i){ +#if X3D_NUM_TEXTURES>0 +case 0: +#if defined(X3D_TEXTURE0_2D) +return texture(x3d_Texture2D[0],texCoord.st); +#elif defined(X3D_TEXTURE0_3D) +return texture(x3d_Texture3D[0],texCoord.stp); +#elif defined(X3D_TEXTURE0_CUBE) +return texture(x3d_TextureCube[0],texCoord.stp); +#endif +#endif +#if X3D_NUM_TEXTURES>1 +case 1: +#if defined(X3D_TEXTURE0_2D) +return texture(x3d_Texture2D[1],texCoord.st); +#elif defined(X3D_TEXTURE0_3D) +return texture(x3d_Texture3D[1],texCoord.stp); +#elif defined(X3D_TEXTURE0_CUBE) +return texture(x3d_TextureCube[1],texCoord.stp); +#endif +#endif +}return vec4(0.0);} +#endif +#if defined(X3D_MULTI_TEXTURING) +uniform vec4 x3d_MultiTextureColor;uniform x3d_MultiTextureParameters x3d_MultiTexture[X3D_NUM_TEXTURES]; +#endif +vec4 getTextureColor(const in vec4 diffuseColor,const in vec4 specularColor){ +#if defined(X3D_MULTI_TEXTURING) +vec4 currentColor=diffuseColor;for(int i=0;i0 +case 0:return texture(x3d_ProjectiveTexture[0],texCoord); +#endif +#if X3D_NUM_TEXTURE_PROJECTORS>1 +case 1:return texture(x3d_ProjectiveTexture[1],texCoord); +#endif +}return vec4(0.0);}vec4 getProjectiveTextureColor(in vec4 currentColor){vec3 N=gl_FrontFacing?normal:-normal;for(int i=0;i1.0)continue;if(texCoord.t<0.0||texCoord.t>1.0)continue;if(texCoord.p<0.0||texCoord.p>1.0)continue;vec3 p=x3d_ProjectiveTextureLocation[i]-vertex;if(dot(N,p)<0.0)continue;currentColor*=getProjectiveTexture(i,texCoord.st);}return currentColor;} +#endif +` +; + +x_ite_Namespace .add ("Texture2.glsl", "assets/shaders/webgl2/include/Texture2.glsl", Texture2_glsl_default_); +/* harmony default export */ const Texture2_glsl = (Texture2_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/include/Utils2.glsl.js +const Utils2_glsl_default_ = /* glsl */ `#if defined(X3D_SKINNING)||defined(X3D_PARTICLE_SYSTEM) +vec4 texelFetch(const in sampler2D _sampler,const in int index,const in int lod){int x=textureSize(_sampler,lod).x;ivec2 p=ivec2(index % x,index/x);vec4 t=texelFetch(_sampler,p,lod);return t;} +#endif +` +; + +x_ite_Namespace .add ("Utils2.glsl", "assets/shaders/webgl2/include/Utils2.glsl", Utils2_glsl_default_); +/* harmony default export */ const Utils2_glsl = (Utils2_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/include/Vertex2.glsl.js +const Vertex2_glsl_default_ = /* glsl */ `uniform mat4 x3d_ProjectionMatrix;uniform mat4 x3d_ModelViewMatrix; +#if defined(X3D_GEOMETRY_1D)&&defined(X3D_STYLE_PROPERTIES) +in vec3 x3d_LineStipple; +#endif +#if defined(X3D_FOG)&&defined(X3D_FOG_COORDS) +in float x3d_FogDepth; +#endif +#if defined(X3D_COLOR_MATERIAL) +in vec4 x3d_Color; +#endif +#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D) +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +#if X3D_NUM_TEXTURE_COORDINATES>0 +in vec4 x3d_TexCoord0; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>1 +in vec4 x3d_TexCoord1; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>2 +in vec4 x3d_TexCoord2; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>3 +in vec4 x3d_TexCoord3; +#endif +#endif +#endif +in vec4 x3d_Vertex; +#if defined(X3D_FOG)&&defined(X3D_FOG_COORDS) +out float fogDepth; +#endif +#if defined(X3D_COLOR_MATERIAL) +out vec4 color; +#endif +#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D) +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +#if X3D_NUM_TEXTURE_COORDINATES>0 +out vec4 texCoord0; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>1 +out vec4 texCoord1; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>2 +out vec4 texCoord2; +#endif +#if X3D_NUM_TEXTURE_COORDINATES>3 +out vec4 texCoord3; +#endif +#endif +#endif +#if defined(X3D_NORMALS) +uniform mat3 x3d_NormalMatrix;in vec3 x3d_Normal;out vec3 normal; +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +out vec3 localNormal; +#endif +#endif +#if defined(X3D_GEOMETRY_1D)&&defined(X3D_STYLE_PROPERTIES) +flat out float lengthSoFar;flat out vec2 startPoint;out vec2 midPoint; +#endif +out vec3 vertex; +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +out vec3 localVertex; +#endif +#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER) +out float depth; +#endif +#pragma X3D include "Utils.glsl" +#pragma X3D include "Skin.glsl" +#pragma X3D include "Particle.glsl" +#pragma X3D include "PointSize.glsl" +void vertex_main(){ +#if defined(X3D_NORMALS) +vec4 x3d_TransformedVertex=getParticleVertex(getSkinVertex(x3d_Vertex,x3d_Normal));vec3 x3d_TransformedNormal=getSkinNormal(x3d_Normal); +#else +vec4 x3d_TransformedVertex=getParticleVertex(getSkinVertex(x3d_Vertex,vec3(0.0))); +#endif +vec4 position=x3d_ModelViewMatrix*x3d_TransformedVertex;vertex=position.xyz; +#if defined(X3D_GEOMETRY_0D) +#if defined(X3D_STYLE_PROPERTIES) +gl_PointSize=pointSize=getPointSize(vertex); +#else +gl_PointSize=1.0; +#endif +#endif +#if defined(X3D_GEOMETRY_1D)&&defined(X3D_STYLE_PROPERTIES) +lengthSoFar=x3d_LineStipple.z;startPoint=x3d_LineStipple.xy;midPoint=x3d_LineStipple.xy; +#endif +#if defined(X3D_FOG)&&defined(X3D_FOG_COORDS) +fogDepth=x3d_FogDepth; +#endif +#if defined(X3D_COLOR_MATERIAL) +color=x3d_Color; +#endif +#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D) +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +#if X3D_NUM_TEXTURE_COORDINATES>0 +texCoord0=getParticleTexCoord(x3d_TexCoord0); +#endif +#if X3D_NUM_TEXTURE_COORDINATES>1 +texCoord1=getParticleTexCoord(x3d_TexCoord1); +#endif +#if X3D_NUM_TEXTURE_COORDINATES>2 +texCoord2=getParticleTexCoord(x3d_TexCoord2); +#endif +#if X3D_NUM_TEXTURE_COORDINATES>3 +texCoord3=getParticleTexCoord(x3d_TexCoord3); +#endif +#endif +#endif +#if defined(X3D_NORMALS) +normal=x3d_NormalMatrix*x3d_TransformedNormal; +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +localNormal=x3d_TransformedNormal; +#endif +#endif +#if defined(X3D_TEXTURE)||defined(X3D_MATERIAL_TEXTURES) +localVertex=x3d_TransformedVertex.xyz; +#endif +gl_Position=x3d_ProjectionMatrix*position; +#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER) +depth=1.0+gl_Position.w; +#endif +} +` +; + +x_ite_Namespace .add ("Vertex2.glsl", "assets/shaders/webgl2/include/Vertex2.glsl", Vertex2_glsl_default_); +/* harmony default export */ const Vertex2_glsl = (Vertex2_glsl_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl1/Default1.vs.js +const Default1_vs_default_ = /* glsl */ `precision highp float;precision highp int;precision highp sampler2D;precision highp samplerCube; +#pragma X3D include "include/Vertex.glsl" +void main(){vertex_main();} +` +; + +x_ite_Namespace .add ("Default1.vs", "assets/shaders/webgl1/Default1.vs", Default1_vs_default_); +/* harmony default export */ const Default1_vs = (Default1_vs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl1/Depth1.fs.js +const Depth1_fs_default_ = /* glsl */ `precision highp float;precision highp int;precision highp sampler2D;varying vec3 vertex; +#pragma X3D include "include/ClipPlanes.glsl" +#pragma X3D include "include/Point.glsl" +void main(){ +#if defined(X3D_CLIP_PLANES) +clip(); +#endif +#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES) +if(getPointColor(vec4(1.0)).a<0.5)discard; +#endif +gl_FragColor=vec4(gl_FragCoord.z);} +` +; + +x_ite_Namespace .add ("Depth1.fs", "assets/shaders/webgl1/Depth1.fs", Depth1_fs_default_); +/* harmony default export */ const Depth1_fs = (Depth1_fs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl1/Depth1.vs.js +const Depth1_vs_default_ = /* glsl */ `precision highp float;precision highp int;uniform mat4 x3d_ProjectionMatrix;uniform mat4 x3d_ModelViewMatrix;attribute vec4 x3d_Vertex;varying vec3 vertex; +#pragma X3D include "include/PointSize.glsl" +void main(){vec4 position=x3d_ModelViewMatrix*x3d_Vertex;vertex=position.xyz; +#if defined(X3D_GEOMETRY_0D) +#if defined(X3D_STYLE_PROPERTIES) +gl_PointSize=max(pointSize=getPointSize(vertex),2.0); +#else +gl_PointSize=2.0; +#endif +#endif +gl_Position=x3d_ProjectionMatrix*position;} +` +; + +x_ite_Namespace .add ("Depth1.vs", "assets/shaders/webgl1/Depth1.vs", Depth1_vs_default_); +/* harmony default export */ const Depth1_vs = (Depth1_vs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl1/Gouraud1.fs.js +const Gouraud1_fs_default_ = /* glsl */ `precision highp float;precision highp int;precision highp sampler2D;precision highp samplerCube; +#pragma X3D include "include/Fragment.glsl" +varying vec4 frontColor; +#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D) +varying vec4 backColor; +#endif +vec4 getMaterialColor(){ +#if defined(X3D_GEOMETRY_0D)||defined(X3D_GEOMETRY_1D) +vec4 finalColor=frontColor; +#else +vec4 finalColor=gl_FrontFacing?frontColor:backColor; +#endif +#if defined(X3D_TEXTURE) +finalColor=getTextureColor(finalColor,vec4(1.0)); +#endif +#if defined(X3D_PROJECTIVE_TEXTURE_MAPPING) +finalColor=getProjectiveTextureColor(finalColor); +#endif +return finalColor;}void main(){fragment_main();} +` +; + +x_ite_Namespace .add ("Gouraud1.fs", "assets/shaders/webgl1/Gouraud1.fs", Gouraud1_fs_default_); +/* harmony default export */ const Gouraud1_fs = (Gouraud1_fs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl1/Gouraud1.vs.js +const Gouraud1_vs_default_ = /* glsl */ `precision highp float;precision highp int;precision highp sampler2D;precision highp samplerCube; +#pragma X3D include "include/Vertex.glsl" +#pragma X3D include "include/Material.glsl" +varying vec4 frontColor; +#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D) +varying vec4 backColor; +#endif +vec4 getMaterialColor(const in vec3 N,const in vec3 vertex,const in x3d_MaterialParameters material){float alpha=1.0-x3d_Material.transparency; +#if defined(X3D_COLOR_MATERIAL) +vec4 diffuseParameter=vec4(color.rgb,color.a*alpha); +#else +vec4 diffuseParameter=vec4(x3d_Material.diffuseColor,alpha); +#endif +vec3 ambientColor=diffuseParameter.rgb*material.ambientIntensity; +#if defined(X3D_LIGHTING) +vec3 finalColor=getMaterialColor(vertex,N,ambientColor,diffuseParameter.rgb,material.specularColor,material.shininess); +#else +vec3 finalColor=vec3(0.0); +#endif +finalColor+=material.emissiveColor;return vec4(finalColor,diffuseParameter.a);}void main(){vertex_main();normal=normalize(normal);frontColor=getMaterialColor(normal,vertex,x3d_Material); +#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D) +backColor=getMaterialColor(-normal,vertex,x3d_Material); +#endif +} +` +; + +x_ite_Namespace .add ("Gouraud1.vs", "assets/shaders/webgl1/Gouraud1.vs", Gouraud1_vs_default_); +/* harmony default export */ const Gouraud1_vs = (Gouraud1_vs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl1/PBR1.fs.js +const PBR1_fs_default_ = /* glsl */ `#extension GL_EXT_shader_texture_lod:enable +precision highp float;precision highp int;precision highp sampler2D;precision highp samplerCube; +#pragma X3D include "include/Fragment.glsl" +#pragma X3D include "include/Colors.glsl" +#pragma X3D include "include/Normal.glsl" +#pragma X3D include "include/SpotFactor.glsl" +#pragma X3D include "include/Shadow.glsl" +#if defined(X3D_LIGHTING) +uniform x3d_LightSourceParameters x3d_LightSource[X3D_NUM_LIGHTS]; +#endif +uniform x3d_PhysicalMaterialParameters x3d_Material; +#if defined(USE_IBL) +uniform samplerCube diffuseEnvironmentTexture;uniform samplerCube specularEnvironmentTexture;uniform sampler2D brdfLUT; +#endif +#if defined(X3D_BASE_TEXTURE) +uniform x3d_BaseTextureParameters x3d_BaseTexture; +#endif +vec4 getBaseColor(){float alpha=1.0-x3d_Material.transparency; +#if defined(X3D_COLOR_MATERIAL) +vec4 baseParameter=vec4(color.rgb,color.a*alpha); +#else +vec4 baseParameter=vec4(x3d_Material.baseColor,alpha); +#endif +#if defined(X3D_BASE_TEXTURE) +vec3 texCoord=getTexCoord(x3d_BaseTexture.textureTransformMapping,x3d_BaseTexture.textureCoordinateMapping); +#if defined(X3D_BASE_TEXTURE_2D) +return baseParameter*SRGBtoLINEAR(texture2D(x3d_BaseTexture.texture2D,texCoord.st)); +#elif defined(X3D_BASE_TEXTURE_CUBE) +return baseParameter*SRGBtoLINEAR(textureCube(x3d_BaseTexture.textureCube,texCoord)); +#endif +#elif defined(X3D_TEXTURE) +return getTextureColor(baseParameter,vec4(vec3(1.0),alpha)); +#else +return baseParameter; +#endif +} +#if defined(X3D_EMISSIVE_TEXTURE) +uniform x3d_EmissiveTextureParameters x3d_EmissiveTexture; +#endif +vec3 getEmissiveColor(){vec3 emissiveParameter=x3d_Material.emissiveColor; +#if defined(X3D_EMISSIVE_TEXTURE) +vec3 texCoord=getTexCoord(x3d_EmissiveTexture.textureTransformMapping,x3d_EmissiveTexture.textureCoordinateMapping); +#if defined(X3D_EMISSIVE_TEXTURE_2D) +return emissiveParameter*SRGBtoLINEAR(texture2D(x3d_EmissiveTexture.texture2D,texCoord.st)).rgb; +#elif defined(X3D_EMISSIVE_TEXTURE_CUBE) +return emissiveParameter*SRGBtoLINEAR(textureCube(x3d_EmissiveTexture.textureCube,texCoord)).rgb; +#endif +#else +return emissiveParameter.rgb; +#endif +} +#if defined(X3D_METALLIC_ROUGHNESS_TEXTURE) +uniform x3d_MetallicRoughnessTextureParameters x3d_MetallicRoughnessTexture; +#endif +vec2 getMetallicRoughness(){float metallic=x3d_Material.metallic;float perceptualRoughness=x3d_Material.roughness; +#if defined(X3D_METALLIC_ROUGHNESS_TEXTURE) +vec3 texCoord=getTexCoord(x3d_MetallicRoughnessTexture.textureTransformMapping,x3d_MetallicRoughnessTexture.textureCoordinateMapping); +#if defined(X3D_METALLIC_ROUGHNESS_TEXTURE_2D) +vec4 mrSample=texture2D(x3d_MetallicRoughnessTexture.texture2D,texCoord.st); +#elif defined(X3D_METALLIC_ROUGHNESS_TEXTURE_CUBE) +vec4 mrSample=textureCube(x3d_MetallicRoughnessTexture.textureCube,texCoord); +#endif +metallic*=mrSample.b;perceptualRoughness*=mrSample.g;return vec2(metallic,perceptualRoughness); +#else +return vec2(metallic,perceptualRoughness); +#endif +} +#if defined(X3D_OCCLUSION_TEXTURE) +uniform x3d_OcclusionTextureParameters x3d_OcclusionTexture; +#endif +float getOcclusionFactor(){ +#if defined(X3D_OCCLUSION_TEXTURE) +vec3 texCoord=getTexCoord(x3d_OcclusionTexture.textureTransformMapping,x3d_OcclusionTexture.textureCoordinateMapping); +#if defined(X3D_OCCLUSION_TEXTURE_2D) +return texture2D(x3d_OcclusionTexture.texture2D,texCoord.st).r; +#elif defined(X3D_OCCLUSION_TEXTURE_CUBE) +return textureCube(x3d_OcclusionTexture.textureCube,texCoord).r; +#endif +#else +return 1.0; +#endif +}struct PBRInfo{float NdotL;float NdotV;float NdotH;float LdotH;float VdotH;float perceptualRoughness;float metalness;vec3 reflectance0;vec3 reflectance90;float alphaRoughness;vec3 diffuseColor;vec3 specularColor;};const float M_PI=3.141592653589793;const float c_MinRoughness=0.04; +#if defined(USE_IBL) +vec3 getIBLContribution(const in PBRInfo pbrInputs,vec3 n,const in vec3 reflection){float mipCount=9.0;float lod=pbrInputs.perceptualRoughness*mipCount;vec3 brdf=SRGBtoLINEAR(texture2D(brdfLUT,vec2(pbrInputs.NdotV,1.0-pbrInputs.perceptualRoughness))).rgb;vec3 diffuseLight=SRGBtoLINEAR(textureCube(diffuseEnvironmentTexture,n)).rgb; +#if defined(USE_TEX_LOD) +vec3 specularLight=SRGBtoLINEAR(textureCubeLodEXT(specularEnvironmentTexture,reflection,lod)).rgb; +#else +vec3 specularLight=SRGBtoLINEAR(textureCube(specularEnvironmentTexture,reflection)).rgb; +#endif +vec3 diffuse=diffuseLight*pbrInputs.diffuseColor;vec3 specular=specularLight*(pbrInputs.specularColor*brdf.x+brdf.y);return diffuse+specular;} +#endif +vec3 diffuse(const in PBRInfo pbrInputs){return pbrInputs.diffuseColor/M_PI;}vec3 specularReflection(const in PBRInfo pbrInputs){return pbrInputs.reflectance0+(pbrInputs.reflectance90-pbrInputs.reflectance0)*pow(clamp(1.0-pbrInputs.VdotH,0.0,1.0),5.0);}float geometricOcclusion(const in PBRInfo pbrInputs){float NdotL=pbrInputs.NdotL;float NdotV=pbrInputs.NdotV;float r=pbrInputs.alphaRoughness;float attenuationL=2.0*NdotL/(NdotL+sqrt(r*r+(1.0-r*r)*(NdotL*NdotL)));float attenuationV=2.0*NdotV/(NdotV+sqrt(r*r+(1.0-r*r)*(NdotV*NdotV)));return attenuationL*attenuationV;}float microfacetDistribution(const in PBRInfo pbrInputs){float roughnessSq=pbrInputs.alphaRoughness*pbrInputs.alphaRoughness;float f=(pbrInputs.NdotH*roughnessSq-pbrInputs.NdotH)*pbrInputs.NdotH+1.0;return roughnessSq/(M_PI*f*f);}vec4 getMaterialColor(){vec2 metallicRoughness=getMetallicRoughness();float perceptualRoughness=clamp(metallicRoughness[1],c_MinRoughness,1.0);float metallic=clamp(metallicRoughness[0],0.0,1.0);float alphaRoughness=perceptualRoughness*perceptualRoughness;vec4 baseColor=getBaseColor();float alpha=baseColor.a;vec3 f0=vec3(0.04);vec3 diffuseColor=baseColor.rgb*(vec3(1.0)-f0);diffuseColor*=1.0-metallic;vec3 specularColor=mix(f0,baseColor.rgb,metallic);float reflectance=max(max(specularColor.r,specularColor.g),specularColor.b);float reflectance90=clamp(reflectance*25.0,0.0,1.0);vec3 specularEnvironmentR0=specularColor.rgb;vec3 specularEnvironmentR90=vec3(1.0,1.0,1.0)*reflectance90;vec3 n=getNormalVector(x3d_Material.normalScale);vec3 v=normalize(-vertex);vec3 finalColor=vec3(0.0); +#if defined(X3D_LIGHTING) +for(int i=0;i0.001&&light.shadowIntensity>0.0)diffuseSpecContrib=mix(diffuseSpecContrib,light.shadowColor,getShadowIntensity(i,light)); +#endif +vec3 color=NdotL*attenuationSpotFactor*light.color*diffuseSpecContrib;finalColor+=color;}} +#endif +#if defined(USE_IBL) +vec3 reflection=-normalize(reflect(v,n));finalColor+=getIBLContribution(pbrInputs,n,reflection); +#endif +#if defined(X3D_OCCLUSION_TEXTURE) +finalColor=mix(finalColor,finalColor*getOcclusionFactor(),x3d_Material.occlusionStrength); +#endif +finalColor+=getEmissiveColor();return Gamma(vec4(finalColor,alpha));}void main(){fragment_main();} +` +; + +x_ite_Namespace .add ("PBR1.fs", "assets/shaders/webgl1/PBR1.fs", PBR1_fs_default_); +/* harmony default export */ const PBR1_fs = (PBR1_fs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl1/Phong1.fs.js +const Phong1_fs_default_ = /* glsl */ `precision highp float;precision highp int;precision highp sampler2D;precision highp samplerCube; +#pragma X3D include "include/Fragment.glsl" +#pragma X3D include "include/Material.glsl" +#pragma X3D include "include/Normal.glsl" +#if defined(X3D_AMBIENT_TEXTURE) +uniform x3d_AmbientTextureParameters x3d_AmbientTexture; +#endif +vec3 getAmbientColor(const in vec3 diffuseColor){vec3 ambientParameter=x3d_Material.ambientIntensity*diffuseColor; +#if defined(X3D_AMBIENT_TEXTURE) +vec3 texCoord=getTexCoord(x3d_AmbientTexture.textureTransformMapping,x3d_AmbientTexture.textureCoordinateMapping); +#if defined(X3D_AMBIENT_TEXTURE_2D) +return ambientParameter*texture2D(x3d_AmbientTexture.texture2D,texCoord.st).rgb; +#elif defined(X3D_AMBIENT_TEXTURE_CUBE) +return ambientParameter*textureCube(x3d_AmbientTexture.textureCube,texCoord).rgb; +#endif +#else +return ambientParameter; +#endif +} +#if defined(X3D_DIFFUSE_TEXTURE) +uniform x3d_DiffuseTextureParameters x3d_DiffuseTexture; +#endif +vec4 getDiffuseColor(){float alpha=1.0-x3d_Material.transparency; +#if defined(X3D_COLOR_MATERIAL) +vec4 diffuseParameter=vec4(color.rgb,color.a*alpha); +#else +vec4 diffuseParameter=vec4(x3d_Material.diffuseColor,alpha); +#endif +#if defined(X3D_DIFFUSE_TEXTURE) +vec3 texCoord=getTexCoord(x3d_DiffuseTexture.textureTransformMapping,x3d_DiffuseTexture.textureCoordinateMapping); +#if defined(X3D_DIFFUSE_TEXTURE_2D) +return diffuseParameter*texture2D(x3d_DiffuseTexture.texture2D,texCoord.st); +#elif defined(X3D_DIFFUSE_TEXTURE_CUBE) +return diffuseParameter*textureCube(x3d_DiffuseTexture.textureCube,texCoord); +#endif +#elif defined(X3D_TEXTURE) +return getTextureColor(diffuseParameter,vec4(x3d_Material.specularColor,alpha)); +#else +return diffuseParameter; +#endif +} +#if defined(X3D_SPECULAR_TEXTURE) +uniform x3d_SpecularTextureParameters x3d_SpecularTexture; +#endif +vec3 getSpecularColor(){vec3 specularParameter=x3d_Material.specularColor; +#if defined(X3D_SPECULAR_TEXTURE) +vec3 texCoord=getTexCoord(x3d_SpecularTexture.textureTransformMapping,x3d_SpecularTexture.textureCoordinateMapping); +#if defined(X3D_SPECULAR_TEXTURE_2D) +return specularParameter*texture2D(x3d_SpecularTexture.texture2D,texCoord.st).rgb; +#elif defined(X3D_SPECULAR_TEXTURE_CUBE) +return specularParameter*textureCube(x3d_SpecularTexture.textureCube,texCoord).rgb; +#endif +#else +return specularParameter; +#endif +} +#if defined(X3D_EMISSIVE_TEXTURE) +uniform x3d_EmissiveTextureParameters x3d_EmissiveTexture; +#endif +vec3 getEmissiveColor(){vec3 emissiveParameter=x3d_Material.emissiveColor; +#if defined(X3D_EMISSIVE_TEXTURE) +vec3 texCoord=getTexCoord(x3d_EmissiveTexture.textureTransformMapping,x3d_EmissiveTexture.textureCoordinateMapping); +#if defined(X3D_EMISSIVE_TEXTURE_2D) +return emissiveParameter*texture2D(x3d_EmissiveTexture.texture2D,texCoord.st).rgb; +#elif defined(X3D_EMISSIVE_TEXTURE_CUBE) +return emissiveParameter*textureCube(x3d_EmissiveTexture.textureCube,texCoord).rgb; +#endif +#else +return emissiveParameter; +#endif +} +#if defined(X3D_SHININESS_TEXTURE) +uniform x3d_ShininessTextureParameters x3d_ShininessTexture; +#endif +float getShininessFactor(){float shininess=x3d_Material.shininess; +#if defined(X3D_SHININESS_TEXTURE) +vec3 texCoord=getTexCoord(x3d_ShininessTexture.textureTransformMapping,x3d_ShininessTexture.textureCoordinateMapping); +#if defined(X3D_SHININESS_TEXTURE_2D) +return shininess*texture2D(x3d_ShininessTexture.texture2D,texCoord.st).a; +#elif defined(X3D_SHININESS_TEXTURE_CUBE) +return shininess*textureCube(x3d_ShininessTexture.textureCube,texCoord).a; +#endif +#else +return shininess; +#endif +} +#if defined(X3D_OCCLUSION_TEXTURE) +uniform x3d_OcclusionTextureParameters x3d_OcclusionTexture; +#endif +float getOcclusionFactor(){ +#if defined(X3D_OCCLUSION_TEXTURE) +vec3 texCoord=getTexCoord(x3d_OcclusionTexture.textureTransformMapping,x3d_OcclusionTexture.textureCoordinateMapping); +#if defined(X3D_OCCLUSION_TEXTURE_2D) +return texture2D(x3d_OcclusionTexture.texture2D,texCoord.st).r; +#elif defined(X3D_OCCLUSION_TEXTURE_CUBE) +return textureCube(x3d_OcclusionTexture.textureCube,texCoord).r; +#endif +#else +return 1.0; +#endif +}vec4 getMaterialColor(){vec4 diffuseColorAlpha=getDiffuseColor();float alpha=diffuseColorAlpha.a;vec3 diffuseColor=diffuseColorAlpha.rgb;vec3 ambientColor=getAmbientColor(diffuseColor);vec3 specularColor=getSpecularColor();float shininess=getShininessFactor();float normalScale=x3d_Material.normalScale; +#if defined(X3D_PROJECTIVE_TEXTURE_MAPPING) +vec4 P=getProjectiveTextureColor(vec4(1.0));diffuseColor*=P.rgb;alpha*=P.a; +#endif +#if defined(X3D_LIGHTING) +vec3 finalColor=getMaterialColor(vertex,getNormalVector(normalScale),ambientColor,diffuseColor,specularColor,shininess); +#else +vec3 finalColor=vec3(0.0); +#endif +#if defined(X3D_OCCLUSION_TEXTURE) +finalColor=mix(finalColor,finalColor*getOcclusionFactor(),x3d_Material.occlusionStrength); +#endif +finalColor+=getEmissiveColor();return vec4(finalColor,alpha);}void main(){fragment_main();} +` +; + +x_ite_Namespace .add ("Phong1.fs", "assets/shaders/webgl1/Phong1.fs", Phong1_fs_default_); +/* harmony default export */ const Phong1_fs = (Phong1_fs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl1/Pointing1.fs.js +const Pointing1_fs_default_ = /* glsl */ `#extension GL_EXT_draw_buffers:enable +precision highp float;precision highp int;precision highp sampler2D;varying vec3 vertex;varying vec3 normal; +#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D) +varying vec4 texCoord0; +#else +vec4 texCoord0=vec4(0.0,0.0,0.0,1.0); +#endif +#pragma X3D include "include/ClipPlanes.glsl" +#pragma X3D include "include/Point.glsl" +uniform float x3d_Id;void main(){ +#if defined(X3D_CLIP_PLANES) +clip(); +#endif +#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES) +if(getPointColor(vec4(1.0)).a<0.5)discard;texCoord0=vec4(gl_PointCoord.x,1.0-gl_PointCoord.y,0.0,1.0); +#endif +gl_FragData[0]=vec4(vertex,x3d_Id);gl_FragData[1]=vec4(normal,0.0);gl_FragData[2]=texCoord0;} +` +; + +x_ite_Namespace .add ("Pointing1.fs", "assets/shaders/webgl1/Pointing1.fs", Pointing1_fs_default_); +/* harmony default export */ const Pointing1_fs = (Pointing1_fs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl1/Pointing1.vs.js +const Pointing1_vs_default_ = /* glsl */ `precision highp float;precision highp int;uniform mat4 x3d_ProjectionMatrix;uniform mat4 x3d_ModelViewMatrix;attribute vec4 x3d_Vertex;attribute vec3 x3d_Normal; +#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D) +attribute vec4 x3d_TexCoord0; +#endif +varying vec3 vertex;varying vec3 normal; +#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D) +varying vec4 texCoord0; +#endif +#pragma X3D include "include/PointSize.glsl" +void main(){ +#if defined(X3D_GEOMETRY_0D) +#if defined(X3D_STYLE_PROPERTIES) +gl_PointSize=max(pointSize=getPointSize(vertex),2.0); +#else +gl_PointSize=2.0; +#endif +#endif +vec4 position=x3d_ModelViewMatrix*x3d_Vertex;vertex=position.xyz;normal=x3d_Normal; +#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D) +texCoord0=x3d_TexCoord0; +#endif +gl_Position=x3d_ProjectionMatrix*position;} +` +; + +x_ite_Namespace .add ("Pointing1.vs", "assets/shaders/webgl1/Pointing1.vs", Pointing1_vs_default_); +/* harmony default export */ const Pointing1_vs = (Pointing1_vs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl1/Unlit1.fs.js +const Unlit1_fs_default_ = /* glsl */ `precision highp float;precision highp int;precision highp sampler2D;precision highp samplerCube; +#pragma X3D include "include/Fragment.glsl" +uniform x3d_UnlitMaterialParameters x3d_Material; +#if defined(X3D_EMISSIVE_TEXTURE) +uniform x3d_EmissiveTextureParameters x3d_EmissiveTexture; +#endif +vec4 getEmissiveColor(){float alpha=1.0-x3d_Material.transparency; +#if defined(X3D_COLOR_MATERIAL) +vec4 emissiveParameter=vec4(color.rgb,color.a*alpha); +#else +vec4 emissiveParameter=vec4(x3d_Material.emissiveColor,alpha); +#endif +#if defined(X3D_EMISSIVE_TEXTURE) +vec3 texCoord=getTexCoord(x3d_EmissiveTexture.textureTransformMapping,x3d_EmissiveTexture.textureCoordinateMapping); +#if defined(X3D_EMISSIVE_TEXTURE_2D) +return emissiveParameter*texture2D(x3d_EmissiveTexture.texture2D,texCoord.st); +#elif defined(X3D_EMISSIVE_TEXTURE_CUBE) +return emissiveParameter*textureCube(x3d_EmissiveTexture.textureCube,texCoord); +#endif +#elif defined(X3D_TEXTURE) +return getTextureColor(emissiveParameter,vec4(vec3(1.0),alpha)); +#else +return emissiveParameter; +#endif +}vec4 getMaterialColor(){return getEmissiveColor();}void main(){fragment_main();} +` +; + +x_ite_Namespace .add ("Unlit1.fs", "assets/shaders/webgl1/Unlit1.fs", Unlit1_fs_default_); +/* harmony default export */ const Unlit1_fs = (Unlit1_fs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/Compose2.fs.js +const Compose2_fs_default_ = /* glsl */ `#version 300 es +precision highp float;precision highp int;precision highp sampler2D;uniform sampler2D x3d_AccumRevealageTexture;uniform sampler2D x3d_AlphaTexture;out vec4 x3d_FragColor;void main(){ivec2 fragCoord=ivec2(gl_FragCoord.xy);vec4 accum=texelFetch(x3d_AccumRevealageTexture,fragCoord,0);if(accum.a>=1.0)discard;float alpha=texelFetch(x3d_AlphaTexture,fragCoord,0).r;float revealage=1.0-accum.a;x3d_FragColor=vec4(revealage*accum.rgb/clamp(alpha,0.001,50000.0),revealage);} +` +; + +x_ite_Namespace .add ("Compose2.fs", "assets/shaders/webgl2/Compose2.fs", Compose2_fs_default_); +/* harmony default export */ const Compose2_fs = (Compose2_fs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/Compose2.vs.js +const Compose2_vs_default_ = /* glsl */ `#version 300 es +precision highp float;precision highp int;precision highp sampler2D;layout(location=0)in vec4 x3d_Vertex;void main(){gl_Position=x3d_Vertex;} +` +; + +x_ite_Namespace .add ("Compose2.vs", "assets/shaders/webgl2/Compose2.vs", Compose2_vs_default_); +/* harmony default export */ const Compose2_vs = (Compose2_vs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/Default2.vs.js +const Default2_vs_default_ = /* glsl */ `#version 300 es +precision highp float;precision highp int;precision highp sampler2D;precision highp sampler3D;precision highp samplerCube; +#pragma X3D include "include/Vertex.glsl" +void main(){vertex_main();} +` +; + +x_ite_Namespace .add ("Default2.vs", "assets/shaders/webgl2/Default2.vs", Default2_vs_default_); +/* harmony default export */ const Default2_vs = (Default2_vs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/Depth2.fs.js +const Depth2_fs_default_ = /* glsl */ `#version 300 es +precision highp float;precision highp int;precision highp sampler2D;in vec3 vertex;out vec4 x3d_FragColor; +#pragma X3D include "include/ClipPlanes.glsl" +#pragma X3D include "include/Point.glsl" +void main(){ +#if defined(X3D_CLIP_PLANES) +clip(); +#endif +#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES) +if(getPointColor(vec4(1.0)).a<0.5)discard; +#endif +x3d_FragColor=vec4(gl_FragCoord.z);} +` +; + +x_ite_Namespace .add ("Depth2.fs", "assets/shaders/webgl2/Depth2.fs", Depth2_fs_default_); +/* harmony default export */ const Depth2_fs = (Depth2_fs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/Depth2.vs.js +const Depth2_vs_default_ = /* glsl */ `#version 300 es +precision highp float;precision highp int;precision highp sampler2D;uniform mat4 x3d_ProjectionMatrix;uniform mat4 x3d_ModelViewMatrix;in vec4 x3d_Vertex;out vec3 vertex; +#pragma X3D include "include/Utils.glsl" +#pragma X3D include "include/Skin.glsl" +#pragma X3D include "include/Particle.glsl" +#pragma X3D include "include/PointSize.glsl" +void main(){vec4 x3d_TransformedVertex=getParticleVertex(getSkinVertex(x3d_Vertex,vec3(0.0)));vec4 position=x3d_ModelViewMatrix*x3d_TransformedVertex;vertex=position.xyz; +#if defined(X3D_GEOMETRY_0D) +#if defined(X3D_STYLE_PROPERTIES) +gl_PointSize=max(pointSize=getPointSize(vertex),2.0); +#else +gl_PointSize=2.0; +#endif +#endif +gl_Position=x3d_ProjectionMatrix*position;} +` +; + +x_ite_Namespace .add ("Depth2.vs", "assets/shaders/webgl2/Depth2.vs", Depth2_vs_default_); +/* harmony default export */ const Depth2_vs = (Depth2_vs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/Gouraud2.fs.js +const Gouraud2_fs_default_ = /* glsl */ `#version 300 es +precision highp float;precision highp int;precision highp sampler2D;precision highp sampler3D;precision highp samplerCube; +#pragma X3D include "include/Fragment.glsl" +in vec4 frontColor; +#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D) +in vec4 backColor; +#endif +vec4 getMaterialColor(){ +#if defined(X3D_GEOMETRY_0D)||defined(X3D_GEOMETRY_1D) +vec4 finalColor=frontColor; +#else +vec4 finalColor=gl_FrontFacing?frontColor:backColor; +#endif +#if defined(X3D_TEXTURE) +finalColor=getTextureColor(finalColor,vec4(1.0)); +#endif +#if defined(X3D_PROJECTIVE_TEXTURE_MAPPING) +finalColor=getProjectiveTextureColor(finalColor); +#endif +return finalColor;}void main(){fragment_main();} +` +; + +x_ite_Namespace .add ("Gouraud2.fs", "assets/shaders/webgl2/Gouraud2.fs", Gouraud2_fs_default_); +/* harmony default export */ const Gouraud2_fs = (Gouraud2_fs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/Gouraud2.vs.js +const Gouraud2_vs_default_ = /* glsl */ `#version 300 es +precision highp float;precision highp int;precision highp sampler2D;precision highp sampler3D;precision highp samplerCube; +#pragma X3D include "include/Vertex.glsl" +#pragma X3D include "include/Material.glsl" +out vec4 frontColor; +#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D) +out vec4 backColor; +#endif +vec4 getMaterialColor(const in vec3 N,const in vec3 vertex,const in x3d_MaterialParameters material){float alpha=1.0-x3d_Material.transparency; +#if defined(X3D_COLOR_MATERIAL) +vec4 diffuseParameter=vec4(color.rgb,color.a*alpha); +#else +vec4 diffuseParameter=vec4(x3d_Material.diffuseColor,alpha); +#endif +vec3 ambientColor=diffuseParameter.rgb*material.ambientIntensity; +#if defined(X3D_LIGHTING) +vec3 finalColor=getMaterialColor(vertex,N,ambientColor,diffuseParameter.rgb,material.specularColor,material.shininess); +#else +vec3 finalColor=vec3(0.0); +#endif +finalColor+=material.emissiveColor;return vec4(finalColor,diffuseParameter.a);}void main(){vertex_main();normal=normalize(normal);frontColor=getMaterialColor(normal,vertex,x3d_Material); +#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D) +backColor=getMaterialColor(-normal,vertex,x3d_Material); +#endif +} +` +; + +x_ite_Namespace .add ("Gouraud2.vs", "assets/shaders/webgl2/Gouraud2.vs", Gouraud2_vs_default_); +/* harmony default export */ const Gouraud2_vs = (Gouraud2_vs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/LineTransform2.fs.js +const LineTransform2_fs_default_ = /* glsl */ `#version 300 es +precision highp float;void main(){} +` +; + +x_ite_Namespace .add ("LineTransform2.fs", "assets/shaders/webgl2/LineTransform2.fs", LineTransform2_fs_default_); +/* harmony default export */ const LineTransform2_fs = (LineTransform2_fs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/LineTransform2.vs.js +const LineTransform2_vs_default_ = /* glsl */ `#version 300 es +precision highp float;uniform vec4 viewport;uniform mat4 modelViewProjectionMatrix;uniform mat4 invModelViewProjectionMatrix;uniform float scale;in float x3d_CoordIndex0;in vec3 x3d_LineStipple0;in float x3d_FogDepth0;in vec4 x3d_Color0;in vec3 x3d_Normal0;in vec4 x3d_Vertex0;in float x3d_CoordIndex1;in vec3 x3d_LineStipple1;in float x3d_FogDepth1;in vec4 x3d_Color1;in vec3 x3d_Normal1;in vec4 x3d_Vertex1;out float coordIndex0;out vec3 lineStipple0;out float fogDepth0;out vec4 color0;out vec3 normal0;out vec4 vertex0;out float coordIndex1;out vec3 lineStipple1;out float fogDepth1;out vec4 color1;out vec3 normal1;out vec4 vertex1;out float coordIndex2;out vec3 lineStipple2;out float fogDepth2;out vec4 color2;out vec3 normal2;out vec4 vertex2;vec3 projectPoint(const in vec4 point,const in mat4 modelViewProjectionMatrix,const in vec4 viewport){vec4 vin=modelViewProjectionMatrix*point;vin.xyz=vin.xyz/(2.0*vin.w)+0.5;return vec3(vin.xy*viewport.zw+viewport.xy,vin.z);}vec4 unProjectPoint(const in vec3 win,const in mat4 invModelViewProjection,const in vec4 viewport){vec4 vin=vec4((win.xy-viewport.xy)/viewport.zw*2.0-1.0,2.0*win.z-1.0,1.0);vin=invModelViewProjection*vin;return vec4(vin.xyz/vin.w,1.0);}void main(){vec3 projected0=projectPoint(x3d_Vertex0,modelViewProjectionMatrix,viewport);vec3 projected1=projectPoint(x3d_Vertex1,modelViewProjectionMatrix,viewport);vec2 direction=normalize(projected1.xy-projected0.xy);vec2 offset=vec2(-direction.y,direction.x)*scale;if(gl_InstanceID==0){vec2 pq0=projected0.xy+offset;vec2 pq1=projected0.xy-offset;vec2 pq2=projected1.xy-offset;vec4 p0=unProjectPoint(vec3(pq0.xy,projected0.z),invModelViewProjectionMatrix,viewport);vec4 p1=unProjectPoint(vec3(pq1.xy,projected0.z),invModelViewProjectionMatrix,viewport);vec4 p2=unProjectPoint(vec3(pq2.xy,projected1.z),invModelViewProjectionMatrix,viewport);coordIndex0=x3d_CoordIndex0;lineStipple0=x3d_LineStipple0;fogDepth0=x3d_FogDepth0;color0=x3d_Color0;normal0=x3d_Normal0;vertex0=p0;coordIndex1=x3d_CoordIndex0;lineStipple1=x3d_LineStipple0;fogDepth1=x3d_FogDepth0;color1=x3d_Color0;normal1=x3d_Normal0;vertex1=p1;coordIndex2=x3d_CoordIndex1;lineStipple2=x3d_LineStipple1;fogDepth2=x3d_FogDepth1;color2=x3d_Color1;normal2=x3d_Normal1;vertex2=p2;}else{vec2 pq0=projected0.xy+offset;vec2 pq2=projected1.xy-offset;vec2 pq3=projected1.xy+offset;vec4 p0=unProjectPoint(vec3(pq0.xy,projected0.z),invModelViewProjectionMatrix,viewport);vec4 p2=unProjectPoint(vec3(pq2.xy,projected1.z),invModelViewProjectionMatrix,viewport);vec4 p3=unProjectPoint(vec3(pq3.xy,projected1.z),invModelViewProjectionMatrix,viewport);coordIndex0=x3d_CoordIndex0;lineStipple0=x3d_LineStipple0;fogDepth0=x3d_FogDepth0;color0=x3d_Color0;normal0=x3d_Normal0;vertex0=p0;coordIndex1=x3d_CoordIndex1;lineStipple1=x3d_LineStipple1;fogDepth1=x3d_FogDepth1;color1=x3d_Color1;normal1=x3d_Normal1;vertex1=p2;coordIndex2=x3d_CoordIndex1;lineStipple2=x3d_LineStipple1;fogDepth2=x3d_FogDepth1;color2=x3d_Color1;normal2=x3d_Normal1;vertex2=p3;}} +` +; + +x_ite_Namespace .add ("LineTransform2.vs", "assets/shaders/webgl2/LineTransform2.vs", LineTransform2_vs_default_); +/* harmony default export */ const LineTransform2_vs = (LineTransform2_vs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/PBR2.fs.js +const PBR2_fs_default_ = /* glsl */ `#version 300 es +precision highp float;precision highp int;precision highp sampler2D;precision highp sampler3D;precision highp samplerCube; +#pragma X3D include "include/Fragment.glsl" +#pragma X3D include "include/Colors.glsl" +#pragma X3D include "include/Normal.glsl" +#pragma X3D include "include/SpotFactor.glsl" +#pragma X3D include "include/Shadow.glsl" +#if defined(X3D_LIGHTING) +uniform x3d_LightSourceParameters x3d_LightSource[X3D_NUM_LIGHTS]; +#endif +uniform x3d_PhysicalMaterialParameters x3d_Material; +#if defined(USE_IBL) +uniform samplerCube diffuseEnvironmentTexture;uniform samplerCube specularEnvironmentTexture;uniform sampler2D brdfLUT; +#endif +#if defined(X3D_BASE_TEXTURE) +uniform x3d_BaseTextureParameters x3d_BaseTexture; +#endif +vec4 getBaseColor(){float alpha=1.0-x3d_Material.transparency; +#if defined(X3D_COLOR_MATERIAL) +vec4 baseParameter=vec4(color.rgb,color.a*alpha); +#else +vec4 baseParameter=vec4(x3d_Material.baseColor,alpha); +#endif +#if defined(X3D_BASE_TEXTURE) +vec3 texCoord=getTexCoord(x3d_BaseTexture.textureTransformMapping,x3d_BaseTexture.textureCoordinateMapping); +#if defined(X3D_BASE_TEXTURE_2D) +return baseParameter*SRGBtoLINEAR(texture(x3d_BaseTexture.texture2D,texCoord.st)); +#elif defined(X3D_BASE_TEXTURE_3D) +return baseParameter*SRGBtoLINEAR(texture(x3d_BaseTexture.texture3D,texCoord)); +#elif defined(X3D_BASE_TEXTURE_CUBE) +return baseParameter*SRGBtoLINEAR(texture(x3d_BaseTexture.textureCube,texCoord)); +#endif +#elif defined(X3D_TEXTURE) +return getTextureColor(baseParameter,vec4(vec3(1.0),alpha)); +#else +return baseParameter; +#endif +} +#if defined(X3D_EMISSIVE_TEXTURE) +uniform x3d_EmissiveTextureParameters x3d_EmissiveTexture; +#endif +vec3 getEmissiveColor(){vec3 emissiveParameter=x3d_Material.emissiveColor; +#if defined(X3D_EMISSIVE_TEXTURE) +vec3 texCoord=getTexCoord(x3d_EmissiveTexture.textureTransformMapping,x3d_EmissiveTexture.textureCoordinateMapping); +#if defined(X3D_EMISSIVE_TEXTURE_2D) +return emissiveParameter*SRGBtoLINEAR(texture(x3d_EmissiveTexture.texture2D,texCoord.st)).rgb; +#elif defined(X3D_EMISSIVE_TEXTURE_3D) +return emissiveParameter*SRGBtoLINEAR(texture(x3d_EmissiveTexture.texture3D,texCoord)).rgb; +#elif defined(X3D_EMISSIVE_TEXTURE_CUBE) +return emissiveParameter*SRGBtoLINEAR(texture(x3d_EmissiveTexture.textureCube,texCoord)).rgb; +#endif +#else +return emissiveParameter.rgb; +#endif +} +#if defined(X3D_METALLIC_ROUGHNESS_TEXTURE) +uniform x3d_MetallicRoughnessTextureParameters x3d_MetallicRoughnessTexture; +#endif +vec2 getMetallicRoughness(){float metallic=x3d_Material.metallic;float perceptualRoughness=x3d_Material.roughness; +#if defined(X3D_METALLIC_ROUGHNESS_TEXTURE) +vec3 texCoord=getTexCoord(x3d_MetallicRoughnessTexture.textureTransformMapping,x3d_MetallicRoughnessTexture.textureCoordinateMapping); +#if defined(X3D_METALLIC_ROUGHNESS_TEXTURE_2D) +vec4 mrSample=texture(x3d_MetallicRoughnessTexture.texture2D,texCoord.st); +#elif defined(X3D_METALLIC_ROUGHNESS_TEXTURE_3D) +vec4 mrSample=texture(x3d_MetallicRoughnessTexture.texture3D,texCoord); +#elif defined(X3D_METALLIC_ROUGHNESS_TEXTURE_CUBE) +vec4 mrSample=texture(x3d_MetallicRoughnessTexture.textureCube,texCoord); +#endif +metallic*=mrSample.b;perceptualRoughness*=mrSample.g;return vec2(metallic,perceptualRoughness); +#else +return vec2(metallic,perceptualRoughness); +#endif +} +#if defined(X3D_OCCLUSION_TEXTURE) +uniform x3d_OcclusionTextureParameters x3d_OcclusionTexture; +#endif +float getOcclusionFactor(){ +#if defined(X3D_OCCLUSION_TEXTURE) +vec3 texCoord=getTexCoord(x3d_OcclusionTexture.textureTransformMapping,x3d_OcclusionTexture.textureCoordinateMapping); +#if defined(X3D_OCCLUSION_TEXTURE_2D) +return texture(x3d_OcclusionTexture.texture2D,texCoord.st).r; +#elif defined(X3D_OCCLUSION_TEXTURE_3D) +return texture(x3d_OcclusionTexture.texture3D,texCoord).r; +#elif defined(X3D_OCCLUSION_TEXTURE_CUBE) +return texture(x3d_OcclusionTexture.textureCube,texCoord).r; +#endif +#else +return 1.0; +#endif +}struct PBRInfo{float NdotL;float NdotV;float NdotH;float LdotH;float VdotH;float perceptualRoughness;float metalness;vec3 reflectance0;vec3 reflectance90;float alphaRoughness;vec3 diffuseColor;vec3 specularColor;};const float M_PI=3.141592653589793;const float c_MinRoughness=0.04; +#if defined(USE_IBL) +vec3 getIBLContribution(const in PBRInfo pbrInputs,vec3 n,const in vec3 reflection){float mipCount=9.0;float lod=pbrInputs.perceptualRoughness*mipCount;vec3 brdf=SRGBtoLINEAR(texture(brdfLUT,vec2(pbrInputs.NdotV,1.0-pbrInputs.perceptualRoughness))).rgb;vec3 diffuseLight=SRGBtoLINEAR(textureCube(diffuseEnvironmentTexture,n)).rgb; +#if defined(USE_TEX_LOD) +vec3 specularLight=SRGBtoLINEAR(textureCubeLodEXT(specularEnvironmentTexture,reflection,lod)).rgb; +#else +vec3 specularLight=SRGBtoLINEAR(textureCube(specularEnvironmentTexture,reflection)).rgb; +#endif +vec3 diffuse=diffuseLight*pbrInputs.diffuseColor;vec3 specular=specularLight*(pbrInputs.specularColor*brdf.x+brdf.y);return diffuse+specular;} +#endif +vec3 diffuse(const in PBRInfo pbrInputs){return pbrInputs.diffuseColor/M_PI;}vec3 specularReflection(const in PBRInfo pbrInputs){return pbrInputs.reflectance0+(pbrInputs.reflectance90-pbrInputs.reflectance0)*pow(clamp(1.0-pbrInputs.VdotH,0.0,1.0),5.0);}float geometricOcclusion(const in PBRInfo pbrInputs){float NdotL=pbrInputs.NdotL;float NdotV=pbrInputs.NdotV;float r=pbrInputs.alphaRoughness;float attenuationL=2.0*NdotL/(NdotL+sqrt(r*r+(1.0-r*r)*(NdotL*NdotL)));float attenuationV=2.0*NdotV/(NdotV+sqrt(r*r+(1.0-r*r)*(NdotV*NdotV)));return attenuationL*attenuationV;}float microfacetDistribution(const in PBRInfo pbrInputs){float roughnessSq=pbrInputs.alphaRoughness*pbrInputs.alphaRoughness;float f=(pbrInputs.NdotH*roughnessSq-pbrInputs.NdotH)*pbrInputs.NdotH+1.0;return roughnessSq/(M_PI*f*f);}vec4 getMaterialColor(){vec2 metallicRoughness=getMetallicRoughness();float perceptualRoughness=clamp(metallicRoughness[1],c_MinRoughness,1.0);float metallic=clamp(metallicRoughness[0],0.0,1.0);float alphaRoughness=perceptualRoughness*perceptualRoughness;vec4 baseColor=getBaseColor();float alpha=baseColor.a;vec3 f0=vec3(0.04);vec3 diffuseColor=baseColor.rgb*(vec3(1.0)-f0);diffuseColor*=1.0-metallic;vec3 specularColor=mix(f0,baseColor.rgb,metallic);float reflectance=max(max(specularColor.r,specularColor.g),specularColor.b);float reflectance90=clamp(reflectance*25.0,0.0,1.0);vec3 specularEnvironmentR0=specularColor.rgb;vec3 specularEnvironmentR90=vec3(1.0,1.0,1.0)*reflectance90;vec3 n=getNormalVector(x3d_Material.normalScale);vec3 v=normalize(-vertex);vec3 finalColor=vec3(0.0); +#if defined(X3D_LIGHTING) +for(int i=0;i0.001&&light.shadowIntensity>0.0)diffuseSpecContrib=mix(diffuseSpecContrib,light.shadowColor,getShadowIntensity(i,light)); +#endif +vec3 color=NdotL*attenuationSpotFactor*light.color*diffuseSpecContrib;finalColor+=color;}} +#endif +#if defined(USE_IBL) +vec3 reflection=-normalize(reflect(v,n));finalColor+=getIBLContribution(pbrInputs,n,reflection); +#endif +#if defined(X3D_OCCLUSION_TEXTURE) +finalColor=mix(finalColor,finalColor*getOcclusionFactor(),x3d_Material.occlusionStrength); +#endif +finalColor+=getEmissiveColor();return Gamma(vec4(finalColor,alpha));}void main(){fragment_main();} +` +; + +x_ite_Namespace .add ("PBR2.fs", "assets/shaders/webgl2/PBR2.fs", PBR2_fs_default_); +/* harmony default export */ const PBR2_fs = (PBR2_fs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/Phong2.fs.js +const Phong2_fs_default_ = /* glsl */ `#version 300 es +precision highp float;precision highp int;precision highp sampler2D;precision highp sampler3D;precision highp samplerCube; +#pragma X3D include "include/Fragment.glsl" +#pragma X3D include "include/Material.glsl" +#pragma X3D include "include/Normal.glsl" +#if defined(X3D_AMBIENT_TEXTURE) +uniform x3d_AmbientTextureParameters x3d_AmbientTexture; +#endif +vec3 getAmbientColor(const in vec3 diffuseColor){vec3 ambientParameter=x3d_Material.ambientIntensity*diffuseColor; +#if defined(X3D_AMBIENT_TEXTURE) +vec3 texCoord=getTexCoord(x3d_AmbientTexture.textureTransformMapping,x3d_AmbientTexture.textureCoordinateMapping); +#if defined(X3D_AMBIENT_TEXTURE_2D) +return ambientParameter*texture(x3d_AmbientTexture.texture2D,texCoord.st).rgb; +#elif defined(X3D_AMBIENT_TEXTURE_3D) +return ambientParameter*texture(x3d_AmbientTexture.texture3D,texCoord).rgb; +#elif defined(X3D_AMBIENT_TEXTURE_CUBE) +return ambientParameter*texture(x3d_AmbientTexture.textureCube,texCoord).rgb; +#endif +#else +return ambientParameter; +#endif +} +#if defined(X3D_DIFFUSE_TEXTURE) +uniform x3d_DiffuseTextureParameters x3d_DiffuseTexture; +#endif +vec4 getDiffuseColor(){float alpha=1.0-x3d_Material.transparency; +#if defined(X3D_COLOR_MATERIAL) +vec4 diffuseParameter=vec4(color.rgb,color.a*alpha); +#else +vec4 diffuseParameter=vec4(x3d_Material.diffuseColor,alpha); +#endif +#if defined(X3D_DIFFUSE_TEXTURE) +vec3 texCoord=getTexCoord(x3d_DiffuseTexture.textureTransformMapping,x3d_DiffuseTexture.textureCoordinateMapping); +#if defined(X3D_DIFFUSE_TEXTURE_2D) +return diffuseParameter*texture(x3d_DiffuseTexture.texture2D,texCoord.st); +#elif defined(X3D_DIFFUSE_TEXTURE_3D) +return diffuseParameter*texture(x3d_DiffuseTexture.texture3D,texCoord); +#elif defined(X3D_DIFFUSE_TEXTURE_CUBE) +return diffuseParameter*texture(x3d_DiffuseTexture.textureCube,texCoord); +#endif +#elif defined(X3D_TEXTURE) +return getTextureColor(diffuseParameter,vec4(x3d_Material.specularColor,alpha)); +#else +return diffuseParameter; +#endif +} +#if defined(X3D_SPECULAR_TEXTURE) +uniform x3d_SpecularTextureParameters x3d_SpecularTexture; +#endif +vec3 getSpecularColor(){vec3 specularParameter=x3d_Material.specularColor; +#if defined(X3D_SPECULAR_TEXTURE) +vec3 texCoord=getTexCoord(x3d_SpecularTexture.textureTransformMapping,x3d_SpecularTexture.textureCoordinateMapping); +#if defined(X3D_SPECULAR_TEXTURE_2D) +return specularParameter*texture(x3d_SpecularTexture.texture2D,texCoord.st).rgb; +#elif defined(X3D_SPECULAR_TEXTURE_3D) +return specularParameter*texture(x3d_SpecularTexture.texture3D,texCoord).rgb; +#elif defined(X3D_SPECULAR_TEXTURE_CUBE) +return specularParameter*texture(x3d_SpecularTexture.textureCube,texCoord).rgb; +#endif +#else +return specularParameter; +#endif +} +#if defined(X3D_EMISSIVE_TEXTURE) +uniform x3d_EmissiveTextureParameters x3d_EmissiveTexture; +#endif +vec3 getEmissiveColor(){vec3 emissiveParameter=x3d_Material.emissiveColor; +#if defined(X3D_EMISSIVE_TEXTURE) +vec3 texCoord=getTexCoord(x3d_EmissiveTexture.textureTransformMapping,x3d_EmissiveTexture.textureCoordinateMapping); +#if defined(X3D_EMISSIVE_TEXTURE_2D) +return emissiveParameter*texture(x3d_EmissiveTexture.texture2D,texCoord.st).rgb; +#elif defined(X3D_EMISSIVE_TEXTURE_3D) +return emissiveParameter*texture(x3d_EmissiveTexture.texture3D,texCoord).rgb; +#elif defined(X3D_EMISSIVE_TEXTURE_CUBE) +return emissiveParameter*texture(x3d_EmissiveTexture.textureCube,texCoord).rgb; +#endif +#else +return emissiveParameter; +#endif +} +#if defined(X3D_SHININESS_TEXTURE) +uniform x3d_ShininessTextureParameters x3d_ShininessTexture; +#endif +float getShininessFactor(){float shininess=x3d_Material.shininess; +#if defined(X3D_SHININESS_TEXTURE) +vec3 texCoord=getTexCoord(x3d_ShininessTexture.textureTransformMapping,x3d_ShininessTexture.textureCoordinateMapping); +#if defined(X3D_SHININESS_TEXTURE_2D) +return shininess*texture(x3d_ShininessTexture.texture2D,texCoord.st).a; +#elif defined(X3D_SHININESS_TEXTURE_3D) +return shininess*texture(x3d_ShininessTexture.texture3D,texCoord).a; +#elif defined(X3D_SHININESS_TEXTURE_CUBE) +return shininess*texture(x3d_ShininessTexture.textureCube,texCoord).a; +#endif +#else +return shininess; +#endif +} +#if defined(X3D_OCCLUSION_TEXTURE) +uniform x3d_OcclusionTextureParameters x3d_OcclusionTexture; +#endif +float getOcclusionFactor(){ +#if defined(X3D_OCCLUSION_TEXTURE) +vec3 texCoord=getTexCoord(x3d_OcclusionTexture.textureTransformMapping,x3d_OcclusionTexture.textureCoordinateMapping); +#if defined(X3D_OCCLUSION_TEXTURE_2D) +return texture(x3d_OcclusionTexture.texture2D,texCoord.st).r; +#elif defined(X3D_OCCLUSION_TEXTURE_3D) +return texture(x3d_OcclusionTexture.texture3D,texCoord).r; +#elif defined(X3D_OCCLUSION_TEXTURE_CUBE) +return texture(x3d_OcclusionTexture.textureCube,texCoord).r; +#endif +#else +return 1.0; +#endif +}vec4 getMaterialColor(){vec4 diffuseColorAlpha=getDiffuseColor();float alpha=diffuseColorAlpha.a;vec3 diffuseColor=diffuseColorAlpha.rgb;vec3 ambientColor=getAmbientColor(diffuseColor);vec3 specularColor=getSpecularColor();float shininess=getShininessFactor();float normalScale=x3d_Material.normalScale; +#if defined(X3D_PROJECTIVE_TEXTURE_MAPPING) +vec4 P=getProjectiveTextureColor(vec4(1.0));diffuseColor*=P.rgb;alpha*=P.a; +#endif +#if defined(X3D_LIGHTING) +vec3 finalColor=getMaterialColor(vertex,getNormalVector(normalScale),ambientColor,diffuseColor,specularColor,shininess); +#else +vec3 finalColor=vec3(0.0); +#endif +#if defined(X3D_OCCLUSION_TEXTURE) +finalColor=mix(finalColor,finalColor*getOcclusionFactor(),x3d_Material.occlusionStrength); +#endif +finalColor+=getEmissiveColor();return vec4(finalColor,alpha);}void main(){fragment_main();} +` +; + +x_ite_Namespace .add ("Phong2.fs", "assets/shaders/webgl2/Phong2.fs", Phong2_fs_default_); +/* harmony default export */ const Phong2_fs = (Phong2_fs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/Pointing2.fs.js +const Pointing2_fs_default_ = /* glsl */ `#version 300 es +precision highp float;precision highp int;precision highp sampler2D;in vec3 vertex;in vec3 normal;in vec4 texCoord; +#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D) +in vec4 texCoord0; +#else +vec4 texCoord0=vec4(0.0,0.0,0.0,1.0); +#endif +layout(location=0)out vec4 x3d_FragData0;layout(location=1)out vec4 x3d_FragData1;layout(location=2)out vec4 x3d_FragData2; +#pragma X3D include "include/ClipPlanes.glsl" +#pragma X3D include "include/Point.glsl" +#pragma X3D include "Stipple.glsl" +uniform float x3d_Id;void main(){ +#if defined(X3D_CLIP_PLANES) +clip(); +#endif +#if defined(X3D_GEOMETRY_0D)&&defined(X3D_STYLE_PROPERTIES) +if(getPointColor(vec4(1.0)).a<0.5)discard;texCoord0=vec4(gl_PointCoord.x,1.0-gl_PointCoord.y,0.0,1.0); +#endif +#if defined(X3D_GEOMETRY_1D)&&defined(X3D_STYLE_PROPERTIES) +stipple(); +#endif +x3d_FragData0=vec4(vertex,x3d_Id);x3d_FragData1=vec4(normal,0.0);x3d_FragData2=texCoord0;} +` +; + +x_ite_Namespace .add ("Pointing2.fs", "assets/shaders/webgl2/Pointing2.fs", Pointing2_fs_default_); +/* harmony default export */ const Pointing2_fs = (Pointing2_fs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/Pointing2.vs.js +const Pointing2_vs_default_ = /* glsl */ `#version 300 es +precision highp float;precision highp int;precision highp sampler2D;uniform mat4 x3d_ProjectionMatrix;uniform mat4 x3d_ModelViewMatrix;in vec4 x3d_Vertex;in vec3 x3d_Normal; +#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D) +in vec4 x3d_TexCoord0; +#endif +#if defined(X3D_GEOMETRY_1D)&&defined(X3D_STYLE_PROPERTIES) +in vec3 x3d_LineStipple; +#endif +out vec3 vertex;out vec3 normal; +#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D) +out vec4 texCoord0; +#endif +#if defined(X3D_GEOMETRY_1D)&&defined(X3D_STYLE_PROPERTIES) +flat out float lengthSoFar;flat out vec2 startPoint;out vec2 midPoint; +#endif +#pragma X3D include "include/Utils.glsl" +#pragma X3D include "include/Skin.glsl" +#pragma X3D include "include/Particle.glsl" +#pragma X3D include "include/PointSize.glsl" +void main(){ +#if defined(X3D_GEOMETRY_1D)&&defined(X3D_STYLE_PROPERTIES) +lengthSoFar=x3d_LineStipple.z;startPoint=x3d_LineStipple.xy;midPoint=x3d_LineStipple.xy; +#endif +vec4 x3d_TransformedVertex=getParticleVertex(getSkinVertex(x3d_Vertex,vec3(0.0)));vec4 position=x3d_ModelViewMatrix*x3d_TransformedVertex;vertex=position.xyz;normal=x3d_Normal; +#if defined(X3D_GEOMETRY_0D) +#if defined(X3D_STYLE_PROPERTIES) +gl_PointSize=max(pointSize=getPointSize(vertex),2.0); +#else +gl_PointSize=2.0; +#endif +#endif +#if!defined(X3D_GEOMETRY_0D)&&!defined(X3D_GEOMETRY_1D) +texCoord0=x3d_TexCoord0; +#endif +gl_Position=x3d_ProjectionMatrix*position;} +` +; + +x_ite_Namespace .add ("Pointing2.vs", "assets/shaders/webgl2/Pointing2.vs", Pointing2_vs_default_); +/* harmony default export */ const Pointing2_vs = (Pointing2_vs_default_); +;// CONCATENATED MODULE: ./src/assets/shaders/webgl2/Unlit2.fs.js +const Unlit2_fs_default_ = /* glsl */ `#version 300 es +precision highp float;precision highp int;precision highp sampler2D;precision highp sampler3D;precision highp samplerCube; +#pragma X3D include "include/Fragment.glsl" +uniform x3d_UnlitMaterialParameters x3d_Material; +#if defined(X3D_EMISSIVE_TEXTURE) +uniform x3d_EmissiveTextureParameters x3d_EmissiveTexture; +#endif +vec4 getEmissiveColor(){float alpha=1.0-x3d_Material.transparency; +#if defined(X3D_COLOR_MATERIAL) +vec4 emissiveParameter=vec4(color.rgb,color.a*alpha); +#else +vec4 emissiveParameter=vec4(x3d_Material.emissiveColor,alpha); +#endif +#if defined(X3D_EMISSIVE_TEXTURE) +vec3 texCoord=getTexCoord(x3d_EmissiveTexture.textureTransformMapping,x3d_EmissiveTexture.textureCoordinateMapping); +#if defined(X3D_EMISSIVE_TEXTURE_2D) +return emissiveParameter*texture(x3d_EmissiveTexture.texture2D,texCoord.st); +#elif defined(X3D_EMISSIVE_TEXTURE_3D) +return emissiveParameter*texture(x3d_EmissiveTexture.texture3D,texCoord); +#elif defined(X3D_EMISSIVE_TEXTURE_CUBE) +return emissiveParameter*texture(x3d_EmissiveTexture.textureCube,texCoord); +#endif +#elif defined(X3D_TEXTURE) +return getTextureColor(emissiveParameter,vec4(vec3(1.0),alpha)); +#else +return emissiveParameter; +#endif +}vec4 getMaterialColor(){return getEmissiveColor();}void main(){fragment_main();} +` +; + +x_ite_Namespace .add ("Unlit2.fs", "assets/shaders/webgl2/Unlit2.fs", Unlit2_fs_default_); +/* harmony default export */ const Unlit2_fs = (Unlit2_fs_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Shaders/ShaderRegistry.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +/* WebGL 1 */ + + + + + + + + + + + + + + + +/* WebGL 2 */ + + + + + + + + + + + + + + + + + + + + +/* WebGL 1 */ + + + + + + + + + + + +/* WebGL 2 */ + + + + + + + + + + + + + + + +const ShaderRegistry = { + includes: { + 1: { + ClipPlanes: ClipPlanes1_glsl, + Colors: Colors1_glsl, + Fog: Fog1_glsl, + Fragment: Fragment1_glsl, + Hatch: Hatch1_glsl, + Material: Material1_glsl, + Normal: Normal1_glsl, + Perlin: Perlin1_glsl, + Point: Point1_glsl, + PointSize: PointSize1_glsl, + Shadow: Shadow1_glsl, + SpotFactor: SpotFactor1_glsl, + Texture: Texture1_glsl, + Vertex: Vertex1_glsl, + }, + 2: { + ClipPlanes: ClipPlanes2_glsl, + Colors: Colors2_glsl, + Fog: Fog2_glsl, + Fragment: Fragment2_glsl, + Hatch: Hatch2_glsl, + Line2: Line22_glsl, + Material: Material2_glsl, + Normal: Normal2_glsl, + Particle: Particle2_glsl, + Perlin: Perlin2_glsl, + Point: Point2_glsl, + PointSize: PointSize2_glsl, + Shadow: Shadow2_glsl, + Skin: Skin2_glsl, + SpotFactor: SpotFactor2_glsl, + Stipple: Stipple2_glsl, + Texture: Texture2_glsl, + Utils: Utils2_glsl, + Vertex: Vertex2_glsl, + }, + }, + vertex: { + 1: { + Default: Default1_vs, + Depth: Depth1_vs, + Gouraud: Gouraud1_vs, + Pointing: Pointing1_vs, + }, + 2: { + Compose: Compose2_vs, + Default: Default2_vs, + Depth: Depth2_vs, + Gouraud: Gouraud2_vs, + LineTransform: LineTransform2_vs, + Pointing: Pointing2_vs, + }, + }, + fragment: { + 1: { + Depth: Depth1_fs, + Gouraud: Gouraud1_fs, + PBR: PBR1_fs, + Phong: Phong1_fs, + Pointing: Pointing1_fs, + Unlit: Unlit1_fs, + }, + 2: { + Compose: Compose2_fs, + Depth: Depth2_fs, + Gouraud: Gouraud2_fs, + LineTransform: LineTransform2_fs, + PBR: PBR2_fs, + Phong: Phong2_fs, + Pointing: Pointing2_fs, + Unlit: Unlit2_fs, + }, + }, +}; + +const ShaderRegistry_default_ = ShaderRegistry; +; + +x_ite_Namespace .add ("ShaderRegistry", "x_ite/Browser/Shaders/ShaderRegistry", ShaderRegistry_default_); +/* harmony default export */ const Shaders_ShaderRegistry = (ShaderRegistry_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Shaders/ShaderCompiler.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +const include = /^\s*#pragma\s+X3D\s+include\s+".*?([^\/]+)\.glsl"\s*$/; + +function ShaderCompiler (gl) +{ + this .includes = Shaders_ShaderRegistry .includes [gl .getVersion ()]; + this .sourceFileNumbers = { }; + + for (const [i, name] of Object .getOwnPropertyNames (this .includes) .entries ()) + this .sourceFileNumbers [name] = i + 1; +} + +Object .assign (ShaderCompiler .prototype, +{ + getSourceFileName (sourceFileNumber) + { + return Object .getOwnPropertyNames (this .includes) [sourceFileNumber - 1]; + }, + process (source, parent = 0) + { + const lines = source .split ("\n"); + + source = ""; + + for (let i = 0, length = lines .length; i < length; ++ i) + { + const + line = lines [i], + match = line .match (include); + + if (match) + { + source += "#line 1 " + this .sourceFileNumbers [match [1]] + "\n"; + source += this .process (this .includes [match [1]], this .sourceFileNumbers [match [1]]); + source += "\n"; + source += "#line " + (i + 2) + " " + parent + "\n"; + } + else + { + source += line; + source += "\n"; + } + } + + return source; + }, +}); + +const ShaderCompiler_default_ = ShaderCompiler; +; + +x_ite_Namespace .add ("ShaderCompiler", "x_ite/Browser/Shaders/ShaderCompiler", ShaderCompiler_default_); +/* harmony default export */ const Shaders_ShaderCompiler = (ShaderCompiler_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shaders/ShaderPart.js +/* provided dependency */ var ShaderPart_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + +const customOptions = [ + "X3D_GEOMETRY_0D", + "X3D_GEOMETRY_1D", + "X3D_GEOMETRY_2D", + "X3D_GEOMETRY_3D", + "X3D_FOG", + "X3D_STYLE_PROPERTIES", + "X3D_UNLIT_MATERIAL", + "X3D_MATERIAL", + "X3D_LIGHTING", + "X3D_TEXTURE", + "X3D_MULTI_TEXTURING", +]; + +function ShaderPart (executionContext) +{ + Core_X3DNode .call (this, executionContext); + Networking_X3DUrlObject .call (this, executionContext); + + this .addType (Base_X3DConstants .ShaderPart); + + this .options = [ ]; +} + +Object .assign (Object .setPrototypeOf (ShaderPart .prototype, Core_X3DNode .prototype), + Networking_X3DUrlObject .prototype, +{ + initialize () + { + Core_X3DNode .prototype .initialize .call (this); + Networking_X3DUrlObject .prototype .initialize .call (this); + + if (!this .isPrivate ()) + this .options = customOptions .slice (); + + this ._type .addInterest ("set_type__", this); + + this .requestImmediateLoad () .catch (Function .prototype); + }, + set_type__ () + { + this .setLoadState (Base_X3DConstants .NOT_STARTED_STATE); + + this .requestImmediateLoad () .catch (Function .prototype); + }, + getSourceText () + { + return this ._url; + }, + getOptions () + { + return this .options; + }, + setOptions (value) + { + this .options = value; + }, + getShader () + { + return this .shader; + }, + getShaderType: (() => + { + const shaderTypes = new Map ([ + ["VERTEX", "VERTEX_SHADER"], + ["TESS_CONTROL", "TESS_CONTROL_SHADER"], + ["TESS_EVALUATION", "TESS_EVALUATION_SHADER"], + ["GEOMETRY", "GEOMETRY_SHADER"], + ["FRAGMENT", "FRAGMENT_SHADER"], + ["COMPUTE", "COMPUTE_SHADER"], + ]); + + return function () + { + return shaderTypes .get (this ._type .getValue ()) || "VERTEX_SHADER"; + }; + })(), + unloadData () + { + this .valid = false; + }, + loadData () + { + new InputOutput_FileLoader (this) .loadDocument (this ._url, + function (data, url) + { + if (data === null) + { + // No URL could be loaded. + this .setLoadState (Base_X3DConstants .FAILED_STATE); + } + else + { + const + browser = this .getBrowser (), + gl = browser .getContext (), + type = this .getShaderType (), + options = ["X3D_" + type] .concat (this .options), + shaderCompiler = new Shaders_ShaderCompiler (gl), + source = Shaders_ShaderSource .getSource (gl, browser, shaderCompiler .process (ShaderPart_$.decodeText (data)), options), + shader = gl .createShader (gl [type]); + + gl .deleteShader (this .shader); + + this .shader = shader; + + gl .shaderSource (shader, source); + gl .compileShader (shader); + + if (!gl .getShaderParameter (shader, gl .COMPILE_STATUS)) + { + const + typeName = this .getTypeName (), + name = this .getName (), + log = gl .getShaderInfoLog (shader), + match = log .match (/(\d+):(\d+)/); + + if (match) + { + const fileName = shaderCompiler .getSourceFileName (match [1]) || url || this .getExecutionContext () .getWorldURL (); + + throw new Error ("Error in " + typeName + " '" + name + "' in URL '" + fileName + "', line " + match [2] + ", " + log); + } + else + { + const fileName = url || this .getExecutionContext () .getWorldURL (); + + throw new Error ("Error in " + typeName + " '" + name + "' in URL '" + fileName + "', " + log); + } + } + + this .setLoadState (Base_X3DConstants .COMPLETE_STATE); + } + } + .bind (this)); + }, + dispose () + { + Networking_X3DUrlObject .prototype .dispose .call (this); + Core_X3DNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (ShaderPart, +{ + typeName: + { + value: "ShaderPart", + enumerable: true, + }, + componentName: + { + value: "Shaders", + enumerable: true, + }, + containerField: + { + value: "parts", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "type", new x_ite_Fields .SFString ("VERTEX")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "load", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "url", new x_ite_Fields .MFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoRefresh", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoRefreshTimeLimit", new x_ite_Fields .SFTime (3600)), + ]), + enumerable: true, + }, +}); + +const ShaderPart_default_ = ShaderPart; +; + +x_ite_Namespace .add ("ShaderPart", "x_ite/Components/Shaders/ShaderPart", ShaderPart_default_); +/* harmony default export */ const Shaders_ShaderPart = (ShaderPart_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shaders/ShaderProgram.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +function ShaderProgram (executionContext) +{ + Core_X3DNode .call (this, executionContext); + Networking_X3DUrlObject .call (this, executionContext); + Shaders_X3DProgrammableShaderObject .call (this, executionContext); + + this .addType (Base_X3DConstants .ShaderProgram); +} + +Object .assign (Object .setPrototypeOf (ShaderProgram .prototype, Core_X3DNode .prototype), + Networking_X3DUrlObject .prototype, + Shaders_X3DProgrammableShaderObject .prototype, +{ + getSourceText () + { + return this ._url; + }, + requestImmediateLoad (cache = true) + { }, + initialize () + { + Core_X3DNode .prototype .initialize .call (this); + Networking_X3DUrlObject .prototype .initialize .call (this); + Shaders_X3DProgrammableShaderObject .prototype .initialize .call (this); + }, + dispose () + { + Shaders_X3DProgrammableShaderObject .prototype .dispose .call (this); + Networking_X3DUrlObject .prototype .dispose .call (this); + Core_X3DNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (ShaderProgram, +{ + typeName: + { + value: "ShaderProgram", + enumerable: true, + }, + componentName: + { + value: "Shaders", + enumerable: true, + }, + containerField: + { + value: "programs", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "type", new x_ite_Fields .SFString ("VERTEX")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "load", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "url", new x_ite_Fields .MFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoRefresh", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoRefreshTimeLimit", new x_ite_Fields .SFTime (3600)), + ]), + enumerable: true, + }, +}); + +const ShaderProgram_default_ = ShaderProgram; +; + +x_ite_Namespace .add ("ShaderProgram", "x_ite/Components/Shaders/ShaderProgram", ShaderProgram_default_); +/* harmony default export */ const Shaders_ShaderProgram = (ShaderProgram_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shaders.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + +const Shaders_default_ = { + name: "Shaders", + concreteNodes: + [ + Shaders_ComposedShader, + Shaders_FloatVertexAttribute, + Shaders_Matrix3VertexAttribute, + Shaders_Matrix4VertexAttribute, + Shaders_PackagedShader, + Shaders_ProgramShader, + Shaders_ShaderPart, + Shaders_ShaderProgram, + ], + abstractNodes: + [ + Shaders_X3DProgrammableShaderObject, + Shaders_X3DShaderNode, + Shaders_X3DVertexAttributeNode, + ], +}; +; + +x_ite_Namespace .add ("Shaders", "x_ite/Components/Shaders", Shaders_default_); +/* harmony default export */ const Shaders = (Shaders_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shape/AcousticProperties.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function AcousticProperties (executionContext) +{ + Shape_X3DAppearanceChildNode .call (this, executionContext); + + this .addType (Base_X3DConstants .AcousticProperties); +} + +Object .setPrototypeOf (AcousticProperties .prototype, Shape_X3DAppearanceChildNode .prototype); + +Object .defineProperties (AcousticProperties, +{ + typeName: + { + value: "AcousticProperties", + enumerable: true, + }, + componentName: + { + value: "Shape", + enumerable: true, + }, + containerField: + { + value: "acousticProperties", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description",new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "absorption", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "refraction", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "diffuse", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "specular", new x_ite_Fields .SFFloat ()), + ]), + enumerable: true, + }, +}); + +const AcousticProperties_default_ = AcousticProperties; +; + +x_ite_Namespace .add ("AcousticProperties", "x_ite/Components/Shape/AcousticProperties", AcousticProperties_default_); +/* harmony default export */ const Shape_AcousticProperties = (AcousticProperties_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shape/X3DAppearanceNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function X3DAppearanceNode (executionContext) +{ + Core_X3DNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DAppearanceNode); + + this .addChildObjects (Base_X3DConstants .outputOnly, "transparent", new x_ite_Fields .SFBool ()); +} + +Object .assign (Object .setPrototypeOf (X3DAppearanceNode .prototype, Core_X3DNode .prototype), +{ + setTransparent (value) + { + if (value !== this ._transparent .getValue ()) + this ._transparent = value; + }, + isTransparent () + { + return this ._transparent .getValue (); + }, +}); + +Object .defineProperties (X3DAppearanceNode, +{ + typeName: + { + value: "X3DAppearanceNode", + enumerable: true, + }, + componentName: + { + value: "Shape", + enumerable: true, + }, +}); + +const X3DAppearanceNode_default_ = X3DAppearanceNode; +; + +x_ite_Namespace .add ("X3DAppearanceNode", "x_ite/Components/Shape/X3DAppearanceNode", X3DAppearanceNode_default_); +/* harmony default export */ const Shape_X3DAppearanceNode = (X3DAppearanceNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shape/Appearance.js +/* provided dependency */ var Appearance_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + +function Appearance (executionContext) +{ + Shape_X3DAppearanceNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Appearance); + + this .stylePropertiesNode = [ ]; + this .textureTransformMapping = new Map (); + this .textureBits = new Utility_BitSet (); + this .shaderNodes = [ ]; +} + +Object .assign (Object .setPrototypeOf (Appearance .prototype, Shape_X3DAppearanceNode .prototype), +{ + initialize () + { + Shape_X3DAppearanceNode .prototype .initialize .call (this); + + const browser = this .getBrowser (); + + browser .getRenderingProperties () ._ContentScale .addInterest ("set_contentScale__", this); + + this ._alphaMode .addInterest ("set_alphaMode__", this); + this ._alphaCutoff .addInterest ("set_alphaCutoff__", this); + this ._pointProperties .addInterest ("set_pointProperties__", this); + this ._lineProperties .addInterest ("set_lineProperties__", this); + this ._fillProperties .addInterest ("set_fillProperties__", this); + this ._material .addInterest ("set_material__", this); + this ._backMaterial .addInterest ("set_backMaterial__", this); + this ._texture .addInterest ("set_texture__", this); + this ._textureTransform .addInterest ("set_textureTransform__", this); + this ._shaders .addInterest ("set_shaders__", this); + this ._blendMode .addInterest ("set_blendMode__", this); + + this ._alphaMode .addInterest ("set_transparent__", this); + this ._fillProperties .addInterest ("set_transparent__", this); + this ._material .addInterest ("set_transparent__", this); + this ._texture .addInterest ("set_transparent__", this); + this ._blendMode .addInterest ("set_transparent__", this); + + this .set_alphaMode__ (); + this .set_pointProperties__ (); + this .set_lineProperties__ (); + this .set_fillProperties__ (); + this .set_material__ (); + this .set_backMaterial__ (); + this .set_texture__ (); + this .set_textureTransform__ (); + this .set_shaders__ (); + this .set_blendMode__ (); + this .set_transparent__ (); + }, + getAlphaMode () + { + return this .alphaMode; + }, + getNormalizedAlphaMode (transparent) + { + return this .alphaMode || (transparent ? Shape_AlphaMode .BLEND : Shape_AlphaMode .OPAQUE); + }, + getAlphaCutoff () + { + return this .alphaCutoff; + }, + getStyleProperties (geometryType) + { + return this .stylePropertiesNode [geometryType]; + }, + getPointProperties () + { + return this .stylePropertiesNode [0]; + }, + getLineProperties () + { + return this .stylePropertiesNode [1]; + }, + getFillProperties () + { + return this .stylePropertiesNode [2]; + }, + getMaterial () + { + return this .materialNode; + }, + getBackMaterial () + { + return this .backMaterialNode; + }, + getTexture () + { + return this .textureNode; + }, + getTextureBits () + { + return this .textureBits; + }, + updateTextureBits () + { + this .textureBits .clear (); + this .textureNode .updateTextureBits (this .textureBits); + }, + getTextureTransform () + { + return this .textureTransformNode; + }, + getTextureTransformMapping () + { + return this .textureTransformMapping; + }, + getShader (geometryContext, renderContext) + { + return this .materialNode .getShader (geometryContext, renderContext); + }, + getBackShader (geometryContext, renderContext) + { + return this .backMaterialNode .getShader (geometryContext, renderContext); + }, + getBlendMode () + { + return this .blendModeNode; + }, + set_contentScale__ () + { + this .set_pointProperties__ (); + this .set_applied__ (); + }, + set_alphaMode__ () + { + this .alphaMode = Appearance_$.enum (Shape_AlphaMode, this ._alphaMode .getValue (), Shape_AlphaMode .AUTO); + + this .set_alphaCutoff__ (); + }, + set_alphaCutoff__ () + { + this .alphaCutoff = this .alphaMode === Shape_AlphaMode .MASK ? this ._alphaCutoff .getValue () : 0; + }, + set_pointProperties__ () + { + this .stylePropertiesNode [0] = Base_X3DCast (Base_X3DConstants .PointProperties, this ._pointProperties); + + if (!this .stylePropertiesNode [0]) + { + const browser = this .getBrowser (); + + if (browser .getRenderingProperty ("ContentScale") !== 1) + this .stylePropertiesNode [0] = browser .getDefaultPointProperties (); + } + }, + set_lineProperties__ () + { + if (this .linePropertiesNode) + this .linePropertiesNode ._applied .removeInterest ("set_applied__", this); + + this .linePropertiesNode = Base_X3DCast (Base_X3DConstants .LineProperties, this ._lineProperties); + + if (this .linePropertiesNode) + this .linePropertiesNode ._applied .addInterest ("set_applied__", this); + + this .set_applied__ (); + }, + set_applied__ () + { + if (this .linePropertiesNode && this .linePropertiesNode ._applied .getValue ()) + { + this .stylePropertiesNode [1] = this .linePropertiesNode; + } + else + { + const browser = this .getBrowser (); + + if (browser .getRenderingProperty ("ContentScale") !== 1) + this .stylePropertiesNode [1] = browser .getDefaultLineProperties (); + else + this .stylePropertiesNode [1] = null; + } + }, + set_fillProperties__ () + { + if (this .stylePropertiesNode [2]) + this .stylePropertiesNode [2] ._transparent .removeInterest ("set_transparent__", this); + + this .stylePropertiesNode [2] = Base_X3DCast (Base_X3DConstants .FillProperties, this ._fillProperties); + + if (this .stylePropertiesNode [2]) + this .stylePropertiesNode [2] ._transparent .addInterest ("set_transparent__", this); + + this .stylePropertiesNode [3] = this .stylePropertiesNode [2]; + }, + set_material__ () + { + if (this .materialNode) + this .materialNode ._transparent .removeInterest ("set_transparent__", this); + + this .materialNode = Base_X3DCast (Base_X3DConstants .X3DMaterialNode, this ._material); + + if (!this .materialNode) + this .materialNode = this .getBrowser () .getDefaultMaterial (); + + if (this .materialNode) + this .materialNode ._transparent .addInterest ("set_transparent__", this); + + // Depreciated TwoSidedMaterial handling. + + if (Base_X3DCast (Base_X3DConstants .TwoSidedMaterial, this .materialNode)) + this .set_backMaterial__ (); + }, + set_backMaterial__ () + { + if (this .backMaterialNode) + this .backMaterialNode ._transparent .removeInterest ("set_transparent__", this); + + this .backMaterialNode = Base_X3DCast (Base_X3DConstants .X3DOneSidedMaterialNode, this ._backMaterial); + + if (this .backMaterialNode) + this .backMaterialNode ._transparent .addInterest ("set_transparent__", this); + + // Depreciated TwoSidedMaterial handling. + + if (!this .backMaterialNode && Base_X3DCast (Base_X3DConstants .TwoSidedMaterial, this .materialNode)) + this .backMaterialNode = this .materialNode; + }, + set_texture__ () + { + if (this .textureNode) + { + this .textureNode .removeInterest ("updateTextureBits", this); + this .textureNode ._transparent .removeInterest ("set_transparent__", this); + } + + this .textureNode = Base_X3DCast (Base_X3DConstants .X3DTextureNode, this ._texture); + + if (this .textureNode) + { + this .textureNode .addInterest ("updateTextureBits", this); + this .textureNode ._transparent .addInterest ("set_transparent__", this); + + this .updateTextureBits (); + } + else + { + this .textureBits .clear (); + } + }, + set_textureTransform__ () + { + if (this .textureTransformNode) + this .textureTransformNode .removeInterest ("updateTextureTransformMapping", this); + + this .textureTransformNode = Base_X3DCast (Base_X3DConstants .X3DTextureTransformNode, this ._textureTransform); + + if (!this .textureTransformNode) + this .textureTransformNode = this .getBrowser () .getDefaultTextureTransform (); + + this .textureTransformNode .addInterest ("updateTextureTransformMapping", this); + + this .updateTextureTransformMapping (); + }, + updateTextureTransformMapping () + { + this .textureTransformMapping .clear (); + + this .textureTransformNode .getTextureTransformMapping (this .textureTransformMapping); + }, + set_shaders__ () + { + const shaderNodes = this .shaderNodes; + + for (const shaderNode of shaderNodes) + shaderNode ._isValid .removeInterest ("set_shader__", this); + + shaderNodes .length = 0; + + for (const node of this ._shaders) + { + const shaderNode = Base_X3DCast (Base_X3DConstants .X3DShaderNode, node); + + if (shaderNode) + shaderNodes .push (shaderNode); + } + + for (const shaderNode of shaderNodes) + shaderNode ._isValid .addInterest ("set_shader__", this); + + this .set_shader__ (); + }, + set_shader__: (() => + { + function getShader () + { + return this .shaderNode; + } + + return function () + { + const shaderNodes = this .shaderNodes; + + if (this .shaderNode) + this .shaderNode .deselect (); + + this .shaderNode = null; + + for (const shaderNode of shaderNodes) + { + if (shaderNode ._isValid .getValue ()) + { + this .shaderNode = shaderNode; + break; + } + } + + if (this .shaderNode) + { + this .shaderNode .select (); + + this .getShader = getShader; + this .getBackShader = getShader; + } + else + { + delete this .getShader; + delete this .getBackShader; + } + }; + })(), + set_blendMode__ () + { + this .blendModeNode = Base_X3DCast (Base_X3DConstants .BlendMode, this ._blendMode); + }, + set_transparent__ () + { + switch (this .alphaMode) + { + case Shape_AlphaMode .AUTO: + this .setTransparent (!!(this .stylePropertiesNode [3] ?.isTransparent () || + this .materialNode ?.isTransparent () || + this .backMaterialNode ?.isTransparent () || + this .textureNode ?.isTransparent () || + this .blendModeNode)); + break; + case Shape_AlphaMode .OPAQUE: + this .setTransparent (false); + break; + case Shape_AlphaMode .MASK: + // Alpha testing using alphaCutoff. + this .setTransparent (false); + break; + case Shape_AlphaMode .BLEND: + this .setTransparent (true); + break; + } + }, + traverse (type, renderObject) + { + if (this .textureNode) + this .textureNode .traverse (type, renderObject); + }, +}); + +Object .defineProperties (Appearance, +{ + typeName: + { + value: "Appearance", + enumerable: true, + }, + componentName: + { + value: "Shape", + enumerable: true, + }, + containerField: + { + value: "appearance", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "acousticProperties", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "alphaMode", new x_ite_Fields .SFString ("AUTO")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "alphaCutoff", new x_ite_Fields .SFFloat (0.5)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pointProperties", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "lineProperties", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "fillProperties", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "material", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "backMaterial", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "texture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "textureTransform", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shaders", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "blendMode", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +const Appearance_default_ = Appearance; +; + +x_ite_Namespace .add ("Appearance", "x_ite/Components/Shape/Appearance", Appearance_default_); +/* harmony default export */ const Shape_Appearance = (Appearance_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shape/FillProperties.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function FillProperties (executionContext) +{ + Shape_X3DAppearanceChildNode .call (this, executionContext); + + this .addType (Base_X3DConstants .FillProperties); + + this .addChildObjects (Base_X3DConstants .outputOnly, "transparent", new x_ite_Fields .SFBool ()); + + this .hatchColor = new Float32Array (3); +} + +Object .assign (Object .setPrototypeOf (FillProperties .prototype, Shape_X3DAppearanceChildNode .prototype), +{ + initialize () + { + Shape_X3DAppearanceChildNode .prototype .initialize .call (this); + + this ._filled .addInterest ("set_filled__", this); + this ._hatched .addInterest ("set_hatched__", this); + this ._hatchColor .addInterest ("set_hatchColor__", this); + this ._hatchStyle .addInterest ("set_hatchStyle__", this); + + this .set_filled__ (); + this .set_hatched__ (); + this .set_hatchColor__ (); + this .set_hatchStyle__ (); + + // Preload texture. + this .getBrowser () .getHatchStyleTexture (this .hatchStyle); + }, + getStyleKey () + { + return this .hatched ? 2 : 1; + }, + set_filled__ () + { + this .filled = this ._filled .getValue (); + + this .setTransparent (! this .filled); + }, + set_hatched__ () + { + this .hatched = this ._hatched .getValue (); + }, + set_hatchColor__ () + { + this .hatchColor [0] = this ._hatchColor [0]; + this .hatchColor [1] = this ._hatchColor [1]; + this .hatchColor [2] = this ._hatchColor [2]; + }, + set_hatchStyle__ () + { + let hatchStyle = this ._hatchStyle .getValue (); + + if (hatchStyle < 1 || hatchStyle > 19) + hatchStyle = 1; + + this .hatchStyle = hatchStyle; + }, + setTransparent (value) + { + if (value !== this ._transparent .getValue ()) + this ._transparent = value; + }, + isTransparent () + { + return this ._transparent .getValue (); + }, + setShaderUniforms (gl, shaderObject) + { + const hatched = this .hatched; + + gl .uniform1i (shaderObject .x3d_FillPropertiesFilled, this .filled); + gl .uniform1i (shaderObject .x3d_FillPropertiesHatched, hatched); + + if (hatched) + { + const + browser = this .getBrowser (), + texture = browser .getHatchStyleTexture (this .hatchStyle), + textureUnit = browser .getTexture2DUnit (); + + gl .uniform3fv (shaderObject .x3d_FillPropertiesHatchColor, this .hatchColor); + gl .uniform1f (shaderObject .x3d_FillPropertiesScale, browser .getRenderingProperty ("ContentScale")); + + gl .activeTexture (gl .TEXTURE0 + textureUnit); + gl .bindTexture (gl .TEXTURE_2D, texture .getTexture ()); + gl .uniform1i (shaderObject .x3d_FillPropertiesTexture, textureUnit); + } + }, +}); + +Object .defineProperties (FillProperties, +{ + typeName: + { + value: "FillProperties", + enumerable: true, + }, + componentName: + { + value: "Shape", + enumerable: true, + }, + containerField: + { + value: "fillProperties", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "filled", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "hatched", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "hatchStyle", new x_ite_Fields .SFInt32 (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "hatchColor", new x_ite_Fields .SFColor (1, 1, 1)), + ]), + enumerable: true, + }, +}); + +const FillProperties_default_ = FillProperties; +; + +x_ite_Namespace .add ("FillProperties", "x_ite/Components/Shape/FillProperties", FillProperties_default_); +/* harmony default export */ const Shape_FillProperties = (FillProperties_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shape/LineProperties.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function LineProperties (executionContext) +{ + Shape_X3DAppearanceChildNode .call (this, executionContext); + + this .addType (Base_X3DConstants .LineProperties); +} + +Object .assign (Object .setPrototypeOf (LineProperties .prototype, Shape_X3DAppearanceChildNode .prototype), +{ + initialize () + { + Shape_X3DAppearanceChildNode .prototype .initialize .call (this); + + const browser = this .getBrowser (); + + browser .getRenderingProperties () ._ContentScale .addInterest ("set_linewidthScaleFactor__", this); + + this ._applied .addInterest ("set_applied__", this); + this ._linetype .addInterest ("set_linetype__", this); + this ._linewidthScaleFactor .addInterest ("set_linewidthScaleFactor__", this); + + this .set_applied__ (); + this .set_linetype__ (); + this .set_linewidthScaleFactor__ (); + + // Preload texture. + this .getBrowser () .getLinetypeTexture (); + }, + getStyleKey () + { + return this .applied ? 2 : 1; + }, + getApplied () + { + return this .applied; + }, + getLinetype () + { + return this .linetype; + }, + getLinewidthScaleFactor () + { + return this .linewidthScaleFactor; + }, + getTransformLines () + { + return this .transformLines; + }, + set_applied__ () + { + this .applied = this ._applied .getValue (); + }, + set_linetype__ () + { + let linetype = this ._linetype .getValue (); + + if (linetype < 1 || linetype > 16) + linetype = 1; + + this .linetype = linetype; + }, + set_linewidthScaleFactor__ () + { + const + browser = this .getBrowser (), + gl = browser .getContext (), + contentScale = browser .getRenderingProperty ("ContentScale"); + + this .linewidthScaleFactor = Math .max (1, this ._linewidthScaleFactor .getValue ()) * contentScale; + this .transformLines = gl .HAS_FEATURE_TRANSFORMED_LINES && this .linewidthScaleFactor > 1; + }, + setShaderUniforms (gl, shaderObject) + { + const browser = this .getBrowser (); + + if (this .applied) + { + const textureUnit = browser .getTexture2DUnit (); + + gl .lineWidth (this .linewidthScaleFactor); + gl .uniform1i (shaderObject .x3d_LinePropertiesLinetype, this .linetype); + gl .uniform1f (shaderObject .x3d_LineStippleScale, browser .getLineStippleScale ()); + + gl .activeTexture (gl .TEXTURE0 + textureUnit); + gl .bindTexture (gl .TEXTURE_2D, browser .getLinetypeTexture () .getTexture ()); + gl .uniform1i (shaderObject .x3d_LinePropertiesTexture, textureUnit); + } + else + { + gl .lineWidth (browser .getRenderingProperty ("ContentScale")); + gl .uniform1i (shaderObject .x3d_LinePropertiesLinetype, 16); + gl .uniform1f (shaderObject .x3d_LineStippleScale, 1); + } + }, +}); + +Object .defineProperties (LineProperties, +{ + typeName: + { + value: "LineProperties", + enumerable: true, + }, + componentName: + { + value: "Shape", + enumerable: true, + }, + containerField: + { + value: "lineProperties", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "applied", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "linetype", new x_ite_Fields .SFInt32 (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "linewidthScaleFactor", new x_ite_Fields .SFFloat ()), + ]), + enumerable: true, + }, +}); + +const LineProperties_default_ = LineProperties; +; + +x_ite_Namespace .add ("LineProperties", "x_ite/Components/Shape/LineProperties", LineProperties_default_); +/* harmony default export */ const Shape_LineProperties = (LineProperties_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shape/X3DMaterialNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function X3DMaterialNode (executionContext) +{ + Shape_X3DAppearanceChildNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DMaterialNode); + + this .addChildObjects (Base_X3DConstants .outputOnly, "transparent", new x_ite_Fields .SFBool ()); + + this .textureBits = new Utility_BitSet (); + this .shaderNodes = this .getBrowser () .getShaders (); +} + +Object .assign (Object .setPrototypeOf (X3DMaterialNode .prototype, Shape_X3DAppearanceChildNode .prototype), +{ + setTransparent (value) + { + if (value !== this ._transparent .getValue ()) + this ._transparent = value; + }, + isTransparent () + { + return this ._transparent .getValue (); + }, + getBaseTexture () + { + return null; + }, + setTexture (index, textureNode) + { + const textureType = textureNode ? textureNode .getTextureType () - 1 : 0; + + this .textureBits .set (index * 2 + 0, textureType & 0b01); + this .textureBits .set (index * 2 + 1, textureType & 0b10); + }, + getTextureBits () + { + return this .textureBits; + }, + getShader (geometryContext, renderContext) + { + let key = ""; + + key += this .textureBits .toString (4); + key += "."; + key += geometryContext .geometryKey; + + if (renderContext) + { + const { renderObject, transparent, shadows, fogNode, shapeNode, appearanceNode, textureNode, humanoidNode, objectsCount } = renderContext; + + key += appearanceNode .getNormalizedAlphaMode (transparent); + key += this .getMaterialKey (shadows); + key += renderObject .getLogarithmicDepthBuffer () ? 1 : 0; + key += shadows ? 1 : 0; + key += fogNode ?.getFogType () ?? 0; + key += shapeNode .getShapeKey (); + key += appearanceNode .getStyleProperties (geometryContext .geometryType) ?.getStyleKey () ?? 0; + key += appearanceNode .getTextureTransformMapping () .size || 1; + key += geometryContext .textureCoordinateMapping .size || 1; + key += "."; + key += humanoidNode ?.getHumanoidKey () ?? ""; + key += "."; + key += objectsCount [0]; // Clip planes + key += "."; + key += objectsCount [1]; // Lights + key += "."; + key += objectsCount [2]; // Texture projectors + key += "."; + key += textureNode ? 1 : appearanceNode .getTextureBits () .toString (4); + } + else + { + // Rubberband, X3DBackgroundNode + + const { textureNode, objectsCount } = geometryContext; + + key += geometryContext .alphaMode; + key += this .getMaterialKey (false); + key += "0000011.0."; + key += objectsCount [0]; // Clip planes + key += "."; + key += objectsCount [1]; // Lights + key += "."; + key += objectsCount [2]; // Texture projectors + key += "."; + key += textureNode ? 1 : 0; + } + + return this .shaderNodes .get (key) ?? this .createShader (key, geometryContext, renderContext); + }, + getShaderOptions (geometryContext, renderContext) + { + const + browser = this .getBrowser (), + options = [ ]; + + options .push (`X3D_GEOMETRY_${geometryContext .geometryType}D`); + + if (geometryContext .hasFogCoords) + options .push ("X3D_FOG_COORDS"); + + if (geometryContext .colorMaterial) + options .push ("X3D_COLOR_MATERIAL"); + + if (geometryContext .hasNormals) + options .push ("X3D_NORMALS"); + + if (renderContext) + { + const { renderObject, fogNode, shapeNode, appearanceNode, humanoidNode, objectsCount } = renderContext; + + if (renderObject .getLogarithmicDepthBuffer ()) + options .push ("X3D_LOGARITHMIC_DEPTH_BUFFER"); + + switch (appearanceNode .getNormalizedAlphaMode (renderContext .transparent)) + { + case Shape_AlphaMode .OPAQUE: + { + options .push ("X3D_ALPHA_MODE_OPAQUE"); + break; + } + case Shape_AlphaMode .MASK: + { + options .push ("X3D_ALPHA_MODE_MASK"); + break; + } + case Shape_AlphaMode .BLEND: + { + options .push ("X3D_ALPHA_MODE_BLEND"); + + if (browser .getBrowserOption ("OrderIndependentTransparency")) + options .push ("X3D_ORDER_INDEPENDENT_TRANSPARENCY"); + + break; + } + } + + if (renderContext .shadows) + options .push ("X3D_SHADOWS", "X3D_PCF_FILTERING"); + + switch (fogNode ?.getFogType ()) + { + case 1: + options .push ("X3D_FOG", "X3D_FOG_LINEAR"); + break; + case 2: + options .push ("X3D_FOG", "X3D_FOG_EXPONENTIAL"); + break; + } + + if (humanoidNode) + { + options .push ("X3D_SKINNING"); + options .push (`X3D_NUM_JOINT_SETS ${humanoidNode .getNumJoints () / 4}`); + options .push (`X3D_NUM_DISPLACEMENTS ${humanoidNode .getNumDisplacements ()}`); + } + + if (objectsCount [0]) + { + options .push ("X3D_CLIP_PLANES") + options .push (`X3D_NUM_CLIP_PLANES ${Math .min (objectsCount [0], browser .getMaxClipPlanes ())}`); + } + + if (objectsCount [1]) + { + options .push ("X3D_LIGHTING") + options .push (`X3D_NUM_LIGHTS ${Math .min (objectsCount [1], browser .getMaxLights ())}`); + } + + if (objectsCount [2]) + { + options .push ("X3D_PROJECTIVE_TEXTURE_MAPPING") + options .push (`X3D_NUM_TEXTURE_PROJECTORS ${Math .min (objectsCount [2], browser .getMaxTextures ())}`); + } + + if (appearanceNode .getStyleProperties (geometryContext .geometryType)) + { + options .push ("X3D_STYLE_PROPERTIES"); + + if (appearanceNode .getStyleProperties (geometryContext .geometryType) .getStyleKey () > 1) + options .push ("X3D_STYLE_PROPERTIES_TEXTURE"); + } + + if (+this .textureBits) + options .push ("X3D_MATERIAL_TEXTURES"); + + if (renderContext .textureNode) + { + // ScreenText + + options .push ("X3D_TEXTURE", + "X3D_NUM_TEXTURES 1", + "X3D_NUM_TEXTURE_TRANSFORMS 1", + "X3D_NUM_TEXTURE_COORDINATES 1", + "X3D_TEXTURE0_2D"); + } + else + { + if (+appearanceNode .getTextureBits () && !this .getBaseTexture ()) + { + const textureNode = appearanceNode .getTexture (); + + options .push ("X3D_TEXTURE"); + options .push (`X3D_NUM_TEXTURES ${textureNode .getCount ()}`); + + if (textureNode .getType () .includes (Base_X3DConstants .MultiTexture)) + options .push ("X3D_MULTI_TEXTURING"); + + textureNode .getShaderOptions (options); + } + + options .push (`X3D_NUM_TEXTURE_TRANSFORMS ${appearanceNode .getTextureTransformMapping () .size || 1}`); + options .push (`X3D_NUM_TEXTURE_COORDINATES ${geometryContext .textureCoordinateMapping .size || 1}`); + } + + switch (shapeNode .getShapeKey ()) + { + case 1: + options .push ("X3D_PARTICLE_SYSTEM"); + break; + case 2: + options .push ("X3D_PARTICLE_SYSTEM", "X3D_TEX_COORD_RAMP"); + break; + } + } + else + { + const { alphaMode, textureNode, objectsCount } = geometryContext; + + switch (alphaMode) + { + case Shape_AlphaMode .OPAQUE: + { + options .push ("X3D_ALPHA_MODE_OPAQUE"); + break; + } + case Shape_AlphaMode .MASK: + { + options .push ("X3D_ALPHA_MODE_MASK"); + break; + } + case Shape_AlphaMode .BLEND: + { + options .push ("X3D_ALPHA_MODE_BLEND"); + + if (browser .getBrowserOption ("OrderIndependentTransparency")) + options .push ("X3D_ORDER_INDEPENDENT_TRANSPARENCY"); + + break; + } + } + + if (objectsCount [0]) + { + options .push ("X3D_CLIP_PLANES") + options .push (`X3D_NUM_CLIP_PLANES ${Math .min (objectsCount [0], browser .getMaxClipPlanes ())}`); + } + + if (objectsCount [1]) + { + options .push ("X3D_LIGHTING") + options .push (`X3D_NUM_LIGHTS ${Math .min (objectsCount [1], browser .getMaxLights ())}`); + } + + if (objectsCount [2]) + { + options .push ("X3D_PROJECTIVE_TEXTURE_MAPPING") + options .push (`X3D_NUM_TEXTURE_PROJECTORS ${Math .min (objectsCount [2], browser .getMaxTextures ())}`); + } + + if (textureNode) + { + // X3DBackgroundNode textures + + options .push ("X3D_TEXTURE", + "X3D_NUM_TEXTURES 1", + "X3D_NUM_TEXTURE_TRANSFORMS 1", + "X3D_NUM_TEXTURE_COORDINATES 1", + "X3D_TEXTURE0_2D"); + } + } + + return options; + }, +}); + +Object .defineProperties (X3DMaterialNode, +{ + typeName: + { + value: "X3DMaterialNode", + enumerable: true, + }, + componentName: + { + value: "Shape", + enumerable: true, + }, +}); + +const X3DMaterialNode_default_ = X3DMaterialNode; +; + +x_ite_Namespace .add ("X3DMaterialNode", "x_ite/Components/Shape/X3DMaterialNode", X3DMaterialNode_default_); +/* harmony default export */ const Shape_X3DMaterialNode = (X3DMaterialNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shape/X3DOneSidedMaterialNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function X3DOneSidedMaterialNode (executionContext) +{ + Shape_X3DMaterialNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DOneSidedMaterialNode); + + this .emissiveColor = new Float32Array (3); +} + +Object .assign (Object .setPrototypeOf (X3DOneSidedMaterialNode .prototype, Shape_X3DMaterialNode .prototype), +{ + initialize () + { + Shape_X3DMaterialNode .prototype .initialize .call (this); + + this ._emissiveColor .addInterest ("set_emissiveColor__", this); + this ._emissiveTexture .addInterest ("set_emissiveTexture__", this); + this ._normalTexture .addInterest ("set_normalTexture__", this); + this ._transparency .addInterest ("set_transparency__", this); + this ._transparency .addInterest ("set_transparent__", this); + + this .set_emissiveColor__ (); + this .set_emissiveTexture__ (); + this .set_normalTexture__ (); + this .set_transparency__ (); + }, + set_emissiveColor__ () + { + //We cannot use this in Windows Edge: + //this .emissiveColor .set (this ._emissiveColor .getValue ()); + + const + emissiveColor = this .emissiveColor, + emissiveColor_ = this ._emissiveColor .getValue (); + + emissiveColor [0] = emissiveColor_ .r; + emissiveColor [1] = emissiveColor_ .g; + emissiveColor [2] = emissiveColor_ .b; + }, + set_emissiveTexture__ () + { + this .emissiveTextureNode = Base_X3DCast (Base_X3DConstants .X3DSingleTextureNode, this ._emissiveTexture); + + this .setTexture (this .getTextureIndices () .EMISSIVE_TEXTURE, this .emissiveTextureNode); + }, + set_normalTexture__ () + { + this .normalTextureNode = Base_X3DCast (Base_X3DConstants .X3DSingleTextureNode, this ._normalTexture); + + this .setTexture (this .getTextureIndices () .NORMAL_TEXTURE, this .normalTextureNode); + }, + set_transparency__ () + { + this .transparency = Math_Algorithm .clamp (this ._transparency .getValue (), 0, 1); + }, + set_transparent__ () + { + this .setTransparent (!! this .transparency); + }, + getBaseTexture () + { + return this .getEmissiveTexture (); + }, + getEmissiveTexture () + { + return this .emissiveTextureNode; + }, + getNormalTexture () + { + return this .normalTextureNode; + }, + getTransparency () + { + return this .transparency; + }, + getTextureIndices: (() => + { + let i = 0; + + const textureIndices = { + EMISSIVE_TEXTURE: i ++, + NORMAL_TEXTURE: i ++, + }; + + return function () + { + return textureIndices; + }; + })(), + getShaderOptions (geometryContext, renderContext) + { + const options = Shape_X3DMaterialNode .prototype .getShaderOptions .call (this, geometryContext, renderContext); + + if (+this .getTextureBits ()) + { + if (this .getEmissiveTexture ()) + options .push ("X3D_EMISSIVE_TEXTURE", `X3D_EMISSIVE_TEXTURE_${this .getEmissiveTexture () .getTextureTypeString ()}`); + + if (this .getNormalTexture ()) + options .push ("X3D_NORMAL_TEXTURE", `X3D_NORMAL_TEXTURE_${this .getNormalTexture () .getTextureTypeString ()}`); + } + + return options; + }, + setShaderUniforms (gl, shaderObject, renderObject, textureTransformMapping, textureCoordinateMapping) + { + gl .uniform3fv (shaderObject .x3d_EmissiveColor, this .emissiveColor); + gl .uniform1f (shaderObject .x3d_Transparency, this .transparency); + + if (+this .getTextureBits ()) + { + // Emissive parameters + + if (this .emissiveTextureNode) + { + const + emissiveTextureMapping = this ._emissiveTextureMapping .getValue (), + emissiveTexture = shaderObject .x3d_EmissiveTexture; + + this .emissiveTextureNode .setShaderUniforms (gl, shaderObject, renderObject, emissiveTexture); + + gl .uniform1i (emissiveTexture .textureTransformMapping, textureTransformMapping .get (emissiveTextureMapping) ?? 0); + gl .uniform1i (emissiveTexture .textureCoordinateMapping, textureCoordinateMapping .get (emissiveTextureMapping) ?? 0); + } + + // Normal parameters + + if (this .normalTextureNode) + { + const + normalTextureMapping = this ._normalTextureMapping .getValue (), + normalTexture = shaderObject .x3d_NormalTexture; + + gl .uniform1f (shaderObject .x3d_NormalScale, Math .max (this ._normalScale .getValue (), 0)); + + this .normalTextureNode .setShaderUniforms (gl, shaderObject, renderObject, normalTexture); + + gl .uniform1i (normalTexture .textureTransformMapping, textureTransformMapping .get (normalTextureMapping) ?? 0); + gl .uniform1i (normalTexture .textureCoordinateMapping, textureCoordinateMapping .get (normalTextureMapping) ?? 0); + } + } + }, +}); + +Object .defineProperties (X3DOneSidedMaterialNode, +{ + typeName: + { + value: "X3DOneSidedMaterialNode", + enumerable: true, + }, + componentName: + { + value: "Shape", + enumerable: true, + }, +}); + +const X3DOneSidedMaterialNode_default_ = X3DOneSidedMaterialNode; +; + +x_ite_Namespace .add ("X3DOneSidedMaterialNode", "x_ite/Components/Shape/X3DOneSidedMaterialNode", X3DOneSidedMaterialNode_default_); +/* harmony default export */ const Shape_X3DOneSidedMaterialNode = (X3DOneSidedMaterialNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shape/Material.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + +function Material (executionContext) +{ + Shape_X3DOneSidedMaterialNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Material); + + if (executionContext .getSpecificationVersion () <= 3.3) + this .getMaterialKey = getMaterialKey; + + this .diffuseColor = new Float32Array (3); + this .specularColor = new Float32Array (3); +} + +Object .assign (Object .setPrototypeOf (Material .prototype, Shape_X3DOneSidedMaterialNode .prototype), +{ + initialize () + { + Shape_X3DOneSidedMaterialNode .prototype .initialize .call (this); + + this ._ambientIntensity .addInterest ("set_ambientIntensity__", this); + this ._ambientTexture .addInterest ("set_ambientTexture__", this); + this ._diffuseColor .addInterest ("set_diffuseColor__", this); + this ._diffuseTexture .addInterest ("set_diffuseTexture__", this); + this ._specularColor .addInterest ("set_specularColor__", this); + this ._specularTexture .addInterest ("set_specularTexture__", this); + this ._shininess .addInterest ("set_shininess__", this); + this ._shininessTexture .addInterest ("set_shininessTexture__", this); + this ._occlusionStrength .addInterest ("set_occlusionStrength__", this); + this ._occlusionTexture .addInterest ("set_occlusionTexture__", this); + + this .set_ambientIntensity__ (); + this .set_ambientTexture__ (); + this .set_diffuseColor__ (); + this .set_diffuseTexture__ (); + this .set_specularColor__ (); + this .set_specularTexture__ (); + this .set_shininess__ (); + this .set_shininessTexture__ (); + this .set_occlusionStrength__ (); + this .set_occlusionTexture__ (); + this .set_transparent__ (); + }, + set_ambientIntensity__ () + { + this .ambientIntensity = Math_Algorithm .clamp (this ._ambientIntensity .getValue (), 0, 1); + }, + set_ambientTexture__ () + { + this .ambientTextureNode = Base_X3DCast (Base_X3DConstants .X3DSingleTextureNode, this ._ambientTexture); + + this .setTexture (this .getTextureIndices () .AMBIENT_TEXTURE, this .ambientTextureNode); + }, + set_diffuseColor__ () + { + //We cannot use this in Windows Edge: + //this .diffuseColor .set (this ._diffuseColor .getValue ()); + + const + diffuseColor = this .diffuseColor, + diffuseColor_ = this ._diffuseColor .getValue (); + + diffuseColor [0] = diffuseColor_ .r; + diffuseColor [1] = diffuseColor_ .g; + diffuseColor [2] = diffuseColor_ .b; + }, + set_diffuseTexture__ () + { + if (this .diffuseTextureNode) + this .diffuseTextureNode ._transparent .removeInterest ("set_transparent__", this); + + this .diffuseTextureNode = Base_X3DCast (Base_X3DConstants .X3DSingleTextureNode, this ._diffuseTexture); + + if (this .diffuseTextureNode) + this .diffuseTextureNode ._transparent .addInterest ("set_transparent__", this); + + this .setTexture (this .getTextureIndices () .DIFFUSE_TEXTURE, this .diffuseTextureNode); + }, + set_specularColor__ () + { + //We cannot use this in Windows Edge: + //this .specularColor .set (this ._specularColor .getValue ()); + + const + specularColor = this .specularColor, + specularColor_ = this ._specularColor .getValue (); + + specularColor [0] = specularColor_ .r; + specularColor [1] = specularColor_ .g; + specularColor [2] = specularColor_ .b; + }, + set_specularTexture__ () + { + this .specularTextureNode = Base_X3DCast (Base_X3DConstants .X3DSingleTextureNode, this ._specularTexture); + + this .setTexture (this .getTextureIndices () .SPECULAR_TEXTURE, this .specularTextureNode); + }, + set_shininess__ () + { + this .shininess = Math_Algorithm .clamp (this ._shininess .getValue (), 0, 1); + }, + set_shininessTexture__ () + { + this .shininessTextureNode = Base_X3DCast (Base_X3DConstants .X3DSingleTextureNode, this ._shininessTexture); + + this .setTexture (this .getTextureIndices () .SHININESS_TEXTURE, this .shininessTextureNode); + }, + set_occlusionStrength__ () + { + this .occlusionStrength = Math_Algorithm .clamp (this ._occlusionStrength .getValue (), 0, 1); + }, + set_occlusionTexture__ () + { + this .occlusionTextureNode = Base_X3DCast (Base_X3DConstants .X3DSingleTextureNode, this ._occlusionTexture); + + this .setTexture (this .getTextureIndices () .OCCLUSION_TEXTURE, this .occlusionTextureNode); + }, + set_transparent__ () + { + this .setTransparent (!!(this .getTransparency () || this .diffuseTextureNode ?.isTransparent ())); + }, + getBaseTexture () + { + return this .diffuseTexture; + }, + getTextureIndices: (() => + { + let i = 0; + + const textureIndices = { + EMISSIVE_TEXTURE: i ++, + NORMAL_TEXTURE: i ++, + AMBIENT_TEXTURE: i ++, + DIFFUSE_TEXTURE: i ++, + SPECULAR_TEXTURE: i ++, + SHININESS_TEXTURE: i ++, + OCCLUSION_TEXTURE: i ++, + }; + + return function () + { + return textureIndices; + }; + })(), + getMaterialKey () + { + return "2"; + }, + createShader (key, geometryContext, renderContext) + { + const + browser = this .getBrowser (), + options = this .getShaderOptions (geometryContext, renderContext); + + if (geometryContext .hasNormals) + { + options .push ("X3D_MATERIAL"); + + if (+this .getTextureBits ()) + { + if (this .ambientTextureNode) + options .push ("X3D_AMBIENT_TEXTURE", `X3D_AMBIENT_TEXTURE_${this .ambientTextureNode .getTextureTypeString ()}`); + + if (this .diffuseTextureNode) + options .push ("X3D_DIFFUSE_TEXTURE", `X3D_DIFFUSE_TEXTURE_${this .diffuseTextureNode .getTextureTypeString ()}`); + + if (this .specularTextureNode) + options .push ("X3D_SPECULAR_TEXTURE", `X3D_SPECULAR_TEXTURE_${this .specularTextureNode .getTextureTypeString ()}`); + + if (this .shininessTextureNode) + options .push ("X3D_SHININESS_TEXTURE", `X3D_SHININESS_TEXTURE_${this .shininessTextureNode .getTextureTypeString ()}`); + + if (this .occlusionTextureNode) + options .push ("X3D_OCCLUSION_TEXTURE", `X3D_OCCLUSION_TEXTURE_${this .occlusionTextureNode .getTextureTypeString ()}`); + } + + switch (this .getMaterialKey (renderContext && renderContext .shadows)) + { + case "1": + var shaderNode = browser .createShader ("GouraudShader", "Gouraud", "Gouraud", options); + break; + case "2": + var shaderNode = browser .createShader ("PhongShader", "Default", "Phong", options); + break; + } + } + else + { + options .push ("X3D_UNLIT_MATERIAL"); + + var shaderNode = browser .createShader ("UnlitShader", "Default", "Unlit", options); + + browser .getShaders () .set (key .replace (/^(\d{1,2})\d*/, "$1") .replace (/\d$/, "0"), shaderNode); + } + + browser .getShaders () .set (key, shaderNode); + + return shaderNode; + }, + setShaderUniforms (gl, shaderObject, renderObject, textureTransformMapping, textureCoordinateMapping) + { + Shape_X3DOneSidedMaterialNode .prototype .setShaderUniforms .call (this, gl, shaderObject, renderObject, textureTransformMapping, textureCoordinateMapping); + + gl .uniform1f (shaderObject .x3d_AmbientIntensity, this .ambientIntensity); + gl .uniform3fv (shaderObject .x3d_DiffuseColor, this .diffuseColor); + gl .uniform3fv (shaderObject .x3d_SpecularColor, this .specularColor); + gl .uniform1f (shaderObject .x3d_Shininess, this .shininess); + + if (+this .getTextureBits ()) + { + // Ambient parameters + + if (this .ambientTextureNode) + { + const + ambientTextureMapping = this ._ambientTextureMapping .getValue (), + ambientTexture = shaderObject .x3d_AmbientTexture; + + this .ambientTextureNode .setShaderUniforms (gl, shaderObject, renderObject, ambientTexture); + + gl .uniform1i (ambientTexture .textureTransformMapping, textureTransformMapping .get (ambientTextureMapping) ?? 0); + gl .uniform1i (ambientTexture .textureCoordinateMapping, textureCoordinateMapping .get (ambientTextureMapping) ?? 0); + } + + // Diffuse parameters + + if (this .diffuseTextureNode) + { + const + diffuseTextureMapping = this ._diffuseTextureMapping .getValue (), + diffuseTexture = shaderObject .x3d_DiffuseTexture; + + this .diffuseTextureNode .setShaderUniforms (gl, shaderObject, renderObject, diffuseTexture); + + gl .uniform1i (diffuseTexture .textureTransformMapping, textureTransformMapping .get (diffuseTextureMapping) ?? 0); + gl .uniform1i (diffuseTexture .textureCoordinateMapping, textureCoordinateMapping .get (diffuseTextureMapping) ?? 0); + } + + // Specular parameters + + if (this .specularTextureNode) + { + const + specularTextureMapping = this ._specularTextureMapping .getValue (), + specularTexture = shaderObject .x3d_SpecularTexture; + + this .specularTextureNode .setShaderUniforms (gl, shaderObject, renderObject, specularTexture); + + gl .uniform1i (specularTexture .textureTransformMapping, textureTransformMapping .get (specularTextureMapping) ?? 0); + gl .uniform1i (specularTexture .textureCoordinateMapping, textureCoordinateMapping .get (specularTextureMapping) ?? 0); + } + + // Shininess parameters + + if (this .shininessTextureNode) + { + const + shininessTextureMapping = this ._shininessTextureMapping .getValue (), + shininessTexture = shaderObject .x3d_ShininessTexture; + + this .shininessTextureNode .setShaderUniforms (gl, shaderObject, renderObject, shininessTexture); + + gl .uniform1i (shininessTexture .textureTransformMapping, textureTransformMapping .get (shininessTextureMapping) ?? 0); + gl .uniform1i (shininessTexture .textureCoordinateMapping, textureCoordinateMapping .get (shininessTextureMapping) ?? 0); + } + + // Occlusion parameters + + if (this .occlusionTextureNode) + { + const + occlusionTextureMapping = this ._occlusionTextureMapping .getValue (), + occlusionTexture = shaderObject .x3d_OcclusionTexture; + + gl .uniform1f (shaderObject .x3d_OcclusionStrength, this .occlusionStrength); + + this .occlusionTextureNode .setShaderUniforms (gl, shaderObject, renderObject, occlusionTexture); + + gl .uniform1i (occlusionTexture .textureTransformMapping, textureTransformMapping .get (occlusionTextureMapping) ?? 0); + gl .uniform1i (occlusionTexture .textureCoordinateMapping, textureCoordinateMapping .get (occlusionTextureMapping) ?? 0); + } + } + }, +}); + +function getMaterialKey (shadows) +{ + if (shadows || +this .getTextureBits ()) + { + return "2"; + } + else + { + switch (this .getBrowser () .getBrowserOptions () .getShading ()) + { + default: + return "1"; + case Core_Shading .PHONG: + return "2"; + } + } +} + +Object .defineProperties (Material, +{ + typeName: + { + value: "Material", + enumerable: true, + }, + componentName: + { + value: "Shape", + enumerable: true, + }, + containerField: + { + value: "material", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "ambientIntensity", new x_ite_Fields .SFFloat (0.2)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "ambientTextureMapping", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "ambientTexture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "diffuseColor", new x_ite_Fields .SFColor (0.8, 0.8, 0.8)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "diffuseTextureMapping", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "diffuseTexture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "specularColor", new x_ite_Fields .SFColor ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "specularTextureMapping", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "specularTexture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "emissiveColor", new x_ite_Fields .SFColor ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "emissiveTextureMapping", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "emissiveTexture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shininess", new x_ite_Fields .SFFloat (0.2)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shininessTextureMapping", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shininessTexture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "occlusionStrength", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "occlusionTextureMapping", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "occlusionTexture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normalScale", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normalTextureMapping", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normalTexture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "transparency", new x_ite_Fields .SFFloat ()), + ]), + enumerable: true, + }, +}); + +const Material_default_ = Material; +; + +x_ite_Namespace .add ("Material", "x_ite/Components/Shape/Material", Material_default_); +/* harmony default export */ const Shape_Material = (Material_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shape/PhysicalMaterial.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +function PhysicalMaterial (executionContext) +{ + Shape_X3DOneSidedMaterialNode .call (this, executionContext); + + this .addType (Base_X3DConstants .PhysicalMaterial); + + this .baseColor = new Float32Array (3); +} + +Object .assign (Object .setPrototypeOf (PhysicalMaterial .prototype, Shape_X3DOneSidedMaterialNode .prototype), +{ + initialize () + { + Shape_X3DOneSidedMaterialNode .prototype .initialize .call (this); + + this ._baseColor .addInterest ("set_baseColor__", this); + this ._baseTexture .addInterest ("set_baseTexture__", this); + this ._metallic .addInterest ("set_metallic__", this); + this ._roughness .addInterest ("set_roughness__", this); + this ._metallicRoughnessTexture .addInterest ("set_metallicRoughnessTexture__", this); + this ._occlusionStrength .addInterest ("set_occlusionStrength__", this); + this ._occlusionTexture .addInterest ("set_occlusionTexture__", this); + + this .set_baseColor__ (); + this .set_baseTexture__ (); + this .set_metallic__ (); + this .set_roughness__ (); + this .set_metallicRoughnessTexture__ (); + this .set_occlusionStrength__ (); + this .set_occlusionTexture__ (); + this .set_transparent__ (); + }, + set_baseColor__ () + { + //We cannot use this in Windows Edge: + //this .baseColor .set (this ._baseColor .getValue ()); + + const + baseColor = this .baseColor, + baseColor_ = this ._baseColor .getValue (); + + baseColor [0] = baseColor_ .r; + baseColor [1] = baseColor_ .g; + baseColor [2] = baseColor_ .b; + }, + set_baseTexture__ () + { + if (this .baseTextureNode) + this .baseTextureNode ._transparent .removeInterest ("set_transparent__", this); + + this .baseTextureNode = Base_X3DCast (Base_X3DConstants .X3DSingleTextureNode, this ._baseTexture); + + this .setTexture (this .getTextureIndices () .BASE_TEXTURE, this .baseTextureNode); + + if (this .baseTextureNode) + this .baseTextureNode ._transparent .addInterest ("set_transparent__", this); + }, + set_metallic__ () + { + this .metallic = Math_Algorithm .clamp (this ._metallic .getValue (), 0, 1); + }, + set_roughness__ () + { + this .roughness = Math_Algorithm .clamp (this ._roughness .getValue (), 0, 1); + }, + set_metallicRoughnessTexture__ () + { + this .metallicRoughnessTextureNode = Base_X3DCast (Base_X3DConstants .X3DSingleTextureNode, this ._metallicRoughnessTexture); + + this .setTexture (this .getTextureIndices () .METALLIC_ROUGHNESS_TEXTURE, this .metallicRoughnessTextureNode); + }, + set_occlusionStrength__ () + { + this .occlusionStrength = Math_Algorithm .clamp (this ._occlusionStrength .getValue (), 0, 1); + }, + set_occlusionTexture__ () + { + this .occlusionTextureNode = Base_X3DCast (Base_X3DConstants .X3DSingleTextureNode, this ._occlusionTexture); + + this .setTexture (this .getTextureIndices () .OCCLUSION_TEXTURE, this .occlusionTextureNode); + }, + set_transparent__ () + { + this .setTransparent (!!(this .getTransparency () || this .baseTextureNode ?.isTransparent ())); + }, + getBaseTexture () + { + return this .baseTextureNode; + }, + getTextureIndices: (() => + { + let i = 0; + + const textureIndices = { + EMISSIVE_TEXTURE: i ++, + NORMAL_TEXTURE: i ++, + BASE_TEXTURE: i ++, + METALLIC_ROUGHNESS_TEXTURE: i ++, + OCCLUSION_TEXTURE: i ++, + }; + + return function () + { + return textureIndices; + }; + })(), + getMaterialKey () + { + return "3"; + }, + createShader (key, geometryContext, renderContext) + { + const + browser = this .getBrowser (), + options = this .getShaderOptions (geometryContext, renderContext); + + if (geometryContext .hasNormals) + { + options .push ("X3D_PHYSICAL_MATERIAL", "MANUAL_SRGB"); + + if (+this .getTextureBits ()) + { + if (this .baseTextureNode) + options .push ("X3D_BASE_TEXTURE", `X3D_BASE_TEXTURE_${this .baseTextureNode .getTextureTypeString ()}`); + + if (this .metallicRoughnessTextureNode) + options .push ("X3D_METALLIC_ROUGHNESS_TEXTURE", `X3D_METALLIC_ROUGHNESS_TEXTURE_${this .metallicRoughnessTextureNode .getTextureTypeString ()}`); + + if (this .occlusionTextureNode) + options .push ("X3D_OCCLUSION_TEXTURE", `X3D_OCCLUSION_TEXTURE_${this .occlusionTextureNode .getTextureTypeString ()}`); + } + + var shaderNode = browser .createShader ("PBRShader", "Default", "PBR", options); + } + else + { + options .push ("X3D_UNLIT_MATERIAL"); + + var shaderNode = browser .createShader ("UnlitShader", "Default", "Unlit", options); + + browser .getShaders () .set (key .replace (/^(\d{1,2})\d*/, "$1") .replace (/\d$/, "0"), shaderNode); + } + + browser .getShaders () .set (key, shaderNode); + + return shaderNode; + }, + setShaderUniforms (gl, shaderObject, renderObject, textureTransformMapping, textureCoordinateMapping) + { + Shape_X3DOneSidedMaterialNode .prototype .setShaderUniforms .call (this, gl, shaderObject, renderObject, textureTransformMapping, textureCoordinateMapping); + + gl .uniform3fv (shaderObject .x3d_BaseColor, this .baseColor); + gl .uniform1f (shaderObject .x3d_Metallic, this .metallic); + gl .uniform1f (shaderObject .x3d_Roughness, this .roughness); + + if (+this .getTextureBits ()) + { + // Base parameters + + if (this .baseTextureNode) + { + const + baseTextureMapping = this ._baseTextureMapping .getValue (), + baseTexture = shaderObject .x3d_BaseTexture; + + this .baseTextureNode .setShaderUniforms (gl, shaderObject, renderObject, baseTexture); + + gl .uniform1i (baseTexture .textureTransformMapping, textureTransformMapping .get (baseTextureMapping) ?? 0); + gl .uniform1i (baseTexture .textureCoordinateMapping, textureCoordinateMapping .get (baseTextureMapping) ?? 0); + } + + // Metallic roughness parameters + + if (this .metallicRoughnessTextureNode) + { + const + metallicRoughnessTextureMapping = this ._metallicRoughnessTextureMapping .getValue (), + metallicRoughnessTexture = shaderObject .x3d_MetallicRoughnessTexture; + + this .metallicRoughnessTextureNode .setShaderUniforms (gl, shaderObject, renderObject, metallicRoughnessTexture); + + gl .uniform1i (metallicRoughnessTexture .textureTransformMapping, textureTransformMapping .get (metallicRoughnessTextureMapping) ?? 0); + gl .uniform1i (metallicRoughnessTexture .textureCoordinateMapping, textureCoordinateMapping .get (metallicRoughnessTextureMapping) ?? 0); + } + + // Occlusion parameters + + if (this .occlusionTextureNode) + { + const + occlusionTextureMapping = this ._occlusionTextureMapping .getValue (), + occlusionTexture = shaderObject .x3d_OcclusionTexture; + + gl .uniform1f (shaderObject .x3d_OcclusionStrength, this .occlusionStrength); + + this .occlusionTextureNode .setShaderUniforms (gl, shaderObject, renderObject, occlusionTexture); + + gl .uniform1i (occlusionTexture .textureTransformMapping, textureTransformMapping .get (occlusionTextureMapping) ?? 0); + gl .uniform1i (occlusionTexture .textureCoordinateMapping, textureCoordinateMapping .get (occlusionTextureMapping) ?? 0); + } + } + }, +}); + +Object .defineProperties (PhysicalMaterial, +{ + typeName: + { + value: "PhysicalMaterial", + enumerable: true, + }, + componentName: + { + value: "Shape", + enumerable: true, + }, + containerField: + { + value: "material", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "baseColor", new x_ite_Fields .SFColor (1, 1, 1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "baseTextureMapping", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "baseTexture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "emissiveColor", new x_ite_Fields .SFColor ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "emissiveTextureMapping", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "emissiveTexture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metallic", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "roughness", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metallicRoughnessTextureMapping", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metallicRoughnessTexture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "occlusionStrength", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "occlusionTextureMapping", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "occlusionTexture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normalScale", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normalTextureMapping", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normalTexture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "transparency", new x_ite_Fields .SFFloat ()), + ]), + enumerable: true, + }, +}); + +const PhysicalMaterial_default_ = PhysicalMaterial; +; + +x_ite_Namespace .add ("PhysicalMaterial", "x_ite/Components/Shape/PhysicalMaterial", PhysicalMaterial_default_); +/* harmony default export */ const Shape_PhysicalMaterial = (PhysicalMaterial_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shape/PointProperties.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +function PointProperties (executionContext) +{ + Shape_X3DAppearanceChildNode .call (this, executionContext); + + this .addType (Base_X3DConstants .PointProperties); + + this .attenuation = new Float32Array (3); +} + +Object .assign (Object .setPrototypeOf (PointProperties .prototype, Shape_X3DAppearanceChildNode .prototype), +{ + initialize () + { + Shape_X3DAppearanceChildNode .prototype .initialize .call (this); + + const + browser = this .getBrowser (), + gl = browser .getContext (); + + this .pointSizeRange = gl .getParameter (gl .ALIASED_POINT_SIZE_RANGE); + + browser .getRenderingProperties () ._ContentScale .addInterest ("set_contentScale__", this); + + this ._pointSizeScaleFactor .addInterest ("set_pointSizeScaleFactor__", this); + this ._pointSizeMinValue .addInterest ("set_pointSizeMinValue__", this); + this ._pointSizeMaxValue .addInterest ("set_pointSizeMaxValue__", this); + this ._attenuation .addInterest ("set_attenuation__", this); + + this .set_pointSizeScaleFactor__ (); + this .set_pointSizeMinValue__ (); + this .set_pointSizeMaxValue__ (); + this .set_attenuation__ (); + }, + getStyleKey () + { + return 1; + }, + set_contentScale__ () + { + this .set_pointSizeScaleFactor__ (); + this .set_pointSizeMinValue__ (); + this .set_pointSizeMaxValue__ (); + }, + set_pointSizeScaleFactor__ () + { + const contentScale = this .getBrowser () .getRenderingProperty ("ContentScale"); + + this .pointSizeScaleFactor = Math .max (this ._pointSizeScaleFactor .getValue (), 0) * contentScale; + }, + set_pointSizeMinValue__ () + { + const contentScale = this .getBrowser () .getRenderingProperty ("ContentScale"); + + this .pointSizeMinValue = Math_Algorithm .clamp (this ._pointSizeMinValue .getValue (), 0, this .pointSizeRange [1]) * contentScale; + }, + set_pointSizeMaxValue__ () + { + const contentScale = this .getBrowser () .getRenderingProperty ("ContentScale"); + + this .pointSizeMaxValue = Math_Algorithm .clamp (this ._pointSizeMaxValue .getValue (), 0, this .pointSizeRange [1]) * contentScale; + }, + set_attenuation__ () + { + const length = this ._attenuation .length; + + this .attenuation [0] = length > 0 ? Math .max (0, this ._attenuation [0]) : 1; + this .attenuation [1] = length > 1 ? Math .max (0, this ._attenuation [1]) : 0; + this .attenuation [2] = length > 2 ? Math .max (0, this ._attenuation [2]) : 0; + }, + setShaderUniforms (gl, shaderObject) + { + gl .uniform1f (shaderObject .x3d_PointPropertiesPointSizeScaleFactor, this .pointSizeScaleFactor); + gl .uniform1f (shaderObject .x3d_PointPropertiesPointSizeMinValue, this .pointSizeMinValue); + gl .uniform1f (shaderObject .x3d_PointPropertiesPointSizeMaxValue, this .pointSizeMaxValue); + gl .uniform3fv (shaderObject .x3d_PointPropertiesAttenuation, this .attenuation); + }, +}); + +Object .defineProperties (PointProperties, +{ + typeName: + { + value: "PointProperties", + enumerable: true, + }, + componentName: + { + value: "Shape", + enumerable: true, + }, + containerField: + { + value: "pointProperties", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pointSizeScaleFactor", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pointSizeMinValue", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pointSizeMaxValue", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "attenuation", new x_ite_Fields .MFFloat (1, 0, 0)), + ]), + enumerable: true, + }, +}); + +const PointProperties_default_ = PointProperties; +; + +x_ite_Namespace .add ("PointProperties", "x_ite/Components/Shape/PointProperties", PointProperties_default_); +/* harmony default export */ const Shape_PointProperties = (PointProperties_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shape/X3DShapeNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +function X3DShapeNode (executionContext) +{ + Core_X3DChildNode .call (this, executionContext); + Grouping_X3DBoundedObject .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DShapeNode); + + this .bbox = new Geometry_Box3 (); + this .bboxSize = new Numbers_Vector3 (0, 0, 0); + this .bboxCenter = new Numbers_Vector3 (0, 0, 0); +} + +Object .assign (Object .setPrototypeOf (X3DShapeNode .prototype, Core_X3DChildNode .prototype), + Grouping_X3DBoundedObject .prototype, +{ + initialize () + { + Core_X3DChildNode .prototype .initialize .call (this); + Grouping_X3DBoundedObject .prototype .initialize .call (this); + + this ._bboxSize .addInterest ("set_bbox__", this); + this ._bboxCenter .addInterest ("set_bbox__", this); + this ._appearance .addInterest ("set_appearance__", this); + this ._geometry .addInterest ("set_geometry__", this); + + this ._appearance .addInterest ("set_transparent__", this); + this ._geometry .addInterest ("set_transparent__", this); + + this .set_appearance__ (); + this .set_geometry__ (); + this .set_transparent__ (); + }, + getBBox (bbox, shadows) + { + if (shadows) + { + if (this ._castShadow .getValue ()) + return bbox .assign (this .bbox); + else + return bbox .set (); + } + else + { + return bbox .assign (this .bbox); + } + }, + getBBoxSize () + { + return this .bboxSize; + }, + getBBoxCenter () + { + return this .bboxCenter; + }, + setTransparent (value) + { + this .transparent = value; + }, + isTransparent () + { + return this .transparent; + }, + getAppearance () + { + return this .appearanceNode; + }, + getGeometry () + { + return this .geometryNode; + }, + set_bbox__ () + { + if (this ._bboxSize .getValue () .equals (this .getDefaultBBoxSize ())) + { + if (this .getGeometry ()) + this .bbox .assign (this .getGeometry () .getBBox ()); + + else + this .bbox .set (); + } + else + { + this .bbox .set (this ._bboxSize .getValue (), this ._bboxCenter .getValue ()); + } + + this .bboxSize .assign (this .bbox .size); + this .bboxCenter .assign (this .bbox .center); + }, + set_appearance__ () + { + if (this .appearanceNode) + this .appearanceNode ._transparent .removeInterest ("set_transparent__", this); + + this .appearanceNode = Base_X3DCast (Base_X3DConstants .X3DAppearanceNode, this ._appearance); + + if (this .appearanceNode) + { + this .appearanceNode ._alphaMode .addInterest ("set_transparent__", this); + this .appearanceNode ._transparent .addInterest ("set_transparent__", this); + } + else + { + this .appearanceNode = this .getBrowser () .getDefaultAppearance (); + } + }, + set_geometry__ () + { + if (this .geometryNode) + { + this .geometryNode ._transparent .addInterest ("set_transparent__", this); + this .geometryNode ._bbox_changed .addInterest ("set_bbox__", this); + } + + this .geometryNode = Base_X3DCast (Base_X3DConstants .X3DGeometryNode, this ._geometry); + + if (this .geometryNode) + { + this .geometryNode ._transparent .addInterest ("set_transparent__", this); + this .geometryNode ._bbox_changed .addInterest ("set_bbox__", this); + } + + this .set_bbox__ (); + }, + set_transparent__ () + { + if (this .appearanceNode .getAlphaMode () === Shape_AlphaMode .AUTO) + { + this .transparent = !!(this .appearanceNode .isTransparent () || this .geometryNode ?.isTransparent ()); + } + else + { + this .transparent = this .appearanceNode .isTransparent (); + } + }, + dispose () + { + Grouping_X3DBoundedObject .prototype .dispose .call (this); + Core_X3DChildNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (X3DShapeNode, +{ + typeName: + { + value: "X3DShapeNode", + enumerable: true, + }, + componentName: + { + value: "Shape", + enumerable: true, + }, +}); + +const X3DShapeNode_default_ = X3DShapeNode; +; + +x_ite_Namespace .add ("X3DShapeNode", "x_ite/Components/Shape/X3DShapeNode", X3DShapeNode_default_); +/* harmony default export */ const Shape_X3DShapeNode = (X3DShapeNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shape/Shape.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function Shape (executionContext) +{ + Shape_X3DShapeNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Shape); +} + +Object .assign (Object .setPrototypeOf (Shape .prototype, Shape_X3DShapeNode .prototype), +{ + initialize () + { + Shape_X3DShapeNode .prototype .initialize .call (this); + + this ._transformSensors_changed .addInterest ("set_transformSensors__", this); + + this .set_transformSensors__ (); + }, + getShapeKey () + { + return 0; + }, + getGeometryContext: Shape_X3DShapeNode .prototype .getGeometry, + set_geometry__ () + { + Shape_X3DShapeNode .prototype .set_geometry__ .call (this); + + if (this .getGeometry ()) + delete this .traverse; + else + this .traverse = Function .prototype; + }, + set_transformSensors__ () + { + this .setPickableObject (this .getTransformSensors () .size); + }, + intersectsBox (box, clipPlanes, modelViewMatrix) + { + return this .getGeometry () .intersectsBox (box, clipPlanes, modelViewMatrix); + }, + traverse (type, renderObject) + { + // Always look at ParticleSystem if you do modify something here and there. + + switch (type) + { + case Rendering_TraverseType .POINTER: + { + renderObject .addPointingShape (this); + break; + } + case Rendering_TraverseType .PICKING: + { + this .picking (renderObject); + break; + } + case Rendering_TraverseType .COLLISION: + { + renderObject .addCollisionShape (this); + break; + } + case Rendering_TraverseType .SHADOW: + { + if (this ._castShadow .getValue ()) + renderObject .addShadowShape (this); + + break; + } + case Rendering_TraverseType .DISPLAY: + { + if (renderObject .addDisplayShape (this)) + this .getAppearance () .traverse (type, renderObject); // Currently used for GeneratedCubeMapTexture. + + break; + } + } + + this .getGeometry () .traverse (type, renderObject); // Currently used for ScreenText. + }, + picking (renderObject) + { + const modelMatrix = renderObject .getModelViewMatrix () .get (); + + if (this .getTransformSensors () .size) + { + for (const transformSensorNode of this .getTransformSensors ()) + transformSensorNode .collect (modelMatrix); + } + + const + browser = this .getBrowser (), + pickSensorStack = browser .getPickSensors (), + pickingHierarchy = browser .getPickingHierarchy (); + + pickingHierarchy .push (this); + + for (const pickSensor of pickSensorStack .at (-1)) + { + pickSensor .collect (this .getGeometry (), modelMatrix, pickingHierarchy); + } + + pickingHierarchy .pop (); + }, + displaySimple (gl, renderContext, shaderNode) + { + this .getGeometry () .displaySimple (gl, renderContext, shaderNode); + }, + display (gl, renderContext) + { + this .getGeometry () .display (gl, renderContext); + }, +}); + +Object .defineProperties (Shape, +{ + typeName: + { + value: "Shape", + enumerable: true, + }, + componentName: + { + value: "Shape", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "visible", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "castShadow", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "bboxDisplay", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxSize", new x_ite_Fields .SFVec3f (-1, -1, -1)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "bboxCenter", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "appearance", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "geometry", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +const Shape_default_ = Shape; +; + +x_ite_Namespace .add ("Shape", "x_ite/Components/Shape/Shape", Shape_default_); +/* harmony default export */ const Shape_Shape = (Shape_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shape/TwoSidedMaterial.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +function TwoSidedMaterial (executionContext) +{ + console .warn ("TwoSidedMaterial is depreciated, please use Appearance backMaterial field."); + + Shape_X3DMaterialNode .call (this, executionContext); + + this .addType (Base_X3DConstants .TwoSidedMaterial); + + this .diffuseColor = new Float32Array (3); + this .specularColor = new Float32Array (3); + this .emissiveColor = new Float32Array (3); + + this .backDiffuseColor = new Float32Array (3); + this .backSpecularColor = new Float32Array (3); + this .backEmissiveColor = new Float32Array (3); +} + +Object .assign (Object .setPrototypeOf (TwoSidedMaterial .prototype, Shape_X3DMaterialNode .prototype), +{ + initialize () + { + Shape_X3DMaterialNode . prototype .initialize .call (this); + + this ._ambientIntensity .addInterest ("set_ambientIntensity__", this); + this ._diffuseColor .addInterest ("set_diffuseColor__", this); + this ._specularColor .addInterest ("set_specularColor__", this); + this ._emissiveColor .addInterest ("set_emissiveColor__", this); + this ._shininess .addInterest ("set_shininess__", this); + this ._transparency .addInterest ("set_transparency__", this); + + this ._backAmbientIntensity .addInterest ("set_backAmbientIntensity__", this); + this ._backDiffuseColor .addInterest ("set_backDiffuseColor__", this); + this ._backSpecularColor .addInterest ("set_backSpecularColor__", this); + this ._backEmissiveColor .addInterest ("set_backEmissiveColor__", this); + this ._backShininess .addInterest ("set_backShininess__", this); + this ._backTransparency .addInterest ("set_backTransparency__", this); + + this ._separateBackColor .addInterest ("set_transparent__", this); + this ._transparency .addInterest ("set_transparent__", this); + this ._backTransparency .addInterest ("set_transparent__", this); + + this .set_ambientIntensity__ (); + this .set_diffuseColor__ (); + this .set_specularColor__ (); + this .set_emissiveColor__ (); + this .set_shininess__ (); + this .set_transparency__ (); + + this .set_backAmbientIntensity__ (); + this .set_backDiffuseColor__ (); + this .set_backSpecularColor__ (); + this .set_backEmissiveColor__ (); + this .set_backShininess__ (); + this .set_backTransparency__ (); + + this .set_transparent__ (); + }, + set_ambientIntensity__ () + { + this .ambientIntensity = Math .max (this ._ambientIntensity .getValue (), 0); + }, + set_diffuseColor__ () + { + //We cannot use this in Windows Edge: + //this .diffuseColor .set (this ._diffuseColor .getValue ()); + + const + diffuseColor = this .diffuseColor, + diffuseColor_ = this ._diffuseColor .getValue (); + + diffuseColor [0] = diffuseColor_ .r; + diffuseColor [1] = diffuseColor_ .g; + diffuseColor [2] = diffuseColor_ .b; + }, + set_specularColor__ () + { + //We cannot use this in Windows Edge: + //this .specularColor .set (this ._specularColor .getValue ()); + + const + specularColor = this .specularColor, + specularColor_ = this ._specularColor .getValue (); + + specularColor [0] = specularColor_ .r; + specularColor [1] = specularColor_ .g; + specularColor [2] = specularColor_ .b; + }, + set_emissiveColor__ () + { + //We cannot use this in Windows Edge: + //this .emissiveColor .set (this ._emissiveColor .getValue ()); + + const + emissiveColor = this .emissiveColor, + emissiveColor_ = this ._emissiveColor .getValue (); + + emissiveColor [0] = emissiveColor_ .r; + emissiveColor [1] = emissiveColor_ .g; + emissiveColor [2] = emissiveColor_ .b; + }, + set_shininess__ () + { + this .shininess = Math_Algorithm .clamp (this ._shininess .getValue (), 0, 1); + }, + set_transparency__ () + { + this .transparency = Math_Algorithm .clamp (this ._transparency .getValue (), 0, 1); + }, + /* + * Back Material + */ + set_backAmbientIntensity__ () + { + this .backAmbientIntensity = Math .max (this ._backAmbientIntensity .getValue (), 0); + }, + set_backDiffuseColor__ () + { + //We cannot use this in Windows Edge: + //this .backDiffuseColor .set (this ._backDiffuseColor .getValue ()); + + const + backDiffuseColor = this .backDiffuseColor, + backDiffuseColor_ = this ._backDiffuseColor .getValue (); + + backDiffuseColor [0] = backDiffuseColor_ .r; + backDiffuseColor [1] = backDiffuseColor_ .g; + backDiffuseColor [2] = backDiffuseColor_ .b; + }, + set_backSpecularColor__ () + { + //We cannot use this in Windows Edge: + //this .backSpecularColor .set (this ._backSpecularColor .getValue ()); + + const + backSpecularColor = this .backSpecularColor, + backSpecularColor_ = this ._backSpecularColor .getValue (); + + backSpecularColor [0] = backSpecularColor_ .r; + backSpecularColor [1] = backSpecularColor_ .g; + backSpecularColor [2] = backSpecularColor_ .b; + }, + set_backEmissiveColor__ () + { + //We cannot use this in Windows Edge: + //this .backEmissiveColor .set (this ._backEmissiveColor .getValue ()); + + const + backEmissiveColor = this .backEmissiveColor, + backEmissiveColor_ = this ._backEmissiveColor .getValue (); + + backEmissiveColor [0] = backEmissiveColor_ .r; + backEmissiveColor [1] = backEmissiveColor_ .g; + backEmissiveColor [2] = backEmissiveColor_ .b; + }, + set_backShininess__ () + { + this .backShininess = Math_Algorithm .clamp (this ._backShininess .getValue (), 0, 1); + }, + set_backTransparency__ () + { + this .backTransparency = Math_Algorithm .clamp (this ._backTransparency .getValue (), 0, 1); + }, + set_transparent__ () + { + this .setTransparent (!!(this ._transparency .getValue () || (this ._separateBackColor .getValue () && this ._backTransparency .getValue ()))); + }, + getBaseTexture: Shape_Material .prototype .getBaseTexture, + getMaterialKey: Shape_Material .prototype .getMaterialKey, + createShader: Shape_Material .prototype .createShader, + setShaderUniforms (gl, shaderObject, renderObject, textureTransformMapping, textureCoordinateMapping, front) + { + if (! front && this ._separateBackColor .getValue ()) + { + gl .uniform1f (shaderObject .x3d_AmbientIntensity, this .backAmbientIntensity); + gl .uniform3fv (shaderObject .x3d_DiffuseColor, this .backDiffuseColor); + gl .uniform3fv (shaderObject .x3d_SpecularColor, this .backSpecularColor); + gl .uniform3fv (shaderObject .x3d_EmissiveColor, this .backEmissiveColor); + gl .uniform1f (shaderObject .x3d_Shininess, this .backShininess); + gl .uniform1f (shaderObject .x3d_Transparency, this .backTransparency); + } + else + { + gl .uniform1f (shaderObject .x3d_AmbientIntensity, this .ambientIntensity); + gl .uniform3fv (shaderObject .x3d_DiffuseColor, this .diffuseColor); + gl .uniform3fv (shaderObject .x3d_SpecularColor, this .specularColor); + gl .uniform3fv (shaderObject .x3d_EmissiveColor, this .emissiveColor); + gl .uniform1f (shaderObject .x3d_Shininess, this .shininess); + gl .uniform1f (shaderObject .x3d_Transparency, this .transparency); + } + }, +}); + +Object .defineProperties (TwoSidedMaterial, +{ + typeName: + { + value: "TwoSidedMaterial", + enumerable: true, + }, + componentName: + { + value: "Shape", + enumerable: true, + }, + containerField: + { + value: "material", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.2", "4.0"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "separateBackColor", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "ambientIntensity", new x_ite_Fields .SFFloat (0.2)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "diffuseColor", new x_ite_Fields .SFColor (0.8, 0.8, 0.8)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "specularColor", new x_ite_Fields .SFColor ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "emissiveColor", new x_ite_Fields .SFColor ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "shininess", new x_ite_Fields .SFFloat (0.2)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "transparency", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "backAmbientIntensity", new x_ite_Fields .SFFloat (0.2)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "backDiffuseColor", new x_ite_Fields .SFColor (0.8, 0.8, 0.8)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "backSpecularColor", new x_ite_Fields .SFColor ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "backEmissiveColor", new x_ite_Fields .SFColor ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "backShininess", new x_ite_Fields .SFFloat (0.2)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "backTransparency", new x_ite_Fields .SFFloat ()), + ]), + enumerable: true, + }, +}); + +const TwoSidedMaterial_default_ = TwoSidedMaterial; +; + +x_ite_Namespace .add ("TwoSidedMaterial", "x_ite/Components/Shape/TwoSidedMaterial", TwoSidedMaterial_default_); +/* harmony default export */ const Shape_TwoSidedMaterial = (TwoSidedMaterial_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shape/UnlitMaterial.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function UnlitMaterial (executionContext) +{ + Shape_X3DOneSidedMaterialNode .call (this, executionContext); + + this .addType (Base_X3DConstants .UnlitMaterial); +} + +Object .assign (Object .setPrototypeOf (UnlitMaterial .prototype, Shape_X3DOneSidedMaterialNode .prototype), +{ + initialize () + { + Shape_X3DOneSidedMaterialNode .prototype .initialize .call (this); + + this .set_transparent__ (); + }, + set_emissiveTexture__ () + { + if (this .getEmissiveTexture ()) + this .getEmissiveTexture () ._transparent .removeInterest ("set_transparent__", this); + + Shape_X3DOneSidedMaterialNode .prototype .set_emissiveTexture__ .call (this); + + if (this .getEmissiveTexture ()) + this .getEmissiveTexture () ._transparent .addInterest ("set_transparent__", this); + }, + set_transparent__ () + { + this .setTransparent (!!(this .getTransparency () || + this .getEmissiveTexture () ?.isTransparent ())); + }, + getMaterialKey () + { + return "0"; + }, + createShader (key, geometryContext, renderContext) + { + const + browser = this .getBrowser (), + options = this .getShaderOptions (geometryContext, renderContext); + + options .push ("X3D_UNLIT_MATERIAL"); + + const shaderNode = browser .createShader ("UnlitShader", "Default", "Unlit", options); + + browser .getShaders () .set (key, shaderNode); + + return shaderNode; + }, +}); + +Object .defineProperties (UnlitMaterial, +{ + typeName: + { + value: "UnlitMaterial", + enumerable: true, + }, + componentName: + { + value: "Shape", + enumerable: true, + }, + containerField: + { + value: "material", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "emissiveColor", new x_ite_Fields .SFColor (1, 1, 1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "emissiveTextureMapping", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "emissiveTexture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normalScale", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normalTextureMapping", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normalTexture", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "transparency", new x_ite_Fields .SFFloat ()), + ]), + enumerable: true, + }, +}); + +const UnlitMaterial_default_ = UnlitMaterial; +; + +x_ite_Namespace .add ("UnlitMaterial", "x_ite/Components/Shape/UnlitMaterial", UnlitMaterial_default_); +/* harmony default export */ const Shape_UnlitMaterial = (UnlitMaterial_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Shape.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + + +const Components_Shape_default_ = { + name: "Shape", + concreteNodes: + [ + Shape_AcousticProperties, + Shape_Appearance, + Shape_FillProperties, + Shape_LineProperties, + Shape_Material, + Shape_PhysicalMaterial, + Shape_PointProperties, + Shape_Shape, + Shape_TwoSidedMaterial, + Shape_UnlitMaterial, + ], + abstractNodes: + [ + Shape_X3DAppearanceChildNode, + Shape_X3DAppearanceNode, + Shape_X3DMaterialNode, + Shape_X3DOneSidedMaterialNode, + Shape_X3DShapeNode, + ], +}; +; + +x_ite_Namespace .add ("Shape", "x_ite/Components/Shape", Components_Shape_default_); +/* harmony default export */ const Components_Shape = (Components_Shape_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/X3DSoundProcessingNode.js +/* provided dependency */ var X3DSoundProcessingNode_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function X3DSoundProcessingNode (executionContext) +{ + Core_X3DChildNode .call (this, executionContext); + Time_X3DTimeDependentNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DSoundProcessingNode); + + this .addChildObjects (Base_X3DConstants .inputOutput, "loop", new x_ite_Fields .SFBool (true), + Base_X3DConstants .inputOutput, "active", new x_ite_Fields .SFBool ()); + + const audioContext = this .getBrowser () .getAudioContext (); + + this .childNodes = [ ]; + this .gainNode = new GainNode (audioContext); +} + +Object .assign (Object .setPrototypeOf (X3DSoundProcessingNode .prototype, Core_X3DChildNode .prototype), + Time_X3DTimeDependentNode .prototype, +{ + initialize () + { + Core_X3DChildNode .prototype .initialize .call (this); + Time_X3DTimeDependentNode .prototype .initialize .call (this); + + this ._active .addInterest ("set_gain__", this); + this ._gain .addInterest ("set_gain__", this); + this ._channelCount .addInterest ("set_channelCount__", this); + this ._channelCountMode .addInterest ("set_channelCountMode__", this); + this ._channelInterpretation .addInterest ("set_channelInterpretation__", this); + this ._children .addInterest ("set_children__", this); + this ._active .addInterest ("set_active__", this); + + this .set_gain__ (); + this .set_channelCount__ (); + this .set_channelCountMode__ (); + this .set_channelInterpretation__ (); + this .set_children__ (); + }, + getAudioSource () + { + return this .gainNode; + }, + getSoundProcessor () + { + return this .gainNode; + }, + set_gain__ () + { + this .gainNode .gain .value = this ._active .getValue () ? this ._gain .getValue () : 1; + }, + set_channelCount__ () + { + this .getSoundProcessor () .channelCount = Math .max (this ._channelCount .getValue (), 1); + }, + set_channelCountMode__: (function () + { + const channelCountModes = new Set (["max", "clamped-max", "explicit"]); + + return function () + { + const channelCountMode = this ._channelCountMode .getValue () .toLowerCase () .replaceAll ("_", "-"); + + this .getSoundProcessor () .channelCountMode = channelCountModes .has (channelCountMode) ? channelCountMode : "max"; + }; + })(), + set_channelInterpretation__: (function () + { + const channelInterpretations = new Set (["speakers", "discrete"]); + + return function () + { + const channelInterpretation = this ._channelInterpretation .getValue () .toLowerCase (); + + this .getSoundProcessor () .channelInterpretation = channelInterpretations .has (channelInterpretation) ? channelInterpretation : "speakers"; + }; + })(), + set_children__ () + { + this .set_disconnect__ (); + + this .childNodes .length = 0; + + for (const child of this ._children) + { + const childNode = Base_X3DCast (Base_X3DConstants .X3DChildNode, child); + + if (!childNode) + continue; + + const type = childNode .getType (); + + for (let t = type .length - 1; t >= 0; -- t) + { + switch (type [t]) + { + case Base_X3DConstants .X3DSoundChannelNode: + case Base_X3DConstants .X3DSoundProcessingNode: + case Base_X3DConstants .X3DSoundSourceNode: + this .childNodes .push (childNode); + break; + default: + continue; + } + + break; + } + } + + this .set_active__ (); + }, + set_disconnect__ () + { + for (const childNode of this .childNodes) + X3DSoundProcessingNode_$.try (() => childNode .getAudioSource () .disconnect (this .gainNode)); + + for (const childNode of this .childNodes) + X3DSoundProcessingNode_$.try (() => childNode .getAudioSource () .disconnect (this .getSoundProcessor ())); + }, + set_active__ () + { + this .set_disconnect__ (); + + if (this ._active .getValue ()) + { + for (const childNode of this .childNodes) + X3DSoundProcessingNode_$.try (() => childNode .getAudioSource () .connect (this .getSoundProcessor ()), true); + } + else + { + for (const childNode of this .childNodes) + X3DSoundProcessingNode_$.try (() => childNode .getAudioSource () .connect (this .gainNode), true); + } + }, + set_start () + { + if (!this ._active .getValue ()) + this ._active = true; + }, + set_pause () + { + if (this ._active .getValue ()) + this ._active = false; + }, + set_resume () + { + if (!this ._active .getValue ()) + this ._active = true; + }, + set_stop () + { + if (this ._active .getValue ()) + this ._active = false; + }, + set_time () + { + this ._elapsedTime = this .getElapsedTime (); + }, + dispose () + { + Time_X3DTimeDependentNode .prototype .dispose .call (this); + Core_X3DChildNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (X3DSoundProcessingNode, +{ + typeName: + { + value: "X3DSoundProcessingNode", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, +}); + +const X3DSoundProcessingNode_default_ = X3DSoundProcessingNode; +; + +x_ite_Namespace .add ("X3DSoundProcessingNode", "x_ite/Components/Sound/X3DSoundProcessingNode", X3DSoundProcessingNode_default_); +/* harmony default export */ const Sound_X3DSoundProcessingNode = (X3DSoundProcessingNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/Analyser.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function Analyser (executionContext) +{ + Sound_X3DSoundProcessingNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Analyser); + + const audioContext = this .getBrowser () .getAudioContext (); + + this .analyzerNode = new AnalyserNode (audioContext); + this .byteFrequencyData = new Uint8Array (this .analyzerNode .frequencyBinCount); + this .byteTimeDomainData = new Uint8Array (this .analyzerNode .frequencyBinCount); + + this .analyzerNode .connect (this .getAudioSource ()); +} + +Object .assign (Object .setPrototypeOf (Analyser .prototype, Sound_X3DSoundProcessingNode .prototype), +{ + initialize () + { + Sound_X3DSoundProcessingNode .prototype .initialize .call (this); + + this ._fftSize .addInterest ("set_fftSize__", this); + this ._minDecibels .addInterest ("set_decibels__", this); + this ._maxDecibels .addInterest ("set_decibels__", this); + this ._smoothingTimeConstant .addInterest ("set_smoothingTimeConstant__", this); + + this .set_fftSize__ (); + this .set_decibels__ (); + this .set_smoothingTimeConstant__ (); + }, + getSoundProcessor () + { + return this .analyzerNode; + }, + set_fftSize__ () + { + this .analyzerNode .fftSize = Math_Algorithm .clamp (Math_Algorithm .nextPowerOfTwo (this ._fftSize .getValue ()), 32, 32768); + + this ._frequencyBinCount = this .analyzerNode .frequencyBinCount; + }, + set_decibels__ () + { + const + minDecibels = Math .min (this ._minDecibels .getValue (), 0), + maxDecibels = Math .min (this ._maxDecibels .getValue (), 0); + + this .analyzerNode .minDecibels = Math .min (minDecibels, maxDecibels); + this .analyzerNode .maxDecibels = Math .max (minDecibels, maxDecibels); + }, + set_smoothingTimeConstant__ () + { + this .analyzerNode .smoothingTimeConstant = Math_Algorithm .clamp (this ._smoothingTimeConstant .getValue (), 0, 1); + }, + set_time () + { + Sound_X3DSoundProcessingNode .prototype .set_time .call (this); + + const + analyzerNode = this .analyzerNode, + frequencyBinCount = analyzerNode .frequencyBinCount; + + if (this .byteFrequencyData .length !== frequencyBinCount) + { + this .byteFrequencyData = new Uint8Array (frequencyBinCount); + this .byteTimeDomainData = new Uint8Array (frequencyBinCount); + } + + this ._byteFrequencyData .length = frequencyBinCount; + this ._byteTimeDomainData .length = frequencyBinCount; + this ._floatFrequencyData .length = frequencyBinCount; + this ._floatTimeDomainData .length = frequencyBinCount; + + analyzerNode .getByteFrequencyData (this .byteFrequencyData); + analyzerNode .getByteTimeDomainData (this .byteTimeDomainData); + + this ._byteFrequencyData .getValue () .set (this .byteFrequencyData); + this ._byteTimeDomainData .getValue () .set (this .byteTimeDomainData); + + analyzerNode .getFloatFrequencyData (this ._floatFrequencyData .shrinkToFit ()); + analyzerNode .getFloatTimeDomainData (this ._floatTimeDomainData .shrinkToFit ()); + + this ._byteFrequencyData .addEvent (); + this ._byteTimeDomainData .addEvent (); + this ._floatFrequencyData .addEvent (); + this ._floatTimeDomainData .addEvent (); + }, +}); + +Object .defineProperties (Analyser, +{ + typeName: + { + value: "Analyser", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "gain", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "fftSize", new x_ite_Fields .SFInt32 (2048)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "minDecibels", new x_ite_Fields .SFFloat (-100)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "maxDecibels", new x_ite_Fields .SFFloat (-30)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "smoothingTimeConstant", new x_ite_Fields .SFFloat (0.8)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tailTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "frequencyBinCount", new x_ite_Fields .SFInt32 ()), // skip test + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "byteFrequencyData", new x_ite_Fields .MFInt32 ()), // experimental + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "byteTimeDomainData", new x_ite_Fields .MFInt32 ()), // experimental + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "floatFrequencyData", new x_ite_Fields .MFFloat ()), // experimental + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "floatTimeDomainData", new x_ite_Fields .MFFloat ()), // experimental + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCount", new x_ite_Fields .SFInt32 ()), // skip test + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCountMode", new x_ite_Fields .SFString ("MAX")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelInterpretation", new x_ite_Fields .SFString ("SPEAKERS")), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "startTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "resumeTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pauseTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "stopTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isPaused", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "elapsedTime", new x_ite_Fields .SFTime ()), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const Analyser_default_ = Analyser; +; + +x_ite_Namespace .add ("Analyser", "x_ite/Components/Sound/Analyser", Analyser_default_); +/* harmony default export */ const Sound_Analyser = (Analyser_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/X3DSoundSourceNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function X3DSoundSourceNode (executionContext) +{ + Core_X3DChildNode .call (this, executionContext); + Time_X3DTimeDependentNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DSoundSourceNode); + + const audioContext = this .getBrowser () .getAudioContext (); + + this .gainNode = new GainNode (audioContext); + this .mediaElement = null; +} + +Object .assign (Object .setPrototypeOf (X3DSoundSourceNode .prototype, Core_X3DChildNode .prototype), + Time_X3DTimeDependentNode .prototype, +{ + initialize () + { + Core_X3DChildNode .prototype .initialize .call (this); + Time_X3DTimeDependentNode .prototype .initialize .call (this); + + this ._gain .addInterest ("set_gain__", this); + + this .set_gain__ (); + }, + getAudioSource () + { + return this .gainNode; + }, + setMediaElement (value) + { + this .mediaElement ?.pause (); + + this .mediaElement = value; + + if (value) + { + // Init mediaElement. + + this .set_loop (); + + // Handle events. + + this ._duration_changed = this .mediaElement .duration; + + this .resetElapsedTime (); + + if (this ._isActive .getValue ()) + { + if (this ._isPaused .getValue ()) + { + this .set_pause (); + } + else + { + if (this .getLiveState ()) + this .set_start (); + else + this .set_pause (); + } + } + else + { + this .set_stop (); + } + } + }, + set_gain__ () + { + this .gainNode .gain .value = this ._gain .getValue (); + }, + set_pitch () + { }, + set_loop () + { + if (this .mediaElement) + this .mediaElement .loop = this ._loop .getValue (); + }, + set_start () + { + if (this .mediaElement) + { + this .mediaElement .currentTime = 0; + this .mediaElement .play () .catch (() => this .getBrowser () .startAudioElement (this .mediaElement)); + } + }, + set_pause () + { + this .mediaElement ?.pause (); + }, + set_resume () + { + this .mediaElement ?.play () .catch (Function .prototype); + }, + set_stop () + { + this .mediaElement ?.pause (); + }, + set_end () + { + if (this ._loop .getValue ()) + return; + + this .stop (); + }, + set_time () + { + this ._elapsedTime = this .getElapsedTime (); + + if (!this .mediaElement) + return; + + if (this .mediaElement .currentTime < this .mediaElement .duration) + return; + + this .set_end (); + }, + dispose () + { + Time_X3DTimeDependentNode .prototype .dispose .call (this); + Core_X3DChildNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (X3DSoundSourceNode, +{ + typeName: + { + value: "X3DSoundSourceNode", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, +}); + +const X3DSoundSourceNode_default_ = X3DSoundSourceNode; +; + +x_ite_Namespace .add ("X3DSoundSourceNode", "x_ite/Components/Sound/X3DSoundSourceNode", X3DSoundSourceNode_default_); +/* harmony default export */ const Sound_X3DSoundSourceNode = (X3DSoundSourceNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/AudioClip.js +/* provided dependency */ var AudioClip_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +function AudioClip (executionContext) +{ + Sound_X3DSoundSourceNode .call (this, executionContext); + Networking_X3DUrlObject .call (this, executionContext); + + this .addType (Base_X3DConstants .AudioClip); + + const audioContext = this .getBrowser () .getAudioContext (); + + this .urlStack = new x_ite_Fields .MFString (); + this .audio = AudioClip_$(""); + this .sourceNode = audioContext .createMediaElementSource (this .audio [0]); + + this .sourceNode .connect (this .getAudioSource ()); +} + +Object .assign (Object .setPrototypeOf (AudioClip .prototype, Sound_X3DSoundSourceNode .prototype), + Networking_X3DUrlObject .prototype, +{ + initialize () + { + Sound_X3DSoundSourceNode .prototype .initialize .call (this); + Networking_X3DUrlObject .prototype .initialize .call (this); + + this .audio + .on ("abort error", this .setError .bind (this)) + .on ("suspend stalled", this .setTimeout .bind (this)) + .prop ("crossOrigin", "Anonymous") + .prop ("preload", "auto"); + + this .requestImmediateLoad () .catch (Function .prototype); + }, + set_live__ () + { + Sound_X3DSoundSourceNode .prototype .set_live__ .call (this); + Networking_X3DUrlObject .prototype .set_live__ .call (this); + }, + unloadData () + { + this .setMediaElement (null); + }, + loadData () + { + this .setMediaElement (null); + this .urlStack .setValue (this ._url); + this .audio .on ("canplaythrough", this .setAudio .bind (this)); + this .loadNext (); + }, + loadNext () + { + if (this .urlStack .length === 0) + { + this .audio .off ("canplaythrough"); + this ._duration_changed = -1; + this .setLoadState (Base_X3DConstants .FAILED_STATE); + return; + } + + // Get URL. + + this .URL = new URL (this .urlStack .shift (), this .getExecutionContext () .getBaseURL ()); + + if (this .URL .protocol !== "data:") + { + if (!this .getCache ()) + this .URL .searchParams .set ("_", Date .now ()); + } + + this .audio .attr ("src", this .URL .href); + this .audio .get (0) .load (); + }, + setTimeout (event) + { + setTimeout (() => + { + if (this .checkLoadState () === Base_X3DConstants .IN_PROGRESS_STATE) + this .setError (event); + }, + 3000); + }, + setError (event) + { + if (this .URL .protocol !== "data:") + console .warn (`Error loading audio '${decodeURI (this .URL .href)}'`, event .type); + + this .loadNext (); + }, + setAudio () + { + try + { + if (DEVELOPMENT) + { + if (this .URL .protocol !== "data:") + console .info (`Done loading audio '${decodeURI (this .URL .href)}'`); + } + + this .audio .unbind ("canplaythrough"); + this .setMediaElement (this .audio [0]); + this .setLoadState (Base_X3DConstants .COMPLETE_STATE); + } + catch (error) + { + this .setError ({ type: error .message }); + } + }, + dispose () + { + Networking_X3DUrlObject .prototype .dispose .call (this); + Sound_X3DSoundSourceNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (AudioClip, +{ + typeName: + { + value: "AudioClip", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "source", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "load", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "url", new x_ite_Fields .MFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoRefresh", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoRefreshTimeLimit", new x_ite_Fields .SFTime (3600)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "gain", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pitch", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "loop", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "startTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "resumeTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pauseTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "stopTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isPaused", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "elapsedTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "duration_changed", new x_ite_Fields .SFTime (-1)), + ]), + enumerable: true, + }, +}); + +const AudioClip_default_ = AudioClip; +; + +x_ite_Namespace .add ("AudioClip", "x_ite/Components/Sound/AudioClip", AudioClip_default_); +/* harmony default export */ const Sound_AudioClip = (AudioClip_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/X3DSoundNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function X3DSoundNode (executionContext) +{ + Core_X3DChildNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DSoundNode); +} + +Object .setPrototypeOf (X3DSoundNode .prototype, Core_X3DChildNode .prototype); + +Object .defineProperties (X3DSoundNode, +{ + typeName: + { + value: "X3DSoundNode", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, +}); + +const X3DSoundNode_default_ = X3DSoundNode; +; + +x_ite_Namespace .add ("X3DSoundNode", "x_ite/Components/Sound/X3DSoundNode", X3DSoundNode_default_); +/* harmony default export */ const Sound_X3DSoundNode = (X3DSoundNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/X3DSoundDestinationNode.js +/* provided dependency */ var X3DSoundDestinationNode_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function X3DSoundDestinationNode (executionContext) +{ + Sound_X3DSoundNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DSoundDestinationNode); + + const audioContext = this .getBrowser () .getAudioContext (); + + this .childNodes = [ ]; + this .gainNode = new GainNode (audioContext); +} + +Object .assign (Object .setPrototypeOf (X3DSoundDestinationNode .prototype, Sound_X3DSoundNode .prototype), +{ + initialize () + { + Sound_X3DSoundNode .prototype .initialize .call (this); + + this .getLive () .addInterest ("set_enabled__", this); + + this ._enabled .addInterest ("set_enabled__", this); + this ._gain .addInterest ("set_gain__", this); + this ._children .addInterest ("set_children__", this); + + this .set_enabled__ (); + this .set_gain__ (); + this .set_children__ (); + }, + getAudioSource () + { + return this .gainNode; + }, + set_enabled__ () + { + if (this ._enabled .getValue () && this .getLive () .getValue ()) + { + this ._channelCount .addInterest ("set_channelCount__", this); + this ._channelCountMode .addInterest ("set_channelCountMode__", this); + this ._channelInterpretation .addInterest ("set_channelInterpretation__", this); + + this .gainNode .connect (this .getSoundDestination ()); + + this .set_channelCount__ (); + this .set_channelCountMode__ (); + this .set_channelInterpretation__ (); + } + else + { + this ._channelCount .removeInterest ("set_channelCount__", this); + this ._channelCountMode .removeInterest ("set_channelCountMode__", this); + this ._channelInterpretation .removeInterest ("set_channelInterpretation__", this); + + this .gainNode .disconnect (); + } + + this ._isActive = this ._enabled; + }, + set_gain__ () + { + this .gainNode .gain .value = this ._gain .getValue (); + }, + set_channelCount__ () + { + this .getSoundDestination () .channelCount = Math .max (this ._channelCount .getValue (), 1); + }, + set_channelCountMode__: (function () + { + const channelCountModes = new Set (["max", "clamped-max", "explicit"]); + + return function () + { + const channelCountMode = this ._channelCountMode .getValue () .toLowerCase () .replaceAll ("_", "-"); + + this .getSoundDestination () .channelCountMode = channelCountModes .has (channelCountMode) ? channelCountMode : "max"; + }; + })(), + set_channelInterpretation__: (function () + { + const channelInterpretations = new Set (["speakers", "discrete"]); + + return function () + { + const channelInterpretation = this ._channelInterpretation .getValue () .toLowerCase (); + + this .getSoundDestination () .channelInterpretation = channelInterpretations .has (channelInterpretation) ? channelInterpretation : "speakers"; + }; + })(), + set_children__ () + { + for (const childNode of this .childNodes) + X3DSoundDestinationNode_$.try (() => childNode .getAudioSource () .disconnect (this .gainNode)); + + this .childNodes .length = 0; + + for (const child of this ._children) + { + const childNode = Base_X3DCast (Base_X3DConstants .X3DChildNode, child); + + if (!childNode) + continue; + + const type = childNode .getType (); + + for (let t = type .length - 1; t >= 0; -- t) + { + switch (type [t]) + { + case Base_X3DConstants .X3DSoundChannelNode: + case Base_X3DConstants .X3DSoundProcessingNode: + case Base_X3DConstants .X3DSoundSourceNode: + this .childNodes .push (childNode); + break; + default: + continue; + } + + break; + } + } + + for (const childNode of this .childNodes) + X3DSoundDestinationNode_$.try (() => childNode .getAudioSource () .connect (this .gainNode), true); + }, +}); + +Object .defineProperties (X3DSoundDestinationNode, +{ + typeName: + { + value: "X3DSoundDestinationNode", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, +}); + +const X3DSoundDestinationNode_default_ = X3DSoundDestinationNode; +; + +x_ite_Namespace .add ("X3DSoundDestinationNode", "x_ite/Components/Sound/X3DSoundDestinationNode", X3DSoundDestinationNode_default_); +/* harmony default export */ const Sound_X3DSoundDestinationNode = (X3DSoundDestinationNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/AudioDestination.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function AudioDestination (executionContext) +{ + Sound_X3DSoundDestinationNode .call (this, executionContext); + + this .addType (Base_X3DConstants .AudioDestination); + + this .audioElement = new Audio (); +} + +Object .assign (Object .setPrototypeOf (AudioDestination .prototype, Sound_X3DSoundDestinationNode .prototype), +{ + initialize () + { + Sound_X3DSoundDestinationNode .prototype .initialize .call (this); + + const audioContext = this .getBrowser () .getAudioContext (); + + this ._mediaDeviceID .addInterest ("set_mediaDeviceID__", this); + + this ._maxChannelCount = audioContext .destination .maxChannelCount; + + this .set_mediaDeviceID__ (); + }, + getSoundDestination () + { + return this .mediaStreamDestination; + }, + set_enabled__ () + { + const active = this ._enabled .getValue () && this .getLive () .getValue (); + + if (!!this .mediaStreamDestination === active) + return; + + if (active) + { + const audioContext = this .getBrowser () .getAudioContext (); + + this .mediaStreamDestination = audioContext .createMediaStreamDestination (); + this .audioElement .srcObject = this .mediaStreamDestination .stream; + + this .audioElement .play () .catch (() => this .getBrowser () .startAudioElement (this .audioElement)); + } + else + { + this .audioElement .pause (); + + for (const track of this .mediaStreamDestination .stream .getAudioTracks ()) + track .stop (); + + for (const track of this .mediaStreamDestination .stream .getVideoTracks ()) + track .stop (); + + this .mediaStreamDestination = null; + } + + Sound_X3DSoundDestinationNode .prototype .set_enabled__ .call (this); + }, + set_mediaDeviceID__ () + { + // Safari has no support yet, as of Aug 2023. + if (!this .audioElement .setSinkId) + return; + + this .audioElement .setSinkId (this ._mediaDeviceID .getValue ()) .catch (error => + { + console .error (error .message); + + this .audioElement .setSinkId ("default") .catch (Function .prototype); + }); + }, +}); + +Object .defineProperties (AudioDestination, +{ + typeName: + { + value: "AudioDestination", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "gain", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "mediaDeviceID", new x_ite_Fields .SFString ()), // skip test + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCount", new x_ite_Fields .SFInt32 ()), // skip test + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCountMode", new x_ite_Fields .SFString ("MAX")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelInterpretation", new x_ite_Fields .SFString ("SPEAKERS")), + + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "maxChannelCount", new x_ite_Fields .SFInt32 ()), // skip test + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const AudioDestination_default_ = AudioDestination; +; + +x_ite_Namespace .add ("AudioDestination", "x_ite/Components/Sound/AudioDestination", AudioDestination_default_); +/* harmony default export */ const Sound_AudioDestination = (AudioDestination_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/BiquadFilter.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function BiquadFilter (executionContext) +{ + Sound_X3DSoundProcessingNode .call (this, executionContext); + + this .addType (Base_X3DConstants .BiquadFilter); +} + +Object .setPrototypeOf (BiquadFilter .prototype, Sound_X3DSoundProcessingNode .prototype); + +Object .defineProperties (BiquadFilter, +{ + typeName: + { + value: "BiquadFilter", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "gain", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "frequency", new x_ite_Fields .SFFloat (350)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "detune", new x_ite_Fields .SFFloat (0)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "type", new x_ite_Fields .SFString ("LOWPASS")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "qualityFactor", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tailTime", new x_ite_Fields .SFTime ()), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCount", new x_ite_Fields .SFInt32 ()), // skip test + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCountMode", new x_ite_Fields .SFString ("MAX")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelInterpretation", new x_ite_Fields .SFString ("SPEAKERS")), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "startTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "resumeTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pauseTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "stopTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isPaused", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "elapsedTime", new x_ite_Fields .SFTime ()), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const BiquadFilter_default_ = BiquadFilter; +; + +x_ite_Namespace .add ("BiquadFilter", "x_ite/Components/Sound/BiquadFilter", BiquadFilter_default_); +/* harmony default export */ const Sound_BiquadFilter = (BiquadFilter_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/BufferAudioSource.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function BufferAudioSource (executionContext) +{ + Sound_X3DSoundSourceNode .call (this, executionContext); + Networking_X3DUrlObject .call (this, executionContext); + + this .addType (Base_X3DConstants .BufferAudioSource); +} + +Object .assign (Object .setPrototypeOf (BufferAudioSource .prototype, Sound_X3DSoundSourceNode .prototype), + Networking_X3DUrlObject .prototype, +{ + initialize () + { + Sound_X3DSoundSourceNode .prototype .initialize .call (this); + Networking_X3DUrlObject .prototype .initialize .call (this); + }, + dispose () + { + Networking_X3DUrlObject .prototype .dispose .call (this); + Sound_X3DSoundSourceNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (BufferAudioSource, +{ + typeName: + { + value: "BufferAudioSource", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "load", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "url", new x_ite_Fields .MFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoRefresh", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoRefreshTimeLimit", new x_ite_Fields .SFTime (3600)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "gain", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "detune", new x_ite_Fields .SFFloat (0)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "buffer", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "bufferDuration", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "bufferLength", new x_ite_Fields .SFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "numberOfChannels", new x_ite_Fields .SFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "sampleRate", new x_ite_Fields .SFFloat (0)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "playbackRate", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "loopStart", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "loopEnd", new x_ite_Fields .SFTime ()), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCount", new x_ite_Fields .SFInt32 ()), // skip test + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCountMode", new x_ite_Fields .SFString ("MAX")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelInterpretation", new x_ite_Fields .SFString ("SPEAKERS")), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "loop", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "startTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "resumeTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pauseTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "stopTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isPaused", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "elapsedTime", new x_ite_Fields .SFTime ()), + ]), + enumerable: true, + }, +}); + +const BufferAudioSource_default_ = BufferAudioSource; +; + +x_ite_Namespace .add ("BufferAudioSource", "x_ite/Components/Sound/BufferAudioSource", BufferAudioSource_default_); +/* harmony default export */ const Sound_BufferAudioSource = (BufferAudioSource_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/X3DSoundChannelNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function X3DSoundChannelNode (executionContext) +{ + Sound_X3DSoundNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DSoundChannelNode); +} + +Object .setPrototypeOf (X3DSoundChannelNode .prototype, Sound_X3DSoundNode .prototype); + +Object .defineProperties (X3DSoundChannelNode, +{ + typeName: + { + value: "X3DSoundChannelNode", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, +}); + +const X3DSoundChannelNode_default_ = X3DSoundChannelNode; +; + +x_ite_Namespace .add ("X3DSoundChannelNode", "x_ite/Components/Sound/X3DSoundChannelNode", X3DSoundChannelNode_default_); +/* harmony default export */ const Sound_X3DSoundChannelNode = (X3DSoundChannelNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/ChannelMerger.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function ChannelMerger (executionContext) +{ + Sound_X3DSoundChannelNode .call (this, executionContext); + + this .addType (Base_X3DConstants .ChannelMerger); +} + +Object .setPrototypeOf (ChannelMerger .prototype, Sound_X3DSoundChannelNode .prototype); + +Object .defineProperties (ChannelMerger, +{ + typeName: + { + value: "ChannelMerger", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "gain", new x_ite_Fields .SFFloat (1)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCount", new x_ite_Fields .SFInt32 ()), // skip test + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCountMode", new x_ite_Fields .SFString ("MAX")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelInterpretation", new x_ite_Fields .SFString ("SPEAKERS")), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const ChannelMerger_default_ = ChannelMerger; +; + +x_ite_Namespace .add ("ChannelMerger", "x_ite/Components/Sound/ChannelMerger", ChannelMerger_default_); +/* harmony default export */ const Sound_ChannelMerger = (ChannelMerger_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/ChannelSelector.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function ChannelSelector (executionContext) +{ + Sound_X3DSoundChannelNode .call (this, executionContext); + + this .addType (Base_X3DConstants .ChannelSelector); +} + +Object .setPrototypeOf (ChannelSelector .prototype, Sound_X3DSoundChannelNode .prototype); + +Object .defineProperties (ChannelSelector, +{ + typeName: + { + value: "ChannelSelector", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "gain", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelSelection", new x_ite_Fields .SFInt32 (0)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCount", new x_ite_Fields .SFInt32 ()), // skip test + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCountMode", new x_ite_Fields .SFString ("MAX")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelInterpretation", new x_ite_Fields .SFString ("SPEAKERS")), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const ChannelSelector_default_ = ChannelSelector; +; + +x_ite_Namespace .add ("ChannelSelector", "x_ite/Components/Sound/ChannelSelector", ChannelSelector_default_); +/* harmony default export */ const Sound_ChannelSelector = (ChannelSelector_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/ChannelSplitter.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function ChannelSplitter (executionContext) +{ + Sound_X3DSoundChannelNode .call (this, executionContext); + + this .addType (Base_X3DConstants .ChannelSplitter); +} + +Object .setPrototypeOf (ChannelSplitter .prototype, Sound_X3DSoundChannelNode .prototype); + +Object .defineProperties (ChannelSplitter, +{ + typeName: + { + value: "ChannelSplitter", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "gain", new x_ite_Fields .SFFloat (1)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCount", new x_ite_Fields .SFInt32 ()), // skip test + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCountMode", new x_ite_Fields .SFString ("MAX")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelInterpretation", new x_ite_Fields .SFString ("SPEAKERS")), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "outputs", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const ChannelSplitter_default_ = ChannelSplitter; +; + +x_ite_Namespace .add ("ChannelSplitter", "x_ite/Components/Sound/ChannelSplitter", ChannelSplitter_default_); +/* harmony default export */ const Sound_ChannelSplitter = (ChannelSplitter_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/Convolver.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function Convolver (executionContext) +{ + Sound_X3DSoundProcessingNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Convolver); +} + +Object .setPrototypeOf (Convolver .prototype, Sound_X3DSoundProcessingNode .prototype); + +Object .defineProperties (Convolver, +{ + typeName: + { + value: "Convolver", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "gain", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "buffer", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "normalize", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tailTime", new x_ite_Fields .SFTime ()), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCount", new x_ite_Fields .SFInt32 ()), // skip test + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCountMode", new x_ite_Fields .SFString ("MAX")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelInterpretation", new x_ite_Fields .SFString ("SPEAKERS")), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "startTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "resumeTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pauseTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "stopTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isPaused", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "elapsedTime", new x_ite_Fields .SFTime ()), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const Convolver_default_ = Convolver; +; + +x_ite_Namespace .add ("Convolver", "x_ite/Components/Sound/Convolver", Convolver_default_); +/* harmony default export */ const Sound_Convolver = (Convolver_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/Delay.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function Delay (executionContext) +{ + Sound_X3DSoundProcessingNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Delay); +} + +Object .setPrototypeOf (Delay .prototype, Sound_X3DSoundProcessingNode .prototype); + +Object .defineProperties (Delay, +{ + typeName: + { + value: "Delay", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "gain", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "delayTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "maxDelayTime", new x_ite_Fields .SFTime (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tailTime", new x_ite_Fields .SFTime ()), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCount", new x_ite_Fields .SFInt32 ()), // skip test + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCountMode", new x_ite_Fields .SFString ("MAX")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelInterpretation", new x_ite_Fields .SFString ("SPEAKERS")), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "startTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "resumeTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pauseTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "stopTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isPaused", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "elapsedTime", new x_ite_Fields .SFTime ()), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const Delay_default_ = Delay; +; + +x_ite_Namespace .add ("Delay", "x_ite/Components/Sound/Delay", Delay_default_); +/* harmony default export */ const Sound_Delay = (Delay_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/DynamicsCompressor.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function DynamicsCompressor (executionContext) +{ + Sound_X3DSoundProcessingNode .call (this, executionContext); + + this .addType (Base_X3DConstants .DynamicsCompressor); +} + +Object .setPrototypeOf (DynamicsCompressor .prototype, Sound_X3DSoundProcessingNode .prototype); + +Object .defineProperties (DynamicsCompressor, +{ + typeName: + { + value: "DynamicsCompressor", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "gain", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "attack", new x_ite_Fields .SFFloat (0.003)), // TODO: SFTime + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "knee", new x_ite_Fields .SFFloat (30)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "ratio", new x_ite_Fields .SFFloat (12)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "reduction", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "release", new x_ite_Fields .SFTime (0.25)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "threshold", new x_ite_Fields .SFFloat (-24)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tailTime", new x_ite_Fields .SFTime ()), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCount", new x_ite_Fields .SFInt32 ()), // skip test + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCountMode", new x_ite_Fields .SFString ("MAX")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelInterpretation", new x_ite_Fields .SFString ("SPEAKERS")), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "startTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "resumeTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pauseTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "stopTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isPaused", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "elapsedTime", new x_ite_Fields .SFTime ()), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const DynamicsCompressor_default_ = DynamicsCompressor; +; + +x_ite_Namespace .add ("DynamicsCompressor", "x_ite/Components/Sound/DynamicsCompressor", DynamicsCompressor_default_); +/* harmony default export */ const Sound_DynamicsCompressor = (DynamicsCompressor_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/Gain.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function Gain (executionContext) +{ + Sound_X3DSoundProcessingNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Gain); +} + +Object .setPrototypeOf (Gain .prototype, Sound_X3DSoundProcessingNode .prototype); + +Object .defineProperties (Gain, +{ + typeName: + { + value: "Gain", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "gain", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tailTime", new x_ite_Fields .SFTime ()), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCount", new x_ite_Fields .SFInt32 ()), // skip test + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCountMode", new x_ite_Fields .SFString ("MAX")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelInterpretation", new x_ite_Fields .SFString ("SPEAKERS")), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "startTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "resumeTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pauseTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "stopTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isPaused", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "elapsedTime", new x_ite_Fields .SFTime ()), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const Gain_default_ = Gain; +; + +x_ite_Namespace .add ("Gain", "x_ite/Components/Sound/Gain", Gain_default_); +/* harmony default export */ const Sound_Gain = (Gain_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/ListenerPointSource.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function ListenerPointSource (executionContext) +{ + Sound_X3DSoundSourceNode .call (this, executionContext); + + this .addType (Base_X3DConstants .ListenerPointSource); + + this .addChildObjects (Base_X3DConstants .inputOutput, "loop", new x_ite_Fields .SFBool ()); + + this ._position .setUnit ("length"); +} + +Object .setPrototypeOf (ListenerPointSource .prototype, Sound_X3DSoundSourceNode .prototype); + +Object .defineProperties (ListenerPointSource, +{ + typeName: + { + value: "ListenerPointSource", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "position", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "orientation", new x_ite_Fields .SFRotation ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "gain", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "dopplerEnabled", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "interauralDistance", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "trackCurrentView", new x_ite_Fields .SFBool ()), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "startTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "resumeTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pauseTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "stopTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isPaused", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "elapsedTime", new x_ite_Fields .SFTime ()), + ]), + enumerable: true, + }, +}); + +const ListenerPointSource_default_ = ListenerPointSource; +; + +x_ite_Namespace .add ("ListenerPointSource", "x_ite/Components/Sound/ListenerPointSource", ListenerPointSource_default_); +/* harmony default export */ const Sound_ListenerPointSource = (ListenerPointSource_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/MicrophoneSource.js +/* provided dependency */ var MicrophoneSource_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function MicrophoneSource (executionContext) +{ + Sound_X3DSoundSourceNode .call (this, executionContext); + + this .addType (Base_X3DConstants .MicrophoneSource); + + this .addChildObjects (Base_X3DConstants .inputOutput, "loop", new x_ite_Fields .SFBool (true)); +} + +Object .assign (Object .setPrototypeOf (MicrophoneSource .prototype, Sound_X3DSoundSourceNode .prototype), +{ + initialize () + { + Sound_X3DSoundSourceNode .prototype .initialize .call (this); + + this ._mediaDeviceID .addInterest ("set_mediaDeviceID__", this); + }, + set_mediaDeviceID__ () + { + this .set_stop (); + + if (this ._isActive .getValue ()) + this .set_start (); + }, + set_start () + { + if (!navigator .mediaDevices) + return; + + this .restore = false; + + navigator .mediaDevices .getUserMedia ({ + audio: + { + deviceId: this ._mediaDeviceID .getValue (), + }, + }) + .then (stream => + { + const audioContext = this .getBrowser () .getAudioContext (); + + this .mediaStreamSource = audioContext .createMediaStreamSource (stream); + + if (this ._isActive .getValue ()) + { + if (this ._isPaused .getValue () || !this .getLive () .getValue ()) + this .set_pause (); + else + this .set_resume (); + } + else + { + this .set_stop (); + } + }) + .catch (error => + { + console .error (error .message); + }); + }, + set_pause () + { + if (!this .mediaStreamSource) + return; + + if (this .getLive () .getValue ()) + { + MicrophoneSource_$.try (() => this .mediaStreamSource .disconnect (this .getAudioSource ())); + + for (const track of this .mediaStreamSource .mediaStream .getAudioTracks ()) + track .enabled = false; + + for (const track of this .mediaStreamSource .mediaStream .getVideoTracks ()) + track .enabled = false; + } + else + { + this .set_stop (true); + } + }, + set_resume () + { + if (this .restore) + return this .set_start (); + + if (!this .mediaStreamSource) + return; + + this .mediaStreamSource .connect (this .getAudioSource ()); + + for (const track of this .mediaStreamSource .mediaStream .getAudioTracks ()) + track .enabled = true; + + for (const track of this .mediaStreamSource .mediaStream .getVideoTracks ()) + track .enabled = true; + }, + set_stop (restore = false) + { + if (!this .mediaStreamSource) + return; + + MicrophoneSource_$.try (() => this .mediaStreamSource .disconnect (this .getAudioSource ())); + + for (const track of this .mediaStreamSource .mediaStream .getAudioTracks ()) + track .stop (); + + for (const track of this .mediaStreamSource .mediaStream .getVideoTracks ()) + track .stop (); + + this .mediaStreamSource = null; + this .restore = restore; + }, +}); + +Object .defineProperties (MicrophoneSource, +{ + typeName: + { + value: "MicrophoneSource", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "gain", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "mediaDeviceID", new x_ite_Fields .SFString ()), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "startTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "resumeTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pauseTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "stopTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isPaused", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "elapsedTime", new x_ite_Fields .SFTime ()), + ]), + enumerable: true, + }, +}); + +const MicrophoneSource_default_ = MicrophoneSource; +; + +x_ite_Namespace .add ("MicrophoneSource", "x_ite/Components/Sound/MicrophoneSource", MicrophoneSource_default_); +/* harmony default export */ const Sound_MicrophoneSource = (MicrophoneSource_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/OscillatorSource.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function OscillatorSource (executionContext) +{ + Sound_X3DSoundSourceNode .call (this, executionContext); + + this .addType (Base_X3DConstants .OscillatorSource); + + this .addChildObjects (Base_X3DConstants .inputOutput, "loop", new x_ite_Fields .SFBool ()); + + const audioContext = this .getBrowser () .getAudioContext (); + + this .oscillatorNode = new OscillatorNode (audioContext); + this .mergerNode = new ChannelMergerNode (audioContext, { numberOfInputs: 2 }); +} + +Object .assign (Object .setPrototypeOf (OscillatorSource .prototype, Sound_X3DSoundSourceNode .prototype), +{ + initialize () + { + Sound_X3DSoundSourceNode .prototype .initialize .call (this); + + this ._detune .addInterest ("set_detune__", this); + this ._frequency .addInterest ("set_frequency__", this); + this ._periodicWave .addInterest ("set_periodicWave__", this); + + this .set_periodicWave__ (); + }, + set_type__: (function () + { + const types = new Set ([ + "sine", + "square", + "sawtooth", + "triangle", + ]); + + return function () + { + this .periodicWaveNode ._optionsReal .removeInterest ("set_periodicWaveOptions__", this); + this .periodicWaveNode ._optionsImag .removeInterest ("set_periodicWaveOptions__", this); + + const type = this .periodicWaveNode ._type .getValue () .toLowerCase (); + + if (type === "custom") + { + this .periodicWaveNode ._optionsReal .addInterest ("set_periodicWaveOptions__", this); + this .periodicWaveNode ._optionsImag .addInterest ("set_periodicWaveOptions__", this); + + this .set_periodicWaveOptions__ (); + } + else + { + this .oscillatorNode .type = types .has (type) ? type : "square"; + } + }; + })(), + set_frequency__ () + { + this .oscillatorNode .frequency .value = this ._frequency .getValue (); + }, + set_detune__ () + { + this .oscillatorNode .detune .value = this ._detune .getValue (); + }, + set_periodicWave__ () + { + this .periodicWaveNode ?._type .removeInterest ("set_type__", this); + + this .periodicWaveNode = Base_X3DCast (Base_X3DConstants .PeriodicWave, this ._periodicWave) + ?? this .getBrowser () .getDefaultPeriodicWave (); + + this .periodicWaveNode ._type .addInterest ("set_type__", this); + + this .set_type__ (); + }, + set_periodicWaveOptions__ () + { + this .oscillatorNode .setPeriodicWave (this .periodicWaveNode .createPeriodicWave ()); + }, + set_start () + { + const audioContext = this .getBrowser () .getAudioContext (); + + this .oscillatorNode = new OscillatorNode (audioContext); + + this .set_type__ (); + this .set_frequency__ (); + this .set_detune__ (); + + this .oscillatorNode .connect (this .mergerNode, 0, 0); + this .oscillatorNode .connect (this .mergerNode, 0, 1); + this .mergerNode .connect (this .getAudioSource ()); + + this .oscillatorNode .start (); + }, + set_pause () + { + this .mergerNode .disconnect (); + }, + set_resume () + { + this .mergerNode .connect (this .getAudioSource ()); + }, + set_stop () + { + this .oscillatorNode .stop (); + this .oscillatorNode .disconnect (); + }, +}); + +Object .defineProperties (OscillatorSource, +{ + typeName: + { + value: "OscillatorSource", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "gain", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "frequency", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "detune", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "periodicWave", new x_ite_Fields .SFNode ()), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "startTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "resumeTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pauseTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "stopTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isPaused", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "elapsedTime", new x_ite_Fields .SFTime ()), + ]), + enumerable: true, + }, +}); + +const OscillatorSource_default_ = OscillatorSource; +; + +x_ite_Namespace .add ("OscillatorSource", "x_ite/Components/Sound/OscillatorSource", OscillatorSource_default_); +/* harmony default export */ const Sound_OscillatorSource = (OscillatorSource_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/PeriodicWave.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function PeriodicWave (executionContext) +{ + Sound_X3DSoundNode .call (this, executionContext); + + this .addType (Base_X3DConstants .PeriodicWave); + + this .real = new Float32Array (2); + this .imag = new Float32Array (2); +} + +Object .assign (Object .setPrototypeOf (PeriodicWave .prototype, Sound_X3DSoundNode .prototype), +{ + createPeriodicWave () + { + const + audioContext = this .getBrowser () .getAudioContext (), + optionsReal = this ._optionsReal .shrinkToFit (), + optionsImag = this ._optionsImag .shrinkToFit (), + length = Math .max (optionsReal .length, optionsImag .length, 2); + + if (this .real .length !== length) + { + this .real = new Float32Array (length); + this .imag = new Float32Array (length); + } + + this .real .set (optionsReal); + this .imag .set (optionsImag); + + return audioContext .createPeriodicWave (this .real, this .imag); + }, +}); + +Object .defineProperties (PeriodicWave, +{ + typeName: + { + value: "PeriodicWave", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "periodicWave", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "type", new x_ite_Fields .SFString ("SQUARE")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "optionsReal", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "optionsImag", new x_ite_Fields .MFFloat ()), + ]), + enumerable: true, + }, +}); + +const PeriodicWave_default_ = PeriodicWave; +; + +x_ite_Namespace .add ("PeriodicWave", "x_ite/Components/Sound/PeriodicWave", PeriodicWave_default_); +/* harmony default export */ const Sound_PeriodicWave = (PeriodicWave_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/Sound.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + +function Sound (executionContext) +{ + Sound_X3DSoundNode .call (this, executionContext); + + this .addType (Base_X3DConstants .Sound); + + this .addChildObjects (Base_X3DConstants .outputOnly, "traversed", new x_ite_Fields .SFBool (true)); + + this ._location .setUnit ("length"); + this ._minBack .setUnit ("length"); + this ._minFront .setUnit ("length"); + this ._maxBack .setUnit ("length"); + this ._maxFront .setUnit ("length"); + + this .childNodes = [ ]; + this .currentTraversed = true; +} + +Object .assign (Object .setPrototypeOf (Sound .prototype, Sound_X3DSoundNode .prototype), +{ + initialize () + { + Sound_X3DSoundNode .prototype .initialize .call (this); + + const + audioContext = this .getBrowser () .getAudioContext (), + splitterNode = new ChannelSplitterNode (audioContext, { numberOfOutputs: 2 }), + mergerNode = new ChannelMergerNode (audioContext, { numberOfInputs: 2 }), + gainLeftNode = new GainNode (audioContext, { gain: 0 }), + gainRightNode = new GainNode (audioContext, { gain: 0 }); + + splitterNode .connect (gainLeftNode, 0); + splitterNode .connect (gainRightNode, 1); + gainLeftNode .connect (mergerNode, 0, 0); + gainRightNode .connect (mergerNode, 0, 1); + mergerNode .connect (audioContext .destination); + + this .splitterNode = splitterNode; + this .gainLeftNode = gainLeftNode; + this .gainRightNode = gainRightNode; + + this .getLive () .addInterest ("set_live__", this); + this ._traversed .addInterest ("set_live__", this); + + this ._source .addInterest ("set_children__", this); + this ._children .addInterest ("set_children__", this); + + this .set_live__ (); + this .set_children__ (); + }, + setTraversed (value) + { + if (value) + { + if (this ._traversed .getValue () === false) + this ._traversed = true; + } + else + { + if (this .currentTraversed !== this ._traversed .getValue ()) + this ._traversed = this .currentTraversed; + } + + this .currentTraversed = value; + }, + getTraversed () + { + return this .currentTraversed; + }, + setVolume (volume, pan = 0.5) + { + this .gainLeftNode .gain .value = volume * (1 - pan ** 2); + this .gainRightNode .gain .value = volume * (1 - (1 - pan) ** 2); + }, + set_live__ () + { + if (this .getLive () .getValue () && this ._traversed .getValue ()) + { + this .getBrowser () .sensorEvents () .addInterest ("update", this); + } + else + { + this .getBrowser () .sensorEvents () .removeInterest ("update", this); + this .setVolume (0); + } + }, + set_children__ () + { + for (const childNode of this .childNodes) + childNode .getAudioSource () .disconnect (this .splitterNode); + + this .childNodes .length = 0; + + const sourceNode = Base_X3DCast (Base_X3DConstants .X3DSoundSourceNode, this ._source); + + if (sourceNode) + this .childNodes .push (sourceNode); + + for (const child of this ._children) + { + const childNode = Base_X3DCast (Base_X3DConstants .X3DChildNode, child); + + if (!childNode) + continue; + + const type = childNode .getType (); + + for (let t = type .length - 1; t >= 0; -- t) + { + switch (type [t]) + { + case Base_X3DConstants .X3DSoundChannelNode: + case Base_X3DConstants .X3DSoundProcessingNode: + case Base_X3DConstants .X3DSoundSourceNode: + this .childNodes .push (childNode); + break; + default: + continue; + } + + break; + } + } + + for (const childNode of this .childNodes) + childNode .getAudioSource () .connect (this .splitterNode); + }, + update () + { + if (!this .getTraversed ()) + this .setVolume (0); + + this .setTraversed (false); + }, + traverse: (() => + { + const + min = { distance: 0, intersection: new Numbers_Vector3 (0, 0, 0) }, + max = { distance: 0, intersection: new Numbers_Vector3 (0, 0, 0) }; + + return function (type, renderObject) + { + if (type !== Rendering_TraverseType .DISPLAY) + return; + + if (!this .childNodes .length) + return; + + // if (!this .sourceNode ._isActive .getValue () || this .sourceNode ._isPaused .getValue ()) + // return; + + this .setTraversed (true); + + const modelViewMatrix = renderObject .getModelViewMatrix () .get (); + + this .getEllipsoidParameter (modelViewMatrix, + Math .max (this ._maxBack .getValue (), 0), + Math .max (this ._maxFront .getValue (), 0), + max); + + if (max .distance < 1) // Radius of normalized sphere is 1. + { + this .getEllipsoidParameter (modelViewMatrix, + Math .max (this ._minBack .getValue (), 0), + Math .max (this ._minFront .getValue (), 0), + min); + + const pan = this .getPan (modelViewMatrix); + + if (min .distance < 1) // Radius of normalized sphere is 1. + { + this .setVolume (Math_Algorithm .clamp (this ._intensity .getValue (), 0, 1), pan); + } + else + { + const + d1 = max .intersection .magnitude (), // Viewer is here at (0, 0, 0) + d2 = max .intersection .distance (min .intersection), + d = Math .min (d1 / d2, 1), + intensity = Math_Algorithm .clamp (this ._intensity .getValue (), 0, 1), + volume = intensity * d; + + this .setVolume (volume, pan); + } + } + else + { + this .setVolume (0); + } + }; + })(), + getEllipsoidParameter: (() => + { + const + location = new Numbers_Vector3 (0, 0, 0), + sphereMatrix = new Numbers_Matrix4 (), + invSphereMatrix = new Numbers_Matrix4 (), + rotation = new Numbers_Rotation4 (), + scale = new Numbers_Vector3 (1, 1, 1), + sphere = new Geometry_Sphere3 (1, Numbers_Vector3 .Zero), + normal = new Numbers_Vector3 (0, 0, 0), + line = new Geometry_Line3 (Numbers_Vector3 .Zero, Numbers_Vector3 .zAxis), + enterPoint = new Numbers_Vector3 (0, 0, 0), + exitPoint = new Numbers_Vector3 (0, 0, 0); + + return function (modelViewMatrix, back, front, value) + { + /* + * https://de.wikipedia.org/wiki/Ellipse + * + * The ellipsoid is transformed to a sphere for easier calculation and then the viewer position is + * transformed into this coordinate system. The radius and distance can then be obtained. + * + * throws Error + */ + + if (back == 0 || front == 0) + { + sphereMatrix .multVecMatrix (value .intersection .assign (this ._location .getValue ())); + value .distance = 1; + return; + } + + const + a = (back + front) / 2, + e = a - back, + b = Math .sqrt (a * a - e * e); + + location .set (0, 0, e); + scale .set (b, b, a); + rotation .setFromToVec (Numbers_Vector3 .zAxis, this ._direction .getValue ()); + + sphereMatrix + .assign (modelViewMatrix) + .translate (this ._location .getValue ()) + .rotate (rotation) + .translate (location) + .scale (scale); + + invSphereMatrix .assign (sphereMatrix) .inverse (); + + const viewer = invSphereMatrix .origin; + location .negate () .divVec (scale); + + normal .assign (location) .subtract (viewer) .normalize (); + line .set (viewer, normal); + sphere .intersectsLine (line, enterPoint, exitPoint); + + value .intersection .assign (sphereMatrix .multVecMatrix (enterPoint)); + value .distance = viewer .magnitude (); + }; + })(), + getPan: (function () + { + const location = new Numbers_Vector3 (0, 0, 0); + + return function (modelViewMatrix) + { + if (!this ._spatialize .getValue ()) + return 0.5; + + const + direction = modelViewMatrix .multVecMatrix (location .assign (this ._location .getValue ())) .normalize (), + pan = Math .acos (Math_Algorithm .clamp (-direction .dot (Numbers_Vector3 .xAxis), -1, 1)) / Math .PI; + + return pan; + }; + })(), +}); + +Object .defineProperties (Sound, +{ + typeName: + { + value: "Sound", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "spatialize", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "intensity", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "location", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "direction", new x_ite_Fields .SFVec3f (0, 0, 1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "minBack", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "minFront", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "maxBack", new x_ite_Fields .SFFloat (10)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "maxFront", new x_ite_Fields .SFFloat (10)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "priority", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "source", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const Sound_default_ = Sound; +; + +x_ite_Namespace .add ("Sound", "x_ite/Components/Sound/Sound", Sound_default_); +/* harmony default export */ const Sound_Sound = (Sound_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/SpatialSound.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function SpatialSound (executionContext) +{ + Sound_X3DSoundNode .call (this, executionContext); + + this .addType (Base_X3DConstants .SpatialSound); + + this ._location .setUnit ("length"); +} + +Object .setPrototypeOf (SpatialSound .prototype, Sound_X3DSoundNode .prototype); + +Object .defineProperties (SpatialSound, +{ + typeName: + { + value: "SpatialSound", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "spatialize", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "coneInnerAngle", new x_ite_Fields .SFFloat (6.2832)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "coneOuterAngle", new x_ite_Fields .SFFloat (6.2832)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "coneOuterGain", new x_ite_Fields .SFFloat (0)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "direction", new x_ite_Fields .SFVec3f (0, 0, 1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "distanceModel", new x_ite_Fields .SFString ("INVERSE")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "dopplerEnabled", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enableHRTF", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "gain", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "intensity", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "location", new x_ite_Fields .SFVec3f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "maxDistance", new x_ite_Fields .SFFloat (10000)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "priority", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "referenceDistance", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "rolloffFactor", new x_ite_Fields .SFFloat (1)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const SpatialSound_default_ = SpatialSound; +; + +x_ite_Namespace .add ("SpatialSound", "x_ite/Components/Sound/SpatialSound", SpatialSound_default_); +/* harmony default export */ const Sound_SpatialSound = (SpatialSound_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/StreamAudioDestination.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function StreamAudioDestination (executionContext) +{ + Sound_X3DSoundDestinationNode .call (this, executionContext); + + this .addType (Base_X3DConstants .StreamAudioDestination); + + const audioContext = this .getBrowser () .getAudioContext (); + + this .mediaStreamDestination = audioContext .createMediaStreamDestination (); +} + +Object .assign (Object .setPrototypeOf (StreamAudioDestination .prototype, Sound_X3DSoundDestinationNode .prototype), +{ + initialize () + { + Sound_X3DSoundDestinationNode .prototype .initialize .call (this); + + this ._streamIdentifier [0] = this .mediaStreamDestination .stream .id; + }, + getSoundDestination () + { + return this .mediaStreamDestination; + }, +}); + +Object .defineProperties (StreamAudioDestination, +{ + typeName: + { + value: "StreamAudioDestination", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "gain", new x_ite_Fields .SFFloat (1)), + // new X3DFieldDefinition (X3DConstants .inputOutput, "mediaDeviceID", new Fields .SFString ()), // skip test + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCount", new x_ite_Fields .SFInt32 ()), // skip test + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCountMode", new x_ite_Fields .SFString ("MAX")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelInterpretation", new x_ite_Fields .SFString ("SPEAKERS")), + + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "streamIdentifier", new x_ite_Fields .MFString ()), // skip test + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const StreamAudioDestination_default_ = StreamAudioDestination; +; + +x_ite_Namespace .add ("StreamAudioDestination", "x_ite/Components/Sound/StreamAudioDestination", StreamAudioDestination_default_); +/* harmony default export */ const Sound_StreamAudioDestination = (StreamAudioDestination_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/StreamAudioSource.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function StreamAudioSource (executionContext) +{ + Sound_X3DSoundSourceNode .call (this, executionContext); + + this .addType (Base_X3DConstants .StreamAudioSource); + + this .addChildObjects (Base_X3DConstants .inputOutput, "loop", new x_ite_Fields .SFBool ()); +} + +Object .setPrototypeOf (StreamAudioSource .prototype, Sound_X3DSoundSourceNode .prototype); + +Object .defineProperties (StreamAudioSource, +{ + typeName: + { + value: "StreamAudioSource", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "gain", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "streamIdentifier", new x_ite_Fields .MFString ()), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "startTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "resumeTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pauseTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "stopTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isPaused", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "elapsedTime", new x_ite_Fields .SFTime ()), + ]), + enumerable: true, + }, +}); + +const StreamAudioSource_default_ = StreamAudioSource; +; + +x_ite_Namespace .add ("StreamAudioSource", "x_ite/Components/Sound/StreamAudioSource", StreamAudioSource_default_); +/* harmony default export */ const Sound_StreamAudioSource = (StreamAudioSource_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound/WaveShaper.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function WaveShaper (executionContext) +{ + Sound_X3DSoundProcessingNode .call (this, executionContext); + + this .addType (Base_X3DConstants .WaveShaper); +} + +Object .setPrototypeOf (WaveShaper .prototype, Sound_X3DSoundProcessingNode .prototype); + +Object .defineProperties (WaveShaper, +{ + typeName: + { + value: "WaveShaper", + enumerable: true, + }, + componentName: + { + value: "Sound", + enumerable: true, + }, + containerField: + { + value: "children", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["4.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "gain", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "curve", new x_ite_Fields .MFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "oversample", new x_ite_Fields .SFString ("NONE")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "tailTime", new x_ite_Fields .SFTime ()), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCount", new x_ite_Fields .SFInt32 ()), // skip test + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelCountMode", new x_ite_Fields .SFString ("MAX")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "channelInterpretation", new x_ite_Fields .SFString ("SPEAKERS")), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "startTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "resumeTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pauseTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "stopTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isPaused", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "elapsedTime", new x_ite_Fields .SFTime ()), + + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "children", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const WaveShaper_default_ = WaveShaper; +; + +x_ite_Namespace .add ("WaveShaper", "x_ite/Components/Sound/WaveShaper", WaveShaper_default_); +/* harmony default export */ const Sound_WaveShaper = (WaveShaper_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Sound.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +const Components_Sound_default_ = { + name: "Sound", + concreteNodes: + [ + Sound_Analyser, + Sound_AudioClip, + Sound_AudioDestination, + Sound_BiquadFilter, + Sound_BufferAudioSource, + Sound_ChannelMerger, + Sound_ChannelSelector, + Sound_ChannelSplitter, + Sound_Convolver, + Sound_Delay, + Sound_DynamicsCompressor, + Sound_Gain, + Sound_ListenerPointSource, + Sound_MicrophoneSource, + Sound_OscillatorSource, + Sound_PeriodicWave, + Sound_Sound, + Sound_SpatialSound, + Sound_StreamAudioDestination, + Sound_StreamAudioSource, + Sound_WaveShaper, + ], + abstractNodes: + [ + Sound_X3DSoundChannelNode, + Sound_X3DSoundDestinationNode, + Sound_X3DSoundNode, + Sound_X3DSoundProcessingNode, + Sound_X3DSoundSourceNode, + ], +}; +; + +x_ite_Namespace .add ("Sound", "x_ite/Components/Sound", Components_Sound_default_); +/* harmony default export */ const Components_Sound = (Components_Sound_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Texturing/GIFMedia.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +function GifMedia (gif, movieTexture) +{ + let + playbackRate = 1, + cycle = 0, + loop = false; + + Object .defineProperties (gif, + { + currentTime: + { + get () + { + if (!loop && cycle < this .cycle) + return this .duration; + + return (movieTexture ._elapsedTime * playbackRate) % this .duration; + }, + set: Function .prototype, + }, + duration: + { + get () + { + return this .get_duration_ms () / 1000; + }, + }, + loop: + { + get () + { + return loop; + }, + set (value) + { + cycle = this .cycle; + loop = value; + }, + }, + cycle: + { + get () + { + return Math .floor (movieTexture ._elapsedTime / this .duration); + }, + }, + currentFrame: + { + get () + { + const length = this .get_length (); + + return this .get_frames () [Math .max (Math .ceil (this .currentTime / this .duration * length) - 1, 0)]; + }, + }, + play: + { + value () + { + cycle = this .cycle; + return Promise .resolve (); + }, + }, + playbackRate: + { + get () + { + return playbackRate; + }, + set (value) + { + playbackRate = value; + }, + }, + }); +} + +const GIFMedia_default_ = GifMedia; +; + +x_ite_Namespace .add ("GIFMedia", "x_ite/Browser/Texturing/GIFMedia", GIFMedia_default_); +/* harmony default export */ const GIFMedia = (GIFMedia_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Texturing/MovieTexture.js +/* provided dependency */ var MovieTexture_$ = __webpack_require__(864); +/* provided dependency */ var SuperGif = __webpack_require__(27); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + +function MovieTexture (executionContext) +{ + Texturing_X3DTexture2DNode .call (this, executionContext); + Sound_X3DSoundSourceNode .call (this, executionContext); + Networking_X3DUrlObject .call (this, executionContext); + + this .addType (Base_X3DConstants .MovieTexture); + + const audioContext = this .getBrowser () .getAudioContext (); + + this .urlStack = new x_ite_Fields .MFString (); + this .video = MovieTexture_$(""); + this .sourceNode = audioContext .createMediaElementSource (this .video [0]); + + this .sourceNode .connect (this .getAudioSource ()); +} + +Object .assign (Object .setPrototypeOf (MovieTexture .prototype, Texturing_X3DTexture2DNode .prototype), + Sound_X3DSoundSourceNode .prototype, + Networking_X3DUrlObject .prototype, +{ + initialize () + { + Texturing_X3DTexture2DNode .prototype .initialize .call (this); + Sound_X3DSoundSourceNode .prototype .initialize .call (this); + Networking_X3DUrlObject .prototype .initialize .call (this); + + this ._speed .addInterest ("set_speed__", this); + + this .video + .on ("abort error", this .setError .bind (this)) + .on ("suspend stalled", this .setTimeout .bind (this)) + .prop ("crossOrigin", "Anonymous") + .prop ("preload", "auto"); + + this .requestImmediateLoad () .catch (Function .prototype); + }, + set_live__ () + { + Sound_X3DSoundSourceNode .prototype .set_live__ .call (this); + Networking_X3DUrlObject .prototype .set_live__ .call (this); + }, + unloadData () + { + this .clearTexture (); + }, + loadData () + { + delete this .gif; + this .setMediaElement (null); + this .urlStack .setValue (this ._url); + this .video .on ("canplaythrough", this .setVideo .bind (this)); + this .loadNext (); + }, + loadNext () + { + if (this .urlStack .length === 0) + { + this .video .off ("canplaythrough"); + this ._duration_changed = -1; + this .clearTexture (); + this .setLoadState (Base_X3DConstants .FAILED_STATE); + return; + } + + // Get URL. + + this .URL = new URL (this .urlStack .shift (), this .getExecutionContext () .getBaseURL ()); + + if (this .URL .protocol !== "data:") + { + if (!this .getCache ()) + this .URL .searchParams .set ("_", Date .now ()); + } + + if (this .URL .pathname .endsWith (".gif")) + { + const + img = MovieTexture_$("") .appendTo (MovieTexture_$("
")), + gif = new SuperGif ({ gif: img [0], on_error: type => this .setError ({ type: type }) }); + + gif .load_url (this .URL, this .setGif .bind (this, gif)); + + this .setTimeout ({ type: "timeout" }); + } + else + { + this .video .attr ("src", this .URL .href); + this .video .get (0) .load (); + } + }, + setTimeout (event) + { + setTimeout (() => + { + if (this .checkLoadState () === Base_X3DConstants .IN_PROGRESS_STATE) + this .setError (event); + }, + 3000); + }, + setError (event) + { + if (this .URL .protocol !== "data:") + console .warn (`Error loading movie '${decodeURI (this .URL .href)}'`, event .type); + + this .loadNext (); + }, + setVideo () + { + try + { + if (DEVELOPMENT) + { + if (this .URL .protocol !== "data:") + console .info (`Done loading movie '${decodeURI (this .URL .href)}'`); + } + + this .video .unbind ("canplaythrough"); + + const + video = this .video [0], + width = video .videoWidth, + height = video .videoHeight; + + if (!Math_Algorithm .isPowerOfTwo (width) || !Math_Algorithm .isPowerOfTwo (height)) + throw new Error ("The movie texture is a non power-of-two texture."); + + this .setMediaElement (this .video [0]); + this .setTexture (width, height, false, video, true); + this .setLoadState (Base_X3DConstants .COMPLETE_STATE); + + this .set_speed__ (); + } + catch (error) + { + // Catch security error from cross origin requests. + this .setError ({ type: error .message }); + } + }, + setGif (gif) + { + try + { + this .gif = gif; + + GIFMedia (gif, this); + + gif .pause (); + + this .setMediaElement (gif); + this .setTexture (gif .get_canvas () .width, gif .get_canvas () .height, false, gif .get_frames () [0] .data, true); + this .setLoadState (Base_X3DConstants .COMPLETE_STATE); + + this .set_speed__ (); + } + catch (error) + { + // Catch security error from cross origin requests. + this .setError ({ type: error .message }); + } + }, + set_speed__ () + { + if (this .gif) + this .gif .playbackRate = this ._speed .getValue (); + + this .video [0] .playbackRate = this ._speed .getValue (); + }, + set_time () + { + Sound_X3DSoundSourceNode .prototype .set_time .call (this); + + if (this .checkLoadState () !== Base_X3DConstants .COMPLETE_STATE) + return; + + if (this .gif) + this .updateTexture (this .gif .currentFrame .data, true); + else + this .updateTexture (this .video [0], true); + }, + traverse: Texturing_X3DTexture2DNode .prototype .traverse, + dispose () + { + Networking_X3DUrlObject .prototype .dispose .call (this); + Sound_X3DSoundSourceNode .prototype .dispose .call (this); + Texturing_X3DTexture2DNode .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (MovieTexture, +{ + typeName: + { + value: "MovieTexture", + enumerable: true, + }, + componentName: + { + value: "Texturing", + enumerable: true, + }, + containerField: + { + value: "texture", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "enabled", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "load", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "url", new x_ite_Fields .MFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoRefresh", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "autoRefreshTimeLimit", new x_ite_Fields .SFTime (3600)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "gain", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "speed", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pitch", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "loop", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "startTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "resumeTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "pauseTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "stopTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isPaused", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "elapsedTime", new x_ite_Fields .SFTime ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "duration_changed", new x_ite_Fields .SFTime (-1)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "repeatS", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "repeatT", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "textureProperties", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +const MovieTexture_default_ = MovieTexture; +; + +x_ite_Namespace .add ("MovieTexture", "x_ite/Components/Texturing/MovieTexture", MovieTexture_default_); +/* harmony default export */ const Texturing_MovieTexture = (MovieTexture_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Texturing/MultiTexture.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + +function MultiTexture (executionContext) +{ + Texturing_X3DTextureNode .call (this, executionContext); + + this .addType (Base_X3DConstants .MultiTexture); + + this .addChildObjects (Base_X3DConstants .outputOnly, "loadState", new x_ite_Fields .SFInt32 (Base_X3DConstants .NOT_STARTED_STATE)); + + const browser = this .getBrowser (); + + this .maxTextures = browser .getMaxTextures () + this .color = new Float32Array (4); + this .modes = [ ]; + this .alphaModes = [ ]; + this .sources = [ ]; + this .functions = [ ]; + this .textureNodes = [ ]; +} + +Object .assign (Object .setPrototypeOf (MultiTexture .prototype, Texturing_X3DTextureNode .prototype), +{ + initialize () + { + Texturing_X3DTextureNode .prototype .initialize .call (this); + + this ._color .addInterest ("set_color__", this); + this ._alpha .addInterest ("set_alpha__", this); + this ._mode .addInterest ("set_mode__", this); + this ._source .addInterest ("set_source__", this); + this ._function .addInterest ("set_function__", this); + this ._texture .addInterest ("set_texture__", this); + + this .set_color__ (); + this .set_alpha__ (); + this .set_mode__ (); + this .set_source__ (); + this .set_function__ (); + this .set_texture__ (); + + this ._loadState = Base_X3DConstants .COMPLETE_STATE; + }, + getCount () + { + return Math .min (this .maxTextures, this .textureNodes .length); + }, + getMode (index) + { + if (index < this .modes .length) + return this .modes [index]; + + return Texturing_ModeType .MODULATE; + }, + getAlphaMode (index) + { + if (index < this .alphaModes .length) + return this .alphaModes [index]; + + return Texturing_ModeType .MODULATE; + }, + getSource (index) + { + if (index < this .sources .length) + return this .sources [index]; + + return Texturing_SourceType .DEFAULT; + }, + getFunction (index) + { + if (index < this .functions .length) + return this .functions [index]; + + return Texturing_FunctionType .DEFAULT; + }, + set_color__ () + { + this .color [0] = this ._color .r; + this .color [1] = this ._color .g; + this .color [2] = this ._color .b; + }, + set_alpha__ () + { + this .color [3] = this ._alpha; + }, + set_mode__: (() => + { + const modeTypes = new Map ([ + ["REPLACE", Texturing_ModeType .REPLACE], + ["MODULATE", Texturing_ModeType .MODULATE], + ["MODULATE2X", Texturing_ModeType .MODULATE2X], + ["MODULATE4X", Texturing_ModeType .MODULATE4X], + ["ADD", Texturing_ModeType .ADD], + ["ADDSIGNED", Texturing_ModeType .ADDSIGNED], + ["ADDSIGNED2X", Texturing_ModeType .ADDSIGNED2X], + ["ADDSMOOTH", Texturing_ModeType .ADDSMOOTH], + ["SUBTRACT", Texturing_ModeType .SUBTRACT], + ["BLENDDIFFUSEALPHA", Texturing_ModeType .BLENDDIFFUSEALPHA], + ["BLENDTEXTUREALPHA", Texturing_ModeType .BLENDTEXTUREALPHA], + ["BLENDFACTORALPHA", Texturing_ModeType .BLENDFACTORALPHA], + ["BLENDCURRENTALPHA", Texturing_ModeType .BLENDCURRENTALPHA], + ["MODULATEALPHA_ADDCOLOR", Texturing_ModeType .MODULATEALPHA_ADDCOLOR], + ["MODULATEINVALPHA_ADDCOLOR", Texturing_ModeType .MODULATEINVALPHA_ADDCOLOR], + ["MODULATEINVCOLOR_ADDALPHA", Texturing_ModeType .MODULATEINVCOLOR_ADDALPHA], + ["DOTPRODUCT3", Texturing_ModeType .DOTPRODUCT3], + ["SELECTARG1", Texturing_ModeType .SELECTARG1], + ["SELECTARG2", Texturing_ModeType .SELECTARG2], + ["OFF", Texturing_ModeType .OFF], + ]); + + return function () + { + this .modes .length = 0; + this .alphaModes .length = 0; + + for (const modes of this ._mode) + { + const mode = modes .split (","); + + for (let m = 0, l = mode .length; m < l; ++ m) + mode [m] = mode [m] .trim (); + + if (mode .length === 0) + mode .push ("MODULATE"); + + if (mode .length < 2) + mode .push (mode [0]); + + // RGB + + const modeType = modeTypes .get (mode [0]); + + if (modeType !== undefined) + this .modes .push (modeType); + else + this .modes .push (Texturing_ModeType .MODULATE); + + // Alpha + + const alphaModeType = modeTypes .get (mode [1]); + + if (alphaModeType !== undefined) + this .alphaModes .push (alphaModeType); + else + this .alphaModes .push (Texturing_ModeType .MODULATE); + } + }; + })(), + set_source__: (() => + { + const sourceTypes = new Map ([ + ["DIFFUSE", Texturing_SourceType .DIFFUSE], + ["SPECULAR", Texturing_SourceType .SPECULAR], + ["FACTOR", Texturing_SourceType .FACTOR], + ]); + + return function () + { + this .sources .length = 0; + + for (const source of this ._source) + { + const sourceType = sourceTypes .get (source); + + if (sourceType !== undefined) + this .sources .push (sourceType); + else + this .sources .push (Texturing_SourceType .DEFAULT); + } + }; + })(), + set_function__: (() => + { + const functionsTypes = new Map ([ + ["COMPLEMENT", Texturing_FunctionType .COMPLEMENT], + ["ALPHAREPLICATE", Texturing_FunctionType .ALPHAREPLICATE], + ]); + + return function () + { + this .functions .length = 0; + + for (const func of this ._function) + { + const functionsType = functionsTypes .get (func); + + if (functionsType !== undefined) + this .functions .push (functionsType); + else + this .functions .push (Texturing_FunctionType .DEFAULT); + } + }; + })(), + set_texture__ () + { + this .textureNodes .length = 0; + + for (const node of this ._texture) + { + const textureNode = Base_X3DCast (Base_X3DConstants .X3DSingleTextureNode, node); + + if (textureNode) + this .textureNodes .push (textureNode); + } + }, + updateTextureBits (textureBits) + { + const + maxTextures = this .maxTextures, + textureNodes = this .textureNodes, + channels = Math .min (maxTextures, textureNodes .length); + + for (let i = 0; i < channels; ++ i) + textureNodes [i] .updateTextureBits (textureBits, i); + + textureBits .set (maxTextures * 2, 1); + }, + getShaderOptions (options) + { + const + textureNodes = this .textureNodes, + channels = Math .min (this .maxTextures, textureNodes .length); + + for (let i = 0; i < channels; ++ i) + textureNodes [i] .getShaderOptions (options, i); + }, + traverse (type, renderObject) + { + for (const textureNode of this .textureNodes) + textureNode .traverse (type, renderObject); + }, + setShaderUniforms (gl, shaderObject, renderObject) + { + const + textureNodes = this .textureNodes, + channels = Math .min (this .maxTextures, textureNodes .length); + + gl .uniform4fv (shaderObject .x3d_MultiTextureColor, this .color); + + for (let i = 0; i < channels; ++ i) + { + textureNodes [i] .setShaderUniforms (gl, shaderObject, renderObject, shaderObject .x3d_Texture [i]); + + gl .uniform1i (shaderObject .x3d_MultiTextureMode [i], this .getMode (i)); + gl .uniform1i (shaderObject .x3d_MultiTextureAlphaMode [i], this .getAlphaMode (i)); + gl .uniform1i (shaderObject .x3d_MultiTextureSource [i], this .getSource (i)); + gl .uniform1i (shaderObject .x3d_MultiTextureFunction [i], this .getFunction (i)); + } + }, +}); + +Object .defineProperties (MultiTexture, +{ + typeName: + { + value: "MultiTexture", + enumerable: true, + }, + componentName: + { + value: "Texturing", + enumerable: true, + }, + containerField: + { + value: "texture", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "color", new x_ite_Fields .SFColor (1, 1, 1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "alpha", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "mode", new x_ite_Fields .MFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "source", new x_ite_Fields .MFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "function", new x_ite_Fields .MFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "texture", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const MultiTexture_default_ = MultiTexture; +; + +x_ite_Namespace .add ("MultiTexture", "x_ite/Components/Texturing/MultiTexture", MultiTexture_default_); +/* harmony default export */ const Texturing_MultiTexture = (MultiTexture_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Texturing/X3DTextureCoordinateNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function X3DTextureCoordinateNode (executionContext) +{ + Rendering_X3DGeometricPropertyNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DTextureCoordinateNode); +} + +Object .setPrototypeOf (X3DTextureCoordinateNode .prototype, Rendering_X3DGeometricPropertyNode .prototype); + +Object .defineProperties (X3DTextureCoordinateNode, +{ + typeName: + { + value: "X3DTextureCoordinateNode", + enumerable: true, + }, + componentName: + { + value: "Texturing", + enumerable: true, + }, +}); + +const X3DTextureCoordinateNode_default_ = X3DTextureCoordinateNode; +; + +x_ite_Namespace .add ("X3DTextureCoordinateNode", "x_ite/Components/Texturing/X3DTextureCoordinateNode", X3DTextureCoordinateNode_default_); +/* harmony default export */ const Texturing_X3DTextureCoordinateNode = (X3DTextureCoordinateNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Texturing/MultiTextureCoordinate.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function MultiTextureCoordinate (executionContext) +{ + Texturing_X3DTextureCoordinateNode .call (this, executionContext); + + this .addType (Base_X3DConstants .MultiTextureCoordinate); + + const browser = this .getBrowser (); + + this .maxTexCoords = browser .getMaxTexCoords (); + this .textureCoordinateNodes = [ ]; +} + +Object .assign (Object .setPrototypeOf (MultiTextureCoordinate .prototype, Texturing_X3DTextureCoordinateNode .prototype), +{ + initialize () + { + Texturing_X3DTextureCoordinateNode .prototype .initialize .call (this); + + this ._texCoord .addInterest ("set_texCoord__", this); + + this .set_texCoord__ (); + }, + set_texCoord__ () + { + const textureCoordinateNodes = this .textureCoordinateNodes; + + for (const textureCoordinateNode of textureCoordinateNodes) + textureCoordinateNode .removeInterest ("addNodeEvent", this); + + textureCoordinateNodes .length = 0; + + for (const node of this ._texCoord) + { + const textureCoordinateNode = Base_X3DCast (Base_X3DConstants .X3DSingleTextureCoordinateNode, node); + + if (textureCoordinateNode) + textureCoordinateNodes .push (textureCoordinateNode); + } + + for (const textureCoordinateNode of textureCoordinateNodes) + textureCoordinateNode .addInterest ("addNodeEvent", this); + }, + getCount () + { + return Math .min (this .maxTexCoords, this .textureCoordinateNodes .length); + }, + isEmpty () + { + return true; + }, + getSize () + { + return 0; + }, + init (multiArray) + { + const + textureCoordinateNodes = this .textureCoordinateNodes, + length = Math .min (this .maxTexCoords, textureCoordinateNodes .length); + + for (let i = 0; i < length; ++ i) + textureCoordinateNodes [i] .init (multiArray); + }, + addPoint (index, multiArray) + { + const + textureCoordinateNodes = this .textureCoordinateNodes, + length = Math .min (this .maxTexCoords, textureCoordinateNodes .length); + + for (let i = 0; i < length; ++ i) + textureCoordinateNodes [i] .addPointToChannel (index, multiArray [i]); + }, + addPoints (array) + { + for (const textureCoordinateNode of this .textureCoordinateNodes) + return textureCoordinateNode .addPoints (array); + + return array; + }, + getTextureCoordinateMapping (textureCoordinateMapping) + { + const + textureCoordinateNodes = this .textureCoordinateNodes, + length = Math .min (this .maxTexCoords, textureCoordinateNodes .length); + + for (let i = 0; i < length; ++ i) + textureCoordinateNodes [i] .getTextureCoordinateMapping (textureCoordinateMapping, i); + }, + setShaderUniforms (gl, shaderObject) + { + const + textureCoordinateNodes = this .textureCoordinateNodes, + length = Math .min (this .maxTexCoords, textureCoordinateNodes .length); + + if (length) + { + for (let i = 0; i < length; ++ i) + textureCoordinateNodes [i] .setShaderUniforms (gl, shaderObject, i); + } + else + { + this .getBrowser () .getDefaultTextureCoordinate () .setShaderUniforms (gl, shaderObject, 0); + } + }, +}); + +Object .defineProperties (MultiTextureCoordinate, +{ + typeName: + { + value: "MultiTextureCoordinate", + enumerable: true, + }, + componentName: + { + value: "Texturing", + enumerable: true, + }, + containerField: + { + value: "texCoord", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "texCoord", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const MultiTextureCoordinate_default_ = MultiTextureCoordinate; +; + +x_ite_Namespace .add ("MultiTextureCoordinate", "x_ite/Components/Texturing/MultiTextureCoordinate", MultiTextureCoordinate_default_); +/* harmony default export */ const Texturing_MultiTextureCoordinate = (MultiTextureCoordinate_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Texturing/X3DTextureTransformNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function X3DTextureTransformNode (executionContext) +{ + Shape_X3DAppearanceChildNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DTextureTransformNode); +} + +Object .setPrototypeOf (X3DTextureTransformNode .prototype, Shape_X3DAppearanceChildNode .prototype); + +Object .defineProperties (X3DTextureTransformNode, +{ + typeName: + { + value: "X3DTextureTransformNode", + enumerable: true, + }, + componentName: + { + value: "Texturing", + enumerable: true, + }, +}); + +const X3DTextureTransformNode_default_ = X3DTextureTransformNode; +; + +x_ite_Namespace .add ("X3DTextureTransformNode", "x_ite/Components/Texturing/X3DTextureTransformNode", X3DTextureTransformNode_default_); +/* harmony default export */ const Texturing_X3DTextureTransformNode = (X3DTextureTransformNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Texturing/MultiTextureTransform.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function MultiTextureTransform (executionContext) +{ + Texturing_X3DTextureTransformNode .call (this, executionContext); + + this .addType (Base_X3DConstants .MultiTextureTransform); + + const browser = this .getBrowser (); + + this .maxTextureTransforms = browser .getMaxTextureTransforms (); + this .textureTransformNodes = [ ]; +} + +Object .assign (Object .setPrototypeOf (MultiTextureTransform .prototype, Texturing_X3DTextureTransformNode .prototype), +{ + initialize () + { + Texturing_X3DTextureTransformNode .prototype .initialize .call (this); + + this ._textureTransform .addInterest ("set_textureTransform__", this); + + this .set_textureTransform__ (); + }, + set_textureTransform__ () + { + const textureTransformNodes = this .textureTransformNodes; + + textureTransformNodes .length = 0; + + for (const node of this ._textureTransform) + { + const textureTransformNode = Base_X3DCast (Base_X3DConstants .X3DSingleTextureTransformNode, node); + + if (textureTransformNode) + textureTransformNodes .push (textureTransformNode); + } + + if (!textureTransformNodes .length) + textureTransformNodes .push (this .getBrowser () .getDefaultTextureTransform ()); + }, + getCount () + { + return Math .min (this .maxTextureTransforms, this .textureTransformNodes .length); + }, + getTextureTransformMapping (textureTransformMapping) + { + const + textureTransformNodes = this .textureTransformNodes, + length = Math .min (this .maxTextureTransforms, textureTransformNodes .length); + + for (let i = 0; i < length; ++ i) + textureTransformNodes [i] .getTextureTransformMapping (textureTransformMapping, i); + }, + setShaderUniforms (gl, shaderObject) + { + const + textureTransformNodes = this .textureTransformNodes, + length = Math .min (this .maxTextureTransforms, textureTransformNodes .length); + + for (let i = 0; i < length; ++ i) + textureTransformNodes [i] .setShaderUniforms (gl, shaderObject, i); + }, + transformPoint (texCoord) + { + return this .textureTransformNodes [0] .transformPoint (texCoord); + }, +}); + +Object .defineProperties (MultiTextureTransform, +{ + typeName: + { + value: "MultiTextureTransform", + enumerable: true, + }, + componentName: + { + value: "Texturing", + enumerable: true, + }, + containerField: + { + value: "textureTransform", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "textureTransform", new x_ite_Fields .MFNode ()), + ]), + enumerable: true, + }, +}); + +const MultiTextureTransform_default_ = MultiTextureTransform; +; + +x_ite_Namespace .add ("MultiTextureTransform", "x_ite/Components/Texturing/MultiTextureTransform", MultiTextureTransform_default_); +/* harmony default export */ const Texturing_MultiTextureTransform = (MultiTextureTransform_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Texturing/PixelTexture.js +/* provided dependency */ var PixelTexture_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + +function PixelTexture (executionContext) +{ + Texturing_X3DTexture2DNode .call (this, executionContext); + + this .addType (Base_X3DConstants .PixelTexture); + + this .addChildObjects (Base_X3DConstants .outputOnly, "loadState", new x_ite_Fields .SFInt32 (Base_X3DConstants .NOT_STARTED_STATE)); +} + +Object .assign (Object .setPrototypeOf (PixelTexture .prototype, Texturing_X3DTexture2DNode .prototype), +{ + initialize () + { + Texturing_X3DTexture2DNode .prototype .initialize .call (this); + + this ._image .addInterest ("set_image__", this); + + this .canvas1 = PixelTexture_$(""); + this .canvas2 = PixelTexture_$(""); + + this .set_image__ (); + }, + checkLoadState () + { + return this ._loadState .getValue (); + }, + convert (data, comp, array, length) + { + switch (comp) + { + case 1: + { + for (let i = 0, index = 0; i < length; ++ i, index += 4) + { + const pixel = array [i]; + + data [index] = + data [index + 1] = + data [index + 2] = pixel & 255; + data [index + 3] = 255; + } + + break; + } + case 2: + { + for (let i = 0, index = 0; i < length; ++ i, index += 4) + { + const pixel = array [i]; + + data [index] = + data [index + 1] = + data [index + 2] = (pixel >>> 8) & 255; + data [index + 3] = pixel & 255; + } + + break; + } + case 3: + { + for (let i = 0, index = 0; i < length; ++ i, index += 4) + { + const pixel = array [i]; + + data [index] = (pixel >>> 16) & 255; + data [index + 1] = (pixel >>> 8) & 255; + data [index + 2] = pixel & 255; + data [index + 3] = 255; + } + + break; + } + case 4: + { + for (let i = 0, index = 0; i < length; ++ i, index += 4) + { + const pixel = array [i]; + + data [index] = (pixel >>> 24); + data [index + 1] = (pixel >>> 16) & 255; + data [index + 2] = (pixel >>> 8) & 255; + data [index + 3] = pixel & 255; + } + + break; + } + } + }, + resize (input, inputWidth, inputHeight, outputWidth, outputHeight) + { + // Nearest neighbor scaling algorithm for very small images. + + const + output = new Uint8Array (outputWidth * outputHeight * 4), + scaleX = outputWidth / inputWidth, + scaleY = outputHeight / inputHeight; + + for (let y = 0; y < outputHeight; ++ y) + { + const + inputW = Math .floor (y / scaleY) * inputWidth, + outputW = y * outputWidth; + + for (let x = 0; x < outputWidth; ++ x) + { + const + index = (inputW + Math.floor (x / scaleX)) * 4, + indexScaled = (outputW + x) * 4; + + output [indexScaled] = input [index]; + output [indexScaled + 1] = input [index + 1]; + output [indexScaled + 2] = input [index + 2]; + output [indexScaled + 3] = input [index + 3]; + } + } + + return output; + }, + set_image__ () + { + const + gl = this .getBrowser () .getContext (), + comp = this ._image .comp, + array = this ._image .array, + transparent = !(comp % 2); + + let + width = this ._image .width, + height = this ._image .height, + data = null; + + if (width > 0 && height > 0 && comp > 0 && comp < 5) + { + if (gl .getVersion () >= 2 || (Math_Algorithm .isPowerOfTwo (width) && Math_Algorithm .isPowerOfTwo (height))) + { + data = new Uint8Array (width * height * 4); + + this .convert (data, comp, array .getValue (), array .length); + } + else if (Math .max (width, height) < this .getBrowser () .getMinTextureSize () && ! this ._textureProperties .getValue ()) + { + data = new Uint8Array (width * height * 4); + + this .convert (data, comp, array .getValue (), array .length); + + const + inputWidth = width, + inputHeight = height; + + width = Math_Algorithm .nextPowerOfTwo (inputWidth) * 8; + height = Math_Algorithm .nextPowerOfTwo (inputHeight) * 8; + data = this .resize (data, inputWidth, inputHeight, width, height); + } + else + { + const + canvas1 = this .canvas1 [0], + canvas2 = this .canvas2 [0], + cx1 = canvas1 .getContext ("2d", { willReadFrequently: true }), + cx2 = canvas2 .getContext ("2d", { willReadFrequently: true }), + imageData = cx1 .createImageData (width, height); + + canvas1 .width = width; + canvas1 .height = height; + + this .convert (imageData .data, comp, array, array .length); + cx1 .putImageData (imageData, 0, 0); + + width = Math_Algorithm .nextPowerOfTwo (width); + height = Math_Algorithm .nextPowerOfTwo (height); + + canvas2 .width = width; + canvas2 .height = height; + + cx2 .clearRect (0, 0, width, height); + cx2 .drawImage (canvas1, 0, 0, canvas1 .width, canvas1 .height, 0, 0, width, height); + + data = cx2 .getImageData (0, 0, width, height) .data; + } + + this .setTexture (width, height, transparent, new Uint8Array (data .buffer), false); + this ._loadState = Base_X3DConstants .COMPLETE_STATE; + } + else + { + this .clearTexture (); + this ._loadState = Base_X3DConstants .FAILED_STATE; + } + }, +}); + +Object .defineProperties (PixelTexture, +{ + typeName: + { + value: "PixelTexture", + enumerable: true, + }, + componentName: + { + value: "Texturing", + enumerable: true, + }, + containerField: + { + value: "texture", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "description", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "image", new x_ite_Fields .SFImage ()), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "repeatS", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "repeatT", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "textureProperties", new x_ite_Fields .SFNode ()), + ]), + enumerable: true, + }, +}); + +const PixelTexture_default_ = PixelTexture; +; + +x_ite_Namespace .add ("PixelTexture", "x_ite/Components/Texturing/PixelTexture", PixelTexture_default_); +/* harmony default export */ const Texturing_PixelTexture = (PixelTexture_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Texturing/X3DSingleTextureCoordinateNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function X3DSingleTextureCoordinateNode (executionContext) +{ + Texturing_X3DTextureCoordinateNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DSingleTextureCoordinateNode); + + this .texCoordArray = new x_ite_Fields .MFFloat (); +} + +Object .assign (Object .setPrototypeOf (X3DSingleTextureCoordinateNode .prototype, Texturing_X3DTextureCoordinateNode .prototype), +{ + getCount () + { + return 1; + }, + init (multiArray) + { + this .texCoordArray .length = 0; + + multiArray .push (this .texCoordArray); + }, + addPoint (index, multiArray) + { + this .addPointToChannel (index, multiArray [0]); + }, + getTextureCoordinateMapping (textureCoordinateMapping, channel = 0) + { + textureCoordinateMapping .set (this ._mapping .getValue () || channel, channel); + }, + setShaderUniforms (gl, shaderObject, channel = 0) + { + gl .uniform1i (shaderObject .x3d_TextureCoordinateGeneratorMode [channel], 0); + }, +}); + +Object .defineProperties (X3DSingleTextureCoordinateNode, +{ + typeName: + { + value: "X3DSingleTextureCoordinateNode", + enumerable: true, + }, + componentName: + { + value: "Texturing", + enumerable: true, + }, +}); + +const X3DSingleTextureCoordinateNode_default_ = X3DSingleTextureCoordinateNode; +; + +x_ite_Namespace .add ("X3DSingleTextureCoordinateNode", "x_ite/Components/Texturing/X3DSingleTextureCoordinateNode", X3DSingleTextureCoordinateNode_default_); +/* harmony default export */ const Texturing_X3DSingleTextureCoordinateNode = (X3DSingleTextureCoordinateNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Texturing/TextureCoordinate.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function TextureCoordinate (executionContext) +{ + Texturing_X3DSingleTextureCoordinateNode .call (this, executionContext); + + this .addType (Base_X3DConstants .TextureCoordinate); +} + +Object .assign (Object .setPrototypeOf (TextureCoordinate .prototype, Texturing_X3DSingleTextureCoordinateNode .prototype), +{ + initialize () + { + Texturing_X3DSingleTextureCoordinateNode .prototype .initialize .call (this); + + this ._point .addInterest ("set_point__", this); + + this .set_point__ (); + }, + set_point__ () + { + this .point = this ._point .getValue (); + this .length = this ._point .length; + }, + isEmpty () + { + return this .length === 0; + }, + getSize () + { + return this .length; + }, + addPointToChannel (index, array) + { + if (index >= 0 && this .length) + { + const + point = this .point, + i = (index % this .length) * 2; + + array .push (point [i], point [i + 1], 0, 1); + } + else + { + array .push (0, 0, 0, 1); + } + }, + addPoints (array) + { + const + point = this .point, + length = this .length; + + for (let i = 0, p = 0; i < length; ++ i, p += 2) + array .push (point [p], point [p + 1], 0, 1); + + return array; + }, +}); + +Object .defineProperties (TextureCoordinate, +{ + typeName: + { + value: "TextureCoordinate", + enumerable: true, + }, + componentName: + { + value: "Texturing", + enumerable: true, + }, + containerField: + { + value: "texCoord", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "mapping", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "point", new x_ite_Fields .MFVec2f ()), + ]), + enumerable: true, + }, +}); + +const TextureCoordinate_default_ = TextureCoordinate; +; + +x_ite_Namespace .add ("TextureCoordinate", "x_ite/Components/Texturing/TextureCoordinate", TextureCoordinate_default_); +/* harmony default export */ const Texturing_TextureCoordinate = (TextureCoordinate_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Texturing/TextureCoordinateGenerator.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function TextureCoordinateGenerator (executionContext) +{ + Texturing_X3DSingleTextureCoordinateNode .call (this, executionContext); + + this .addType (Base_X3DConstants .TextureCoordinateGenerator); + + this .mode = TextureCoordinateGeneratorModeType .SPHERE; + this .parameter = new Float32Array (6); +} + +Object .assign (Object .setPrototypeOf (TextureCoordinateGenerator .prototype, Texturing_X3DSingleTextureCoordinateNode .prototype), +{ + initialize () + { + Texturing_X3DSingleTextureCoordinateNode .prototype .initialize .call (this); + + this ._mode .addInterest ("set_mode__", this); + this ._parameter .addInterest ("set_parameter__", this); + + this .set_mode__ (); + this .set_parameter__ (); + }, + set_mode__: (() => + { + const modes = new Map ([ + ["SPHERE", TextureCoordinateGeneratorModeType .SPHERE], + ["CAMERASPACENORMAL", TextureCoordinateGeneratorModeType .CAMERASPACENORMAL], + ["CAMERASPACEPOSITION", TextureCoordinateGeneratorModeType .CAMERASPACEPOSITION], + ["CAMERASPACEREFLECTIONVECTOR", TextureCoordinateGeneratorModeType .CAMERASPACEREFLECTIONVECTOR], + ["SPHERE-LOCAL", TextureCoordinateGeneratorModeType .SPHERE_LOCAL], + ["COORD", TextureCoordinateGeneratorModeType .COORD], + ["COORD-EYE", TextureCoordinateGeneratorModeType .COORD_EYE], + ["NOISE", TextureCoordinateGeneratorModeType .NOISE], + ["NOISE-EYE", TextureCoordinateGeneratorModeType .NOISE_EYE], + ["SPHERE-REFLECT", TextureCoordinateGeneratorModeType .SPHERE_REFLECT], + ["SPHERE-REFLECT-LOCAL", TextureCoordinateGeneratorModeType .SPHERE_REFLECT_LOCAL], + ]); + + return function () + { + this .mode = modes .get (this ._mode .getValue ()); + + if (this .mode === undefined) + this .mode = TextureCoordinateGeneratorModeType .SPHERE; + }; + })(), + set_parameter__ () + { + const length = Math .min (this .parameter .length, this ._parameter .length) + + for (let i = 0; i < length; ++ i) + this .parameter [i] = this ._parameter [i]; + + this .parameter .fill (0, length); + }, + addPointToChannel (index, array) + { + array .push (0, 0, 0, 1); + }, + addPoints (array) + { + return array; + }, + setShaderUniforms (gl, shaderObject, channel = 0) + { + gl .uniform1i (shaderObject .x3d_TextureCoordinateGeneratorMode [channel], this .mode); + gl .uniform1fv (shaderObject .x3d_TextureCoordinateGeneratorParameter [channel], this .parameter); + }, +}); + +Object .defineProperties (TextureCoordinateGenerator, +{ + typeName: + { + value: "TextureCoordinateGenerator", + enumerable: true, + }, + componentName: + { + value: "Texturing", + enumerable: true, + }, + containerField: + { + value: "texCoord", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "mapping", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "mode", new x_ite_Fields .SFString ("SPHERE")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "parameter", new x_ite_Fields .MFFloat ()), + ]), + enumerable: true, + }, +}); + +const TextureCoordinateGenerator_default_ = TextureCoordinateGenerator; +; + +x_ite_Namespace .add ("TextureCoordinateGenerator", "x_ite/Components/Texturing/TextureCoordinateGenerator", TextureCoordinateGenerator_default_); +/* harmony default export */ const Texturing_TextureCoordinateGenerator = (TextureCoordinateGenerator_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Texturing/TextureProperties.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +function TextureProperties (executionContext) +{ + Core_X3DNode .call (this, executionContext); + + this .addType (Base_X3DConstants .TextureProperties); + + if (executionContext .getSpecificationVersion () <= 3.3) + { + this ._minificationFilter = "DEFAULT"; + this ._magnificationFilter = "DEFAULT"; + this ._textureCompression = "DEFAULT"; + } +} + +Object .assign (Object .setPrototypeOf (TextureProperties .prototype, Core_X3DNode .prototype), +{ + getBorderWidth () + { + // https://stackoverflow.com/questions/27760277/webgl-border-color-shader?lq=1 + return Math_Algorithm .clamp (this ._borderWidth .getValue (), 0, 1); + }, + getBoundaryMode: (() => + { + const boundaryModes = new Map ([ + ["CLAMP", "CLAMP_TO_EDGE"], // "CLAMP" + ["CLAMP_TO_EDGE", "CLAMP_TO_EDGE"], + ["CLAMP_TO_BOUNDARY", "CLAMP_TO_EDGE"], // "CLAMP_TO_BORDER" + ["MIRRORED_REPEAT", "MIRRORED_REPEAT"], + ["REPEAT", "REPEAT"], + ]); + + return function (string) + { + const boundaryMode = boundaryModes .get (string); + + if (boundaryMode !== undefined) + return boundaryMode; + + return "REPEAT"; + }; + })(), + getBoundaryModeS () + { + return this .getBoundaryMode (this ._boundaryModeS .getValue ()); + }, + getBoundaryModeT () + { + return this .getBoundaryMode (this ._boundaryModeT .getValue ()); + }, + getBoundaryModeR () + { + return this .getBoundaryMode (this ._boundaryModeR .getValue ()); + }, + getMinificationFilter: (() => + { + const minificationFilters = new Map ([ + ["AVG_PIXEL_AVG_MIPMAP", "LINEAR_MIPMAP_LINEAR"], + ["AVG_PIXEL", "LINEAR"], + ["AVG_PIXEL_NEAREST_MIPMAP", "LINEAR_MIPMAP_NEAREST"], + ["NEAREST_PIXEL_AVG_MIPMAP", "NEAREST_MIPMAP_LINEAR"], + ["NEAREST_PIXEL_NEAREST_MIPMAP", "NEAREST_MIPMAP_NEAREST"], + ["NEAREST_PIXEL", "NEAREST"], + ["NICEST", "LINEAR_MIPMAP_LINEAR"], + ["FASTEST", "NEAREST"], + ]); + + return function () + { + if (this ._generateMipMaps .getValue ()) + { + const minificationFilter = minificationFilters .get (this ._minificationFilter .getValue ()); + + if (minificationFilter !== undefined) + return minificationFilter; + + return this .getBrowser () .getDefaultTextureProperties () .getMinificationFilter (); + } + + return "LINEAR"; + }; + })(), + getMagnificationFilter: (() => + { + const magnificationFilters = new Map ([ + ["AVG_PIXEL", "LINEAR"], + ["NEAREST_PIXEL", "NEAREST"], + ["NICEST", "LINEAR"], + ["FASTEST", "NEAREST"], + ]); + + return function () + { + const magnificationFilter = magnificationFilters .get (this ._magnificationFilter .getValue ()); + + if (magnificationFilter !== undefined) + return magnificationFilter; + + // DEFAULT + return this .getBrowser () .getDefaultTextureProperties () .getMagnificationFilter (); + }; + })(), + getTextureCompression: (() => + { + const textureCompressions = new Map ([ + ["DEFAULT", "RGBA"], + ["NICEST", "RGBA"], + ["FASTEST", "RGBA"], + ["LOW", "RGBA"], + ["MEDIUM", "RGBA"], + ["HIGH", "RGBA"], + ]); + + return function () + { + const + browser = this .getBrowser (), + gl = browser .getContext (), + compressedTexture = gl .getExtension ("WEBGL_compressed_texture_etc"), // TODO: find suitable compression. + textureCompression = compressedTexture ? compressedTexture [textureCompressions .get (this ._textureCompression .getValue ())] : undefined; + + if (textureCompression !== undefined) + return textureCompression; + + // DEFAULT + return gl .RGBA; + }; + })(), +}); + +Object .defineProperties (TextureProperties, +{ + typeName: + { + value: "TextureProperties", + enumerable: true, + }, + componentName: + { + value: "Texturing", + enumerable: true, + }, + containerField: + { + value: "textureProperties", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["3.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "borderColor", new x_ite_Fields .SFColorRGBA ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "borderWidth", new x_ite_Fields .SFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "anisotropicDegree", new x_ite_Fields .SFFloat (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "generateMipMaps", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "minificationFilter", new x_ite_Fields .SFString ("FASTEST")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "magnificationFilter", new x_ite_Fields .SFString ("FASTEST")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "boundaryModeS", new x_ite_Fields .SFString ("REPEAT")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "boundaryModeT", new x_ite_Fields .SFString ("REPEAT")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "boundaryModeR", new x_ite_Fields .SFString ("REPEAT")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "textureCompression", new x_ite_Fields .SFString ("FASTEST")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "texturePriority", new x_ite_Fields .SFFloat ()), + ]), + enumerable: true, + }, +}); + +const TextureProperties_default_ = TextureProperties; +; + +x_ite_Namespace .add ("TextureProperties", "x_ite/Components/Texturing/TextureProperties", TextureProperties_default_); +/* harmony default export */ const Texturing_TextureProperties = (TextureProperties_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Texturing/X3DSingleTextureTransformNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function X3DSingleTextureTransformNode (executionContext) +{ + Texturing_X3DTextureTransformNode .call (this, executionContext); + + this .addType (Base_X3DConstants .X3DSingleTextureTransformNode); + + this .matrixArray = new Float32Array (Numbers_Matrix4 .Identity); +} + +Object .assign (Object .setPrototypeOf (X3DSingleTextureTransformNode .prototype, Texturing_X3DTextureTransformNode .prototype), +{ + getCount () + { + return 1; + }, + setMatrix (value) + { + this .matrixArray .set (value); + }, + getTextureTransformMapping (textureTransformMapping, channel = 0) + { + textureTransformMapping .set (this ._mapping .getValue () || channel, channel); + }, + setShaderUniforms (gl, shaderObject, channel = 0) + { + gl .uniformMatrix4fv (shaderObject .x3d_TextureMatrix [channel], false, this .matrixArray); + }, + transformPoint (texCoord) + { + return Numbers_Matrix4 .prototype .multVecMatrix .call (this .matrixArray, texCoord); + }, +}); + +Object .defineProperties (X3DSingleTextureTransformNode, +{ + typeName: + { + value: "X3DSingleTextureTransformNode", + enumerable: true, + }, + componentName: + { + value: "Texturing", + enumerable: true, + }, +}); + +const X3DSingleTextureTransformNode_default_ = X3DSingleTextureTransformNode; +; + +x_ite_Namespace .add ("X3DSingleTextureTransformNode", "x_ite/Components/Texturing/X3DSingleTextureTransformNode", X3DSingleTextureTransformNode_default_); +/* harmony default export */ const Texturing_X3DSingleTextureTransformNode = (X3DSingleTextureTransformNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Texturing/TextureTransform.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + +function TextureTransform (executionContext) +{ + Texturing_X3DSingleTextureTransformNode .call (this, executionContext); + + this .addType (Base_X3DConstants .TextureTransform); + + this ._rotation .setUnit ("angle"); + + this .matrix = new Numbers_Matrix4 (); +} + +Object .assign (Object .setPrototypeOf (TextureTransform .prototype, Texturing_X3DSingleTextureTransformNode .prototype), +{ + initialize () + { + Texturing_X3DSingleTextureTransformNode .prototype .initialize .call (this); + + this .addInterest ("eventsProcessed", this); + + this .eventsProcessed (); + }, + getMatrix () + { + return this .matrix; + }, + eventsProcessed: (() => + { + const + vector = new Numbers_Vector2 (0, 0), + matrix3 = new Numbers_Matrix3 (); + + return function () + { + const + translation = this ._translation .getValue (), + rotation = this ._rotation .getValue (), + scale = this ._scale .getValue (), + center = this ._center .getValue (), + matrix4 = this .matrix; + + matrix3 .identity (); + + if (! center .equals (Numbers_Vector2 .Zero)) + matrix3 .translate (vector .assign (center) .negate ()); + + if (! scale .equals (Numbers_Vector2 .One)) + matrix3 .scale (scale); + + if (rotation !== 0) + matrix3 .rotate (rotation); + + if (! center .equals (Numbers_Vector2 .Zero)) + matrix3 .translate (center); + + if (! translation .equals (Numbers_Vector2 .Zero)) + matrix3 .translate (translation); + + matrix4 [ 0] = matrix3 [0]; + matrix4 [ 1] = matrix3 [1]; + matrix4 [ 4] = matrix3 [3]; + matrix4 [ 5] = matrix3 [4]; + matrix4 [12] = matrix3 [6]; + matrix4 [13] = matrix3 [7]; + + this .setMatrix (matrix4); + }; + })(), +}); + +Object .defineProperties (TextureTransform, +{ + typeName: + { + value: "TextureTransform", + enumerable: true, + }, + componentName: + { + value: "Texturing", + enumerable: true, + }, + containerField: + { + value: "textureTransform", + enumerable: true, + }, + specificationRange: + { + value: Object .freeze (["2.0", "Infinity"]), + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "metadata", new x_ite_Fields .SFNode ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "mapping", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "translation", new x_ite_Fields .SFVec2f ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "rotation", new x_ite_Fields .SFFloat ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "scale", new x_ite_Fields .SFVec2f (1, 1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "center", new x_ite_Fields .SFVec2f ()), + ]), + enumerable: true, + }, +}); + +const TextureTransform_default_ = TextureTransform; +; + +x_ite_Namespace .add ("TextureTransform", "x_ite/Components/Texturing/TextureTransform", TextureTransform_default_); +/* harmony default export */ const Texturing_TextureTransform = (TextureTransform_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Texturing.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + + + + +const Texturing_default_ = { + name: "Texturing", + concreteNodes: + [ + Texturing_ImageTexture, + Texturing_MovieTexture, + Texturing_MultiTexture, + Texturing_MultiTextureCoordinate, + Texturing_MultiTextureTransform, + Texturing_PixelTexture, + Texturing_TextureCoordinate, + Texturing_TextureCoordinateGenerator, + Texturing_TextureProperties, + Texturing_TextureTransform, + ], + abstractNodes: + [ + Texturing_X3DSingleTextureCoordinateNode, + Texturing_X3DSingleTextureNode, + Texturing_X3DSingleTextureTransformNode, + Texturing_X3DTexture2DNode, + Texturing_X3DTextureCoordinateNode, + Texturing_X3DTextureNode, + Texturing_X3DTextureTransformNode, + ], +}; +; + +x_ite_Namespace .add ("Texturing", "x_ite/Components/Texturing", Texturing_default_); +/* harmony default export */ const Texturing = (Texturing_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components/Time.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +const Time_default_ = { + name: "Time", + concreteNodes: + [ + Time_TimeSensor, + ], + abstractNodes: + [ + Time_X3DTimeDependentNode, + ], +}; +; + +x_ite_Namespace .add ("Time", "x_ite/Components/Time", Time_default_); +/* harmony default export */ const Time = (Time_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Core/Context.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +const extensions = [ + "ANGLE_instanced_arrays", + "EXT_blend_minmax", + "EXT_frag_depth", + "EXT_shader_texture_lod", + "EXT_texture_filter_anisotropic", + "OES_element_index_uint", + "OES_standard_derivatives", + "OES_texture_float", + "OES_texture_float_linear", + "OES_texture_half_float", + "OES_texture_half_float_linear", + "OES_vertex_array_object", + "WEBGL_compressed_texture_s3tc", + //"WEBGL_debug_renderer_info", + "WEBGL_debug_shaders", + "WEBGL_depth_texture", + "WEBGL_draw_buffers", + "WEBGL_lose_context", + + "EXT_color_buffer_float", + "EXT_color_buffer_half_float", + "EXT_disjoint_timer_query", + "EXT_disjoint_timer_query_webgl2", + "EXT_sRGB", + "WEBGL_color_buffer_float", + "WEBGL_compressed_texture_astc", + "WEBGL_compressed_texture_atc", + "WEBGL_compressed_texture_etc", + "WEBGL_compressed_texture_etc1", + "WEBGL_compressed_texture_pvrtc", + "WEBGL_compressed_texture_s3tc", + "WEBGL_compressed_texture_s3tc_srgb", + + "EXT_float_blend", + "OES_fbo_render_mipmap", + "WEBGL_get_buffer_sub_data_async", + "WEBGL_multiview", + "WEBGL_security_sensitive_resources", + "WEBGL_shared_resources", + + "EXT_clip_cull_distance", + "WEBGL_debug", + "WEBGL_dynamic_texture", + "WEBGL_subarray_uploads", + "WEBGL_texture_multisample", + "WEBGL_texture_source_iframe", + "WEBGL_video_texture", + + "EXT_texture_storage", + "OES_depth24", + "WEBGL_debug_shader_precision", + "WEBGL_draw_elements_no_range_check", + "WEBGL_subscribe_uniform", + "WEBGL_texture_from_depth_video", +]; + +const Context = +{ + create (canvas, version, preserveDrawingBuffer, mobile) + { + const options = { preserveDrawingBuffer: preserveDrawingBuffer }; + + let gl = null; + + if (version >= 2 && !gl) + { + gl = canvas .getContext ("webgl2", { ... options, antialias: false }); + + if (gl) + gl .getVersion = () => 2; + } + + if (version >= 1 && !gl) + { + gl = canvas .getContext ("webgl", options) || + canvas .getContext ("experimental-webgl", options); + + if (gl) + { + gl .getVersion = () => 1; + + { + const ext = gl .getExtension ("OES_vertex_array_object"); + + gl .bindVertexArray = ext .bindVertexArrayOES .bind (ext); + gl .createVertexArray = ext .createVertexArrayOES .bind (ext); + gl .deleteVertexArray = ext .deleteVertexArrayOES .bind (ext); + gl .isVertexArray = ext .isVertexArrayOES .bind (ext); + } + } + } + + if (!gl) + throw new Error ("Couldn't create WebGL context."); + + // Load extensions. + + for (const extension of extensions) + gl .getExtension (extension); + + // Feature detection: + + // If the aliased lineWidth ranges are both 1, gl .lineWidth is probably not possible, + // thus we disable it completely to prevent webgl errors. + + const aliasedLineWidthRange = gl .getParameter (gl .ALIASED_LINE_WIDTH_RANGE); + + if (aliasedLineWidthRange [0] === 1 && aliasedLineWidthRange [1] === 1) + { + gl .lineWidth = Function .prototype; + gl .HAS_FEATURE_TRANSFORMED_LINES = gl .getVersion () >= 2; + + if (DEVELOPMENT) + console .info ("Lines are transformed if necessary to obtain thick lines."); + } + else + { + gl .HAS_FEATURE_TRANSFORMED_LINES = false; + } + + gl .HAS_FEATURE_DEPTH_TEXTURE = gl .getVersion () >= 2 || !! gl .getExtension ("WEBGL_depth_texture"); + gl .HAS_FEATURE_FRAG_DEPTH = gl .getVersion () >= 2 || !! gl .getExtension ("EXT_frag_depth"); + + if (gl .getVersion () === 1) + { + const + color_buffer_float = gl .getExtension ("WEBGL_color_buffer_float"), + draw_buffers = gl .getExtension ("WEBGL_draw_buffers"); + + gl .RGBA32F = color_buffer_float .RGBA32F_EXT; + gl .MAX_COLOR_ATTACHMENTS = draw_buffers .MAX_COLOR_ATTACHMENTS_WEBGL; + gl .drawBuffers = draw_buffers .drawBuffersWEBGL .bind (draw_buffers); + + for (let i = 0, length = gl .getParameter(gl .MAX_COLOR_ATTACHMENTS); i < length; ++ i) + { + const COLOR_ATTACHMENTi = draw_buffers .COLOR_ATTACHMENT0_WEBGL + i; + + if (gl [`COLOR_ATTACHMENT${i}`] === undefined) + gl [`COLOR_ATTACHMENT${i}`] = COLOR_ATTACHMENTi; + } + } + + if (mobile) + { + const color_buffer_half_float = gl .getExtension ("EXT_color_buffer_half_float"); + + Object .defineProperty (gl, "RGBA32F", + { + value: gl .getVersion () === 1 ? color_buffer_half_float .RGBA16F_EXT : gl .RGBA16F, + }); + } + + // Async functions + + Object .assign (gl, gl .getVersion () === 1 + ? + { + readPixelsAsync: gl .readPixels, + } + : + { + clientWaitAsync (sync, flags, timeout) + { + return new Promise ((resolve, reject) => + { + const check = () => + { + const result = this .clientWaitSync (sync, flags, 0); + + switch (result) + { + case this .WAIT_FAILED: + { + reject (new Error ("clientWaitSync: WAIT_FAILED")); + return; + } + case this .TIMEOUT_EXPIRED: + { + setTimeout (check, timeout); + return; + } + default: + { + resolve (); + return; + } + } + }; + + setTimeout (check); + }); + }, + getBufferSubDataAsync: async function (target, buffer, srcByteOffset, dstBuffer, /* optional */ dstOffset, /* optional */ length) + { + const sync = this .fenceSync (this .SYNC_GPU_COMMANDS_COMPLETE, 0); + + this .flush (); + + await this .clientWaitAsync (sync, 0, 10); + + this .deleteSync (sync); + + this .bindBuffer (target, buffer); + this .getBufferSubData (target, srcByteOffset, dstBuffer, dstOffset, length); + this .bindBuffer (target, null); + }, + readPixelsAsync: async function (x, y, w, h, format, type, dest, dstOffset) + { + const buffer = this .createBuffer (); + + this .bindBuffer (this .PIXEL_PACK_BUFFER, buffer); + this .bufferData (this .PIXEL_PACK_BUFFER, dest .byteLength, this .STREAM_READ); + this .readPixels (x, y, w, h, format, type, 0); + this .bindBuffer (this .PIXEL_PACK_BUFFER, null); + + await this .getBufferSubDataAsync (this .PIXEL_PACK_BUFFER, buffer, 0, dest, dstOffset); + + this .deleteBuffer (buffer); + }, + }); + + // Return context. + + return gl; + }, +} + +const Context_default_ = Context; +; + +x_ite_Namespace .add ("Context", "x_ite/Browser/Core/Context", Context_default_); +/* harmony default export */ const Core_Context = (Context_default_); +;// CONCATENATED MODULE: ./src/locale/de.po.js +const de_po_default_ = `msgid "" +msgstr "" +"Project-Id-Version: X_ITE\n" +"POT-Creation-Date: 2015-12-23 04:56+0100\n" +"PO-Revision-Date: 2015-12-23 04:57+0100\n" +"Last-Translator: Holger Seelig \n" +"Language-Team: \n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.4\n" +"X-Poedit-Basepath: ../x_ite\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Poedit-SearchPath-0: .\n" + +msgid "Less Properties" +msgstr "Weniger Eigenschaften" + +msgid "More Properties" +msgstr "Mehr Eigenschaften" + +msgid "Frame rate" +msgstr "Bildrate" + +msgid "fps" +msgstr "BpS" + +msgid "Speed" +msgstr "Geschwindigkeit" + +msgid "m/s" +msgstr "" + +msgid "km/h" +msgstr "" + +msgid "Browser" +msgstr "" + +msgid "ms" +msgstr "" + +msgid "X3D total" +msgstr "X3D gesamt" + +msgid "Event Processing" +msgstr "Ereignisverarbeitung" + +msgid "Pointer" +msgstr "Zeigegerät" + +msgid "Camera" +msgstr "Kamera" + +msgid "Collision Detection" +msgstr "Kollisionserkennung" + +msgid "Rendering" +msgstr "Rendering" + +msgid "Number of Shapes" +msgstr "Anzahl der Formen" + +msgid "Number of Sensors" +msgstr "Anzahl der Sensoren" + +msgid "Browser Timings" +msgstr "Zeitberechnung" + +msgid "X_ITE Browser" +msgstr "" + +msgid "Viewpoints" +msgstr "Ansichtspunkte" + +msgid "Available Viewers" +msgstr "Verfügbare Betrachter" + +msgid "Straighten Horizon" +msgstr "Horizont gerade richten" + +msgid "Primitive Quality" +msgstr "Qualität der Grundobjekte" + +msgid "High" +msgstr "Hoch" + +msgid "high" +msgstr "hoch" + +msgid "Medium" +msgstr "Mittel" + +msgid "medium" +msgstr "mittel" + +msgid "Low" +msgstr "Niedrig" + +msgid "low" +msgstr "niedrig" + +msgid "Texture Quality" +msgstr "Textur Qualität" + +msgid "Display Rubberband" +msgstr "Gummiband anzeigen" + +msgid "Rubberband" +msgstr "Gummiband" + +msgid "on" +msgstr "an" + +msgid "off" +msgstr "aus" + +msgid "Mute Browser" +msgstr "Browser stumm schalten" + +msgid "Browser muted" +msgstr "Browser stumm geschalten" + +msgid "Browser unmuted" +msgstr "Browser Ton an" + +msgid "Leave Fullscreen" +msgstr "Vollbild verlassen" + +msgid "Fullscreen" +msgstr "Vollbild" + +msgid "About X_ITE" +msgstr "Über X_ITE" + +msgid "Examine Viewer" +msgstr "Untersuchen" + +msgid "Walk Viewer" +msgstr "Laufen" + +msgid "Fly Viewer" +msgstr "Fliegen" + +msgid "Plane Viewer" +msgstr "Ebenen Betrachter" + +msgid "Look At Viewer" +msgstr "Auf Objekte zielen" + +msgid "None Viewer" +msgstr "Kein Betrachter" + +msgid "Points" +msgstr "Punkte" + +msgid "Flat" +msgstr "Flach" + +msgid "Wireframe" +msgstr "Drahtgittermodel" + +msgid "Loading %1 file" +msgstr "Lade %1 Datei" + +msgid "Loading %1 files" +msgstr "Lade %1 Dateien" + +msgid "Loading done" +msgstr "Fertig mit Laden" + +msgid "Failed loading world." +msgstr "Laden der Dateien fehlgeschlagen." + +msgid "Show World Info" +msgstr "World Info anzeigen" + +msgid "Viewpoint is copied to clipboard." +msgstr "Ansichtspunkt wurde in die Zwischenablage kopiert." +`; +; + +x_ite_Namespace .add ("de.po", "locale/de.po", de_po_default_); +/* harmony default export */ const de_po = (de_po_default_); +;// CONCATENATED MODULE: ./src/locale/fr.po.js +const fr_po_default_ = `msgid "" +msgstr "" +"Project-Id-Version: X_ITE\n" +"POT-Creation-Date: 2015-12-23 04:58+0100\n" +"PO-Revision-Date: 2015-12-23 05:07+0100\n" +"Last-Translator: Holger Seelig \n" +"Language-Team: \n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.4\n" +"X-Poedit-Basepath: ../x_ite\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Poedit-SearchPath-0: .\n" + +msgid "Less Properties" +msgstr "Moins de Propriétés" + +msgid "More Properties" +msgstr "Plus de Propriétés" + +msgid "Frame rate" +msgstr "Fréquence d'Images" + +msgid "fps" +msgstr "fps" + +msgid "Speed" +msgstr "Vélocité" + +msgid "m/s" +msgstr "" + +msgid "km/h" +msgstr "" + +msgid "Browser" +msgstr "X_ITE Navigateur" + +msgid "ms" +msgstr "" + +msgid "X3D total" +msgstr "X3D total" + +msgid "Event Processing" +msgstr "Traitement des Événements" + +msgid "Pointer" +msgstr "Pointeur" + +msgid "Camera" +msgstr "Caméra" + +msgid "Collision Detection" +msgstr "Détection des Collisions" + +msgid "Rendering" +msgstr "Rendement" + +msgid "Number of Shapes" +msgstr "Nombre de Formes" + +msgid "Number of Sensors" +msgstr "Nombre de Senseurs" + +msgid "Browser Timings" +msgstr "Calcul du Temps" + +msgid "X_ITE Browser" +msgstr "X_ITE Navigateur" + +msgid "Viewpoints" +msgstr "Points de Vue" + +msgid "Available Viewers" +msgstr "Visionneurs disponibles" + +msgid "Straighten Horizon" +msgstr "Redresser l'Horizon" + +msgid "Primitive Quality" +msgstr "Qualité des Objets simples" + +msgid "High" +msgstr "Haut" + +msgid "high" +msgstr "haut" + +msgid "Medium" +msgstr "Moyenne" + +msgid "medium" +msgstr "moyenne" + +msgid "Low" +msgstr "Faible" + +msgid "low" +msgstr "faible" + +msgid "Texture Quality" +msgstr "Qualité des Textures" + +msgid "Display Rubberband" +msgstr "Présenter le Bande élastique" + +msgid "Rubberband" +msgstr "Bande élastique" + +msgid "on" +msgstr "marche" + +msgid "off" +msgstr "arrêt" + +msgid "Mute Browser" +msgstr "Rendre Navigateur muet" + +msgid "Browser muted" +msgstr "Navigateur muet" + +msgid "Browser unmuted" +msgstr "Son de Navigateur réactivé" + +msgid "Leave Fullscreen" +msgstr "Laisser le plein Écran" + +msgid "Fullscreen" +msgstr "Plein Écran" + +msgid "About X_ITE" +msgstr "À propos de X_ITE" + +msgid "Examine Viewer" +msgstr "Examiner" + +msgid "Walk Viewer" +msgstr "Aller" + +msgid "Fly Viewer" +msgstr "Voler" + +msgid "Plane Viewer" +msgstr "Visionneur de la Plaine" + +msgid "Look At Viewer" +msgstr "Regarder un Objet de près" + +msgid "None Viewer" +msgstr "Pas de Visionneur" + +msgid "Flat" +msgstr "Plat" + +msgid "Wireframe" +msgstr "Image filaire" + +msgid "Loading %1 file" +msgstr "Télécharger %1 Fichier" + +msgid "Loading %1 files" +msgstr "Télécharger %1 Fichiers" + +msgid "Loading done" +msgstr "Téléchargement fini" + +msgid "Failed loading world." +msgstr "Le chargement des Fichiers a échoué." + +msgid "Show World Info" +msgstr "Afficher World Info" + +msgid "Viewpoint is copied to clipboard." +msgstr "Le point de Vue est copié dans le Presse-Papiers." +`; +; + +x_ite_Namespace .add ("fr.po", "locale/fr.po", fr_po_default_); +/* harmony default export */ const fr_po = (fr_po_default_); +;// CONCATENATED MODULE: ./src/locale/gettext.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function execAll (regex, string) +{ + const matches = [ ]; + + let match = null; + + while (match = regex .exec (string)) + matches .push (match); + + return matches; +} + +function getLanguage () +{ + for (const value of navigator .languages) + { + const language = value .split ("-") [0]; + + if (locales [language]) + return language; + } + + return (navigator .language || navigator .userLanguage) .split ("-") [0]; +} + +function setLocale (language) +{ + if (locales [language]) + { + const + matches = execAll (msg, locales [language]), + locale = locales [language] = { }; + + for (var i = 0, length = matches .length; i < length; ++ i) + { + if (matches [i] [2] .length) + locale [matches [i] [1]] = matches [i] [2]; + } + } +} + +const locales = +{ + en: "C", + de: de_po, + fr: fr_po, +}; + +const + msg = /msgid\s+"(.*?)"\nmsgstr\s+"(.*?)"\n/g, + language = getLanguage (); + +setLocale (language); + +function gettext (string) +{ + const locale = locales [language]; + + if (locale === undefined) + return string; + + const translation = locale [string]; + + if (translation === undefined) + return string; + + return translation; +} + +const gettext_default_ = gettext; +; + +x_ite_Namespace .add ("gettext", "locale/gettext", gettext_default_); +/* harmony default export */ const locale_gettext = (gettext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Core/BrowserTimings.js +/* provided dependency */ var BrowserTimings_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function BrowserTimings (executionContext) +{ + Base_X3DBaseNode .call (this, executionContext); + + this .localStorage = this .getBrowser () .getLocalStorage () .addNameSpace ("BrowserTimings."); + this .fps = new Time_StopWatch (); +} + +Object .assign (Object .setPrototypeOf (BrowserTimings .prototype, Base_X3DBaseNode .prototype), +{ + initialize () + { + Base_X3DBaseNode .prototype .initialize .call (this); + + this .getBrowser () .getBrowserOptions () ._Timings .addInterest ("set_enabled__", this); + + this .localStorage .setDefaultValues ({ type: "LESS" }); + + this .element = BrowserTimings_$("
") + .hide () + .addClass ("x_ite-private-browser-timings") + .appendTo (this .getBrowser () .getSurface ()); + + this .table = BrowserTimings_$("
") + .appendTo (this .element); + + this .header = BrowserTimings_$("") + .append (BrowserTimings_$("") + .append (BrowserTimings_$("") + .text (locale_gettext("Browser Timings")))) + .appendTo (this .table); + + this .body = BrowserTimings_$("") + .appendTo (this .table); + + this .footer = BrowserTimings_$("") + .append (BrowserTimings_$("") + .append (BrowserTimings_$(""))) + .appendTo (this .table); + + this .button = BrowserTimings_$("") + .attr ("type", "button") + .appendTo (this .footer .find ("td")); + + this .frameRate = BrowserTimings_$(""); + this .speed = BrowserTimings_$(""); + this .frameRate = BrowserTimings_$(""); + this .speed = BrowserTimings_$(""); + this .browserTime = BrowserTimings_$(""); + this .x3dTotal = BrowserTimings_$(""); + this .eventProcessing = BrowserTimings_$(""); + this .pointerTime = BrowserTimings_$(""); + this .cameraTime = BrowserTimings_$(""); + this .pickingTime = BrowserTimings_$(""); + this .collisionTime = BrowserTimings_$(""); + this .renderTime = BrowserTimings_$(""); + this .numShapes = BrowserTimings_$(""); + this .sensors = BrowserTimings_$(""); + + this .body .append (BrowserTimings_$("") + .append (BrowserTimings_$("") .text (locale_gettext("Frame rate") + ":")) + .append (this .frameRate)); + + this .body .append (BrowserTimings_$("") + .append (BrowserTimings_$("") .text (locale_gettext("Speed") + ":")) + .append (this .speed) + .addClass ("x_ite-private-more")); + + this .body .append (BrowserTimings_$("") + .append (BrowserTimings_$("") .text (locale_gettext("Browser") + ":")) + .append (this .browserTime)); + + this .body .append (BrowserTimings_$("") + .append (BrowserTimings_$("") .text (locale_gettext("X3D total") + ":")) + .append (this .x3dTotal)); + + this .body .append (BrowserTimings_$("") + .append (BrowserTimings_$("") .text (locale_gettext("Event Processing") + ":")) + .append (this .eventProcessing)); + + this .body .append (BrowserTimings_$("") + .append (BrowserTimings_$("") .text (locale_gettext("Pointer") + ":")) + .append (this .pointerTime)); + + this .body .append (BrowserTimings_$("") + .append (BrowserTimings_$("") .text (locale_gettext("Camera") + ":")) + .append (this .cameraTime)); + + this .body .append (BrowserTimings_$("") + .append (BrowserTimings_$("") .text (locale_gettext("Picking") + ":")) + .append (this .pickingTime)); + + this .body .append (BrowserTimings_$("") + .append (BrowserTimings_$("") .text (locale_gettext("Collision Detection") + ":")) + .append (this .collisionTime)); + + this .body .append (BrowserTimings_$("") + .append (BrowserTimings_$("") .text (locale_gettext("Rendering") + ":")) + .append (this .renderTime)); + + this .body .append (BrowserTimings_$("") + .append (BrowserTimings_$("") .text (locale_gettext("Number of Shapes") + ":")) + .append (this .numShapes)); + + this .body .append (BrowserTimings_$("") + .append (BrowserTimings_$("") .text (locale_gettext("Number of Sensors") + ":")) + .append (this .sensors)); + + this .button .on ("click touchend", this .set_type__ .bind (this)); + + this .localStorage .type = this .localStorage .type === "MORE" ? "LESS" : "MORE"; + + this .set_type__ (); + }, + set_enabled__ () + { + if (this .getBrowser () .getBrowserOption ("Timings")) + { + this .element .stop (true, true) .fadeIn (); + this .fps .reset (); + this .getBrowser () .prepareEvents () .addInterest ("update", this); + this .update (); + this .build (); + } + else + { + this .element .stop (true, true) .fadeOut (); + this .getBrowser () .prepareEvents () .removeInterest ("update", this); + } + }, + set_type__ () + { + if (this .localStorage .type === "MORE") + { + this .localStorage .type = "LESS"; + this .table .addClass ("less"); + this .table .removeClass ("more"); + } + else + { + this .localStorage .type = "MORE"; + this .table .addClass ("more"); + this .table .removeClass ("less"); + } + + this .set_button__ (); + this .build (); + }, + set_button__ () + { + if (this .localStorage .type === "MORE") + this .button .text (locale_gettext("Less Properties")); + else + this .button .text (locale_gettext("More Properties")); + }, + update () + { + this .fps .stop () + + if (this .fps .elapsedTime > 1000) + { + this .build (); + this .fps .reset (); + } + + this .fps .start (); + }, + build () + { + const browser = this .getBrowser (); + + this .frameRate .text (`${f2 (1000 / this .fps .averageTime)} ${locale_gettext("fps")}`); + this .speed .text (`${f2 (this .getSpeed (browser .currentSpeed))} ${this .getSpeedUnit (browser .currentSpeed)}`); + + if (this .localStorage .type !== "MORE" || !browser .getWorld ()) + return; + + const + layers = browser .getWorld () .getLayerSet () .getLayers (), + activeLayer = browser .getActiveLayer (), + navigationTime = activeLayer && browser .getCollisionCount () ? activeLayer .getCollisionTime () .averageTime : 0, + collisionTime = browser .getCollisionTime () .averageTime + navigationTime, + routingTime = Math .max (0, browser .getBrowserTime () .averageTime - (browser .getCameraTime () .averageTime + browser .getCollisionTime () .averageTime + browser .getDisplayTime () .averageTime)), + prepareEvents = browser .prepareEvents () .getInterests () .size - 1, + sensors = browser .sensorEvents () .getInterests () .size, + opaqueShapes = layers .reduce ((n, layer) => n + layer .getNumOpaqueShapes (), 0), + transparentShapes = layers .reduce ((n, layer) => n + layer .getNumTransparentShapes (), 0); + + this .browserTime .text (`${f2 (browser .getSystemTime () .averageTime)} ${locale_gettext("ms")}`); + this .x3dTotal .text (`${f2 (browser .getBrowserTime () .averageTime)} ${locale_gettext("ms")}`); + this .eventProcessing .text (`${f2 (routingTime)} ${locale_gettext("ms")}`); + this .pointerTime .text (`${f2 (browser .getPointingTime () .averageTime)} ${locale_gettext("ms")}`); + this .cameraTime .text (`${f2 (browser .getCameraTime () .averageTime)} ${locale_gettext("ms")}`); + this .pickingTime .text (`${f2 (browser .getPickingTime () .averageTime)} ${locale_gettext("ms")}`); + this .collisionTime .text (`${f2 (collisionTime)} ${locale_gettext("ms")}`); + this .renderTime .text (`${f2 (browser .getDisplayTime () .averageTime)} ${locale_gettext("ms")}`); + this .numShapes .text (`${opaqueShapes} + ${transparentShapes}`); + this .sensors .text (prepareEvents + sensors); + + browser .getSystemTime () .reset (); + browser .getBrowserTime () .reset (); + browser .getPointingTime () .reset (); + browser .getCameraTime () .reset (); + browser .getPickingTime () .reset (); + browser .getCollisionTime () .reset (); + browser .getDisplayTime () .reset (); + + activeLayer ?.getCollisionTime () .reset (); + }, + getSpeed (speed) + { + if (speed < 15) + return speed; + + return speed * 3.6; + }, + getSpeedUnit (speed) + { + if (speed < 15) + return locale_gettext("m/s"); + + return locale_gettext("km/h"); + }, +}); + +Object .defineProperties (BrowserTimings, +{ + typeName: + { + value: "BrowserTimings", + enumerable: true, + }, +}); + +const f2 = (() => +{ + const format = new Intl .NumberFormat (navigator .language || navigator .userLanguage, { + notation: "standard", + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }) .format; + + return function (value) + { + return format (Number .isFinite (value) ? value : 0); + }; +})(); + +const BrowserTimings_default_ = BrowserTimings; +; + +x_ite_Namespace .add ("BrowserTimings", "x_ite/Browser/Core/BrowserTimings", BrowserTimings_default_); +/* harmony default export */ const Core_BrowserTimings = (BrowserTimings_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Core/PrimitiveQuality.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +let PrimitiveQuality_i = 0; + +const PrimitiveQuality = +{ + LOW: PrimitiveQuality_i ++, + MEDIUM: PrimitiveQuality_i ++, + HIGH: PrimitiveQuality_i ++, +}; + +const PrimitiveQuality_default_ = PrimitiveQuality; +; + +x_ite_Namespace .add ("PrimitiveQuality", "x_ite/Browser/Core/PrimitiveQuality", PrimitiveQuality_default_); +/* harmony default export */ const Core_PrimitiveQuality = (PrimitiveQuality_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Core/TextureQuality.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +let TextureQuality_i = 0; + +const TextureQuality = +{ + LOW: TextureQuality_i ++, + MEDIUM: TextureQuality_i ++, + HIGH: TextureQuality_i ++, +}; + +const TextureQuality_default_ = TextureQuality; +; + +x_ite_Namespace .add ("TextureQuality", "x_ite/Browser/Core/TextureQuality", TextureQuality_default_); +/* harmony default export */ const Core_TextureQuality = (TextureQuality_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Core/BrowserOptions.js +/* provided dependency */ var BrowserOptions_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + +function BrowserOptions (executionContext) +{ + Base_X3DBaseNode .call (this, executionContext); + + this .addAlias ("AntiAliased", this ._Antialiased); + + const browser = this .getBrowser (); + + this .localStorage = browser .getLocalStorage () .addNameSpace ("BrowserOptions."); + this .textureQuality = Core_TextureQuality .MEDIUM + this .primitiveQuality = Core_PrimitiveQuality .MEDIUM; + this .shading = Core_Shading .GOURAUD; +} + +Object .assign (Object .setPrototypeOf (BrowserOptions .prototype, Base_X3DBaseNode .prototype), +{ + initialize () + { + Base_X3DBaseNode .prototype .initialize .call (this); + + this .localStorage .setDefaultValues ({ + Rubberband: this ._Rubberband .getValue (), + PrimitiveQuality: this ._PrimitiveQuality .getValue (), + TextureQuality: this ._TextureQuality .getValue (), + StraightenHorizon: this ._StraightenHorizon .getValue (), + Timings: this ._Timings .getValue (), + }); + + this ._Rubberband .addInterest ("set_rubberband__", this); + this ._Antialiased .addInterest ("set_antialiased__", this); + this ._PrimitiveQuality .addInterest ("set_primitiveQuality__", this); + this ._TextureQuality .addInterest ("set_textureQuality__", this); + this ._Shading .addInterest ("set_shading__", this); + this ._StraightenHorizon .addInterest ("set_straightenHorizon__", this); + this ._AutoUpdate .addInterest ("set_autoUpdate__", this); + this ._ContentScale .addInterest ("set_contentScale__", this); + this ._LogarithmicDepthBuffer .addInterest ("set_logarithmicDepthBuffer__", this); + this ._Multisampling .addInterest ("set_multisampling__", this); + this ._OrderIndependentTransparency .addInterest ("set_orderIndependentTransparency__", this); + this ._Timings .addInterest ("set_timings__", this); + + this .set_antialiased__ (this ._Antialiased); + this .set_shading__ (this ._Shading); + this .set_contentScale__ (this ._ContentScale); + this .set_logarithmicDepthBuffer__ (this ._LogarithmicDepthBuffer); + this .set_multisampling__ (this ._Multisampling); + this .set_orderIndependentTransparency__ (this ._OrderIndependentTransparency); + + this .reset (); + }, + reset: (() => + { + const attributes = new Set ([ + "Antialiased", + "AutoUpdate", + "Cache", + "ContentScale", + "ContextMenu", + "Debug", + "Multisampling", + "Notifications", + "OrderIndependentTransparency", + "SplashScreen", + ]); + + const mappings = new Map ([ + ["AutoUpdate", "Update"], + ]); + + const restorable = new Set ([ + "PrimitiveQuality", + "Rubberband", + "StraightenHorizon", + "TextureQuality", + "Timings", + ]); + + return function () + { + const + browser = this .getBrowser (), + localStorage = this .localStorage; + + for (const { name, value } of this .getFieldDefinitions ()) + { + if (attributes .has (name)) + { + const + attribute = BrowserOptions_$.toLowerCaseFirst (mappings .get (name) ?? name), + value = browser .getElement () .attr (attribute); + + if (value !== undefined) + { + browser .attributeChangedCallback (attribute, null, value); + continue; + } + } + + if (restorable .has (name)) + { + const + value = localStorage [name], + field = this .getField (name); + + if (value !== field .getValue ()) + field .setValue (value); + + continue; + } + + const field = this .getField (name); + + if (field .equals (value)) + continue; + + field .assign (value); + } + }; + })(), + getPrimitiveQuality () + { + return this .primitiveQuality; + }, + getShading () + { + return this .shading; + }, + getTextureQuality () + { + return this .textureQuality; + }, + set_rubberband__ (rubberband) + { + this .localStorage .Rubberband = rubberband .getValue (); + }, + set_antialiased__ () + { + this .set_multisampling__ (this ._Multisampling); + }, + set_primitiveQuality__ (value) + { + const + browser = this .getBrowser (), + primitiveQuality = value .getValue () .toUpperCase (); + + this .localStorage .PrimitiveQuality = primitiveQuality; + this .primitiveQuality = BrowserOptions_$.enum (Core_PrimitiveQuality, primitiveQuality, Core_PrimitiveQuality .MEDIUM); + + if (typeof browser .setPrimitiveQuality2D === "function") + browser .setPrimitiveQuality2D (this .primitiveQuality); + + if (typeof browser .setPrimitiveQuality3D === "function") + browser .setPrimitiveQuality3D (this .primitiveQuality); + }, + set_textureQuality__ (value) + { + const + browser = this .getBrowser (), + textureQuality = value .getValue () .toUpperCase (); + + this .localStorage .TextureQuality = textureQuality; + this .textureQuality = BrowserOptions_$.enum (Core_TextureQuality, textureQuality, Core_TextureQuality .MEDIUM); + + if (typeof browser .setTextureQuality === "function") + browser .setTextureQuality (this .textureQuality); + }, + set_shading__: (() => + { + const strings = { + [Core_Shading .POINT]: "POINT", + [Core_Shading .WIREFRAME]: "WIREFRAME", + [Core_Shading .FLAT]: "FLAT", + [Core_Shading .GOURAUD]: "GOURAUD", + [Core_Shading .PHONG]: "PHONG", + }; + + return function (value) + { + const + browser = this .getBrowser (), + shading = value .getValue () .toUpperCase () .replace ("POINTSET", "POINT"); + + this .shading = BrowserOptions_$.enum (Core_Shading, shading, Core_Shading .GOURAUD); + + browser .getRenderingProperties () ._Shading = strings [this .shading]; + browser .setShading (this .shading); + }; + })(), + set_straightenHorizon__ (straightenHorizon) + { + this .localStorage .StraightenHorizon = straightenHorizon .getValue (); + + if (straightenHorizon .getValue ()) + this .getBrowser () .getActiveLayer () ?.straightenView (); + }, + set_autoUpdate__ (autoUpdate) + { + const events = ["resize", "scroll", "load"] + .map (event => `${event}.${this .getTypeName ()}${this .getId ()}`) + .join (" "); + + if (autoUpdate .getValue ()) + { + const + browser = this .getBrowser (), + element = browser .getElement (); + + const checkUpdate = () => + { + if (element .isInViewport ()) + { + if (!browser .isLive ()) + browser .beginUpdate (); + } + else + { + if (browser .isLive ()) + browser .endUpdate (); + } + }; + + BrowserOptions_$(window) .on (events, checkUpdate); + checkUpdate (); + } + else + { + BrowserOptions_$(window) .off (events); + } + }, + set_contentScale__ (contentScale) + { + const browser = this .getBrowser (); + + if (this .removeUpdateContentScale) + this .removeUpdateContentScale (); + + if (contentScale .getValue () === -1) + this .updateContentScale (); + else + browser .getRenderingProperties () ._ContentScale = Math .max (contentScale .getValue (), 0) || 1; + + browser .reshape (); + }, + updateContentScale () + { + const + browser = this .getBrowser (), + media = window .matchMedia (`(resolution: ${window .devicePixelRatio}dppx)`), + update = this .updateContentScale .bind (this); + + if (this .removeUpdateContentScale) + this .removeUpdateContentScale (); + + this .removeUpdateContentScale = function () { media .removeEventListener ("change", update) }; + + media .addEventListener ("change", update); + + browser .getRenderingProperties () ._ContentScale = window .devicePixelRatio; + + browser .reshape (); + }, + set_logarithmicDepthBuffer__ (logarithmicDepthBuffer) + { + const + browser = this .getBrowser (), + gl = browser .getContext (); + + browser .getRenderingProperties () ._LogarithmicDepthBuffer = logarithmicDepthBuffer .getValue () && gl .HAS_FEATURE_FRAG_DEPTH; + }, + set_multisampling__ (multisampling) + { + const + browser = this .getBrowser (), + samples = Math_Algorithm .clamp (multisampling .getValue (), 0, browser .getMaxSamples ()); + + browser .getRenderingProperties () ._Multisampling = this ._Antialiased .getValue () ? samples : 0; + browser .getRenderingProperties () ._Antialiased = samples > 0; + + browser .reshape (); + }, + set_orderIndependentTransparency__ () + { + const browser = this .getBrowser (); + + browser .getShaders () .clear (); + browser .reshape (); + }, + set_timings__ (timings) + { + this .localStorage .Timings = timings .getValue (); + }, +}); + +Object .defineProperties (BrowserOptions, +{ + typeName: + { + value: "BrowserOptions", + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "SplashScreen", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "Dashboard", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "Rubberband", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "EnableInlineViewpoints", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "Antialiased", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "TextureQuality", new x_ite_Fields .SFString ("MEDIUM")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "PrimitiveQuality", new x_ite_Fields .SFString ("MEDIUM")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "QualityWhenMoving", new x_ite_Fields .SFString ("SAME")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "Shading", new x_ite_Fields .SFString ("GOURAUD")), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "MotionBlur", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "AutoUpdate", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "Cache", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "ContentScale", new x_ite_Fields .SFDouble (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "ContextMenu", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "Debug", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "Gravity", new x_ite_Fields .SFDouble (9.80665)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "LoadUrlObjects", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "LogarithmicDepthBuffer", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "Notifications", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "Multisampling", new x_ite_Fields .SFInt32 (4)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "OrderIndependentTransparency", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "StraightenHorizon", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .inputOutput, "Timings", new x_ite_Fields .SFBool ()), + ]), + enumerable: true, + }, +}); + +const BrowserOptions_default_ = BrowserOptions; +; + +x_ite_Namespace .add ("BrowserOptions", "x_ite/Browser/Core/BrowserOptions", BrowserOptions_default_); +/* harmony default export */ const Core_BrowserOptions = (BrowserOptions_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Core/BrowserProperties.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function BrowserProperties (executionContext) +{ + Base_X3DBaseNode .call (this, executionContext); +} + +Object .setPrototypeOf (BrowserProperties .prototype, Base_X3DBaseNode .prototype); + +Object .defineProperties (BrowserProperties, +{ + typeName: + { + value: "BrowserProperties", + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "ABSTRACT_NODES", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "CONCRETE_NODES", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "EXTERNAL_INTERACTIONS", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "PROTOTYPE_CREATE", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "DOM_IMPORT", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "XML_ENCODING", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "CLASSIC_VRML_ENCODING", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .initializeOnly, "BINARY_ENCODING", new x_ite_Fields .SFBool ()), + ]), + enumerable: true, + }, +}); + +const BrowserProperties_default_ = BrowserProperties; +; + +x_ite_Namespace .add ("BrowserProperties", "x_ite/Browser/Core/BrowserProperties", BrowserProperties_default_); +/* harmony default export */ const Core_BrowserProperties = (BrowserProperties_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Core/RenderingProperties.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function RenderingProperties (executionContext) +{ + Base_X3DBaseNode .call (this, executionContext); + + this .addAlias ("AntiAliased", this ._Antialiased); +} + +Object .assign (Object .setPrototypeOf (RenderingProperties .prototype, Base_X3DBaseNode .prototype), +{ + initialize () + { + Base_X3DBaseNode .prototype .initialize .call (this); + + const browser = this .getBrowser (); + + this ._MaxTextureSize = browser .getMaxTextureSize (); + this ._TextureUnits = browser .getMaxCombinedTextureUnits (); + this ._MaxLights = browser .getMaxLights (); + this ._ColorDepth = browser .getColorDepth (); + this ._TextureMemory = browser .getTextureMemory (); + this ._MaxSamples = browser .getMaxSamples (); + }, +}); + +Object .defineProperties (RenderingProperties, +{ + typeName: + { + value: "RenderingProperties", + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "Shading", new x_ite_Fields .SFString ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "MaxTextureSize", new x_ite_Fields .SFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "TextureUnits", new x_ite_Fields .SFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "MaxLights", new x_ite_Fields .SFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "Antialiased", new x_ite_Fields .SFBool (true)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "ColorDepth", new x_ite_Fields .SFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "TextureMemory", new x_ite_Fields .SFDouble ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "ContentScale", new x_ite_Fields .SFDouble (1)), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "LogarithmicDepthBuffer", new x_ite_Fields .SFBool ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "MaxSamples", new x_ite_Fields .SFInt32 ()), + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "Multisampling", new x_ite_Fields .SFInt32 (4)), + ]), + enumerable: true, + } +}); + +const RenderingProperties_default_ = RenderingProperties; +; + +x_ite_Namespace .add ("RenderingProperties", "x_ite/Browser/Core/RenderingProperties", RenderingProperties_default_); +/* harmony default export */ const Core_RenderingProperties = (RenderingProperties_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Core/Notification.js +/* provided dependency */ var Notification_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +Notification_$.fn.textWidth = function (string) +{ + const + children = Notification_$(this) .children (), + html = Notification_$(this) .html (), + span = '' + html + ''; + Notification_$(this) .html (span); + const width = Notification_$(this) .find ('span:first') .width (); + Notification_$(this) .empty (); + Notification_$(this) .append (children); + return width; +}; + +function Notification (executionContext) +{ + Base_X3DBaseNode .call (this, executionContext); + + this .addChildObjects (Base_X3DConstants .inputOutput, "string", new Fields_SFString ()); +} + +Object .assign (Object .setPrototypeOf (Notification .prototype, Base_X3DBaseNode .prototype), +{ + initialize () + { + Base_X3DBaseNode .prototype .initialize .call (this); + + this .element = Notification_$("
") + .hide () + .addClass ("x_ite-private-notification") + .appendTo (this .getBrowser () .getSurface ()) + .animate ({ width: 0 }); + + Notification_$("") .appendTo (this .element); + + this ._string .addInterest ("set_string__", this); + }, + set_string__ () + { + if (! this .getBrowser () .getBrowserOption ("Notifications")) + return; + + if (this ._string .length === 0) + return; + + this .element .children () .text (this ._string .getValue ()); + + this .element + .stop (true, true) + .fadeIn (0) + .animate ({ width: this .element .textWidth () }) + .animate ({ "delay": 1 }, 5000) + .animate ({ width: 0 }) + .fadeOut (0); + }, +}); + +Object .defineProperties (Notification, +{ + typeName: + { + value: "Notification", + enumerable: true, + }, +}); + +const Notification_default_ = Notification; +; + +x_ite_Namespace .add ("Notification", "x_ite/Browser/Core/Notification", Notification_default_); +/* harmony default export */ const Core_Notification = (Notification_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Core/ContextMenu.js +/* provided dependency */ var jquery_fullscreen = __webpack_require__(543); +/* provided dependency */ var ContextMenu_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +typeof jquery_fullscreen; // import plugin + +const _userMenu = Symbol (); + +function ContextMenu (executionContext) +{ + Base_X3DBaseNode .call (this, executionContext); + + this [_userMenu] = null; +} + +Object .assign (Object .setPrototypeOf (ContextMenu .prototype, Base_X3DBaseNode .prototype), +{ + initialize () + { + Base_X3DBaseNode .prototype .initialize .call (this); + + const browser = this .getBrowser (); + + this .init ({ + element: browser .getElement (), + appendTo: browser .getShadow (), + build: this .build .bind (this), + animation: {duration: 500, show: "fadeIn", hide: "fadeOut"}, + }); + }, + getUserMenu () + { + return this [_userMenu]; + }, + setUserMenu (userMenu) + { + this [_userMenu] = userMenu; + }, + createUserMenu () + { + const userMenu = { }; + + if (typeof this [_userMenu] === "function") + { + const menu = this [_userMenu] (); + + if (ContextMenu_$.isPlainObject (menu)) + { + for (const key in menu) + userMenu ["user-" + key] = menu [key]; + } + } + + return userMenu; + }, + build (event) + { + const + browser = this .getBrowser (), + fullscreen = browser .getElement () .fullScreen (); + + if (! browser .getBrowserOption ("ContextMenu")) + return; + + const menu = { + className: "x_ite-private-menu", + items: { + "title": { + name: browser .getName () + " Browser v" + browser .getVersion (), + className: "context-menu-title context-menu-not-selectable", + }, + "separator0": "--------", + "viewpoints": { + name: locale_gettext("Viewpoints"), + className: "context-menu-icon x_ite-private-icon-viewpoint", + items: this .getViewpoints (), + }, + "available-viewers": { + name: locale_gettext("Available Viewers"), + items: this .getAvailableViewers (), + }, + "straighten-horizon": { + name: locale_gettext("Straighten Horizon"), + type: "checkbox", + selected: browser .getBrowserOption ("StraightenHorizon"), + events: { + click: (event) => + { + const straightenHorizon = ContextMenu_$(event .target) .is (":checked"); + + browser .setBrowserOption ("StraightenHorizon", straightenHorizon); + + if (straightenHorizon) + browser .getNotification () ._string = locale_gettext("Straighten Horizon") + ": " + locale_gettext("on"); + else + browser .getNotification () ._string = locale_gettext("Straighten Horizon") + ": " + locale_gettext("off"); + }, + }, + }, + "display-rubberband": { + name: locale_gettext("Display Rubberband"), + type: "checkbox", + selected: browser .getBrowserOption ("Rubberband"), + events: { + click: (event) => + { + const rubberband = ContextMenu_$(event .target) .is (":checked"); + + browser .setBrowserOption ("Rubberband", rubberband); + + if (rubberband) + browser .getNotification () ._string = locale_gettext("Rubberband") + ": " + locale_gettext("on"); + else + browser .getNotification () ._string = locale_gettext("Rubberband") + ": " + locale_gettext("off"); + }, + }, + }, + "separator1": "--------", + "primitive-quality": { + name: locale_gettext("Primitive Quality"), + className: "context-menu-icon x_ite-private-icon-primitive-quality", + items: { + "high": { + name: locale_gettext("High"), + type: "radio", + radio: "primitive-quality", + selected: browser .getBrowserOption ("PrimitiveQuality") === "HIGH", + events: { + click: () => + { + browser .setBrowserOption ("PrimitiveQuality", "HIGH"); + browser .getNotification () ._string = locale_gettext("Primitive Quality") + ": " + locale_gettext("high"); + }, + }, + }, + "medium": { + name: locale_gettext("Medium"), + type: "radio", + radio: "primitive-quality", + selected: browser .getBrowserOption ("PrimitiveQuality") === "MEDIUM", + events: { + click: () => + { + browser .setBrowserOption ("PrimitiveQuality", "MEDIUM"); + browser .getNotification () ._string = locale_gettext("Primitive Quality") + ": " + locale_gettext("medium"); + }, + }, + }, + "low": { + name: locale_gettext("Low"), + type: "radio", + radio: "primitive-quality", + selected: browser .getBrowserOption ("PrimitiveQuality") === "LOW", + events: { + click: () => + { + browser .setBrowserOption ("PrimitiveQuality", "LOW"); + browser .getNotification () ._string = locale_gettext("Primitive Quality") + ": " + locale_gettext("low"); + }, + }, + }, + }, + }, + "texture-quality": { + name: locale_gettext("Texture Quality"), + className: "context-menu-icon x_ite-private-icon-texture-quality", + items: { + "high": { + name: locale_gettext("High"), + type: "radio", + radio: "texture-quality", + selected: browser .getBrowserOption ("TextureQuality") === "HIGH", + events: { + click: () => + { + browser .setBrowserOption ("TextureQuality", "HIGH"); + browser .getNotification () ._string = locale_gettext("Texture Quality") + ": " + locale_gettext("high"); + }, + }, + }, + "medium": { + name: locale_gettext("Medium"), + type: "radio", + radio: "texture-quality", + selected: browser .getBrowserOption ("TextureQuality") === "MEDIUM", + events: { + click: () => + { + browser .setBrowserOption ("TextureQuality", "MEDIUM"); + browser .getNotification () ._string = locale_gettext("Texture Quality") + ": " + locale_gettext("medium"); + }, + }, + }, + "low": { + name: locale_gettext("Low"), + type: "radio", + radio: "texture-quality", + selected: browser .getBrowserOption ("TextureQuality") === "LOW", + events: { + click: () => + { + browser .setBrowserOption ("TextureQuality", "LOW"); + browser .getNotification () ._string = locale_gettext("Texture Quality") + ": " + locale_gettext("low"); + }, + }, + }, + }, + }, + "shading": { + name: locale_gettext("Shading"), + className: "context-menu-icon x_ite-private-icon-shading", + items: { + "point": { + name: locale_gettext("Points"), + type: "radio", + radio: "shading", + selected: browser .getBrowserOption ("Shading") === "POINT", + events: { + click: () => + { + browser .setBrowserOption ("Shading", "POINT"); + browser .getNotification () ._string = locale_gettext("Shading") + ": " + locale_gettext("Points"); + }, + }, + }, + "wireframe": { + name: locale_gettext("Wireframe"), + type: "radio", + radio: "shading", + selected: browser .getBrowserOption ("Shading") === "WIREFRAME", + events: { + click: () => + { + browser .setBrowserOption ("Shading", "WIREFRAME"); + browser .getNotification () ._string = locale_gettext("Shading") + ": " + locale_gettext("Wireframe"); + }, + }, + }, + "flat": { + name: locale_gettext("Flat"), + type: "radio", + radio: "shading", + selected: browser .getBrowserOption ("Shading") === "FLAT", + events: { + click: () => + { + browser .setBrowserOption ("Shading", "FLAT"); + browser .getNotification () ._string = locale_gettext("Shading") + ": " + locale_gettext("Flat"); + }, + }, + }, + "gouraud": { + name: locale_gettext("Gouraud"), + type: "radio", + radio: "shading", + selected: browser .getBrowserOption ("Shading") === "GOURAUD", + events: { + click: () => + { + browser .setBrowserOption ("Shading", "GOURAUD"); + browser .getNotification () ._string = locale_gettext("Shading") + ": " + locale_gettext("Gouraud"); + }, + }, + }, + "phong": { + name: locale_gettext("Phong"), + type: "radio", + radio: "shading", + selected: browser .getBrowserOption ("Shading") === "PHONG", + events: { + click: () => + { + browser .setBrowserOption ("Shading", "PHONG"); + browser .getNotification () ._string = locale_gettext("Shading") + ": " + locale_gettext("Phong"); + }, + }, + }, + }, + }, + "separator2": "--------", + "browser-timings": { + name: locale_gettext("Browser Timings"), + type: "checkbox", + selected: browser .getBrowserOption ("Timings"), + events: { + click: (event) => + { + browser .setBrowserOption ("Timings", ContextMenu_$(event .target) .is (":checked")); + browser .getSurface () .focus (); + }, + }, + }, + "fullscreen": { + name: fullscreen ? locale_gettext("Leave Fullscreen") : locale_gettext("Fullscreen"), + className: "context-menu-icon " + (fullscreen + ? "x_ite-private-icon-leave-fullscreen" + : "x_ite-private-icon-enter-fullscreen"), + callback: () => + { + browser .getElement () .toggleFullScreen (); + }, + }, + "separator3": "--------", + }, + }; + + Object .assign (menu .items, this .createUserMenu ()); + + Object .assign (menu .items, { + "separator4": "--------", + "world-info": { + name: locale_gettext("Show World Info"), + className: "context-menu-icon x_ite-private-icon-world-info", + callback () + { + browser .getShadow () .find (".x_ite-private-world-info") .remove (); + + const + priv = browser .getShadow () .find (".x_ite-private-browser"), + overlay = ContextMenu_$("
") .addClass ("x_ite-private-world-info-overlay") .appendTo (priv), + div = ContextMenu_$("
") .addClass ("x_ite-private-world-info") .appendTo (overlay), + worldInfo = browser .getExecutionContext () .getWorldInfos () [0], + title = worldInfo .title, + info = worldInfo .info; + + ContextMenu_$("
") .addClass ("x_ite-private-world-info-top") .text ("World Info") .appendTo (div); + + if (title .length) + { + ContextMenu_$("
") .addClass ("x_ite-private-world-info-title") .text (title) .appendTo (div); + } + + for (const line of info) + { + ContextMenu_$("
") .addClass ("x_ite-private-world-info-info") .text (line) .appendTo (div); + } + + overlay .on ("click", function () { overlay .remove (); }); + }, + }, + "about": { + name: locale_gettext("About X_ITE"), + className: "context-menu-icon x_ite-private-icon-help-about", + callback () + { + window .open (browser .getProviderURL ()); + }, + }, + }); + + if (ContextMenu_$.isEmptyObject (menu .items .viewpoints .items)) + delete menu .items ["viewpoints"]; + + if (Object .keys (menu .items ["available-viewers"] .items) .length < 2) + { + delete menu .items ["available-viewers"]; + } + + if (! browser .getCurrentViewer () .match (/^(?:EXAMINE|FLY)$/)) + { + delete menu .items ["straighten-horizon"]; + } + + if (! browser .getBrowserOption ("Debug")) + { + delete menu .items ["shading"]; + } + + const worldInfo = browser .getExecutionContext () .getWorldInfos () [0]; + + if (! worldInfo || (worldInfo .title .length === 0 && worldInfo .info .length === 0)) + { + delete menu .items ["world-info"]; + } + + return menu; + }, + getViewpoints () + { + const + browser = this .getBrowser (), + activeLayer = browser .getActiveLayer (); + + if (! activeLayer) + return { }; + + const + enableInlineViewpoints = browser .getBrowserOption ("EnableInlineViewpoints"), + currentScene = browser .currentScene, + viewpoints = activeLayer .getViewpoints () .get (), + currentViewpoint = activeLayer .getViewpoint (), + menu = { }; + + for (const viewpoint of viewpoints) + { + const description = viewpoint .getDescriptions () .join (" » "); + + if (description === "") + continue; + + if (! enableInlineViewpoints && viewpoint .getScene () !== currentScene) + continue; + + const item = { + name: description, + callback: () => + { + browser .bindViewpoint (browser .getActiveLayer (), viewpoint); + browser .getSurface () .focus (); + }, + }; + + if (viewpoint === currentViewpoint) + item .className = "context-menu-selected"; + + menu ["Viewpoint" + viewpoint .getId ()] = item; + } + + return menu; + }, + getAvailableViewers () + { + const + browser = this .getBrowser (), + currentViewer = browser ._viewer .getValue (), + availableViewers = browser ._availableViewers, + menu = { }; + + for (const viewer of availableViewers) + { + menu [viewer] = { + name: locale_gettext(this .getViewerName (viewer)), + className: "context-menu-icon x_ite-private-icon-" + viewer .toLowerCase () + "-viewer", + callback: () => + { + browser ._viewer = viewer; + browser .getNotification () ._string = locale_gettext(this .getViewerName (viewer)); + browser .getSurface () .focus (); + }, + }; + + if (viewer === currentViewer) + menu [viewer] .className += " context-menu-selected"; + } + + return menu; + }, + getViewerName (viewer) + { + switch (viewer) + { + case "EXAMINE": + return locale_gettext("Examine Viewer"); + case "WALK": + return locale_gettext("Walk Viewer"); + case "FLY": + return locale_gettext("Fly Viewer"); + case "PLANE": + return locale_gettext("Plane Viewer"); + case "LOOKAT": + return locale_gettext("Look At Viewer"); + case "NONE": + return locale_gettext("None Viewer"); + } + }, + init (options) + { + this .show = this .createRoot .bind (this, options); + + options .element .on ("contextmenu", this .show); + }, + show (event) + { }, + hide (event) + { }, + createRoot (options, event) + { + const + menu = options .build (event), + level = 1; + + if (! menu) return; + + // Layer + + const layer = ContextMenu_$("
") + .addClass ("context-menu-layer") + .addClass (menu .className) + .appendTo (options .appendTo); + + const hide = this .hide = () => + { + delete this .hide; + + layer .remove (); + + ul [options .animation .hide] (options .animation .duration, function () + { + ul .remove (); + + if (options .events && typeof options .events .hide === "function") + options .events .hide (); + }); + + return false; + }; + + // Menu + + const ul = ContextMenu_$("
    ") + .hide () + .addClass ("context-menu-root") + .addClass ("context-menu-list") + .addClass (menu .className) + .appendTo (options .appendTo) + .offset ({ "left": event .pageX, "top": event .pageY }); + + for (const k in menu .items) + ul .append (this .createItem (menu .items [k], "context-menu-root", k, level + 1, hide)); + + ul [options .animation .show] (options .animation .duration); + + // Reposition menu if to right or to low. + + ul .offset ({ "left": event .pageX, "top": event .pageY }); // Do it again! + + if (ul .offset () .left - ContextMenu_$(document) .scrollLeft () + ul .outerWidth () > ContextMenu_$(window) .width ()) + ul .offset ({ "left": ContextMenu_$(document) .scrollLeft () + Math .max (0, ContextMenu_$(window) .width () - ul .outerWidth ()) }); + + if (ul .offset () .top - ContextMenu_$(document) .scrollTop () + ul .outerHeight () > ContextMenu_$(window) .height ()) + ul .offset ({ "top": ContextMenu_$(document) .scrollTop () + Math .max (0, ContextMenu_$(window) .height () - ul .outerHeight ()) }); + + // Display submenus on the left or right side. + // If the submenu is higher than vh, add scrollbars. + + ul .find ("ul") .each ((i, e) => + { + e = ContextMenu_$(e); + + const + width = e .outerWidth () + ul .outerWidth (), + position = ul .offset () .left - ContextMenu_$(document) .scrollLeft () + width > ContextMenu_$(window) .width () ? "right" : "left"; + + e .css ("width", e .outerWidth ()); + e .css (position, e .parent () .closest ("ul") .width ()); + + if (e .outerHeight () >= ContextMenu_$(window) .height ()) + e .css ({ "max-height": "100vh", "overflow-y": "scroll" }); + }); + + // If the submenu is higher than vh, reposition it. + + ul .find ("li") .on ("mouseenter touchstart", function (event) + { + event .stopImmediatePropagation (); + + const + t = ContextMenu_$(event .target) .closest ("li"), + e = t .children ("ul"); + + if (! e .length) + return; + + e .css ("top", ""); + + const bottom = e .offset () .top + e .outerHeight () - ContextMenu_$(window) .scrollTop () - ContextMenu_$(window) .height (); + + if (bottom > 0) + e .offset ({ "top": e .offset () .top - bottom }); + }); + + // Layer + + layer .on ("click contextmenu", hide); + ul .on ("contextmenu", hide); + + // Show + + if (options .events && typeof options .events .show === "function") + options .events .show (ul); + + return false; + }, + createItem (item, parent, key, level, hide) + { + const li = ContextMenu_$("
  • ") .addClass ("context-menu-item"); + + switch (typeof item) + { + case "string": + { + if (item .match (/^-+$/)) + li .addClass (["context-menu-separator", "context-menu-not-selectable"]); + + break; + } + case "object": + { + if (item .className) + li .addClass (item .className); + + switch (item .type) + { + case "radio": + case "checkbox": + { + const + label = ContextMenu_$("") .appendTo (li), + input = ContextMenu_$("") .appendTo (label); + + input + .attr ("type", item .type) + .attr ("name", "context-menu-input-" + (item .radio || parent)); + + ContextMenu_$("") .text (item .name) .appendTo (label); + + if (item .selected) + input .attr ("checked", "checked"); + + for (const k in item .events) + { + if (typeof item .events [k] === "function") + input .on (k, item .events [k]); + } + + li .addClass ("context-menu-input"); + + break; + } + default: + { + if (item .name) + ContextMenu_$("") .text (item .name) .appendTo (li); + + if (typeof item .callback === "function") + li .on ("click", item .callback) .on ("click", hide); + + break; + } + } + + break; + } + } + + if (typeof item .items === "object" && level < 3) + { + const ul = ContextMenu_$("
      ") + .addClass ("context-menu-list") + .css ({ "z-index": level }) + .appendTo (li); + + for (const k in item .items) + ul .append (this .createItem (item .items [k], key, k, level + 1, hide)); + + li .addClass ("context-menu-submenu"); + } + + return li; + }, +}); + +Object .defineProperties (ContextMenu, +{ + typeName: + { + value: "ContextMenu", + enumerable: true, + }, +}); + +const ContextMenu_default_ = ContextMenu; +; + +x_ite_Namespace .add ("ContextMenu", "x_ite/Browser/Core/ContextMenu", ContextMenu_default_); +/* harmony default export */ const Core_ContextMenu = (ContextMenu_default_); +;// CONCATENATED MODULE: ./src/x_ite/Configuration/ComponentInfo.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function ComponentInfo (name, level, title, providerURL, external = false, dependencies = [ ]) +{ + Object .defineProperties (this, + { + name: { value: name, enumerable: true }, + level: { value: level, enumerable: true }, + title: { value: title, enumerable: true }, + providerURL: { value: providerURL || Networking_URLs .getProviderURL (external && name), enumerable: true }, + external: { value: external }, + dependencies: { value: dependencies }, + }); +} + +Object .assign (Object .setPrototypeOf (ComponentInfo .prototype, Base_X3DObject .prototype), +{ + toVRMLStream (generator) + { + generator .string += generator .Indent (); + generator .string += "COMPONENT"; + generator .string += generator .Space (); + generator .string += this .name; + generator .string += generator .TidySpace (); + generator .string += ":"; + generator .string += generator .TidySpace (); + generator .string += this .level; + }, + toXMLStream (generator) + { + generator .string += generator .Indent (); + generator .string += "" : "/>"; + }, + toJSONStream (generator) + { + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@name"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += this .name; + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@level"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += this .level; + generator .string += generator .TidyBreak (); + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + }, +}); + +for (const key of Object .keys (ComponentInfo .prototype)) + Object .defineProperty (ComponentInfo .prototype, key, { enumerable: false }); + +Object .defineProperties (ComponentInfo, +{ + typeName: + { + value: "ComponentInfo", + enumerable: true, + }, +}); + +Object .defineProperties (ComponentInfo .prototype, +{ + providerUrl: // legacy + { + get: function () { return this .providerURL; }, + }, +}); + +const ComponentInfo_default_ = ComponentInfo; +; + +x_ite_Namespace .add ("ComponentInfo", "x_ite/Configuration/ComponentInfo", ComponentInfo_default_); +/* harmony default export */ const Configuration_ComponentInfo = (ComponentInfo_default_); +;// CONCATENATED MODULE: ./src/x_ite/Configuration/ComponentInfoArray.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function ComponentInfoArray (values = [ ]) +{ + return Base_X3DInfoArray .call (this, Array .from (values, value => [value .name, value]), Configuration_ComponentInfo); +} + +Object .assign (Object .setPrototypeOf (ComponentInfoArray .prototype, Base_X3DInfoArray .prototype), +{ + add (name, { level, title, providerURL, external = false, dependencies = [ ] }) + { + Base_X3DInfoArray .prototype .add .call (this, name, new Configuration_ComponentInfo (name, level, title, providerURL, external, dependencies)); + }, +}); + +for (const key of Object .keys (ComponentInfoArray .prototype)) + Object .defineProperty (ComponentInfoArray .prototype, key, { enumerable: false }); + +Object .defineProperties (ComponentInfoArray, +{ + typeName: + { + value: "ComponentInfoArray", + enumerable: true, + }, +}); + +const ComponentInfoArray_default_ = ComponentInfoArray; +; + +x_ite_Namespace .add ("ComponentInfoArray", "x_ite/Configuration/ComponentInfoArray", ComponentInfoArray_default_); +/* harmony default export */ const Configuration_ComponentInfoArray = (ComponentInfoArray_default_); +;// CONCATENATED MODULE: ./src/x_ite/Configuration/UnitInfo.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function UnitInfo (category, name, conversionFactor) +{ + Object .defineProperties (this, + { + category: { value: category, enumerable: true }, + name: { value: name, enumerable: true }, + conversionFactor: { value: conversionFactor, enumerable: true }, + }); +} + +Object .assign (Object .setPrototypeOf (UnitInfo .prototype, Base_X3DObject .prototype), +{ + toVRMLStream (generator) + { + generator .string += generator .Indent (); + generator .string += "UNIT"; + generator .string += generator .Space (); + generator .string += this .category; + generator .string += generator .Space (); + generator .string += this .name; + generator .string += generator .Space (); + generator .string += this .conversionFactor; + }, + toXMLStream (generator) + { + generator .string += generator .Indent (); + generator .string += "" : "/>"; + }, + toJSONStream (generator, _throw) + { + if (this .conversionFactor === 1) + throw new Error ("conversionFactor is 1"); + + generator .string += generator .Indent (); + + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@category"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += this .category; + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@name"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (this .name); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@conversionFactor"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += this .conversionFactor; + generator .string += generator .TidyBreak (); + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + }, +}); + +for (const key of Object .keys (UnitInfo .prototype)) + Object .defineProperty (UnitInfo .prototype, key, { enumerable: false }); + +Object .defineProperty (UnitInfo .prototype, "conversion_factor", +{ + get () { return this .conversionFactor; }, +}); + +Object .defineProperties (UnitInfo, +{ + typeName: + { + value: "UnitInfo", + enumerable: true, + }, +}); + +const UnitInfo_default_ = UnitInfo; +; + +x_ite_Namespace .add ("UnitInfo", "x_ite/Configuration/UnitInfo", UnitInfo_default_); +/* harmony default export */ const Configuration_UnitInfo = (UnitInfo_default_); +;// CONCATENATED MODULE: ./src/x_ite/Configuration/UnitInfoArray.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function UnitInfoArray (values = [ ]) +{ + return Base_X3DInfoArray .call (this, Array .from (values, value => [value .category, value]), Configuration_UnitInfo); +} + +Object .setPrototypeOf (UnitInfoArray .prototype, Base_X3DInfoArray .prototype); + +for (const key of Object .keys (UnitInfoArray .prototype)) + Object .defineProperty (UnitInfoArray .prototype, key, { enumerable: false }); + +Object .defineProperties (UnitInfoArray, +{ + typeName: + { + value: "UnitInfoArray", + enumerable: true, + }, +}); + +const UnitInfoArray_default_ = UnitInfoArray; +; + +x_ite_Namespace .add ("UnitInfoArray", "x_ite/Configuration/UnitInfoArray", UnitInfoArray_default_); +/* harmony default export */ const Configuration_UnitInfoArray = (UnitInfoArray_default_); +;// CONCATENATED MODULE: ./src/x_ite/Execution/X3DExportedNode.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +const + X3DExportedNode_exportedName = Symbol (), + _localNode = Symbol (); + +function X3DExportedNode (exportedName, localNode) +{ + Base_X3DObject .call (this); + + this [X3DExportedNode_exportedName] = exportedName; + this [_localNode] = localNode; +} + +Object .assign (Object .setPrototypeOf (X3DExportedNode .prototype, Base_X3DObject .prototype), +{ + getExportedName () + { + return this [X3DExportedNode_exportedName]; + }, + getLocalNode () + { + return this [_localNode]; + }, + toVRMLStream (generator) + { + const localName = generator .LocalName (this [_localNode]); + + generator .string += generator .Indent (); + generator .string += "EXPORT"; + generator .string += generator .Space (); + generator .string += localName; + + if (this [X3DExportedNode_exportedName] !== localName) + { + generator .string += generator .Space (); + generator .string += "AS"; + generator .string += generator .Space (); + generator .string += this [X3DExportedNode_exportedName]; + } + }, + toXMLStream (generator) + { + const localName = generator .LocalName (this [_localNode]); + + generator .string += generator .Indent (); + generator .string += "" : "/>"; + }, + toJSONStream (generator) + { + const localName = generator .LocalName (this [_localNode]); + + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += "EXPORT"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@localDEF"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (localName); + generator .string += '"'; + + if (this [X3DExportedNode_exportedName] !== localName) + { + generator .string += ','; + generator .string += generator .TidyBreak (); + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@AS"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (this [X3DExportedNode_exportedName]); + generator .string += '"'; + generator .string += generator .TidyBreak (); + } + else + { + generator .string += generator .TidyBreak (); + } + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + }, +}); + +for (const key of Object .keys (X3DExportedNode .prototype)) + Object .defineProperty (X3DExportedNode .prototype, key, { enumerable: false }); + +Object .defineProperties (X3DExportedNode .prototype, +{ + exportedName: + { + get () + { + return this [X3DExportedNode_exportedName]; + }, + enumerable: true, + }, + localNode: + { + get () + { + return Fields_SFNodeCache .get (this [_localNode]); + }, + enumerable: true, + }, +}); + +Object .defineProperties (X3DExportedNode, +{ + typeName: + { + value: "X3DExportedNode", + enumerable: true, + }, +}); + +const X3DExportedNode_default_ = X3DExportedNode; +; + +x_ite_Namespace .add ("X3DExportedNode", "x_ite/Execution/X3DExportedNode", X3DExportedNode_default_); +/* harmony default export */ const Execution_X3DExportedNode = (X3DExportedNode_default_); +;// CONCATENATED MODULE: ./src/x_ite/Execution/ExportedNodesArray.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function ExportedNodesArray (values = [ ]) +{ + return Base_X3DInfoArray .call (this, Array .from (values, value => [value .getExportedName (), value]), Execution_X3DExportedNode); +} + +Object .setPrototypeOf (ExportedNodesArray .prototype, Base_X3DInfoArray .prototype); + +for (const key of Object .keys (ExportedNodesArray .prototype)) + Object .defineProperty (ExportedNodesArray .prototype, key, { enumerable: false }); + +Object .defineProperties (ExportedNodesArray, +{ + typeName: + { + value: "ExportedNodesArray", + enumerable: true, + }, +}); + +const ExportedNodesArray_default_ = ExportedNodesArray; +; + +x_ite_Namespace .add ("ExportedNodesArray", "x_ite/Execution/ExportedNodesArray", ExportedNodesArray_default_); +/* harmony default export */ const Execution_ExportedNodesArray = (ExportedNodesArray_default_); +;// CONCATENATED MODULE: ./src/x_ite/Execution/X3DScene.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + +const + _specificationVersion = Symbol (), + _encoding = Symbol (), + _profile = Symbol (), + _components = Symbol (), + _worldURL = Symbol (), + _units = Symbol (), + _metadata = Symbol (), + _exportedNodes = Symbol (), + _loadingObjects = Symbol (); + +const X3D_LATEST_VERSION = "4.0"; + +function X3DScene (browser) +{ + Execution_X3DExecutionContext .call (this, this, null, browser); + + this .addType (Base_X3DConstants .X3DScene) + + this .addChildObjects (Base_X3DConstants .outputOnly, "profile_changed", new x_ite_Fields .SFTime (), + Base_X3DConstants .outputOnly, "metadata_changed", new x_ite_Fields .SFTime (), + Base_X3DConstants .outputOnly, "initLoadCount", new x_ite_Fields .SFInt32 (), + Base_X3DConstants .outputOnly, "loadCount", new x_ite_Fields .SFInt32 ()) + + this [_specificationVersion] = X3D_LATEST_VERSION; + this [_encoding] = "SCRIPTED"; + this [_profile] = null; + this [_components] = new Configuration_ComponentInfoArray ([ ]); + this [_worldURL] = location .toString (); + this [_units] = new Configuration_UnitInfoArray (); + + this [_units] .add ("angle", new Configuration_UnitInfo ("angle", "radian", 1)); + this [_units] .add ("force", new Configuration_UnitInfo ("force", "newton", 1)); + this [_units] .add ("length", new Configuration_UnitInfo ("length", "metre", 1)); + this [_units] .add ("mass", new Configuration_UnitInfo ("mass", "kilogram", 1)); + + this [_metadata] = new Map (); + this [_exportedNodes] = new Execution_ExportedNodesArray (); + this [_loadingObjects] = new Set (); + + this [_components] .addParent (this); + this [_units] .addParent (this); + this [_exportedNodes] .addParent (this); + + this .getRootNodes () .setAccessType (Base_X3DConstants .inputOutput); + + this .setLive (false); +} + +Object .assign (Object .setPrototypeOf (X3DScene .prototype, Execution_X3DExecutionContext .prototype), +{ + isMainScene () + { + return this === this .getExecutionContext (); + }, + isScene () + { + return true; + }, + setSpecificationVersion (specificationVersion) + { + this [_specificationVersion] = String (specificationVersion); + }, + getSpecificationVersion () + { + return this [_specificationVersion]; + }, + setEncoding (encoding) + { + this [_encoding] = String (encoding); + }, + getEncoding () + { + return this [_encoding]; + }, + setWorldURL (url) + { + this [_worldURL] = String (url); + }, + getWorldURL () + { + return this [_worldURL]; + }, + getBaseURL () + { + if (this [_worldURL] .match (/^(?:data|blob):/)) + { + if (this .isMainScene ()) + return this .getBrowser () .getBaseURL (); + + return this .getExecutionContext () .getBaseURL (); + } + + return this [_worldURL]; + }, + setProfile (profile) + { + this [_profile] = profile; + + this ._profile_changed = this .getBrowser () .getCurrentTime (); + }, + getProfile () + { + return this [_profile]; + }, + hasComponent (name, level = 0) + { + if (!this [_profile]) + return true; + + if (name instanceof Configuration_ComponentInfo) + var { name, level } = name; + + const component = this [_profile] .components .get (name) ?? this [_components] .get (name); + + if (component) + return level <= component .level; + + return false; + }, + addComponent (component) + { + this [_components] .add (component .name, component); + + this ._components_changed = this .getBrowser () .getCurrentTime (); + }, + updateComponent (component) + { + this [_components] .update (component .name, component .name, component); + + this ._components_changed = this .getBrowser () .getCurrentTime (); + }, + removeComponent (name) + { + this [_components] .remove (name); + + this ._components_changed = this .getBrowser () .getCurrentTime (); + }, + getComponents () + { + return this [_components]; + }, + updateUnit (category, name, conversionFactor) + { + // Private function. + + if (!this [_units] .has (category)) + return; + + this [_units] .update (category, category, new Configuration_UnitInfo (category, String (name), Number (conversionFactor))); + + this ._units_changed = this .getBrowser () .getCurrentTime (); + }, + getUnit (category) + { + return this [_units] .get (category); + }, + getUnits () + { + return this [_units]; + }, + fromUnit (category, value) + { + switch (category) + { + // Base units + + case "angle": + case "force": + case "length": + case "mass": + return value * this .getUnits () .get (category) .conversionFactor; + + // Derived units + + case "acceleration:": + return value * this .getUnits () .get ("length") .conversionFactor; + case "angularRate": + return value * this .getUnits () .get ("angle") .conversionFactor; + case "area": + return value * this .getUnits () .get ("length") .conversionFactor ** 2; + case "speed": + return value * this .getUnits () .get ("length") .conversionFactor; + case "volume": + return value * this .getUnits () .get ("length") .conversionFactor ** 3; + } + + return value; + }, + toUnit (category, value) + { + switch (category) + { + // Base units + + case "angle": + case "force": + case "length": + case "mass": + return value / this .getUnits () .get (category) .conversionFactor; + + // Derived units + + case "acceleration:": + return value / this .getUnits () .get ("length") .conversionFactor; + case "angularRate": + return value / this .getUnits () .get ("angle") .conversionFactor; + case "area": + return value / this .getUnits () .get ("length") .conversionFactor ** 2; + case "speed": + return value / this .getUnits () .get ("length") .conversionFactor; + case "volume": + return value / this .getUnits () .get ("length") .conversionFactor ** 3; + } + + return value; + }, + setMetaData (name, values) + { + name = String (name); + + if (!name .length) + throw new Error ("Couldn't add metadata: name is empty."); + + if (!Array .isArray (values)) + values = [String (values)]; + + if (!values .length) + throw new Error ("Couldn't add metadata: values length is 0."); + + this [_metadata] .set (name, values .map (value => String (value))); + + this ._metadata_changed = this .getBrowser () .getCurrentTime (); + }, + addMetaData (name, value) + { + name = String (name); + value = String (value); + + if (!name .length) + throw new Error ("Couldn't add metadata: name is empty."); + + let values = this [_metadata] .get (name); + + if (!values) + this [_metadata] .set (name, values = [ ]); + + values .push (value); + }, + removeMetaData (name) + { + name = String (name); + + this [_metadata] .delete (name); + + this ._metadata_changed = this .getBrowser () .getCurrentTime (); + }, + getMetaData (name) + { + name = String (name); + + const values = this [_metadata] .get (name); + + if (values) + return Array .from (values); + + return undefined; + }, + getMetaDatas () + { + return new Map (this [_metadata]); + }, + addExportedNode (exportedName, node) + { + exportedName = String (exportedName); + + if (this [_exportedNodes] .has (exportedName)) + throw new Error (`Couldn't add exported node: exported name '${exportedName}' already in use.`); + + this .updateExportedNode (exportedName, node); + + this ._exportedNodes_changed = this .getBrowser () .getCurrentTime (); + }, + updateExportedNode (exportedName, node) + { + exportedName = String (exportedName); + node = Base_X3DCast (Base_X3DConstants .X3DNode, node, false); + + if (exportedName .length === 0) + throw new Error ("Couldn't update exported node: node exported name is empty."); + + if (!node) + throw new Error ("Couldn't update exported node: node must be of type X3DNode."); + + //if (node .getExecutionContext () !== this) + // throw new Error ("Couldn't update exported node: node does not belong to this execution context."); + + this .removeExportedNode (exportedName); + + const exportedNode = new Execution_X3DExportedNode (exportedName, node); + + this [_exportedNodes] .add (exportedName, exportedNode); + + this ._exportedNodes_changed = this .getBrowser () .getCurrentTime (); + }, + removeExportedNode (exportedName) + { + exportedName = String (exportedName); + + this [_exportedNodes] .remove (exportedName); + + this ._exportedNodes_changed = this .getBrowser () .getCurrentTime (); + }, + getExportedNode (exportedName) + { + exportedName = String (exportedName); + + const exportedNode = this [_exportedNodes] .get (exportedName); + + if (exportedNode) + return Fields_SFNodeCache .get (exportedNode .getLocalNode ()); + + throw new Error (`Exported node '${exportedName}' not found.`); + }, + getExportedNodes () + { + return this [_exportedNodes]; + }, + getUniqueExportName (name) + { + return getUniqueName (this [_exportedNodes], name); + }, + addRootNode (node) + { + node = Fields_SFNodeCache .get (Base_X3DCast (Base_X3DConstants .X3DNode, node, false)); + + const rootNodes = this .getRootNodes (); + + for (const rootNode of rootNodes) + { + if (rootNode .equals (node)) + return; + } + + rootNodes .push (node); + }, + removeRootNode (node) + { + node = Fields_SFNodeCache .get (Base_X3DCast (Base_X3DConstants .X3DNode, node, false)); + + const rootNodes = this .getRootNodes (); + + rootNodes .assign (rootNodes .filter (rootNode => rootNode !== node)); + }, + setRootNodes (value) + { + if (!(value instanceof x_ite_Fields .MFNode)) + throw new Error ("Value must be of type MFNode."); + + this .getRootNodes () .assign (value); + }, + toVRMLStream (generator) + { + generator .string += generator .Indent (); + generator .string += "#X3D V"; + generator .string += X3D_LATEST_VERSION; + generator .string += generator .Space (); + generator .string += "utf8"; + generator .string += generator .Space (); + generator .string += this .getBrowser () .name; + generator .string += generator .Space (); + generator .string += "V"; + generator .string += this .getBrowser () .version; + generator .string += generator .ForceBreak (); + generator .string += generator .ForceBreak (); + + const profile = this .getProfile (); + + if (profile) + { + profile .toVRMLStream (generator); + + generator .string += generator .Break (); + generator .string += generator .TidyBreak (); + } + + const components = this .getComponents (); + + if (components .length) + { + components .toVRMLStream (generator); + + generator .string += generator .TidyBreak (); + } + + const units = this .getUnits () .filter (unit => unit .conversionFactor !== 1); + + if (units .length) + { + for (const unit of units) + { + unit .toVRMLStream (generator); + + generator .string += generator .Break (); + } + + generator .string += generator .TidyBreak (); + } + + const metadata = this .getMetaDatas (); + + if (metadata .size) + { + for (const [key, values] of metadata) + { + for (const value of values) + { + generator .string += generator .Indent (); + generator .string += "META"; + generator .string += generator .Space (); + generator .string += new x_ite_Fields .SFString (key) .toString (); + generator .string += generator .Space (); + generator .string += new x_ite_Fields .SFString (value) .toString (); + generator .string += generator .Break (); + } + } + + generator .string += generator .TidyBreak (); + } + + const exportedNodes = this .getExportedNodes (); + + generator .PushExecutionContext (this); + generator .EnterScope (); + generator .ExportedNodes (exportedNodes); + + Execution_X3DExecutionContext .prototype .toVRMLStream .call (this, generator); + + if (exportedNodes .length) + { + generator .string += generator .TidyBreak (); + + exportedNodes .toVRMLStream (generator); + } + + generator .LeaveScope (); + generator .PopExecutionContext (); + }, + toXMLStream (generator) + { + if (!generator .html) + { + generator .string += generator .Indent (); + generator .string += ""; + generator .string += generator .TidyBreak (); + generator .string += generator .Indent (); + generator .string += ""; + generator .string += generator .TidyBreak (); + } + + generator .string += generator .Indent (); + generator .string += " unit .conversionFactor !== 1) || + this .getMetaDatas () .size) + { + generator .string += generator .Indent (); + generator .string += ""; + generator .string += generator .TidyBreak (); + + generator .IncIndent (); + + // + + this .getComponents () .toXMLStream (generator); + + for (const unit of this .getUnits ()) + { + if (unit .conversionFactor !== 1) + { + unit .toXMLStream (generator); + + generator .string += generator .TidyBreak (); + } + } + + for (const [key, values] of this .getMetaDatas ()) + { + for (const value of values) + { + generator .string += generator .Indent (); + generator .string += "" : "/>"; + generator .string += generator .TidyBreak (); + } + } + + // + + generator .DecIndent (); + + generator .string += generator .Indent (); + generator .string += ""; + generator .string += generator .TidyBreak (); + } + + if (this .getExternProtoDeclarations () .length || + this .getProtoDeclarations () .length || + this .getRootNodes () .length) + { + generator .string += generator .Indent (); + generator .string += ""; + generator .string += generator .TidyBreak (); + + generator .IncIndent (); + + // + + const exportedNodes = this .getExportedNodes (); + + generator .PushExecutionContext (this); + generator .EnterScope (); + generator .ExportedNodes (exportedNodes); + + Execution_X3DExecutionContext .prototype .toXMLStream .call (this, generator); + + exportedNodes .toXMLStream (generator); + + generator .LeaveScope (); + generator .PopExecutionContext (); + + // + + generator .DecIndent (); + + generator .string += generator .Indent (); + generator .string += ""; + generator .string += generator .TidyBreak (); + } + else + { + generator .string += generator .Indent (); + generator .string += ""; + generator .string += generator .TidyBreak (); + } + + generator .DecIndent (); + + generator .string += generator .Indent (); + generator .string += ""; + generator .string += generator .TidyBreak (); + }, + toJSONStream (generator) + { + // X3D + + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += "X3D"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .IncIndent (); + + + // Encoding + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "encoding"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += "UTF-8"; + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + + // Profile + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@profile"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += this .getProfile () ? this .getProfile () .name : "Full"; + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + + // Version + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@version"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += X3D_LATEST_VERSION; + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + + // XSD noNamespaceSchemaLocation + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@xsd:noNamespaceSchemaLocation"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += "http://www.web3d.org/specifications/x3d-"; + generator .string += X3D_LATEST_VERSION; + generator .string += ".xsd"; + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + + // JSON schema + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "JSON schema"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += "http://www.web3d.org/specifications/x3d-"; + generator .string += X3D_LATEST_VERSION; + generator .string += "-JSONSchema.json"; + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + + // Head + + const outputUnits = this .getUnits () .some (unit => unit .conversionFactor !== 1); + + if (this .getComponents () .length || outputUnits || this .getMetaDatas () .size) + { + let headLastProperty = false; + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "head"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + + // Meta data + + if (this .getMetaDatas () .size) + { + if (headLastProperty) + { + generator .string += ','; + generator .string += generator .TidyBreak (); + } + + + // Meta data begin + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "meta"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '['; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + + // Meta data + + for (const [i, [key, values]] of [... this .getMetaDatas ()] .entries ()) + { + for (const [j, value] of values .entries ()) + { + generator .string += generator .Indent (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@name"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (key); + generator .string += '"'; + generator .string += ','; + generator .string += generator .TidyBreak (); + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "@content"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '"'; + generator .string += generator .JSONEncode (value); + generator .string += '"'; + generator .string += generator .TidyBreak (); + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + + if (!(i === this .getMetaDatas () .size - 1 && j === values .length - 1)) + generator .string += ','; + + generator .string += generator .TidyBreak (); + } + } + + + // Meta data end + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += ']'; + + headLastProperty = true; + } + + + // Components + + if (this .getComponents () .length) + { + if (headLastProperty) + { + generator .string += ','; + generator .string += generator .TidyBreak (); + } + + + // Components begin + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "component"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '['; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + + // Components + + this .getComponents () .toJSONStream (generator); + + + // Components end + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += ']'; + + headLastProperty = true; + } + + + // Units + + if (outputUnits) + { + if (headLastProperty) + { + generator .string += ','; + generator .string += generator .TidyBreak (); + } + + + // Units begin + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "unit"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '['; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + + // Units + + this .getUnits () .toJSONStream (generator); + + + // Unit end + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += ']'; + + headLastProperty = true; + } + + + // Head end + + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + generator .string += ','; + generator .string += generator .TidyBreak (); + } + + // Scene + + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "Scene"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '{'; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + generator .string += generator .Indent (); + generator .string += '"'; + generator .string += "-children"; + generator .string += '"'; + generator .string += ':'; + generator .string += generator .TidySpace (); + generator .string += '['; + generator .string += generator .TidyBreak (); + generator .string += generator .IncIndent (); + + const exportedNodes = this .getExportedNodes (); + + generator .PushExecutionContext (this); + generator .EnterScope (); + generator .ExportedNodes (exportedNodes); + + Execution_X3DExecutionContext .prototype .toJSONStream .call (this, generator); + + // Exported nodes + + this .getExportedNodes () .toJSONStream (generator, true); + + generator .JSONRemoveComma (); + + generator .LeaveScope (); + generator .PopExecutionContext (); + + // Scene end + + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += ']'; + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + + + // X3D end + + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + generator .string += generator .TidyBreak (); + generator .string += generator .DecIndent (); + generator .string += generator .Indent (); + generator .string += '}'; + generator .string += generator .TidyBreak (); + }, +}, +{ + setExecutionContext (value) + { + if (!this .isMainScene ()) + { + const scene = this .getScene (); + + for (const object of this [_loadingObjects]) + scene .removeLoadingObject (object); + } + + Execution_X3DExecutionContext .prototype .setExecutionContext .call (this, value); + + if (!this .isMainScene ()) + { + const scene = this .getScene (); + + for (const object of this [_loadingObjects]) + scene .addLoadingObject (object); + } + }, + addInitLoadCount (node) + { + this ._initLoadCount = this ._initLoadCount .getValue () + 1; + }, + removeInitLoadCount (node) + { + this ._initLoadCount = this ._initLoadCount .getValue () - 1; + }, + getLoadingObjects () + { + return this [_loadingObjects]; + }, + addLoadingObject (node) + { + if (this [_loadingObjects] .has (node)) + return; + + this [_loadingObjects] .add (node); + + this ._loadCount = this [_loadingObjects] .size; + + const + browser = this .getBrowser (), + scene = this .getScene (); + + if (this === browser .getExecutionContext () || this .loader === browser .loader) + browser .addLoadingObject (node); + + if (!this .isMainScene ()) + scene .addLoadingObject (node); + }, + removeLoadingObject (node) + { + if (!this [_loadingObjects] .has (node)) + return; + + this [_loadingObjects] .delete (node); + + this ._loadCount = this [_loadingObjects] .size; + + const + browser = this .getBrowser (), + scene = this .getScene (); + + if (this === browser .getExecutionContext () || this .loader === browser .loader) + browser .removeLoadingObject (node); + + if (!this .isMainScene ()) + scene .removeLoadingObject (node); + }, +}); + +for (const key of Object .keys (X3DScene .prototype)) + Object .defineProperty (X3DScene .prototype, key, { enumerable: false }); + +Object .defineProperties (X3DScene .prototype, +{ + specificationVersion: + { + get: X3DScene .prototype .getSpecificationVersion, + enumerable: true, + }, + encoding: + { + get: X3DScene .prototype .getEncoding, + enumerable: true, + }, + profile: + { + get: X3DScene .prototype .getProfile, + enumerable: true, + }, + profile_changed: + { + get () { return this ._profile_changed; }, + enumerable: false, + }, + components: + { + get: X3DScene .prototype .getComponents, + enumerable: true, + }, + worldURL: + { + get: X3DScene .prototype .getWorldURL, + enumerable: true, + }, + units: + { + get: X3DScene .prototype .getUnits, + enumerable: true, + }, + metadata_changed: + { + get () { return this ._metadata_changed; }, + enumerable: false, + }, + rootNodes: + { + get: X3DScene .prototype .getRootNodes, + set: X3DScene .prototype .setRootNodes, + enumerable: true, + }, + exportedNodes: + { + get: X3DScene .prototype .getExportedNodes, + enumerable: true, + }, + sceneGraph_changed: + { + get () { return this ._sceneGraph_changed; }, + enumerable: false, + }, +}); + +Object .defineProperties (X3DScene, +{ + typeName: + { + value: "X3DScene", + enumerable: true, + }, +}); + +Base_X3DConstants .addNode (X3DScene); + +const X3DScene_default_ = X3DScene; +; + +x_ite_Namespace .add ("X3DScene", "x_ite/Execution/X3DScene", X3DScene_default_); +/* harmony default export */ const Execution_X3DScene = (X3DScene_default_); +;// CONCATENATED MODULE: ./src/standard/Utility/DataStorage.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +const + storages = new WeakMap (), + namespaces = new WeakMap (), + defaults = new WeakMap (); + +const DataStorage_handler = +{ + get (target, key) + { + const property = target [key]; + + if (property !== undefined) + return property; + + const string = target .getStorage () [target .getNameSpace () + key]; + + if (string === undefined || string === "undefined" || string === null) + return target .getDefaultValue (key); + + const value = JSON .parse (string); + + return value; + }, + set (target, key, value) + { + if (value === undefined) + target .getStorage () .removeItem (target .getNameSpace () + key); + + else + target .getStorage () [target .getNameSpace () + key] = JSON .stringify (value); + + return true; + }, +}; + +function DataStorage (storage, namespace) +{ + this .target = this; + + storages .set (this, storage); + namespaces .set (this, namespace); + defaults .set (this, { }); + + return new Proxy (this, DataStorage_handler); +} + +Object .assign (DataStorage .prototype, +{ + getStorage () + { + return storages .get (this .target); + }, + getNameSpace () + { + return namespaces .get (this .target); + }, + addNameSpace (namespace) + { + return new DataStorage (this .getStorage (), this .getNameSpace () + namespace); + }, + setDefaultValues (object) + { + Object .assign (defaults .get (this .target), object); + }, + getDefaultValue (key) + { + const value = defaults .get (this .target) [key]; + + return value === undefined ? undefined : JSON .parse (JSON .stringify (value)); + }, + clear () + { + const + storage = this .getStorage (), + namespace = this .getNameSpace (); + + for (const key of Object .keys (storage)) + { + if (key .startsWith (namespace)) + storage .removeItem (key) + } + }, +}); + +const DataStorage_default_ = DataStorage; +; + +x_ite_Namespace .add ("DataStorage", "standard/Utility/DataStorage", DataStorage_default_); +/* harmony default export */ const Utility_DataStorage = (DataStorage_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Core/X3DCoreContext.js +/* provided dependency */ var X3DCoreContext_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + +const WEBGL_LATEST_VERSION = 2; + +const + _instanceId = Symbol (), + _element = Symbol (), + _shadow = Symbol (), + _surface = Symbol (), + _canvas = Symbol (), + _context = Symbol (), + _splashScreen = Symbol (), + _localStorage = Symbol (), + _mobile = Symbol (), + _browserTimings = Symbol (), + _browserOptions = Symbol (), + _browserProperties = Symbol (), + _renderingProperties = Symbol (), + _notification = Symbol (), + _contextMenu = Symbol (), + _privateScene = Symbol (), + _keydown = Symbol (), + _keyup = Symbol (), + _pixelPerPoint = Symbol (); + +let instanceId = 0; + +function X3DCoreContext (element) +{ + // Get canvas & context. + + const + browser = X3DCoreContext_$("
      ") .addClass ("x_ite-private-browser") .attr ("tabindex", 0), + surface = X3DCoreContext_$("
      ") .addClass ("x_ite-private-surface") .appendTo (browser), + splashScreen = X3DCoreContext_$("
      ") .hide () .addClass ("x_ite-private-splash-screen") .appendTo (browser), + spinner = X3DCoreContext_$("
      ") .addClass ("x_ite-private-spinner") .appendTo (splashScreen), + progress = X3DCoreContext_$("
      ") .addClass ("x_ite-private-progress") .appendTo (splashScreen); + + if (element .prop ("nodeName") .toLowerCase () === "x3d-canvas") + { + const + shadow = X3DCoreContext_$(element [0] .attachShadow ({ mode: "open", delegatesFocus: true })), + link = X3DCoreContext_$(""); + + link + .on ("load", () => browser .show ()) + .attr ("rel", "stylesheet") + .attr ("type", "text/css") + .attr ("href", new URL ("x_ite.css", Networking_URLs .getScriptURL ()) .href); + + this [_shadow] = shadow + .append (link) + .append (browser .hide ()); + } + else + { + this [_shadow] = element .prepend (browser); + } + + X3DCoreContext_$("
      ") .addClass ("x_ite-private-x_ite") .html (this .getName () + "X3D") .appendTo (progress); + X3DCoreContext_$("
      ") .addClass ("x_ite-private-progressbar") .appendTo (progress) .append (X3DCoreContext_$("
      ")); + X3DCoreContext_$("
      ") .addClass ("x_ite-private-spinner-text") .appendTo (progress); + + this [_instanceId] = ++ instanceId; + this [_localStorage] = new Utility_DataStorage (localStorage, "X_ITE.X3DBrowser(" + this [_instanceId] + ")."); + this [_mobile] = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i .test (navigator .userAgent); + this [_element] = element; + this [_surface] = surface; + this [_canvas] = X3DCoreContext_$("") .addClass ("x_ite-private-canvas") .prependTo (surface); + this [_context] = Core_Context .create (this [_canvas] [0], WEBGL_LATEST_VERSION, element .attr ("preserveDrawingBuffer") === "true", this [_mobile]); + this [_splashScreen] = splashScreen; + + this [_renderingProperties] = new Core_RenderingProperties (this .getPrivateScene ()); + this [_browserOptions] = new Core_BrowserOptions (this .getPrivateScene ()); + this [_browserProperties] = new Core_BrowserProperties (this .getPrivateScene ()); + this [_browserTimings] = new Core_BrowserTimings (this .getPrivateScene ()); + this [_notification] = new Core_Notification (this .getPrivateScene ()); + this [_contextMenu] = new Core_ContextMenu (this .getPrivateScene ()); + + const inches = X3DCoreContext_$("
      ") .hide () .css ("height", "10in") .appendTo (X3DCoreContext_$("body")); + this [_pixelPerPoint] = inches .height () / 720 || 1; + inches .remove (); + + this .addChildObjects (Base_X3DConstants .outputOnly, "controlKey", new x_ite_Fields .SFBool (), + Base_X3DConstants .outputOnly, "shiftKey", new x_ite_Fields .SFBool (), + Base_X3DConstants .outputOnly, "altKey", new x_ite_Fields .SFBool (), + Base_X3DConstants .outputOnly, "commandKey", new x_ite_Fields .SFBool (), + Base_X3DConstants .outputOnly, "altGrKey", new x_ite_Fields .SFBool ()); +} + +Object .assign (X3DCoreContext .prototype, +{ + initialize () + { + // Setup browser nodes. + + this [_renderingProperties] .setup (); + this [_browserOptions] .setup (); + this [_browserProperties] .setup (); + this [_browserTimings] .setup (); + this [_notification] .setup (); + this [_contextMenu] .setup (); + + // Define properties of X3DCanvasElement. + + Object .defineProperties (this .getElement () .get (0), + { + browser: + { + value: this, + enumerable: true, + }, + src: + { + get: () => + { + return this .getExecutionContext () .getWorldURL (); + }, + set: (value) => + { + this .loadURL (new x_ite_Fields .MFString (value)) + .catch (error => console .error (error)); + }, + enumerable: true, + }, + url: + { + get: () => + { + return new x_ite_Fields .MFString (this .getExecutionContext () .getWorldURL ()); + }, + set: (value) => + { + this .loadURL (value) + .catch (error => console .error (error)); + }, + enumerable: true, + }, + }); + + // Configure browser event handlers. + + this .getElement () + .on ("keydown.X3DCoreContext", this [_keydown] .bind (this)) + .on ("keyup.X3DCoreContext", this [_keyup] .bind (this)); + }, + getInstanceId () + { + return this [_instanceId]; + }, + isStrict () + { + return false; + }, + getElement () + { + return this [_element]; + }, + getShadow () + { + return this [_shadow]; + }, + getSurface () + { + return this [_surface]; + }, + getSplashScreen () + { + return this [_splashScreen]; + }, + getCanvas () + { + return this [_canvas]; + }, + getContext () + { + return this [_context]; + }, + getMobile () + { + return this [_mobile]; + }, + getLocalStorage () + { + return this [_localStorage]; + }, + getBrowserTimings () + { + return this [_browserTimings]; + }, + getBrowserOptions () + { + return this [_browserOptions]; + }, + getBrowserProperties () + { + return this [_browserProperties]; + }, + getRenderingProperties () + { + return this [_renderingProperties]; + }, + getNotification () + { + return this [_notification]; + }, + getContextMenu () + { + return this [_contextMenu]; + }, + getPrivateScene () + { + if (this [_privateScene]) + return this [_privateScene]; + + // X3DScene for default nodes. + + this [_privateScene] = new Execution_X3DScene (this); + + this [_privateScene] .setLive (true); + this [_privateScene] .setup (); + + return this [_privateScene]; + }, + getPixelPerPoint () + { + return this [_pixelPerPoint] * this .getRenderingProperty ("ContentScale"); + }, + connectedCallback () + { }, + attributeChangedCallback (name, oldValue, newValue) + { + switch (name) + { + case "antialiased": + { + this .setBrowserOption ("Antialiased", this .parseBooleanAttribute (newValue, true)); + break; + } + case "baseURL": + case "baseurl": + { + this .setBaseURL (newValue); + break; + } + case "cache": + { + this .setBrowserOption ("Cache", this .parseBooleanAttribute (newValue, true)); + break; + } + case "contentScale": + case "contentscale": + { + this .setBrowserOption ("ContentScale", newValue === "auto" ? -1 : parseFloat (newValue)); + break; + } + case "contextMenu": + case "contextmenu": + { + this .setBrowserOption ("ContextMenu", this .parseBooleanAttribute (newValue, true)); + break; + } + case "debug": + { + this .setBrowserOption ("Debug", this .parseBooleanAttribute (newValue, false)); + break; + } + case "multisampling": + { + const samples = parseInt (newValue); + + this .setBrowserOption ("Multisampling", isNaN (samples) ? 4 : samples); + break; + } + case "notifications": + { + this .setBrowserOption ("Notifications", this .parseBooleanAttribute (newValue, true)); + break; + } + case "oninitialized": + case "onshutdown": + { + try + { + this .getElement () [0] [name] = new Function ("event", newValue); + } + catch (error) + { + console .error (error); + } + + break; + } + case "orderIndependentTransparency": + case "orderindependenttransparency": + { + this .setBrowserOption ("OrderIndependentTransparency", this .parseBooleanAttribute (newValue, false)); + break; + } + case "splashScreen": + case "splashscreen": + { + this .setBrowserOption ("SplashScreen", this .parseBooleanAttribute (newValue, true)); + + if (! this .getBrowserOption ("SplashScreen")) + { + this .getCanvas () .show (); + this .getSplashScreen () .stop (true, true) .hide (); + } + + break; + } + case "src": + { + if (newValue) + { + this .loadURL (new x_ite_Fields .MFString (newValue)) + .catch (error => console .error (error)); + } + + break; + } + case "timings": + { + this .setBrowserOption ("Timings", this .parseBooleanAttribute (newValue, false)); + break; + } + case "update": + { + if (newValue === "auto") + { + this .setBrowserOption ("AutoUpdate", true); + } + else + { + this .setBrowserOption ("AutoUpdate", false); + + if (this .parseBooleanAttribute (newValue, true)) + this .beginUpdate (); + else + this .endUpdate (); + } + + break; + } + case "url": + { + if (newValue) + { + this .loadURL (this .parseUrlAttribute (newValue)) + .catch (error => console .error (error)); + } + + break; + } + } + }, + parseBooleanAttribute (value, defaultValue) + { + if (value === "true") + return true; + + if (value === "false") + return false; + + return defaultValue; + }, + parseUrlAttribute (urlCharacters) + { + try + { + const url = new x_ite_Fields .MFString (); + + url .fromString ("[" + urlCharacters + "]", this .getExecutionContext ()); + + return url; + } + catch + { + throw new Error ("Couldn't parse url attribute."); + } + }, + callBrowserEventHandler: (() => + { + const build_in = new Set (["error", "load"]); + + return function (events) + { + const element = this .getElement () [0]; + + for (const name of events .split (" ")) + { + // Order is attribute, then dispatch. + + const event = new CustomEvent (name); + + try + { + if (!build_in .has (name)) + element [`on${name}`] ?.(event); + } + catch (error) + { + console .error (error); + } + + element .dispatchEvent (event); + } + }; + })(), + getShiftKey () + { + return this ._shiftKey .getValue (); + }, + getControlKey () + { + return this ._controlKey .getValue (); + }, + getAltKey () + { + return this ._altKey .getValue (); + }, + getCommandKey () + { + return this ._commandKey .getValue (); + }, + getAltGrKey () + { + return this ._altGrKey .getValue (); + }, + [_keydown] (event) + { + switch (event .keyCode) + { + case 16: // Shift + { + this ._shiftKey = true; + break; + } + case 17: // Ctrl + { + this ._controlKey = true; + break; + } + case 18: // Alt + { + this ._altKey = true; + break; + } + case 49: // 1 + { + if (this .getBrowserOption ("Debug")) + { + if (this .getControlKey ()) + { + event .preventDefault (); + this .setBrowserOption ("Shading", "POINT"); + this .getNotification () ._string = "Shading: Pointset"; + } + } + + break; + } + case 50: // 2 + { + if (this .getBrowserOption ("Debug")) + { + if (this .getControlKey ()) + { + event .preventDefault (); + this .setBrowserOption ("Shading", "WIREFRAME"); + this .getNotification () ._string = "Shading: Wireframe"; + } + } + + break; + } + case 51: // 3 + { + if (this .getBrowserOption ("Debug")) + { + if (this .getControlKey ()) + { + event .preventDefault (); + this .setBrowserOption ("Shading", "FLAT"); + this .getNotification () ._string = "Shading: Flat"; + } + } + + break; + } + case 52: // 4 + { + if (this .getBrowserOption ("Debug")) + { + if (this .getControlKey ()) + { + event .preventDefault (); + this .setBrowserOption ("Shading", "GOURAUD"); + this .getNotification () ._string = "Shading: Gouraud"; + } + } + + break; + } + case 53: // 5 + { + if (this .getBrowserOption ("Debug")) + { + if (this .getControlKey ()) + { + event .preventDefault (); + this .setBrowserOption ("Shading", "PHONG"); + this .getNotification () ._string = "Shading: Phong"; + } + } + + break; + } + case 83: // s + { + if (this .getBrowserOption ("Debug")) + { + if (this .getControlKey ()) + { + event .preventDefault (); + + if (this .isLive ()) + this .endUpdate (); + else + this .beginUpdate (); + + this .getNotification () ._string = this .getLive () .getValue () ? "Begin Update" : "End Update"; + } + } + + break; + } + case 91: // Command + { + this ._commandKey = true; + break; + } + case 225: // Alt Gr + { + this ._altGrKey = true; + break; + } + case 171: // Plus // Firefox + case 187: // Plus // Opera + { + if (this .getControlKey ()) + { + event .preventDefault (); + this .setBrowserOption ("Timings", !this .getBrowserOption ("Timings")); + } + + break; + } + case 36: // Pos 1 + { + event .preventDefault (); + this .firstViewpoint (); + break; + } + case 35: // End + { + event .preventDefault (); + this .lastViewpoint (); + break; + } + case 33: // Page Up + { + event .preventDefault (); + this .previousViewpoint (); + break; + } + case 34: // Page Down + { + event .preventDefault (); + this .nextViewpoint (); + break; + } + case 119: // F8 + { + if (this .getShiftKey ()) + { + event .preventDefault (); + + const viewpoint = this .getActiveViewpoint (); + + if (!viewpoint) + break; + + const vp = this .getPrivateScene () .createNode (viewpoint .getTypeName ()); + + switch (viewpoint .getTypeName ()) + { + case "Viewpoint": + { + vp .position = viewpoint .getUserPosition (); + vp .orientation = viewpoint .getUserOrientation (); + vp .centerOfRotation = viewpoint .getUserCenterOfRotation (); + vp .fieldOfView = viewpoint .getFieldOfView (); + break; + } + case "OrthoViewpoint": + { + vp .position = viewpoint .getUserPosition (); + vp .orientation = viewpoint .getUserOrientation (); + vp .centerOfRotation = viewpoint .getUserCenterOfRotation (); + vp .fieldOfView = new x_ite_Fields .MFFloat (viewpoint .getMinimumX (), viewpoint .getMinimumY (), viewpoint .getMaximumX (), viewpoint .getMaximumY ()); + break; + } + case "GeoViewpoint": + { + const + geoOrigin = viewpoint ._geoOrigin, + geoCoord = new Numbers_Vector3 (0, 0, 0); + + if (geoOrigin .getValue () && geoOrigin .getNodeTypeName () === "GeoOrigin") + { + const go = this .getPrivateScene () .createNode ("GeoOrigin"); + + vp .geoOrigin = go; + go .geoSystem = geoOrigin .geoSystem; + go .geoCoords = geoOrigin .geoCoords; + go .rotateYUp = geoOrigin .rotateYUp; + } + + vp .geoSystem = viewpoint ._geoSystem; + vp .position = viewpoint .getGeoCoord (viewpoint .getUserPosition (), geoCoord); + vp .orientation = viewpoint .getUserOrientation (); + vp .centerOfRotation = viewpoint .getGeoCoord (viewpoint .getUserCenterOfRotation (), geoCoord); + vp .fieldOfView = viewpoint .getFieldOfView (); + break; + } + } + + let text; + + switch (this .getExecutionContext () .getEncoding ()) + { + case "ASCII": + case "VRML": text = vp .toVRMLString (); break; + case "JSON": text = vp .toJSONString (); break; + default: text = vp .toXMLString (); break; + } + + text += "\n"; + + this .copyToClipboard (text); + this .getNotification () ._string = locale_gettext ("Viewpoint copied to clipboard."); + + console .log ("Viewpoint copied to clipboard."); + console .debug (text); + } + + break; + } + } + }, + [_keyup] (event) + { + //console .log (event .which); + + switch (event .which) + { + case 16: // Shift + { + this ._shiftKey = false; + break; + } + case 17: // Ctrl + { + this ._controlKey = false; + break; + } + case 18: // Alt + { + this ._altKey = false; + break; + } + case 91: // Command + { + this ._commandKey = false; + break; + } + case 225: // Alt Gr + { + this ._altGrKey = false; + break; + } + } + }, + copyToClipboard (text) + { + // The textarea must be visible to make copy work. + const tmp = X3DCoreContext_$(""); + this .getShadow () .find (".x_ite-private-browser") .prepend (tmp); + tmp .text (text) .trigger ("select"); + document .execCommand ("copy"); + tmp .remove (); + }, + dispose () + { + this [_context] .getExtension ("WEBGL_lose_context") ?.loseContext (); + }, +}); + +const X3DCoreContext_default_ = X3DCoreContext; +; + +x_ite_Namespace .add ("X3DCoreContext", "x_ite/Browser/Core/X3DCoreContext", X3DCoreContext_default_); +/* harmony default export */ const Core_X3DCoreContext = (X3DCoreContext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/EnvironmentalEffects/X3DEnvironmentalEffectsContext.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +const _backgroundTextureProperties = Symbol (); + +function X3DEnvironmentalEffectsContext () { } + +Object .assign (X3DEnvironmentalEffectsContext .prototype, +{ + getBackgroundTextureProperties () + { + this [_backgroundTextureProperties] = new Texturing_TextureProperties (this .getPrivateScene ()); + + this [_backgroundTextureProperties] ._boundaryModeS = "CLAMP_TO_EDGE"; + this [_backgroundTextureProperties] ._boundaryModeT = "CLAMP_TO_EDGE"; + this [_backgroundTextureProperties] ._boundaryModeR = "CLAMP_TO_EDGE"; + this [_backgroundTextureProperties] ._minificationFilter = "NICEST"; + this [_backgroundTextureProperties] ._magnificationFilter = "NICEST"; + this [_backgroundTextureProperties] ._textureCompression = "DEFAULT"; + this [_backgroundTextureProperties] .setup (); + + this .getBackgroundTextureProperties = function () { return this [_backgroundTextureProperties]; }; + + Object .defineProperty (this, "getBackgroundTextureProperties", { enumerable: false }); + + return this [_backgroundTextureProperties]; + }, +}); + +const X3DEnvironmentalEffectsContext_default_ = X3DEnvironmentalEffectsContext; +; + +x_ite_Namespace .add ("X3DEnvironmentalEffectsContext", "x_ite/Browser/EnvironmentalEffects/X3DEnvironmentalEffectsContext", X3DEnvironmentalEffectsContext_default_); +/* harmony default export */ const EnvironmentalEffects_X3DEnvironmentalEffectsContext = (X3DEnvironmentalEffectsContext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Geometry3D/BoxOptions.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function BoxOptions (executionContext) +{ + Base_X3DBaseNode .call (this, executionContext); +} + +Object .assign (Object .setPrototypeOf (BoxOptions .prototype, Base_X3DBaseNode .prototype), +{ + initialize () + { + Base_X3DBaseNode .prototype .initialize .call (this); + }, + getGeometry () + { + if (this .geometry) + return this .geometry; + + this .geometry = new Geometry3D_IndexedFaceSet (this .getExecutionContext ()); + this .geometry ._texCoord = new Texturing_TextureCoordinate (this .getExecutionContext ()); + this .geometry ._coord = new Rendering_Coordinate (this .getExecutionContext ()); + + const + geometry = this .geometry, + texCoord = this .geometry ._texCoord .getValue (), + coord = this .geometry ._coord .getValue (); + + geometry ._texCoordIndex = new x_ite_Fields .MFInt32 ( + 0, 1, 2, 3, -1, // front + 0, 1, 2, 3, -1, // back + 0, 1, 2, 3, -1, // left + 0, 1, 2, 3, -1, // right + 0, 1, 2, 3, -1, // top + 0, 1, 2, 3, -1 // bottom + ); + + geometry ._coordIndex = new x_ite_Fields .MFInt32 ( + 0, 1, 2, 3, -1, // front + 5, 4, 7, 6, -1, // back + 1, 5, 6, 2, -1, // left + 4, 0, 3, 7, -1, // right + 4, 5, 1, 0, -1, // top + 3, 2, 6, 7, -1 // bottom + ); + + texCoord ._point = new x_ite_Fields .MFVec2f ( + new x_ite_Fields .SFVec2f (1, 1), new x_ite_Fields .SFVec2f (0, 1), new x_ite_Fields .SFVec2f (0, 0), new x_ite_Fields .SFVec2f (1, 0) + ); + + coord ._point = new x_ite_Fields .MFVec3f ( + new x_ite_Fields .SFVec3f ( 1, 1, 1), new x_ite_Fields .SFVec3f (-1, 1, 1), new x_ite_Fields .SFVec3f (-1, -1, 1), new x_ite_Fields .SFVec3f ( 1, -1, 1), + new x_ite_Fields .SFVec3f ( 1, 1, -1), new x_ite_Fields .SFVec3f (-1, 1, -1), new x_ite_Fields .SFVec3f (-1, -1, -1), new x_ite_Fields .SFVec3f ( 1, -1, -1) + ); + + texCoord .setup (); + coord .setup (); + geometry .setup (); + + return this .geometry; + }, +}); + +Object .defineProperties (BoxOptions, +{ + typeName: + { + value: "BoxOptions", + enumerable: true, + }, +}); + +const BoxOptions_default_ = BoxOptions; +; + +x_ite_Namespace .add ("BoxOptions", "x_ite/Browser/Geometry3D/BoxOptions", BoxOptions_default_); +/* harmony default export */ const Geometry3D_BoxOptions = (BoxOptions_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Geometry3D/ConeOptions.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function ConeOptions (executionContext) +{ + Base_X3DBaseNode .call (this, executionContext); + + this .addChildObjects (Base_X3DConstants .inputOutput, "xDimension", new x_ite_Fields .SFInt32 (20), + Base_X3DConstants .inputOutput, "yDimension", new x_ite_Fields .SFInt32 (1)) +} + +Object .setPrototypeOf (ConeOptions .prototype, Base_X3DBaseNode .prototype); + +Object .defineProperties (ConeOptions, +{ + typeName: + { + value: "ConeOptions", + enumerable: true, + }, +}); + +const ConeOptions_default_ = ConeOptions; +; + +x_ite_Namespace .add ("ConeOptions", "x_ite/Browser/Geometry3D/ConeOptions", ConeOptions_default_); +/* harmony default export */ const Geometry3D_ConeOptions = (ConeOptions_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Geometry3D/CylinderOptions.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function CylinderOptions (executionContext) +{ + Base_X3DBaseNode .call (this, executionContext); + + this .addChildObjects (Base_X3DConstants .inputOutput, "xDimension", new x_ite_Fields .SFInt32 (20), + Base_X3DConstants .inputOutput, "yDimension", new x_ite_Fields .SFInt32 (1)) +} + +Object .setPrototypeOf (CylinderOptions .prototype, Base_X3DBaseNode .prototype); + +Object .defineProperties (CylinderOptions, +{ + typeName: + { + value: "CylinderOptions", + enumerable: true, + }, +}); + +const CylinderOptions_default_ = CylinderOptions; +; + +x_ite_Namespace .add ("CylinderOptions", "x_ite/Browser/Geometry3D/CylinderOptions", CylinderOptions_default_); +/* harmony default export */ const Geometry3D_CylinderOptions = (CylinderOptions_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Geometry3D/QuadSphereOptions.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + +function QuadSphereOptions (executionContext) +{ + Base_X3DBaseNode .call (this, executionContext); + + this .addChildObjects (Base_X3DConstants .inputOutput, "xDimension", new x_ite_Fields .SFInt32 (32), + Base_X3DConstants .inputOutput, "yDimension", new x_ite_Fields .SFInt32 (15)) +} + +Object .assign (Object .setPrototypeOf (QuadSphereOptions .prototype, Base_X3DBaseNode .prototype), +{ + initialize () + { + Base_X3DBaseNode .prototype .initialize .call (this); + + this .addInterest ("eventsProcessed", this); + }, + getGeometry () + { + if (! this .geometry) + this .eventsProcessed (); + + return this .geometry; + }, + createTexCoordIndex () + { + const + xDimension = this ._xDimension .getValue () + 1, + yDimension = this ._yDimension .getValue (), + texCoordIndex = this .geometry ._texCoordIndex; + + // North pole + + for (let u = 0, uLength = xDimension - 1; u < uLength; ++ u) + { + texCoordIndex .push (u); + texCoordIndex .push (u + xDimension - 1); + texCoordIndex .push (u + xDimension); + texCoordIndex .push (-1); + } + + // Sphere segments + + for (let p = xDimension - 1, v = 0, vLength = yDimension - 3; v < vLength; ++ v, ++ p) + { + for (let u = 0, uLength = xDimension - 1; u < uLength; ++ u, ++ p) + { + texCoordIndex .push (p); + texCoordIndex .push (p + xDimension); + texCoordIndex .push (p + xDimension + 1); + texCoordIndex .push (p + 1); + texCoordIndex .push (-1); + } + } + + // South pole + + let p = (yDimension - 2) * xDimension - 1; + + for (let u = 0, uLength = xDimension - 1; u < uLength; ++ u, ++ p) + { + texCoordIndex .push (p + xDimension); + texCoordIndex .push (p + 1); + texCoordIndex .push (p); + texCoordIndex .push (-1); + } + }, + createTexCoord () + { + const + xDimension = this ._xDimension .getValue () + 1, + yDimension = this ._yDimension .getValue (), + point = this .geometry ._texCoord .getValue () ._point; + + const poleOffset = -0.5 / (xDimension - 1); + + // North pole + + for (let u = 1; u < xDimension; ++ u) + { + const x = u / (xDimension - 1) + poleOffset; + + point .push (new Numbers_Vector2 (x, 1)); + } + + // Sphere segments + + for (let v = 1, vLength = yDimension - 1; v < vLength; ++ v) + { + const y = 1 - v / (yDimension - 1); + + for (let u = 0; u < xDimension; ++ u) + { + const x = u / (xDimension - 1); + + point .push (new Numbers_Vector2 (x, y)); + } + } + + // South pole + + for (let u = 1; u < xDimension; ++ u) + { + const x = u / (xDimension - 1) + poleOffset; + + point .push (new Numbers_Vector2 (x, 0)); + } + }, + createCoordIndex () + { + const + xDimension = this ._xDimension .getValue () + 1, + yDimension = this ._yDimension .getValue (), + coordIndex = this .geometry ._coordIndex; + + // North pole + + let u = 1; + + for (const uLength = xDimension - 1; u < uLength; ++ u) + { + coordIndex .push (0); + coordIndex .push (u); + coordIndex .push (u + 1); + coordIndex .push (-1); + } + + coordIndex .push (0); + coordIndex .push (u); + coordIndex .push (1); + coordIndex .push (-1); + + // Sphere segments + + let p = 1; + + for (let v = 0, vLength = yDimension - 3; v < vLength; ++ v, ++ p) + { + for (let u = 0, uLength = xDimension - 2; u < uLength; ++ u, ++ p) + { + coordIndex .push (p); + coordIndex .push (p + xDimension - 1); + coordIndex .push (p + xDimension); + coordIndex .push (p + 1); + coordIndex .push (-1); + } + + coordIndex .push (p); + coordIndex .push (p + xDimension - 1); + coordIndex .push (p + 1); + coordIndex .push (p - xDimension + 2); + coordIndex .push (-1); + } + + // South pole + + const last = p + xDimension - 1; + + for (let u = 0, uLength = xDimension - 2; u < uLength; ++ u, ++ p) + { + coordIndex .push (last); + coordIndex .push (p + 1); + coordIndex .push (p); + coordIndex .push (-1); + } + + coordIndex .push (last); + coordIndex .push (last - xDimension + 1); + coordIndex .push (p); + coordIndex .push (-1); + }, + createPoints () + { + const + xDimension = this ._xDimension .getValue () + 1, + yDimension = this ._yDimension .getValue (), + point = this .geometry ._coord .getValue () ._point; + + // North pole + point .push (new Numbers_Vector3 (0, 1, 0)); + + // Sphere segments + for (let v = 1, vLength = yDimension - 1; v < vLength; ++ v) + { + const zPlane = Numbers_Complex .Polar (1, -Math .PI * v / vLength); + + for (let u = 0, uLength = xDimension - 1; u < uLength; ++ u) + { + const yPlane = Numbers_Complex .Polar (zPlane .imag, 2 * Math .PI * u / uLength); + + point .push (new Numbers_Vector3 (yPlane .imag, zPlane .real, yPlane .real)); + } + } + + // South pole + point .push (new Numbers_Vector3 (0, -1, 0)); + }, + eventsProcessed () + { + this .geometry = new Geometry3D_IndexedFaceSet (this .getExecutionContext ()); + this .geometry ._texCoord = new Texturing_TextureCoordinate (this .getExecutionContext ()); + this .geometry ._coord = new Rendering_Coordinate (this .getExecutionContext ()); + + this .createTexCoordIndex (); + this .createTexCoord (); + this .createCoordIndex (); + this .createPoints (); + + const + geometry = this .geometry, + texCoord = this .geometry ._texCoord .getValue (), + coord = this .geometry ._coord .getValue (); + + geometry ._creaseAngle = Math .PI; + + texCoord .setup (); + coord .setup (); + geometry .setup (); + }, +}); + +Object .defineProperties (QuadSphereOptions, +{ + typeName: + { + value: "QuadSphereOptions", + enumerable: true, + }, +}); + +const QuadSphereOptions_default_ = QuadSphereOptions; +; + +x_ite_Namespace .add ("QuadSphereOptions", "x_ite/Browser/Geometry3D/QuadSphereOptions", QuadSphereOptions_default_); +/* harmony default export */ const Geometry3D_QuadSphereOptions = (QuadSphereOptions_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Geometry3D/X3DGeometry3DContext.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function X3DGeometry3DContext () { } + +Object .assign (X3DGeometry3DContext .prototype, +{ + initialize () + { + this .setPrimitiveQuality3D (this .getBrowserOptions () .getPrimitiveQuality ()); + }, + getBoxOptions () + { + return getOptionNode .call (this, "getBoxOptions", Geometry3D_BoxOptions); + }, + getConeOptions () + { + return getOptionNode .call (this, "getConeOptions", Geometry3D_ConeOptions); + }, + getCylinderOptions () + { + return getOptionNode .call (this, "getCylinderOptions", Geometry3D_CylinderOptions); + }, + getSphereOptions () + { + return getOptionNode .call (this, "getSphereOptions", Geometry3D_QuadSphereOptions); + }, + setPrimitiveQuality3D (primitiveQuality) + { + const + cone = this .getConeOptions (), + cylinder = this .getCylinderOptions (), + sphere = this .getSphereOptions (); + + switch (primitiveQuality) + { + case Core_PrimitiveQuality .LOW: + { + cone ._xDimension = 16; + cylinder ._xDimension = 16; + sphere ._xDimension = 20; + sphere ._yDimension = 9; + break; + } + case Core_PrimitiveQuality .MEDIUM: + { + cone ._xDimension = 20; + cylinder ._xDimension = 20; + sphere ._xDimension = 32; + sphere ._yDimension = 15; + break; + } + case Core_PrimitiveQuality .HIGH: + { + cone ._xDimension = 32; + cylinder ._xDimension = 32; + sphere ._xDimension = 64; + sphere ._yDimension = 31; + break; + } + } + }, +}); + +function getOptionNode (key, OptionNode) +{ + const optionNode = new OptionNode (this .getPrivateScene ()); + + optionNode .setup (); + + this [key] = function () { return optionNode; }; + + Object .defineProperty (this, key, { enumerable: false }); + + return optionNode; +} + +const X3DGeometry3DContext_default_ = X3DGeometry3DContext; +; + +x_ite_Namespace .add ("X3DGeometry3DContext", "x_ite/Browser/Geometry3D/X3DGeometry3DContext", X3DGeometry3DContext_default_); +/* harmony default export */ const Geometry3D_X3DGeometry3DContext = (X3DGeometry3DContext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Grouping/X3DGroupingContext.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +const _bboxShape = Symbol (); + +function X3DGroupingContext () { } + +Object .assign (X3DGroupingContext .prototype, +{ + getBBoxNode () + { + const + bboxShape = new Shape_Shape (this .getPrivateScene ()), + bboxGeometry = new Rendering_IndexedLineSet (this .getPrivateScene ()), + bboxCoordinate = new Rendering_Coordinate (this .getPrivateScene ()); + + bboxShape ._geometry = bboxGeometry; + bboxGeometry ._coordIndex = [0, 1, 2, 3, 0, -1, 4, 5, 6, 7, 4, -1, 0, 4, -1, 1, 5, -1, 2, 6, -1, 3, 7, -1]; + bboxGeometry ._coord = bboxCoordinate; + bboxCoordinate ._point = [0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5]; + + bboxCoordinate .setup (); + bboxGeometry .setup (); + bboxShape .setup (); + + this [_bboxShape] = bboxShape; + + this .getBBoxNode = function () { return this [_bboxShape]; }; + + Object .defineProperty (this, "getBBoxNode", { enumerable: false }); + + return bboxShape; + }, +}); + +const X3DGroupingContext_default_ = X3DGroupingContext; +; + +x_ite_Namespace .add ("X3DGroupingContext", "x_ite/Browser/Grouping/X3DGroupingContext", X3DGroupingContext_default_); +/* harmony default export */ const Grouping_X3DGroupingContext = (X3DGroupingContext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Layering/X3DLayeringContext.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +const _defaultViewport = Symbol (); + +function X3DLayeringContext () +{ + this [_defaultViewport] = new Layering_Viewport (this .getPrivateScene ()); +} + +Object .assign (X3DLayeringContext .prototype, +{ + initialize () + { + this [_defaultViewport] .setPrivate (true); + this [_defaultViewport] .setup (); + }, + getDefaultViewport () + { + return this [_defaultViewport]; + }, +}); + +const X3DLayeringContext_default_ = X3DLayeringContext; +; + +x_ite_Namespace .add ("X3DLayeringContext", "x_ite/Browser/Layering/X3DLayeringContext", X3DLayeringContext_default_); +/* harmony default export */ const Layering_X3DLayeringContext = (X3DLayeringContext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Lighting/X3DLightingContext.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +const + _maxLights = Symbol (), + _shadowBuffers = Symbol (); + +function X3DLightingContext () +{ + const + gl = this .getContext (), + maxTextureImageUnits = gl .getParameter (gl .MAX_TEXTURE_IMAGE_UNITS); + + if (maxTextureImageUnits > 8) + this [_maxLights] = 8; + else + this [_maxLights] = 2; + + this [_shadowBuffers] = [ ]; // Shadow buffer cache +} + +Object .assign (X3DLightingContext .prototype, +{ + getMaxLights () + { + return this [_maxLights]; + }, + popShadowBuffer (shadowMapSize) + { + try + { + const shadowBuffers = this [_shadowBuffers] [shadowMapSize]; + + if (shadowBuffers) + { + if (shadowBuffers .length) + return shadowBuffers .pop (); + } + else + this [_shadowBuffers] [shadowMapSize] = [ ]; + + return new Rendering_TextureBuffer (this, shadowMapSize, shadowMapSize, true); + } + catch (error) + { + // Couldn't create texture buffer. + console .error (error); + + return null; + } + }, + pushShadowBuffer (buffer) + { + if (buffer) + this [_shadowBuffers] [buffer .getWidth ()] .push (buffer); + }, +}); + +const X3DLightingContext_default_ = X3DLightingContext; +; + +x_ite_Namespace .add ("X3DLightingContext", "x_ite/Browser/Lighting/X3DLightingContext", X3DLightingContext_default_); +/* harmony default export */ const Lighting_X3DLightingContext = (X3DLightingContext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Navigation/X3DViewer.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +function X3DViewer (executionContext, navigationInfo) +{ + Base_X3DBaseNode .call (this, executionContext); + + this .navigationInfo = navigationInfo; +} + +Object .assign (Object .setPrototypeOf (X3DViewer .prototype, Base_X3DBaseNode .prototype), +{ + getActiveLayer () + { + return this .getBrowser () .getActiveLayer (); + }, + getViewport () + { + return this .getBrowser () .getActiveLayer () .getViewport () .getRectangle (); + }, + getNavigationInfo () + { + return this .navigationInfo; + }, + getActiveViewpoint () + { + return this .getBrowser () .getActiveLayer () .getViewpoint (); + }, + getStraightenHorizon () + { + return this .getBrowser () .getBrowserOption ("StraightenHorizon"); + }, + getButton (button) + { + // If Alt key is pressed and button 0, then emulate button 1 (middle). + if (button === 0) + { + if (this .getBrowser () .getAltKey ()) + { + return 1; + } + } + + return button; + }, + isPointerInRectangle: (() => + { + const pointer = new Numbers_Vector2 (0, 0); + + return function (x, y) + { + const + browser = this .getBrowser (), + rectangle = this .getViewport (); + + return browser .isPointerInRectangle (rectangle, pointer .set (x, y)); + }; + })(), + getPointOnCenterPlane: (() => + { + const + axis = new Numbers_Vector3 (0, 0, -1), + distance = new Numbers_Vector3 (0, 0, 0), + far = new Numbers_Vector3 (0, 0, 0); + + return function (x, y, result) + { + const + navigationInfo = this .getNavigationInfo (), + viewpoint = this .getActiveViewpoint (), + viewport = this .getViewport (), + projectionMatrix = viewpoint .getProjectionMatrixWithLimits (navigationInfo .getNearValue (), navigationInfo .getFarValue (viewpoint), viewport); + + // Far plane point + Geometry_ViewVolume .unProjectPoint (x, y, 0.9, Numbers_Matrix4 .Identity, projectionMatrix, viewport, far); + + if (viewpoint instanceof Navigation_OrthoViewpoint) + return result .set (far .x, far .y, -this .getDistanceToCenter (distance) .magnitude ()); + + const direction = far .normalize (); + + return result .assign (direction) .multiply (this .getDistanceToCenter (distance) .magnitude () / direction .dot (axis)); + }; + })(), + getDistanceToCenter (distance, positionOffset) + { + const viewpoint = this .getActiveViewpoint (); + + return (distance + .assign (viewpoint .getPosition ()) + .add (positionOffset || viewpoint ._positionOffset .getValue ()) + .subtract (viewpoint .getUserCenterOfRotation ())); + }, + trackballProjectToSphere (x, y, vector) + { + const viewport = this .getViewport (); + + x = (x - viewport [0]) / viewport [2] - 0.5; + y = (y - viewport [1]) / viewport [3] - 0.5; + + return vector .set (x, y, tbProjectToSphere (0.5, x, y)); + }, + lookAtPoint (x, y, straightenHorizon) + { + if (! this .touch (x, y)) + return; + + const + viewpoint = this .getActiveViewpoint (), + hit = this .getBrowser () .getHit (); + + viewpoint .lookAtPoint (this .getActiveLayer (), hit .point, 1, 2 - 1.618034, straightenHorizon); + }, + lookAtBBox (x, y, straightenHorizon) + { + if (! this .touch (x, y)) + return; + + const + viewpoint = this .getActiveViewpoint (), + hit = this .getBrowser () .getHit (); + + const bbox = hit .shapeNode .getBBox (new Geometry_Box3 ()) + .multRight (hit .modelViewMatrix) + .multRight (viewpoint .getCameraSpaceMatrix ()); + + viewpoint .lookAtBBox (this .getActiveLayer (), bbox, 1, 2 - 1.618034, straightenHorizon); + }, + touch (x, y) + { + return this .getBrowser () .touch (x, y); + }, + +}); + +function tbProjectToSphere (r, x, y) +{ + const d = Math .hypot (x, y); + + if (d < r * Math .sqrt (0.5)) // Inside sphere + { + return Math .sqrt (r * r - d * d); + } + + // On hyperbola + + const t = r / Math .sqrt (2); + + return t * t / d; +} + +const X3DViewer_default_ = X3DViewer; +; + +x_ite_Namespace .add ("X3DViewer", "x_ite/Browser/Navigation/X3DViewer", X3DViewer_default_); +/* harmony default export */ const Navigation_X3DViewer = (X3DViewer_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Navigation/ExamineViewer.js +/* provided dependency */ var jquery_mousewheel = __webpack_require__(273); +/* provided dependency */ var ExamineViewer_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + +typeof jquery_mousewheel; // import plugin + +const macOS = /Mac OS X/i .test (navigator .userAgent) + +const + MOTION_TIME = 0.05 * 1000, + SPIN_RELEASE_TIME = 0.04 * 1000, + SPIN_ANGLE = 0.003, + SPIN_FACTOR = 0.4, + SCROLL_FACTOR = macOS ? 1 / 120 : 1 / 20, + MOVE_TIME = 0.2, + ROTATE_TIME = 0.2, + CRITICAL_ANGLE = 0.97; + +function ExamineViewer (executionContext, navigationInfo) +{ + Navigation_X3DViewer .call (this, executionContext, navigationInfo); + + this .button = -1; + this .orientationOffset = new Numbers_Rotation4 (); + this .fromVector = new Numbers_Vector3 (0, 0, 0); + this .toVector = new Numbers_Vector3 (0, 0, 0); + this .fromPoint = new Numbers_Vector3 (0, 0, 0); + this .toPoint = new Numbers_Vector3 (0, 0, 0); + this .rotation = new Numbers_Rotation4 (); + this .direction = new Numbers_Vector3 (0, 0, 0); + this .axis = new Numbers_Vector3 (0, 0, 0); + this .pressTime = 0; + this .motionTime = 0; + + this .touchMode = 0; + this .touch1 = new Numbers_Vector2 (0, 0); + this .touch2 = new Numbers_Vector2 (0, 0); + this .tapStart = 0; + this .dblTapInterval = 0.4; + + this .initialPositionOffset = new Numbers_Vector3 (0, 0, 0); + this .initialOrientationOffset = new Numbers_Rotation4 (); + this .positionChaser = new Followers_PositionChaser (executionContext); + this .centerOfRotationChaser = new Followers_PositionChaser (executionContext); + this .rotationChaser = new Followers_OrientationChaser (executionContext); + + this .timeSensor = new Time_TimeSensor (executionContext); +} + +Object .assign (Object .setPrototypeOf (ExamineViewer .prototype, Navigation_X3DViewer .prototype), +{ + initialize () + { + Navigation_X3DViewer .prototype .initialize .call (this); + + const + browser = this .getBrowser (), + element = browser .getSurface (); + + // Disconnect from spin. + + this .getNavigationInfo () ._transitionStart .addInterest ("disconnect", this); + browser .getBrowserOptions () ._StraightenHorizon .addInterest ("disconnect", this); + browser ._activeViewpoint .addInterest ("set_activeViewpoint__", this); + + // Bind pointing device events. + + element .on ("mousedown.ExamineViewer", this .mousedown .bind (this)); + element .on ("mouseup.ExamineViewer", this .mouseup .bind (this)); + element .on ("dblclick.ExamineViewer", this .dblclick .bind (this)); + element .on ("mousewheel.ExamineViewer", this .mousewheel .bind (this)); + + element .on ("touchstart.ExamineViewer", this .touchstart .bind (this)); + element .on ("touchend.ExamineViewer", this .touchend .bind (this)); + + // Setup scroll chaser. + + this .positionChaser ._duration = MOVE_TIME; + this .positionChaser .setup (); + + this .centerOfRotationChaser ._duration = MOVE_TIME; + this .centerOfRotationChaser .setup (); + + this .rotationChaser ._duration = ROTATE_TIME; + this .rotationChaser .setup (); + + this .timeSensor ._loop = true; + this .timeSensor ._stopTime = browser .getCurrentTime (); + this .timeSensor .setup (); + + this .timeSensor ._fraction_changed .addInterest ("spin", this); + + this .set_activeViewpoint__ (); + }, + set_activeViewpoint__ () + { + if (this .getStraightenHorizon ()) + { + const viewpoint = this .getActiveViewpoint (); + + if (viewpoint) + viewpoint ._orientationOffset = this .getOrientationOffset (Numbers_Rotation4 .Identity, viewpoint ._orientationOffset .getValue (), false); + } + + this .disconnect (); + }, + mousedown (event) + { + if (this .button >= 0) + return; + + this .pressTime = Date .now (); + + const { x, y } = this .getBrowser () .getPointerFromEvent (event); + + if (!this .isPointerInRectangle (x, y)) + return; + + switch (this .getButton (event .button)) + { + case 0: + { + // Start rotate. + + // Stop event propagation. + event .preventDefault (); + event .stopImmediatePropagation (); + + this .button = event .button; + + ExamineViewer_$(document) .on ("mouseup.ExamineViewer" + this .getId (), this .mouseup .bind (this)); + ExamineViewer_$(document) .on ("mousemove.ExamineViewer" + this .getId (), this .mousemove .bind (this)); + ExamineViewer_$(document) .on ("touchend.ExamineViewer" + this .getId (), this .touchend .bind (this)); + ExamineViewer_$(document) .on ("touchmove.ExamineViewer" + this .getId (), this .touchmove .bind (this)); + + this .disconnect (); + this .getActiveViewpoint () .transitionStop (); + this .getBrowser () .setCursor ("MOVE"); + + this .trackballProjectToSphere (x, y, this .fromVector); + this .rotation .assign (Numbers_Rotation4 .Identity); + + this .motionTime = 0; + + this ._isActive = true; + break; + } + case 1: + { + // Start pan. + + // Stop event propagation. + event .preventDefault (); + event .stopImmediatePropagation (); + + this .button = event .button; + + ExamineViewer_$(document) .on ("mouseup.ExamineViewer" + this .getId (), this .mouseup .bind (this)); + ExamineViewer_$(document) .on ("mousemove.ExamineViewer" + this .getId (), this .mousemove .bind (this)); + ExamineViewer_$(document) .on ("touchend.ExamineViewer" + this .getId (), this .touchend .bind (this)); + ExamineViewer_$(document) .on ("touchmove.ExamineViewer" + this .getId (), this .touchmove .bind (this)); + + this .disconnect (); + this .getActiveViewpoint () .transitionStop (); + this .getBrowser () .setCursor ("MOVE"); + + this .getPointOnCenterPlane (x, y, this .fromPoint); + + this ._isActive = true; + break; + } + } + }, + mouseup (event) + { + if (event .button !== this .button) + return; + + this .button = -1; + + ExamineViewer_$(document) .off (".ExamineViewer" + this .getId ()); + + switch (this .getButton (event .button)) + { + case 0: + { + // End rotate. + + // Stop event propagation. + event .preventDefault (); + event .stopImmediatePropagation (); + + this .getBrowser () .setCursor ("DEFAULT"); + + if (Math .abs (this .rotation .angle) > SPIN_ANGLE && Date .now () - this .motionTime < SPIN_RELEASE_TIME) + this .addSpinning (this .rotation); + + this ._isActive = false; + break; + } + case 1: + { + // End pan. + + // Stop event propagation. + event .preventDefault (); + event .stopImmediatePropagation (); + + this .getBrowser () .setCursor ("DEFAULT"); + + this ._isActive = false; + break; + } + } + }, + dblclick (event) + { + // Stop event propagation. + event .preventDefault (); + event .stopImmediatePropagation (); + + const { x, y } = this .getBrowser () .getPointerFromEvent (event); + + this .disconnect (); + this .lookAtBBox (x, y, this .getStraightenHorizon ()); + }, + mousemove: (() => + { + const fromPoint = new Numbers_Vector3 (0, 0, 0); + + return function (event) + { + const { x, y } = this .getBrowser () .getPointerFromEvent (event); + + switch (this .getButton (this .button)) + { + case 0: + { + // Rotate view around Viewpoint.centerOfRotation. + + // Stop event propagation. + event .preventDefault (); + event .stopImmediatePropagation (); + + const toVector = this .trackballProjectToSphere (x, y, this .toVector); + + this .rotation .setFromToVec (toVector, this .fromVector); + + if (Math .abs (this .rotation .angle) < SPIN_ANGLE && Date .now () - this .pressTime < MOTION_TIME) + return; + + this .addRotate (this .rotation); + + this .fromVector .assign (toVector); + this .motionTime = Date .now (); + break; + } + case 1: + { + // Move view along center plane. + + // Stop event propagation. + event .preventDefault (); + event .stopImmediatePropagation (); + + const + viewpoint = this .getActiveViewpoint (), + toPoint = this .getPointOnCenterPlane (x, y, this .toPoint), + translation = viewpoint .getUserOrientation () .multVecRot (fromPoint .assign (this .fromPoint) .subtract (toPoint)); + + this .addMove (translation, translation); + + this .fromPoint .assign (toPoint); + break; + } + } + }; + })(), + mousewheel: (() => + { + const + step = new Numbers_Vector3 (0, 0, 0), + translation = new Numbers_Vector3 (0, 0, 0); + + return function (event) + { + const { x, y } = this .getBrowser () .getPointerFromEvent (event); + + if (!this .isPointerInRectangle (x, y)) + return; + + // Stop event propagation. + + event .preventDefault (); + event .stopImmediatePropagation (); + + // Change viewpoint position. + + const + browser = this .getBrowser (), + viewpoint = this .getActiveViewpoint (); + + browser .prepareEvents () .removeInterest ("spin", this); + viewpoint .transitionStop (); + + this .getDistanceToCenter (step) .multiply (event .zoomFactor || SCROLL_FACTOR); + viewpoint .getUserOrientation () .multVecRot (translation .set (0, 0, step .magnitude ())); + + if (event .deltaY > 0) + this .addMove (translation .negate (), Numbers_Vector3 .Zero); + + else if (event .deltaY < 0) + this .addMove (translation, Numbers_Vector3 .Zero); + }; + })(), + touchstart (event) + { + const touches = event .originalEvent .touches; + + switch (touches .length) + { + case 1: + { + // Start rotate (button 0). + + event .button = 0; + event .pageX = touches [0] .pageX; + event .pageY = touches [0] .pageY; + + this .mousedown (event); + + // Remember tap. + + this .touch1 .set (touches [0] .pageX, touches [0] .pageY); + break; + } + case 2: + { + // End rotate (button 0). + + this .touchend (event); + + // Start move (button 1). + + event .button = 1; + event .pageX = (touches [0] .pageX + touches [1] .pageX) / 2; + event .pageY = (touches [0] .pageY + touches [1] .pageY) / 2; + + this .mousedown (event); + + // Start zoom (mouse wheel). + + this .touch1 .set (touches [0] .pageX, touches [0] .pageY); + this .touch2 .set (touches [1] .pageX, touches [1] .pageY); + break; + } + case 3: + { + // End move (button 1). + this .touchend (event); + break; + } + } + }, + touchend (event) + { + switch (this .button) + { + case 0: + { + // End rotate (button 0). + + event .button = 0; + event .pageX = this .touch1 .x; + event .pageY = this .touch1 .y; + + this .mouseup (event); + + // Start dblclick (button 0). + + if (this .tapedTwice) + { + this .dblclick (event); + } + else + { + this .tapedTwice = true; + + setTimeout (() => this .tapedTwice = false, 300); + } + + break; + } + case 1: + { + // End move (button 1). + + this .touchMode = 0; + event .button = 1; + + this .mouseup (event); + break; + } + } + }, + touchmove: (() => + { + const + MOVE_ANGLE = 0.7, + ZOOM_ANGLE = -0.7, + touch1Change = new Numbers_Vector2 (0, 0), + touch2Change = new Numbers_Vector2 (0, 0); + + return function (event) + { + const touches = event .originalEvent .touches; + + switch (touches .length) + { + case 1: + { + // Rotate (button 0). + + event .pageX = touches [0] .pageX; + event .pageY = touches [0] .pageY; + + this .mousemove (event); + break; + } + case 2: + { + touch1Change .set (touches [0] .pageX, touches [0] .pageY) .subtract (this .touch1) .normalize (); + touch2Change .set (touches [1] .pageX, touches [1] .pageY) .subtract (this .touch2) .normalize (); + + const + move = touch1Change .dot (touch2Change) > MOVE_ANGLE, + zoom = touch1Change .dot (touch2Change) < ZOOM_ANGLE, + mode = this .touchMode || (move ? 1 : (zoom ? 2 : 0)); + + switch (mode) + { + case 1: + { + // Move (button 1). + + this .touchMode = 1; + + event .pageX = (touches [0] .pageX + touches [1] .pageX) / 2; + event .pageY = (touches [0] .pageY + touches [1] .pageY) / 2; + + this .mousemove (event); + + break; + } + case 2: + { + // Zoom (mouse wheel). + + this .touchMode = 2; + + const distance1 = this .touch1 .distance (this .touch2); + + this .touch1 .set (touches [0] .pageX, touches [0] .pageY); + this .touch2 .set (touches [1] .pageX, touches [1] .pageY); + + const + distance2 = this .touch1 .distance (this .touch2), + delta = distance2 - distance1; + + event .deltaY = delta; + event .zoomFactor = Math .abs (delta) / ExamineViewer_$(window) .width (); + + event .pageX = (touches [0] .pageX + touches [1] .pageX) / 2; + event .pageY = (touches [0] .pageY + touches [1] .pageY) / 2; + + this .mousewheel (event); + + break; + } + } + + this .touch1 .set (touches [0] .pageX, touches [0] .pageY); + this .touch2 .set (touches [1] .pageX, touches [1] .pageY); + break; + } + } + }; + })(), + set_positionOffset__ (value) + { + const viewpoint = this .getActiveViewpoint (); + + viewpoint ._positionOffset = value; + }, + set_centerOfRotationOffset__ (value) + { + const viewpoint = this .getActiveViewpoint (); + + viewpoint ._centerOfRotationOffset = value; + }, + set_rotation__ (value) + { + const viewpoint = this .getActiveViewpoint (); + + viewpoint ._orientationOffset = this .getOrientationOffset (value .getValue (), this .initialOrientationOffset, false); + viewpoint ._positionOffset = this .getPositionOffset (this .initialPositionOffset, this .initialOrientationOffset, viewpoint ._orientationOffset .getValue ()); + }, + addRotate: (() => + { + const destination = new Numbers_Rotation4 (); + + return function (rotationChange) + { + const viewpoint = this .getActiveViewpoint (); + + if (this .rotationChaser ._isActive .getValue () && this .rotationChaser ._value_changed .hasInterest ("set_rotation__", this)) + { + try + { + destination .assign (this .rotationChaser ._set_destination .getValue ()) + .multLeft (rotationChange); + + // Check for critical angle. + this .getOrientationOffset (destination, this .initialOrientationOffset, true); + + this .rotationChaser ._set_destination = destination; + } + catch + { + // Slide along critical angle. + + rotationChange = this .getHorizonRotation (rotationChange); + + destination .assign (this .rotationChaser ._set_destination .getValue ()) + .multLeft (rotationChange); + + this .rotationChaser ._set_destination = destination; + } + } + else + { + try + { + this .initialOrientationOffset .assign (viewpoint ._orientationOffset .getValue ()); + this .initialPositionOffset .assign (viewpoint ._positionOffset .getValue ()); + + // Check for critical angle. + this .getOrientationOffset (rotationChange, this .initialOrientationOffset, true); + + this .rotationChaser ._set_value = Numbers_Rotation4 .Identity; + this .rotationChaser ._set_destination = rotationChange; + } + catch + { + // Slide along critical angle. + + this .rotationChaser ._set_value = Numbers_Rotation4 .Identity; + this .rotationChaser ._set_destination = this .getHorizonRotation (rotationChange); + } + } + + this .disconnect (); + this .rotationChaser ._value_changed .addInterest ("set_rotation__", this); + }; + })(), + addSpinning (rotationChange) + { + this .disconnect (); + + if (this .getStraightenHorizon ()) + { + const + viewpoint = this .getActiveViewpoint (), + userPosition = viewpoint .getUserPosition (), + userCenterOfRotation = viewpoint .getUserCenterOfRotation (), + direction = userPosition .copy () .subtract (userCenterOfRotation), + rotation = this .getHorizonRotation (rotationChange), + axis = viewpoint .getUpVector (true); + + this .axis .assign (axis); + + if (rotation .getAxis (new Numbers_Vector3 (0, 0, 0)) .dot (Numbers_Vector3 .yAxis) < 0 !== rotation .angle < 0) + this .axis .negate (); + + this .timeSensor ._cycleInterval = Math .PI / (rotationChange .angle * SPIN_FACTOR * 30); + this .timeSensor ._startTime = this .getBrowser () .getCurrentTime (); + + const lookAtRotation = viewpoint .getLookAtRotation (userPosition, userCenterOfRotation); + + this .direction .assign (direction); + this .orientationOffset .assign (viewpoint .getUserOrientation ()) .multRight (lookAtRotation .inverse ()); + } + else + { + this .getBrowser () .prepareEvents () .addInterest ("spin", this); + this .rotation .assign (rotationChange); + } + }, + spin: (() => + { + const + direction = new Numbers_Vector3 (0, 0, 0), + positionOffset = new Numbers_Vector3 (0, 0, 0), + orientationOffset = new Numbers_Rotation4 (), + rotation = new Numbers_Rotation4 (); + + return function () + { + const viewpoint = this .getActiveViewpoint (); + + if (this .getStraightenHorizon ()) + { + const + userCenterOfRotation = viewpoint .getUserCenterOfRotation (), + fraction = this .timeSensor ._fraction_changed .getValue (), + rotation = new Numbers_Rotation4 (this .axis, 2 * Math .PI * fraction), + userPosition = rotation .multVecRot (direction .assign (this .direction)) .add (userCenterOfRotation), + lookAtRotation = viewpoint .getLookAtRotation (userPosition, viewpoint .getUserCenterOfRotation ()); + + positionOffset .assign (userPosition) .subtract (viewpoint .getPosition ()); + + orientationOffset .assign (viewpoint .getOrientation ()) .inverse () + .multRight (this .orientationOffset) .multRight (lookAtRotation); + + viewpoint ._positionOffset = positionOffset; + viewpoint ._orientationOffset = orientationOffset; + } + else + { + rotation .assign (Numbers_Rotation4 .Identity) .slerp (this .rotation, SPIN_FACTOR * 60 / this .getBrowser () .getCurrentFrameRate ()); + + this .orientationOffset .assign (viewpoint ._orientationOffset .getValue ()); + + viewpoint ._orientationOffset = this .getOrientationOffset (rotation, this .orientationOffset); + viewpoint ._positionOffset = this .getPositionOffset (viewpoint ._positionOffset .getValue (), this .orientationOffset, viewpoint ._orientationOffset .getValue ()); + } + }; + })(), + addMove: (() => + { + const + positionOffset = new Numbers_Vector3 (0, 0, 0), + centerOfRotationOffset = new Numbers_Vector3 (0, 0, 0); + + return function (positionOffsetChange, centerOfRotationOffsetChange) + { + const viewpoint = this .getActiveViewpoint (); + + if (this .positionChaser ._isActive .getValue () && this .positionChaser ._value_changed .hasInterest ("set_positionOffset__", this)) + { + positionOffset + .assign (this .positionChaser ._set_destination .getValue ()) + .add (positionOffsetChange); + + this .positionChaser ._set_destination = positionOffset; + } + else + { + positionOffset + .assign (viewpoint ._positionOffset .getValue ()) + .add (positionOffsetChange); + + this .positionChaser ._set_value = viewpoint ._positionOffset; + this .positionChaser ._set_destination = positionOffset; + } + + if (this .centerOfRotationChaser ._isActive .getValue () && this .centerOfRotationChaser ._value_changed .hasInterest ("set_centerOfRotationOffset__", this)) + { + centerOfRotationOffset + .assign (this .centerOfRotationChaser ._set_destination .getValue ()) + .add (centerOfRotationOffsetChange); + + this .centerOfRotationChaser ._set_destination = centerOfRotationOffset; + } + else + { + centerOfRotationOffset + .assign (viewpoint ._centerOfRotationOffset .getValue ()) + .add (centerOfRotationOffsetChange); + + this .centerOfRotationChaser ._set_value = viewpoint ._centerOfRotationOffset; + this .centerOfRotationChaser ._set_destination = centerOfRotationOffset; + } + + this .disconnect (); + this .positionChaser ._value_changed .addInterest ("set_positionOffset__", this); + this .centerOfRotationChaser ._value_changed .addInterest ("set_centerOfRotationOffset__", this); + }; + })(), + getPositionOffset: (() => + { + const + distance = new Numbers_Vector3 (0, 0, 0), + d = new Numbers_Vector3 (0, 0, 0), + oob = new Numbers_Rotation4 (); + + return function (positionOffsetBefore, orientationOffsetBefore, orientationOffsetAfter) + { + this .getDistanceToCenter (distance, positionOffsetBefore); + + return (oob + .assign (orientationOffsetBefore) + .inverse () + .multRight (orientationOffsetAfter) + .multVecRot (d .assign (distance)) + .subtract (distance) + .add (positionOffsetBefore)); + }; + })(), + getOrientationOffset: (() => + { + const + userOrientation = new Numbers_Rotation4 (), + orientationOffset = new Numbers_Rotation4 (), + zAxis = new Numbers_Vector3 (0, 0, 0); + + return function (rotation, orientationOffsetBefore, _throw) + { + const + viewpoint = this .getActiveViewpoint (), + straightenHorizon = this .getStraightenHorizon (); + + userOrientation + .assign (rotation) + .multRight (viewpoint .getOrientation ()) + .multRight (orientationOffsetBefore); + + if (straightenHorizon) + viewpoint .straightenHorizon (userOrientation); + + const orientationOffsetAfter = orientationOffset + .assign (viewpoint .getOrientation ()) + .inverse () + .multRight (userOrientation); + + if (straightenHorizon) + { + if (! _throw) + return orientationOffsetAfter; + + const userVector = userOrientation .multVecRot (zAxis .assign (Numbers_Vector3 .zAxis)); + + if (Math .abs (viewpoint .getUpVector (true) .dot (userVector)) < CRITICAL_ANGLE) + return orientationOffsetAfter; + + throw new Error ("Critical angle"); + } + else + { + return orientationOffsetAfter; + } + }; + })(), + getHorizonRotation: (() => + { + const zAxis = new Numbers_Vector3 (0, 0, 0); + + return function (rotation) + { + const + V = rotation .multVecRot (zAxis .assign (Numbers_Vector3 .zAxis)), + N = Numbers_Vector3 .yAxis .copy () .cross (V), + H = N .copy () .cross (Numbers_Vector3 .yAxis), + r = new Numbers_Rotation4 (Numbers_Vector3 .zAxis, H); + + return r; + }; + })(), + disconnect () + { + const browser = this .getBrowser (); + + this .positionChaser ._value_changed .removeInterest ("set_positionOffset__", this); + this .centerOfRotationChaser ._value_changed .removeInterest ("set_centerOfRotationOffset__", this); + this .rotationChaser ._value_changed .removeInterest ("set_rotation__", this); + + this .timeSensor ._stopTime = browser .getCurrentTime (); + browser .prepareEvents () .removeInterest ("spin", this); + }, + dispose () + { + const browser = this .getBrowser (); + + this .disconnect (); + this .getNavigationInfo () ._transitionStart .removeInterest ("disconnect", this); + browser .getBrowserOptions () ._StraightenHorizon .removeInterest ("disconnect", this); + + browser ._activeViewpoint .removeInterest ("set_activeViewpoint__", this); + + browser .getSurface () .off (".ExamineViewer"); + ExamineViewer_$(document) .off (".ExamineViewer" + this .getId ()); + }, +}); + +Object .defineProperties (ExamineViewer, +{ + typeName: + { + value: "ExamineViewer", + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + ]), + enumerable: true, + }, +}); + +const ExamineViewer_default_ = ExamineViewer; +; + +x_ite_Namespace .add ("ExamineViewer", "x_ite/Browser/Navigation/ExamineViewer", ExamineViewer_default_); +/* harmony default export */ const Navigation_ExamineViewer = (ExamineViewer_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Navigation/X3DFlyViewer.js +/* provided dependency */ var X3DFlyViewer_jquery_mousewheel = __webpack_require__(273); +/* provided dependency */ var X3DFlyViewer_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + +typeof X3DFlyViewer_jquery_mousewheel; // import plugin + +const X3DFlyViewer_macOS = /Mac OS X/i .test (navigator .userAgent) + +const + SPEED_FACTOR = 0.007, + SHIFT_SPEED_FACTOR = 4 * SPEED_FACTOR, + ROTATION_SPEED_FACTOR = 1.4, + ROTATION_LIMIT = 40, + PAN_SPEED_FACTOR = SPEED_FACTOR, + PAN_SHIFT_SPEED_FACTOR = 1.4 * PAN_SPEED_FACTOR, + ROLL_ANGLE = X3DFlyViewer_macOS ? Math .PI / 512 : Math .PI / 32, + X3DFlyViewer_ROTATE_TIME = 0.3; + +const + MOVE = 0, + PAN = 1; + +function X3DFlyViewer (executionContext, navigationInfo) +{ + Navigation_X3DViewer .call (this, executionContext, navigationInfo); + + const + browser = this .getBrowser (), + gl = browser .getContext (); + + this .button = -1; + this .fromVector = new Numbers_Vector3 (0, 0, 0); + this .toVector = new Numbers_Vector3 (0, 0, 0); + this .direction = new Numbers_Vector3 (0, 0, 0); + this .startTime = 0; + this .event = null; + this .lookAround = false; + this .orientationChaser = new Followers_OrientationChaser (executionContext); + this .lineIndexBuffer = gl .createBuffer (); + this .lineColorBuffer = gl .createBuffer (); + this .lineVertexBuffer = gl .createBuffer (); + this .lineVertexArrayObject = new Rendering_VertexArray (gl); + this .lineVertexArray = new Float32Array (8 * 4) .fill (1); + this .geometryContext = new Rendering_GeometryContext ({ geometryType: 2, colorMaterial: true }); + + gl .bindBuffer (gl .ELEMENT_ARRAY_BUFFER, this .lineIndexBuffer); + gl .bufferData (gl .ELEMENT_ARRAY_BUFFER, new Uint8Array ([0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7]), gl .STATIC_DRAW); + gl .bindBuffer (gl .ARRAY_BUFFER, this .lineColorBuffer); + gl .bufferData (gl .ARRAY_BUFFER, new Float32Array ([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), gl .STATIC_DRAW); +} + +Object .assign (Object .setPrototypeOf (X3DFlyViewer .prototype, Navigation_X3DViewer .prototype), +{ + initialize () + { + Navigation_X3DViewer .prototype .initialize .call (this); + + const + browser = this .getBrowser (), + element = browser .getSurface (); + + // Bind pointing device events. + + element .on ("mousedown.X3DFlyViewer", this .mousedown .bind (this)); + element .on ("mouseup.X3DFlyViewer", this .mouseup .bind (this)); + element .on ("mousewheel.X3DFlyViewer", this .mousewheel .bind (this)); + + element .on ("touchstart.X3DFlyViewer", this .touchstart .bind (this)); + element .on ("touchend.X3DFlyViewer", this .touchend .bind (this)); + + browser ._controlKey .addInterest ("set_controlKey__", this); + + // Setup look around chaser. + + this .orientationChaser ._duration = X3DFlyViewer_ROTATE_TIME; + this .orientationChaser .setup (); + }, + addCollision () { }, + removeCollision () { }, + set_controlKey__ () + { + if (this .event && this .event .button === 0) + { + this .button = -1; + this .mousedown (this .event); + } + }, + mousedown (event) + { + if (this .button >= 0) + return; + + this .event = event; + + const { x, y } = this .getBrowser () .getPointerFromEvent (event); + + if (!this .isPointerInRectangle (x, y)) + return; + + switch (this .getButton (event .button)) + { + case 0: + { + // Start walk or fly. + + // Stop event propagation. + event .preventDefault (); + event .stopImmediatePropagation (); + + this .button = event .button; + + X3DFlyViewer_$(document) .on ("mouseup.X3DFlyViewer" + this .getId (), this .mouseup .bind (this)); + X3DFlyViewer_$(document) .on ("mousemove.X3DFlyViewer" + this .getId (), this .mousemove .bind (this)); + X3DFlyViewer_$(document) .on ("touchend.X3DFlyViewer" + this .getId (), this .touchend .bind (this)); + X3DFlyViewer_$(document) .on ("touchmove.X3DFlyViewer" + this .getId (), this .touchmove .bind (this)); + + this .disconnect (); + this .getActiveViewpoint () .transitionStop (); + this .getBrowser () .setCursor ("MOVE"); + this .addCollision (); + + if (this .getBrowser () .getControlKey () || this .getBrowser () .getCommandKey () || this .lookAround) + { + // Look around. + + this .trackballProjectToSphere (x, y, this .fromVector); + } + else + { + // Move. + + this .fromVector .set (x, 0, -y); + this .toVector .assign (this .fromVector); + + this .getFlyDirection (this .fromVector, this .toVector, this .direction); + this .addFly (); + + if (this .getBrowser () .getBrowserOption ("Rubberband")) + this .getBrowser () .finishedEvents () .addInterest ("display", this, MOVE); + } + + this ._isActive = true; + break; + } + case 1: + { + // Start pan. + + // Stop event propagation. + event .preventDefault (); + event .stopImmediatePropagation (); + + this .button = event .button; + + X3DFlyViewer_$(document) .on ("mouseup.X3DFlyViewer" + this .getId (), this .mouseup .bind (this)); + X3DFlyViewer_$(document) .on ("mousemove.X3DFlyViewer" + this .getId (), this .mousemove .bind (this)); + + this .disconnect (); + this .getActiveViewpoint () .transitionStop (); + this .getBrowser () .setCursor ("MOVE"); + this .addCollision (); + + this .fromVector .set (x, y, 0); + this .toVector .assign (this .fromVector); + this .direction .set (0, 0, 0); + + this .addPan (); + + if (this .getBrowser () .getBrowserOption ("Rubberband")) + this .getBrowser () .finishedEvents () .addInterest ("display", this, PAN); + + this ._isActive = true; + break; + } + } + }, + mouseup (event) + { + event .preventDefault (); + + if (event .button !== this .button) + return; + + this .event = null; + this .button = -1; + + X3DFlyViewer_$(document) .off (".X3DFlyViewer" + this .getId ()); + + this .disconnect (); + this .getBrowser () .setCursor ("DEFAULT"); + this .removeCollision (); + + this ._isActive = false; + }, + mousemove (event) + { + const browser = this .getBrowser (); + + browser .addBrowserEvent (); + + this .event = event; + + const { x, y } = this .getBrowser () .getPointerFromEvent (event); + + switch (this .getButton (this .button)) + { + case 0: + { + if (browser .getControlKey () || browser .getCommandKey () || this .lookAround) + { + // Stop event propagation. + event .preventDefault (); + event .stopImmediatePropagation (); + + // Look around + + const toVector = this .trackballProjectToSphere (x, y, this .toVector); + + this .addRotation (this .fromVector, toVector); + this .fromVector .assign (toVector); + break; + } + else + { + // Fly + + this .toVector .set (x, 0, -y); + this .getFlyDirection (this .fromVector, this .toVector, this .direction); + this .direction .divide (browser .getRenderingProperty ("ContentScale")); + break; + } + } + case 1: + { + // Stop event propagation. + event .preventDefault (); + event .stopImmediatePropagation (); + + // Pan + + this .toVector .set (x, y, 0); + this .direction .assign (this .toVector) .subtract (this .fromVector); + this .direction .divide (browser .getRenderingProperty ("ContentScale")); + break; + } + } + }, + mousewheel (event) + { + const { x, y } = this .getBrowser () .getPointerFromEvent (event); + + if (!this .isPointerInRectangle (x, y)) + return; + + // Stop event propagation. + + event .preventDefault (); + event .stopImmediatePropagation (); + + // Change viewpoint position. + + const viewpoint = this .getActiveViewpoint (); + + viewpoint .transitionStop (); + + if (event .deltaY > 0) + this .addRoll (-ROLL_ANGLE); + + else if (event .deltaY < 0) + this .addRoll (ROLL_ANGLE); + }, + touchstart (event) + { + const touches = event .originalEvent .touches; + + switch (touches .length) + { + case 1: + { + // Start fly or walk (button 0). + + event .button = 0; + event .pageX = touches [0] .pageX; + event .pageY = touches [0] .pageY; + + this .mousedown (event); + break; + } + case 2: + { + // End fly or walk (button 0). + + this .touchend (event); + + // Start look around (button 0). + + this .lookAround = true; + event .button = 0; + event .pageX = (touches [0] .pageX + touches [1] .pageX) / 2; + event .pageY = (touches [0] .pageY + touches [1] .pageY) / 2; + + this .mousedown (event); + break; + } + case 3: + { + // End look around (button 0). + + this .touchend (event); + break; + } + } + }, + touchend (event) + { + switch (this .button) + { + case 0: + { + // End move or look around (button 0). + this .lookAround = false; + event .button = 0; + + this .mouseup (event); + break; + } + } + }, + touchmove (event) + { + const touches = event .originalEvent .touches; + + switch (touches .length) + { + case 1: + { + // Fly or walk (button 0). + + event .button = 0; + event .pageX = touches [0] .pageX; + event .pageY = touches [0] .pageY; + + this .mousemove (event); + break; + } + case 2: + { + // Fly or walk (button 0). + + event .button = 0; + event .pageX = (touches [0] .pageX + touches [1] .pageX) / 2; + event .pageY = (touches [0] .pageY + touches [1] .pageY) / 2; + + this .mousemove (event); + break; + } + } + }, + fly: (() => + { + const + upVector = new Numbers_Vector3 (0, 0, 0), + direction = new Numbers_Vector3 (0, 0, 0), + axis = new Numbers_Vector3 (0, 0, 0), + userOrientation = new Numbers_Rotation4 (), + orientationOffset = new Numbers_Rotation4 (), + rubberBandRotation = new Numbers_Rotation4 (); + + return function () + { + const + navigationInfo = this .getNavigationInfo (), + viewpoint = this .getActiveViewpoint (), + now = Date .now (), + dt = (now - this .startTime) / 1000; + + upVector .assign (viewpoint .getUpVector ()); + + // Rubberband values + + if (this .direction .z > 0) + rubberBandRotation .setFromToVec (this .direction, axis .set (0, 0, 1)); + else + rubberBandRotation .setFromToVec (axis .set (0, 0, -1), this .direction); + + const rubberBandLength = this .direction .magnitude (); + + // Determine positionOffset. + + let speedFactor = 1 - rubberBandRotation .angle / (Math .PI / 2); + + speedFactor *= navigationInfo ._speed .getValue (); + speedFactor *= viewpoint .getSpeedFactor (); + speedFactor *= this .getBrowser () .getShiftKey () ? SHIFT_SPEED_FACTOR : SPEED_FACTOR; + speedFactor *= dt; + + const translation = this .getTranslationOffset (direction .assign (this .direction) .multiply (speedFactor)); + + this .getActiveLayer () .constrainTranslation (translation, true); + + viewpoint ._positionOffset = translation .add (viewpoint ._positionOffset .getValue ()); + + // Determine weight for rubberBandRotation. + + const weight = ROTATION_SPEED_FACTOR * dt * (rubberBandLength / (rubberBandLength + ROTATION_LIMIT)) ** 2; + + // Determine userOrientation. + + userOrientation + .assign (Numbers_Rotation4 .Identity) + .slerp (rubberBandRotation, weight) + .multRight (viewpoint .getUserOrientation ()); + + // Straighten horizon of userOrientation. + + if (this .getStraightenHorizon ()) + viewpoint .straightenHorizon (userOrientation); + + // Determine orientationOffset. + + orientationOffset + .assign (viewpoint .getOrientation ()) + .inverse () + .multRight (userOrientation); + + // Set orientationOffset. + + viewpoint ._orientationOffset = orientationOffset; + + this .startTime = now; + }; + })(), + pan: (() => + { + const + direction = new Numbers_Vector3 (0, 0, 0), + axis = new Numbers_Vector3 (0, 0, 0); + + return function () + { + const + navigationInfo = this .getNavigationInfo (), + viewpoint = this .getActiveViewpoint (), + now = Date .now (), + dt = (now - this .startTime) / 1000, + upVector = viewpoint .getUpVector (); + + this .constrainPanDirection (direction .assign (this .direction)); + + let speedFactor = 1; + + speedFactor *= navigationInfo ._speed .getValue (); + speedFactor *= viewpoint .getSpeedFactor (); + speedFactor *= this .getBrowser () .getShiftKey () ? PAN_SHIFT_SPEED_FACTOR : PAN_SPEED_FACTOR; + speedFactor *= dt; + + const + orientation = viewpoint .getUserOrientation () .multRight (new Numbers_Rotation4 (viewpoint .getUserOrientation () .multVecRot (axis .assign (Numbers_Vector3 .yAxis)), upVector)), + translation = orientation .multVecRot (direction .multiply (speedFactor)); + + this .getActiveLayer () .constrainTranslation (translation, true); + + viewpoint ._positionOffset = translation .add (viewpoint ._positionOffset .getValue ()); + + this .startTime = now; + }; + })(), + set_orientationOffset__ (value) + { + const viewpoint = this .getActiveViewpoint (); + + viewpoint ._orientationOffset = value; + }, + addFly () + { + if (this .startTime) + return; + + this .getBrowser () .prepareEvents () .addInterest ("fly", this); + this .getBrowser () .addBrowserEvent (); + + this .startTime = Date .now (); + }, + addPan () + { + if (this .startTime) + return; + + this .disconnect (); + this .getBrowser () .prepareEvents () .addInterest ("pan", this); + this .getBrowser () .addBrowserEvent (); + + this .startTime = Date .now (); + }, + addRoll: (() => + { + const + orientationOffset = new Numbers_Rotation4 (), + roll = new Numbers_Rotation4 (); + + return function (rollAngle) + { + const viewpoint = this .getActiveViewpoint (); + + if (this .orientationChaser ._isActive .getValue () && this .orientationChaser ._value_changed .hasInterest ("set_orientationOffset__", this)) + { + orientationOffset + .assign (viewpoint .getOrientation ()) + .inverse () + .multRight (roll .set (1, 0, 0, rollAngle)) + .multRight (viewpoint .getOrientation ()) + .multRight (this .orientationChaser ._set_destination .getValue ()); + + this .orientationChaser ._set_destination = orientationOffset; + } + else + { + orientationOffset + .assign (viewpoint .getOrientation ()) + .inverse () + .multRight (roll .set (1, 0, 0, rollAngle)) + .multRight (viewpoint .getUserOrientation ()); + + this .orientationChaser ._set_value = viewpoint ._orientationOffset; + this .orientationChaser ._set_destination = orientationOffset; + } + + this .disconnect (); + this .orientationChaser ._value_changed .addInterest ("set_orientationOffset__", this); + }; + })(), + addRotation: (() => + { + const + userOrientation = new Numbers_Rotation4 (), + orientationOffset = new Numbers_Rotation4 (); + + return function (fromVector, toVector) + { + const viewpoint = this .getActiveViewpoint (); + + if (this .orientationChaser ._isActive .getValue () && this .orientationChaser ._value_changed .hasInterest ("set_orientationOffset__", this)) + { + userOrientation + .setFromToVec (toVector, fromVector) + .multRight (viewpoint .getOrientation ()) + .multRight (this .orientationChaser ._set_destination .getValue ()); + + if (this .getStraightenHorizon ()) + viewpoint .straightenHorizon (userOrientation); + + orientationOffset .assign (viewpoint .getOrientation ()) .inverse () .multRight (userOrientation); + + this .orientationChaser ._set_destination = orientationOffset; + } + else + { + userOrientation + .setFromToVec (toVector, fromVector) + .multRight (viewpoint .getUserOrientation ()); + + if (this .getStraightenHorizon ()) + viewpoint .straightenHorizon (userOrientation); + + orientationOffset .assign (viewpoint .getOrientation ()) .inverse () .multRight (userOrientation); + + this .orientationChaser ._set_value = viewpoint ._orientationOffset; + this .orientationChaser ._set_destination = orientationOffset; + } + + this .disconnect (); + this .orientationChaser ._value_changed .addInterest ("set_orientationOffset__", this); + }; + })(), + display: (() => + { + const + fromPoint = new Numbers_Vector3 (0, 0, 0), + toPoint = new Numbers_Vector3 (0, 0, 0), + normal = new Numbers_Vector3 (0, 0, 0), + vertex = new Numbers_Vector3 (0, 0, 0), + projectionMatrix = new Numbers_Matrix4 (), + projectionMatrixArray = new Float32Array (Numbers_Matrix4 .Identity), + modelViewMatrixArray = new Float32Array (Numbers_Matrix4 .Identity), + clipPlanes = [ ]; + + return function (type) + { + // Configure HUD + + const + browser = this .getBrowser (), + gl = browser .getContext (), + viewport = browser .getViewport (), + width = viewport [2], + height = viewport [3], + contentScale = browser .getRenderingProperty ("ContentScale"); + + projectionMatrixArray .set (Geometry_Camera .ortho (0, width, 0, height, -1, 1, projectionMatrix)); + + // Display Rubberband. + + switch (type) + { + case MOVE: + { + fromPoint .set (this .fromVector .x, -this .fromVector .z, 0); + toPoint .set (this .toVector .x, -this .toVector .z, 0); + break; + } + case PAN: + { + fromPoint .set (this .fromVector .x, this .fromVector .y, 0); + toPoint .set (this .toVector .x, this .toVector .y, 0); + break; + } + } + + // Set black line quad vertices. + + normal .assign (toPoint) + .subtract (fromPoint) + .normalize () + .multiply (contentScale) + .set (-normal .y, normal .x, 0); + + this .lineVertexArray .set (vertex .assign (fromPoint) .add (normal), 0); + this .lineVertexArray .set (vertex .assign (fromPoint) .subtract (normal), 4); + this .lineVertexArray .set (vertex .assign (toPoint) .subtract (normal), 8); + this .lineVertexArray .set (vertex .assign (toPoint) .add (normal), 12); + + // Set white line quad vertices. + + normal .assign (toPoint) + .subtract (fromPoint) + .normalize () + .multiply (contentScale / 2) + .set (-normal .y, normal .x, 0); + + this .lineVertexArray .set (vertex .assign (fromPoint) .add (normal), 16); + this .lineVertexArray .set (vertex .assign (fromPoint) .subtract (normal), 20); + this .lineVertexArray .set (vertex .assign (toPoint) .subtract (normal), 24); + this .lineVertexArray .set (vertex .assign (toPoint) .add (normal), 28); + + // Transfer line. + + gl .bindBuffer (gl .ARRAY_BUFFER, this .lineVertexBuffer); + gl .bufferData (gl .ARRAY_BUFFER, this .lineVertexArray, gl .DYNAMIC_DRAW); + + // Set uniforms and attributes. + + const shaderNode = browser .getDefaultMaterial () .getShader (this .geometryContext); + + shaderNode .enable (gl); + shaderNode .setClipPlanes (gl, clipPlanes); + + gl .uniformMatrix4fv (shaderNode .x3d_ProjectionMatrix, false, projectionMatrixArray); + gl .uniformMatrix4fv (shaderNode .x3d_ModelViewMatrix, false, modelViewMatrixArray); + gl .uniform3f (shaderNode .x3d_EmissiveColor, 0, 0, 0); + gl .uniform1f (shaderNode .x3d_Transparency, 0); + + if (this .lineVertexArrayObject .enable (shaderNode)) + { + gl .bindBuffer (gl .ELEMENT_ARRAY_BUFFER, this .lineIndexBuffer); + + shaderNode .enableColorAttribute (gl, this .lineColorBuffer, 0, 0); + shaderNode .enableVertexAttribute (gl, this .lineVertexBuffer, 0, 0); + } + + // Draw a black and a white line. + + gl .disable (gl .DEPTH_TEST); + gl .enable (gl .CULL_FACE); + gl .frontFace (gl .CCW); + gl .drawElements (gl .TRIANGLES, 12, gl .UNSIGNED_BYTE, 0); + gl .enable (gl .DEPTH_TEST); + }; + })(), + disconnect () + { + const browser = this .getBrowser (); + + browser .addBrowserEvent (); + + browser .prepareEvents () .removeInterest ("fly", this); + browser .prepareEvents () .removeInterest ("pan", this); + browser .finishedEvents () .removeInterest ("display", this); + + this .orientationChaser ._value_changed .removeInterest ("set_orientationOffset__", this); + + this .startTime = 0; + }, + dispose () + { + const gl = this .getBrowser () .getContext (); + + gl .deleteBuffer (this .lineVertexBuffer); + this .lineVertexArrayObject .delete (gl); + + this .disconnect (); + this .getBrowser () ._controlKey .removeInterest ("set_controlKey__", this); + this .getBrowser () .getSurface () .off (".X3DFlyViewer"); + X3DFlyViewer_$(document) .off (".X3DFlyViewer" + this .getId ()); + }, +}); + +const X3DFlyViewer_default_ = X3DFlyViewer; +; + +x_ite_Namespace .add ("X3DFlyViewer", "x_ite/Browser/Navigation/X3DFlyViewer", X3DFlyViewer_default_); +/* harmony default export */ const Navigation_X3DFlyViewer = (X3DFlyViewer_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Navigation/WalkViewer.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +function WalkViewer (executionContext, navigationInfo) +{ + Navigation_X3DFlyViewer .call (this, executionContext, navigationInfo); +} + +Object .assign (Object .setPrototypeOf (WalkViewer .prototype, Navigation_X3DFlyViewer .prototype), +{ + initialize () + { + Navigation_X3DFlyViewer .prototype .initialize .call (this); + + this .getBrowser () .addCollision (this); + }, + getStraightenHorizon () + { + return true; + }, + getFlyDirection (fromVector, toVector, direction) + { + return direction .assign (toVector) .subtract (fromVector); + }, + getTranslationOffset: (() => + { + const + localYAxis = new Numbers_Vector3 (0, 0, 0), + userOrientation = new Numbers_Rotation4 (), + rotation = new Numbers_Rotation4 (); + + return function (velocity) + { + const + viewpoint = this .getActiveViewpoint (), + upVector = viewpoint .getUpVector (); + + userOrientation .assign (viewpoint .getUserOrientation ()); + userOrientation .multVecRot (localYAxis .assign (Numbers_Vector3 .yAxis)); + rotation .setFromToVec (localYAxis, upVector); + + const orientation = userOrientation .multRight (rotation); + + return orientation .multVecRot (velocity); + }; + })(), + constrainPanDirection (direction) + { + if (direction .y < 0) + direction .y = 0; + + return direction; + }, + dispose () + { + this .getBrowser () .removeCollision (this); + + Navigation_X3DFlyViewer .prototype .dispose .call (this); + }, +}); + +Object .defineProperties (WalkViewer, +{ + typeName: + { + value: "WalkViewer", + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + ]), + enumerable: true, + }, +}); + +const WalkViewer_default_ = WalkViewer; +; + +x_ite_Namespace .add ("WalkViewer", "x_ite/Browser/Navigation/WalkViewer", WalkViewer_default_); +/* harmony default export */ const Navigation_WalkViewer = (WalkViewer_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Navigation/FlyViewer.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function FlyViewer (executionContext, navigationInfo) +{ + Navigation_X3DFlyViewer .call (this, executionContext, navigationInfo); +} + +Object .assign (Object .setPrototypeOf (FlyViewer .prototype, Navigation_X3DFlyViewer .prototype), +{ + addCollision () + { + this .getBrowser () .addCollision (this); + }, + removeCollision () + { + this .getBrowser () .removeCollision (this); + }, + getFlyDirection (fromVector, toVector, direction) + { + return direction .assign (toVector) .subtract (fromVector); + }, + getTranslationOffset (velocity) + { + return this .getActiveViewpoint () .getUserOrientation () .multVecRot (velocity); + }, + constrainPanDirection (direction) + { + return direction; + }, +}); + +Object .defineProperties (FlyViewer, +{ + typeName: + { + value: "FlyViewer", + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + ]), + enumerable: true, + }, +}); + +const FlyViewer_default_ = FlyViewer; +; + +x_ite_Namespace .add ("FlyViewer", "x_ite/Browser/Navigation/FlyViewer", FlyViewer_default_); +/* harmony default export */ const Navigation_FlyViewer = (FlyViewer_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Navigation/PlaneViewer.js +/* provided dependency */ var PlaneViewer_jquery_mousewheel = __webpack_require__(273); +/* provided dependency */ var PlaneViewer_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + +typeof PlaneViewer_jquery_mousewheel; // import plugin + +const PlaneViewer_macOS = /Mac OS X/i .test (navigator .userAgent) + +const PlaneViewer_SCROLL_FACTOR = PlaneViewer_macOS ? 1 / 160 : 1 / 20; + +const + PlaneViewer_vector = new Numbers_Vector3 (0 ,0, 0), + positionOffset = new Numbers_Vector3 (0 ,0, 0), + centerOfRotationOffset = new Numbers_Vector3 (0, 0, 0); + +function PlaneViewer (executionContext, navigationInfo) +{ + Navigation_X3DViewer .call (this, executionContext, navigationInfo); + + this .button = -1; + this .fromPoint = new Numbers_Vector3 (0, 0, 0); + this .toPoint = new Numbers_Vector3 (0, 0, 0); +} + +Object .assign (Object .setPrototypeOf (PlaneViewer .prototype, Navigation_X3DViewer .prototype), +{ + initialize () + { + Navigation_X3DViewer .prototype .initialize .call (this); + + const + browser = this .getBrowser (), + element = browser .getSurface (); + + element .on ("mousedown.PlaneViewer", this .mousedown .bind (this)); + element .on ("mouseup.PlaneViewer", this .mouseup .bind (this)); + element .on ("mousemove.PlaneViewer", this .mousemove .bind (this)); + element .on ("mousewheel.PlaneViewer", this .mousewheel .bind (this)); + }, + mousedown (event) + { + if (this .button >= 0) + return; + + const { x, y } = this .getBrowser () .getPointerFromEvent (event); + + if (!this .isPointerInRectangle (x, y)) + return; + + switch (this .getButton (event .button)) + { + case 1: + { + // Stop event propagation. + + event .preventDefault (); + event .stopImmediatePropagation (); + + this .button = event .button; + + this .getBrowser () .getSurface () .off ("mousemove.PlaneViewer"); + PlaneViewer_$(document) .on ("mouseup.PlaneViewer" + this .getId (), this .mouseup .bind (this)); + PlaneViewer_$(document) .on ("mousemove.PlaneViewer" + this .getId (), this .mousemove .bind (this)); + + this .getActiveViewpoint () .transitionStop (); + this .getBrowser () .setCursor ("MOVE"); + + this .getPointOnCenterPlane (x, y, this .fromPoint); + + this ._isActive = true; + break; + } + } + }, + mouseup (event) + { + // Stop event propagation. + + event .preventDefault (); + event .stopImmediatePropagation (); + + if (event .button !== this .button) + return; + + this .button = -1; + + PlaneViewer_$(document) .off (".PlaneViewer" + this .getId ()); + this .getBrowser () .getSurface () .on ("mousemove.PlaneViewer", this .mousemove .bind (this)); + + this .getBrowser () .setCursor ("DEFAULT"); + + this ._isActive = false; + }, + mousemove (event) + { + const { x, y } = this .getBrowser () .getPointerFromEvent (event); + + switch (this .getButton (this .button)) + { + case 1: + { + // Stop event propagation. + + event .preventDefault (); + event .stopImmediatePropagation (); + + // Move. + + const + viewpoint = this .getActiveViewpoint (), + toPoint = this .getPointOnCenterPlane (x, y, this .toPoint), + translation = viewpoint .getUserOrientation () .multVecRot (this .fromPoint .subtract (toPoint)); + + viewpoint ._positionOffset = positionOffset .assign (viewpoint ._positionOffset .getValue ()) .add (translation); + viewpoint ._centerOfRotationOffset = centerOfRotationOffset .assign (viewpoint ._centerOfRotationOffset .getValue ()) .add (translation); + + this .fromPoint .assign (toPoint); + break; + } + } + }, + mousewheel (event) + { + const { x, y } = this .getBrowser () .getPointerFromEvent (event); + + if (!this .isPointerInRectangle (x, y)) + return; + + // Stop event propagation. + + event .preventDefault (); + event .stopImmediatePropagation (); + + // Change viewpoint position. + + const + viewpoint = this .getActiveViewpoint (), + fromPoint = this .getPointOnCenterPlane (x, y, this .fromPoint); + + viewpoint .transitionStop (); + + if (event .deltaY > 0) // Move backwards. + { + viewpoint ._fieldOfViewScale = Math .max (0.00001, viewpoint ._fieldOfViewScale .getValue () * (1 - PlaneViewer_SCROLL_FACTOR)); + } + else if (event .deltaY < 0) // Move forwards. + { + viewpoint ._fieldOfViewScale = viewpoint ._fieldOfViewScale .getValue () * (1 + PlaneViewer_SCROLL_FACTOR); + + this .constrainFieldOfViewScale (); + } + + const + toPoint = this .getPointOnCenterPlane (x, y, this .toPoint), + translation = viewpoint .getUserOrientation () .multVecRot (PlaneViewer_vector .assign (fromPoint) .subtract (toPoint)); + + viewpoint ._positionOffset = positionOffset .assign (viewpoint ._positionOffset .getValue ()) .add (translation); + viewpoint ._centerOfRotationOffset = centerOfRotationOffset .assign (viewpoint ._centerOfRotationOffset .getValue ()) .add (translation); + }, + constrainFieldOfViewScale () + { + const viewpoint = this .getActiveViewpoint (); + + if (viewpoint .getTypeName () .match (/^(?:Viewpoint|GeoViewpoint)$/)) + { + if (viewpoint ._fieldOfView .getValue () * viewpoint ._fieldOfViewScale .getValue () >= Math .PI) + viewpoint ._fieldOfViewScale = (Math .PI - 0.001) / viewpoint ._fieldOfView .getValue (); + } + }, + dispose () + { + this .getBrowser () .getSurface () .off (".PlaneViewer"); + PlaneViewer_$(document) .off (".PlaneViewer" + this .getId ()); + }, +}); + +Object .defineProperties (PlaneViewer, +{ + typeName: + { + value: "PlaneViewer", + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + ]), + enumerable: true, + }, +}); + +const PlaneViewer_default_ = PlaneViewer; +; + +x_ite_Namespace .add ("PlaneViewer", "x_ite/Browser/Navigation/PlaneViewer", PlaneViewer_default_); +/* harmony default export */ const Navigation_PlaneViewer = (PlaneViewer_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Navigation/NoneViewer.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + +function NoneViewer (executionContext, navigationInfo) +{ + Navigation_X3DViewer .call (this, executionContext, navigationInfo); +} + +Object .setPrototypeOf (NoneViewer .prototype, Navigation_X3DViewer .prototype); + +Object .defineProperties (NoneViewer, +{ + typeName: + { + value: "NoneViewer", + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + ]), + enumerable: true, + }, +}); + +const NoneViewer_default_ = NoneViewer; +; + +x_ite_Namespace .add ("NoneViewer", "x_ite/Browser/Navigation/NoneViewer", NoneViewer_default_); +/* harmony default export */ const Navigation_NoneViewer = (NoneViewer_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Navigation/LookAtViewer.js +/* provided dependency */ var LookAtViewer_jquery_mousewheel = __webpack_require__(273); +/* provided dependency */ var LookAtViewer_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + +typeof LookAtViewer_jquery_mousewheel; // import plugin + +const LookAtViewer_macOS = /Mac OS X/i .test (navigator .userAgent) + +const + LookAtViewer_SCROLL_FACTOR = LookAtViewer_macOS ? 1 / 120 : 1 / 20, + LookAtViewer_MOVE_TIME = 0.3, + LookAtViewer_ROTATE_TIME = 0.3; + +function LookAtViewer (executionContext, navigationInfo) +{ + Navigation_X3DViewer .call (this, executionContext, navigationInfo); + + this .button = -1; + this .fromVector = new Numbers_Vector3 (0, 0, 0); + this .toVector = new Numbers_Vector3 (0, 0, 0); + + this .touch1 = new Numbers_Vector2 (0, 0); + this .touch2 = new Numbers_Vector2 (0, 0); + this .tapStart = 0; + this .dblTapInterval = 0.4; + + this .positionChaser = new Followers_PositionChaser (executionContext); + this .centerOfRotationChaser = new Followers_PositionChaser (executionContext); + this .orientationChaser = new Followers_OrientationChaser (executionContext); +} + +Object .assign (Object .setPrototypeOf (LookAtViewer .prototype, Navigation_X3DViewer .prototype), +{ + initialize () + { + Navigation_X3DViewer .prototype .initialize .call (this); + + const + browser = this .getBrowser (), + element = browser .getSurface (); + + // Bind pointing device events. + + element .on ("mousedown.LookAtViewer", this .mousedown .bind (this)); + element .on ("mouseup.LookAtViewer", this .mouseup .bind (this)); + element .on ("dblclick.LookAtViewer", this .dblclick .bind (this)); + element .on ("mousewheel.LookAtViewer", this .mousewheel .bind (this)); + + element .on ("touchstart.LookAtViewer", this .touchstart .bind (this)); + element .on ("touchend.LookAtViewer", this .touchend .bind (this)); + + // Setup chaser. + + this .positionChaser ._duration = LookAtViewer_MOVE_TIME; + this .positionChaser .setup (); + + this .centerOfRotationChaser ._duration = LookAtViewer_MOVE_TIME; + this .centerOfRotationChaser .setup (); + + this .orientationChaser ._duration = LookAtViewer_ROTATE_TIME; + this .orientationChaser .setup (); + }, + mousedown (event) + { + if (this .button >= 0) + return; + + const { x, y } = this .getBrowser () .getPointerFromEvent (event); + + if (!this .isPointerInRectangle (x, y)) + return; + + switch (event .button) + { + case 0: + { + // Stop event propagation. + + event .preventDefault (); + event .stopImmediatePropagation (); + + this .button = event .button; + + LookAtViewer_$(document) .on ("mouseup.LookAtViewer" + this .getId (), this .mouseup .bind (this)); + LookAtViewer_$(document) .on ("mousemove.LookAtViewer" + this .getId (), this .mousemove .bind (this)); + LookAtViewer_$(document) .on ("touchend.LookAtViewer" + this .getId (), this .mouseup .bind (this)); + LookAtViewer_$(document) .on ("touchmove.LookAtViewer" + this .getId (), this .touchmove .bind (this)); + + this .getActiveViewpoint () .transitionStop (); + + // Look around. + + this .trackballProjectToSphere (x, y, this .fromVector); + + this ._isActive = true; + break; + } + } + }, + mouseup (event) + { + if (event .button !== this .button) + return; + + this .button = -1; + + LookAtViewer_$(document) .off (".LookAtViewer" + this .getId ()); + + switch (event .button) + { + case 0: + { + // Stop event propagation. + + event .preventDefault (); + event .stopImmediatePropagation (); + + this ._isActive = false; + break; + } + } + }, + dblclick (event) + { + // Stop event propagation. + event .preventDefault (); + event .stopImmediatePropagation (); + + const { x, y } = this .getBrowser () .getPointerFromEvent (event); + + this .disconnect (); + this .lookAtPoint (x, y, this .getStraightenHorizon ()); + }, + mousemove (event) + { + this .getBrowser () .addBrowserEvent (); + + this .event = event; + + const { x, y } = this .getBrowser () .getPointerFromEvent (event); + + switch (this .button) + { + case 0: + { + // Stop event propagation. + event .preventDefault (); + event .stopImmediatePropagation (); + + // Look around + + const toVector = this .trackballProjectToSphere (x, y, this .toVector); + + this .addRotation (this .fromVector, toVector); + this .fromVector .assign (toVector); + break; + } + } + }, + mousewheel: (() => + { + const + step = new Numbers_Vector3 (0, 0, 0), + translation = new Numbers_Vector3 (0, 0, 0); + + return function (event) + { + const { x, y } = this .getBrowser () .getPointerFromEvent (event); + + if (!this .isPointerInRectangle (x, y)) + return; + + // Stop event propagation. + + event .preventDefault (); + event .stopImmediatePropagation (); + + // Change viewpoint position. + + const viewpoint = this .getActiveViewpoint (); + + viewpoint .transitionStop (); + + this .getDistanceToCenter (step) .multiply (event .zoomFactor || LookAtViewer_SCROLL_FACTOR), + viewpoint .getUserOrientation () .multVecRot (translation .set (0, 0, step .magnitude ())); + + if (event .deltaY > 0) + this .addMove (translation .negate (), Numbers_Vector3 .Zero); + + else if (event .deltaY < 0) + this .addMove (translation, Numbers_Vector3 .Zero); + }; + })(), + touchstart (event) + { + const touches = event .originalEvent .touches; + + switch (touches .length) + { + case 1: + { + // Start move (button 0). + + this .touch1 .set (touches [0] .pageX, touches [0] .pageY); + break; + } + case 2: + { + // End move (button 0). + + this .touchend (event); + + // Start look around (button 0). + + event .button = 0; + event .pageX = (touches [0] .pageX + touches [1] .pageX) / 2; + event .pageY = (touches [0] .pageY + touches [1] .pageY) / 2; + + this .mousedown (event); + + // Start zoom (mouse wheel). + + this .touch1 .set (touches [0] .pageX, touches [0] .pageY); + this .touch2 .set (touches [1] .pageX, touches [1] .pageY); + break; + } + case 3: + { + this .touchend (event); + break; + } + } + }, + touchend (event) + { + switch (this .button) + { + case 0: + { + // End look around (button 0). + this .mouseup (event); + break; + } + } + + // Start dblclick (button 0). + + if (this .getBrowser () .getCurrentTime () - this .tapStart < this .dblTapInterval) + { + event .button = 1; + event .pageX = this .touch1 .x; + event .pageY = this .touch1 .y; + + this .dblclick (event); + } + + this .tapStart = this .getBrowser () .getCurrentTime (); + }, + touchmove: (() => + { + const + MOVE_ANGLE = 0.7, + ZOOM_ANGLE = -0.7, + touch1Change = new Numbers_Vector2 (0, 0), + touch2Change = new Numbers_Vector2 (0, 0); + + return function (event) + { + const touches = event .originalEvent .touches; + + switch (touches .length) + { + case 1: + { + // Move (button 0). + break; + } + case 2: + { + touch1Change .set (touches [0] .pageX, touches [0] .pageY) .subtract (this .touch1) .normalize (); + touch2Change .set (touches [1] .pageX, touches [1] .pageY) .subtract (this .touch2) .normalize (); + + const + move = touch1Change .dot (touch2Change) > MOVE_ANGLE, + zoom = touch1Change .dot (touch2Change) < ZOOM_ANGLE; + + if (move) + { + // Look around (button 0). + + event .button = 0; + event .pageX = (touches [0] .pageX + touches [1] .pageX) / 2; + event .pageY = (touches [0] .pageY + touches [1] .pageY) / 2; + + this .mousemove (event); + } + else if (zoom) + { + // Zoom (mouse wheel). + + const distance1 = this .touch1 .distance (this .touch2); + + this .touch1 .set (touches [0] .pageX, touches [0] .pageY); + this .touch2 .set (touches [1] .pageX, touches [1] .pageY); + + const + distance2 = this .touch1 .distance (this .touch2), + delta = distance2 - distance1; + + event .deltaY = delta; + event .zoomFactor = Math .abs (delta) / LookAtViewer_$(window) .width (); + + event .pageX = (touches [0] .pageX + touches [1] .pageX) / 2; + event .pageY = (touches [0] .pageY + touches [1] .pageY) / 2; + + this .mousewheel (event); + } + + this .touch1 .set (touches [0] .pageX, touches [0] .pageY); + this .touch2 .set (touches [1] .pageX, touches [1] .pageY); + break; + } + } + }; + })(), + set_positionOffset__ (value) + { + const viewpoint = this .getActiveViewpoint (); + + viewpoint ._positionOffset = value; + }, + set_centerOfRotationOffset__ (value) + { + const viewpoint = this .getActiveViewpoint (); + + viewpoint ._centerOfRotationOffset = value; + }, + set_orientationOffset__ (value) + { + const viewpoint = this .getActiveViewpoint (); + + viewpoint ._orientationOffset = value; + }, + addMove: (() => + { + const + positionOffset = new Numbers_Vector3 (0, 0, 0), + centerOfRotationOffset = new Numbers_Vector3 (0, 0, 0); + + return function (positionOffsetChange, centerOfRotationOffsetChange) + { + const viewpoint = this .getActiveViewpoint (); + + if (this .positionChaser ._isActive .getValue () && this .positionChaser ._value_changed .hasInterest ("set_positionOffset__", this)) + { + positionOffset + .assign (this .positionChaser ._set_destination .getValue ()) + .add (positionOffsetChange); + + this .positionChaser ._set_destination = positionOffset; + } + else + { + positionOffset + .assign (viewpoint ._positionOffset .getValue ()) + .add (positionOffsetChange); + + this .positionChaser ._set_value = viewpoint ._positionOffset; + this .positionChaser ._set_destination = positionOffset; + } + + if (this .centerOfRotationChaser ._isActive .getValue () && this .centerOfRotationChaser ._value_changed .hasInterest ("set_centerOfRotationOffset__", this)) + { + centerOfRotationOffset + .assign (this .centerOfRotationChaser ._set_destination .getValue ()) + .add (centerOfRotationOffsetChange); + + this .centerOfRotationChaser ._set_destination = centerOfRotationOffset; + } + else + { + centerOfRotationOffset + .assign (viewpoint ._centerOfRotationOffset .getValue ()) + .add (centerOfRotationOffsetChange); + + this .centerOfRotationChaser ._set_value = viewpoint ._centerOfRotationOffset; + this .centerOfRotationChaser ._set_destination = centerOfRotationOffset; + } + + this .disconnect (); + this .positionChaser ._value_changed .addInterest ("set_positionOffset__", this); + this .centerOfRotationChaser ._value_changed .addInterest ("set_centerOfRotationOffset__", this); + }; + })(), + addRotation: (() => + { + const + userOrientation = new Numbers_Rotation4 (), + orientationOffset = new Numbers_Rotation4 (); + + return function (fromVector, toVector) + { + const viewpoint = this .getActiveViewpoint (); + + if (this .orientationChaser ._isActive .getValue () && this .orientationChaser ._value_changed .hasInterest ("set_orientationOffset__", this)) + { + userOrientation + .setFromToVec (toVector, fromVector) + .multRight (viewpoint .getOrientation ()) + .multRight (this .orientationChaser ._set_destination .getValue ()); + + viewpoint .straightenHorizon (userOrientation); + + orientationOffset .assign (viewpoint .getOrientation ()) .inverse () .multRight (userOrientation); + + this .orientationChaser ._set_destination = orientationOffset; + } + else + { + userOrientation + .setFromToVec (toVector, fromVector) + .multRight (viewpoint .getUserOrientation ()); + + viewpoint .straightenHorizon (userOrientation); + + orientationOffset .assign (viewpoint .getOrientation ()) .inverse () .multRight (userOrientation); + + this .orientationChaser ._set_value = viewpoint ._orientationOffset; + this .orientationChaser ._set_destination = orientationOffset; + } + + this .disconnect (); + this .orientationChaser ._value_changed .addInterest ("set_orientationOffset__", this); + }; + })(), + disconnect () + { + this .orientationChaser ._value_changed .removeInterest ("set_orientationOffset__", this); + this .positionChaser ._value_changed .removeInterest ("set_positionOffset__", this) + this .centerOfRotationChaser ._value_changed .removeInterest ("set_centerOfRotationOffset__", this) + }, + dispose () + { + this .getBrowser () .getSurface () .off (".LookAtViewer"); + LookAtViewer_$(document) .off (".LookAtViewer" + this .getId ()); + }, +}); + +Object .defineProperties (LookAtViewer, +{ + typeName: + { + value: "LookAtViewer", + enumerable: true, + }, + fieldDefinitions: + { + value: new Base_FieldDefinitionArray ([ + new Base_X3DFieldDefinition (Base_X3DConstants .outputOnly, "isActive", new x_ite_Fields .SFBool ()), + ]), + enumerable: true, + }, +}); + +const LookAtViewer_default_ = LookAtViewer; +; + +x_ite_Namespace .add ("LookAtViewer", "x_ite/Browser/Navigation/LookAtViewer", LookAtViewer_default_); +/* harmony default export */ const Navigation_LookAtViewer = (LookAtViewer_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Navigation/X3DNavigationContext.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + +const + _activeCollisions = Symbol (), + _viewerNode = Symbol (), + _headlightContainer = Symbol (); + +function getHeadlight (browser) +{ + const headlight = new Lighting_DirectionalLight (browser .getPrivateScene ()); + + headlight .setup (); + + const headlightContainer = headlight .getLights () .pop (); + + headlightContainer .set (headlight, null, Numbers_Matrix4 .Identity); + headlightContainer .dispose = Function .prototype; + + return headlightContainer; +}; + +function X3DNavigationContext () +{ + this .addChildObjects (Base_X3DConstants .outputOnly, "activeLayer", new x_ite_Fields .SFNode (), + Base_X3DConstants .outputOnly, "activeNavigationInfo", new x_ite_Fields .SFNode (), + Base_X3DConstants .outputOnly, "activeViewpoint", new x_ite_Fields .SFNode (), + Base_X3DConstants .outputOnly, "availableViewers", new x_ite_Fields .MFString (), + Base_X3DConstants .outputOnly, "viewer", new x_ite_Fields .SFString ("EXAMINE")); + + this [_activeCollisions] = new Set (); + this [_viewerNode] = new Navigation_NoneViewer (this .getPrivateScene ()); +} + +Object .assign (X3DNavigationContext .prototype, +{ + initialize () + { + this ._viewer .addInterest ("set_viewer__", this); + + this .initialized () .addInterest ("set_world__", this); + this .shutdown () .addInterest ("remove_world__", this); + + this [_headlightContainer] = getHeadlight (this); + this [_viewerNode] .setup (); + }, + getHeadlight () + { + return this [_headlightContainer]; + }, + getActiveLayer () + { + return this ._activeLayer .getValue (); + }, + getActiveNavigationInfo () + { + return this ._activeNavigationInfo .getValue (); + }, + getActiveViewpoint () + { + return this ._activeViewpoint .getValue (); + }, + getCurrentViewer () + { + return this ._viewer .getValue (); + }, + getViewer () + { + return this [_viewerNode]; + }, + addCollision (object) + { + this [_activeCollisions] .add (object); + }, + removeCollision (object) + { + this [_activeCollisions] .delete (object); + }, + getCollisionCount () + { + return this [_activeCollisions] .size; + }, + remove_world__ () + { + this .getWorld () ._activeLayer .removeInterest ("set_activeLayer__", this); + }, + set_world__ () + { + this .getWorld () ._activeLayer .addInterest ("set_activeLayer__", this); + + this .set_activeLayer__ (); + }, + set_activeLayer__ () + { + if (this ._activeLayer .getValue ()) + { + this ._activeLayer .getValue () .getNavigationInfoStack () .removeInterest ("set_activeNavigationInfo__", this); + this ._activeLayer .getValue () .getViewpointStack () .removeInterest ("set_activeViewpoint__", this); + } + + this ._activeLayer = this .getWorld () .getActiveLayer (); + + if (this ._activeLayer .getValue ()) + { + this ._activeLayer .getValue () .getNavigationInfoStack () .addInterest ("set_activeNavigationInfo__", this); + this ._activeLayer .getValue () .getViewpointStack () .addInterest ("set_activeViewpoint__", this); + } + + this .set_activeNavigationInfo__ (); + this .set_activeViewpoint__ (); + }, + set_activeNavigationInfo__ () + { + this ._activeNavigationInfo .getValue () ?._viewer .removeFieldInterest (this ._viewer); + + if (this ._activeLayer .getValue ()) + { + this ._activeNavigationInfo = this ._activeLayer .getValue () .getNavigationInfo (); + + this ._activeNavigationInfo .getValue () ._viewer .addFieldInterest (this ._viewer); + + this ._viewer = this ._activeNavigationInfo .getValue () ._viewer; + } + else + { + this ._activeNavigationInfo = null; + this ._viewer = "NONE"; + } + }, + set_activeViewpoint__ () + { + if (this ._activeLayer .getValue ()) + this ._activeViewpoint = this ._activeLayer .getValue () .getViewpoint (); + else + this ._activeViewpoint = null; + }, + set_viewer__ (viewer) + { + const navigationInfo = this ._activeNavigationInfo .getValue (); + + if (navigationInfo) + this ._availableViewers = navigationInfo ._availableViewers; + else + this ._availableViewers .length = 0; + + // Create viewer node. + + this [_viewerNode] ?.dispose (); + + switch (viewer .getValue ()) + { + case "EXAMINE": + this [_viewerNode] = new Navigation_ExamineViewer (this .getPrivateScene (), navigationInfo); + break; + case "WALK": + this [_viewerNode] = new Navigation_WalkViewer (this .getPrivateScene (), navigationInfo); + break; + case "FLY": + this [_viewerNode] = new Navigation_FlyViewer (this .getPrivateScene (), navigationInfo); + break; + case "PLANE": + case "PLANE_create3000.github.io": + case "PLANE_create3000.de": + this [_viewerNode] = new Navigation_PlaneViewer (this .getPrivateScene (), navigationInfo); + break; + case "NONE": + this [_viewerNode] = new Navigation_NoneViewer (this .getPrivateScene (), navigationInfo); + break; + case "LOOKAT": + this [_viewerNode] = new Navigation_LookAtViewer (this .getPrivateScene (), navigationInfo); + break; + default: + this [_viewerNode] = new Navigation_ExamineViewer (this .getPrivateScene (), navigationInfo); + break; + } + + this [_viewerNode] .setup (); + }, + dispose () + { + this [_viewerNode] ?.dispose (); + }, +}); + +const X3DNavigationContext_default_ = X3DNavigationContext; +; + +x_ite_Namespace .add ("X3DNavigationContext", "x_ite/Browser/Navigation/X3DNavigationContext", X3DNavigationContext_default_); +/* harmony default export */ const Navigation_X3DNavigationContext = (X3DNavigationContext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Networking/X3DNetworkingContext.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + +const + _baseURL = Symbol (), + _loadingDisplay = Symbol (), + _loadingTotal = Symbol (), + X3DNetworkingContext_loadingObjects = Symbol (), + _loading = Symbol (), + _set_loadCount = Symbol (), + _defaultScene = Symbol (); + +function getBaseURI (element) +{ + let baseURI = element .prop ("baseURI"); + + // Fix for Edge. + if (baseURI .startsWith ("about:")) + baseURI = document .baseURI; + + return baseURI; +} + +function X3DNetworkingContext () +{ + this .addChildObjects (Base_X3DConstants .outputOnly, "loadCount", new x_ite_Fields .SFInt32 ()); + + this [_baseURL] = getBaseURI (this .getElement ()); + this [_loadingDisplay] = 0; + this [_loadingTotal] = 0; + this [X3DNetworkingContext_loadingObjects] = new Set (); + this [_loading] = false; +} + +Object .assign (X3DNetworkingContext .prototype, +{ + initialize () + { + this ._loadCount .addInterest (_set_loadCount, this); + }, + getProviderURL () + { + return Networking_URLs .getProviderURL (); + }, + getBaseURL () + { + return this [_baseURL]; + }, + setBaseURL (value) + { + const + base = getBaseURI (this .getElement ()), + url = new URL (value, base); + + this [_baseURL] = url .protocol .match (/^(?:data|blob):$/) ? base : url .href; + }, + getBrowserLoading () + { + return this [_loading]; + }, + setBrowserLoading (value) + { + this [_loading] = value; + + if (value) + { + if (!this [X3DNetworkingContext_loadingObjects] .has (this)) + this .resetLoadCount (); + + this .getShadow () .find (".x_ite-private-world-info") .remove (); + + if (this .getBrowserOption ("SplashScreen")) + { + this .getContextMenu () .hide (); + this .getCanvas () .hide (); + this .getSplashScreen () .stop (true, true) .show (); + } + } + else + { + if (this .getBrowserOption ("SplashScreen")) + { + this .getCanvas () .show (); + this .getSplashScreen () .stop (true, true) .show () .fadeOut (2000); + } + } + }, + getLoadingObjects () + { + return this [X3DNetworkingContext_loadingObjects]; + }, + addLoadingObject (object) + { + if (this [X3DNetworkingContext_loadingObjects] .has (object)) + return; + + ++ this [_loadingTotal]; + + this [X3DNetworkingContext_loadingObjects] .add (object); + + this .setLoadCount (this [X3DNetworkingContext_loadingObjects] .size); + this .setCursor ("DEFAULT"); + }, + removeLoadingObject (object) + { + if (!this [X3DNetworkingContext_loadingObjects] .has (object)) + return; + + this [X3DNetworkingContext_loadingObjects] .delete (object); + + this .setLoadCount (this [X3DNetworkingContext_loadingObjects] .size); + this .setCursor (this .getCursor ()); + }, + getDisplayLoadCount () + { + return [... this [X3DNetworkingContext_loadingObjects]] .reduce ((v, o) => v + !(o .isPrivate ?.() ?? true), 0); + }, + setLoadCount (value) + { + this ._loadCount = value; + }, + resetLoadCount () + { + this ._loadCount = 0; + this [_loadingDisplay] = 0; + this [_loadingTotal] = 0; + + this [X3DNetworkingContext_loadingObjects] .clear (); + + for (const object of this .getPrivateScene () .getLoadingObjects ()) + this .addLoadingObject (object); + }, + [_set_loadCount] () + { + const loadingDisplay = this .getDisplayLoadCount (); + + if (this ._loadCount .getValue () || this [_loading]) + { + var string = ((loadingDisplay || 1) === 1 + ? locale_gettext ("Loading %1 file") + : locale_gettext ("Loading %1 files")) .replace ("%1", loadingDisplay || 1); + } + else + { + var string = locale_gettext("Loading done"); + this .setCursor ("DEFAULT"); + } + + if (this [_loading]) + { + this .getSplashScreen () .find (".x_ite-private-spinner-text") .text (string); + this .getSplashScreen () .find (".x_ite-private-progressbar div") + .css ("width", (100 - 100 * this ._loadCount .getValue () / this [_loadingTotal]) + "%"); + } + else + { + if (loadingDisplay !== this [_loadingDisplay]) + this .getNotification () ._string = string; + } + + this [_loadingDisplay] = loadingDisplay; + }, + getDefaultScene () + { + // Inline node's empty scene. + + this [_defaultScene] = this .createScene (); + this [_defaultScene] .setLive (true); + + this .getDefaultScene = function () { return this [_defaultScene]; }; + + Object .defineProperty (this, "getDefaultScene", { enumerable: false }); + + return this [_defaultScene]; + }, +}); + +const X3DNetworkingContext_default_ = X3DNetworkingContext; +; + +x_ite_Namespace .add ("X3DNetworkingContext", "x_ite/Browser/Networking/X3DNetworkingContext", X3DNetworkingContext_default_); +/* harmony default export */ const Networking_X3DNetworkingContext = (X3DNetworkingContext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Picking/X3DPickingContext.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +const + _transformSensorNodes = Symbol (), + _pickSensorNodes = Symbol (), + _pickingHierarchy = Symbol (), + _pickable = Symbol (), + _pickingTime = Symbol (); + +function X3DPickingContext () +{ + this [_transformSensorNodes] = new Set (); + this [_pickSensorNodes] = [ new Set () ]; + this [_pickingHierarchy] = [ ]; + this [_pickable] = [ false ]; + this [_pickingTime] = new Time_StopWatch (); +} + +Object .assign (X3DPickingContext .prototype, +{ + addTransformSensor (transformSensorNode) + { + this [_transformSensorNodes] .add (transformSensorNode); + this .enablePicking (); + }, + removeTransformSensor (transformSensorNode) + { + this [_transformSensorNodes] .delete (transformSensorNode); + this .enablePicking (); + }, + addPickSensor (pickSensorNode) + { + this [_pickSensorNodes] [0] .add (pickSensorNode); + this .enablePicking (); + }, + removePickSensor (pickSensorNode) + { + this [_pickSensorNodes] [0] .delete (pickSensorNode); + this .enablePicking (); + }, + getPickSensors () + { + return this [_pickSensorNodes]; + }, + getPickingHierarchy () + { + return this [_pickingHierarchy]; + }, + getPickable () + { + return this [_pickable]; + }, + enablePicking () + { + if (this [_transformSensorNodes] .size || this [_pickSensorNodes] [0] .size) + this ._sensorEvents .addInterest ("picking", this); + else + this ._sensorEvents .removeInterest ("picking", this); + }, + picking () + { + this [_pickingTime] .start (); + + this .getWorld () .traverse (Rendering_TraverseType .PICKING); + + for (const transformSensorNode of this [_transformSensorNodes]) + { + transformSensorNode .process (); + } + + for (const pickSensorNode of this [_pickSensorNodes] [0]) + { + pickSensorNode .process (); + } + + this [_pickingTime] .stop (); + }, + getPickingTime () + { + return this [_pickingTime]; + }, +}); + +const X3DPickingContext_default_ = X3DPickingContext; +; + +x_ite_Namespace .add ("X3DPickingContext", "x_ite/Browser/Picking/X3DPickingContext", X3DPickingContext_default_); +/* harmony default export */ const Picking_X3DPickingContext = (X3DPickingContext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/PointingDeviceSensor/PointingDevice.js +/* provided dependency */ var PointingDevice_jquery_mousewheel = __webpack_require__(273); +/* provided dependency */ var PointingDevice_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +typeof PointingDevice_jquery_mousewheel; // import plugin + +const CONTEXT_MENU_TIME = 1200; + +function PointingDevice (executionContext) +{ + Base_X3DBaseNode .call (this, executionContext); + + this .cursor = "DEFAULT"; + this .isOver = false; + this .motionTime = 0; +} + +Object .assign (Object .setPrototypeOf (PointingDevice .prototype, Base_X3DBaseNode .prototype), +{ + initialize () + { + const element = this .getBrowser () .getSurface (); + + //element .on ("mousewheel.PointingDevice", this .mousewheel .bind (this)); + element .on ("mousedown.PointingDevice" + this .getId (), this .mousedown .bind (this)); + element .on ("mouseup.PointingDevice" + this .getId (), this .mouseup .bind (this)); + element .on ("dblclick.PointingDevice" + this .getId (), this .dblclick .bind (this)); + element .on ("mousemove.PointingDevice" + this .getId (), this .mousemove .bind (this)); + element .on ("mouseout.PointingDevice" + this .getId (), this .onmouseout .bind (this)); + + element .on ("touchstart.PointingDevice" + this .getId (), this .touchstart .bind (this)); + element .on ("touchend.PointingDevice" + this .getId (), this .touchend .bind (this)); + }, + mousewheel (event) + { + // event .preventDefault () must be done in the all viewers. + }, + mousedown (event) + { + const + browser = this .getBrowser (), + element = browser .getSurface (); + + browser .getElement () .focus (); + + if (browser .getShiftKey () && browser .getControlKey ()) + return; + + if (event .button === 0) + { + const { x, y } = browser .getPointerFromEvent (event); + + element .off ("mousemove.PointingDevice" + this .getId ()); + + PointingDevice_$(document) + .on ("mouseup.PointingDevice" + this .getId (), this .mouseup .bind (this)) + .on ("mousemove.PointingDevice" + this .getId (), this .mousemove .bind (this)) + .on ("touchend.PointingDevice" + this .getId (), this .touchend .bind (this)) + .on ("touchmove.PointingDevice" + this .getId (), this .touchmove .bind (this)); + + if (browser .buttonPressEvent (x, y)) + { + event .preventDefault (); + event .stopImmediatePropagation (); // Keeps the rest of the handlers from being executed + + browser .setCursor ("HAND"); + browser .finishedEvents () .addInterest ("onverifymotion", this, x, y); + } + } + }, + mouseup (event) + { + event .preventDefault (); + + if (event .button === 0) + { + const + browser = this .getBrowser (), + element = browser .getSurface (); + + const { x, y } = browser .getPointerFromEvent (event); + + PointingDevice_$(document) .off (".PointingDevice" + this .getId ()); + element .on ("mousemove.PointingDevice" + this .getId (), this .mousemove .bind (this)); + + browser .buttonReleaseEvent (); + browser .setCursor (this .isOver ? "HAND" : "DEFAULT"); + browser .finishedEvents () .addInterest ("onverifymotion", this, x, y); + browser .addBrowserEvent (); + + this .cursor = "DEFAULT"; + } + }, + dblclick (event) + { + if (this .isOver) + event .stopImmediatePropagation (); + }, + mousemove (event) + { + event .preventDefault (); + + const browser = this .getBrowser (); + + if (this .motionTime === browser .getCurrentTime ()) + return; + + this .motionTime = browser .getCurrentTime (); + + const { x, y } = browser .getPointerFromEvent (event); + + this .onmotion (x, y); + }, + touchstart (event) + { + const touches = event .originalEvent .touches; + + switch (touches .length) + { + case 1: + { + // button 0. + + event .button = 0; + event .pageX = touches [0] .pageX; + event .pageY = touches [0] .pageY; + + this .mousedown (event); + + // Show context menu on long tab. + + const hit = this .getBrowser () .getHit (); + + if (hit .id === 0 || hit .sensors .length === 0) + { + this .touchX = event .pageX; + this .touchY = event .pageY; + this .touchTimeout = setTimeout (this .showContextMenu .bind (this, event), CONTEXT_MENU_TIME); + } + + break; + } + case 2: + { + this .touchend (event); + break; + } + } + }, + touchend (event) + { + event .button = 0; + + this .mouseup (event); + + clearTimeout (this .touchTimeout); + }, + touchmove (event) + { + const touches = event .originalEvent .touches; + + switch (touches .length) + { + case 1: + { + // button 0. + + event .button = 0; + event .pageX = touches [0] .pageX; + event .pageY = touches [0] .pageY; + + this .mousemove (event); + + if (Math .hypot (this .touchX - event .pageX, this .touchY - event .pageY) > 7) + clearTimeout (this .touchTimeout); + + break; + } + } + }, + onmotion (x, y) + { + const browser = this .getBrowser (); + + if (browser .motionNotifyEvent (x, y)) + { + if (!this .isOver) + { + this .isOver = true; + this .cursor = browser .getCursor (); + + browser .setCursor ("HAND"); + } + } + else + { + if (this .isOver) + { + this .isOver = false; + + browser .setCursor (this .cursor); + } + } + }, + onmouseout (event) + { + this .getBrowser () .leaveNotifyEvent (); + }, + onverifymotion (x, y) + { + // Verify isOver state. This is necessary if an Switch changes on buttonReleaseEvent + // and the new child has a sensor node inside. This sensor node must be update to + // reflect the correct isOver state. + + this .getBrowser () .finishedEvents () .removeInterest ("onverifymotion", this); + + this .onmotion (x, y); + }, + showContextMenu (event) + { + this .getBrowser () .getContextMenu () .show (event); + }, +}); + +Object .defineProperties (PointingDevice, +{ + typeName: + { + value: "PointingDevice", + enumerable: true, + }, +}); + +const PointingDevice_default_ = PointingDevice; +; + +x_ite_Namespace .add ("PointingDevice", "x_ite/Browser/PointingDeviceSensor/PointingDevice", PointingDevice_default_); +/* harmony default export */ const PointingDeviceSensor_PointingDevice = (PointingDevice_default_); +;// CONCATENATED MODULE: ./src/x_ite/Rendering/PointingBuffer.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +function PointingBuffer (browser) +{ + const gl = browser .getContext (); + + this .context = gl; + this .array = new Float32Array (4); + + // Create frame buffer. + + this .lastBuffer = gl .getParameter (gl .FRAMEBUFFER_BINDING); + this .frameBuffer = gl .createFramebuffer (); + + // Create color buffers. + + this .colorBuffers = [ ]; + this .frameBuffers = [ ]; + + for (let i = 0; i < 3; ++ i) + { + this .colorBuffers [i] = gl .createRenderbuffer (); + this .frameBuffers [i] = gl .createFramebuffer (); + + gl .bindRenderbuffer (gl .RENDERBUFFER, this .colorBuffers [i]); + gl .renderbufferStorage (gl .RENDERBUFFER, gl .RGBA32F, 1, 1); + gl .bindFramebuffer (gl .FRAMEBUFFER, this .frameBuffer); + gl .framebufferRenderbuffer (gl .FRAMEBUFFER, gl .COLOR_ATTACHMENT0 + i, gl .RENDERBUFFER, this .colorBuffers [i]); + gl .bindFramebuffer (gl .FRAMEBUFFER, this .frameBuffers [i]); + gl .framebufferRenderbuffer (gl .FRAMEBUFFER, gl .COLOR_ATTACHMENT0, gl .RENDERBUFFER, this .colorBuffers [i]); + } + + gl .bindFramebuffer (gl .FRAMEBUFFER, this .frameBuffer); + + gl .drawBuffers ([ + gl .COLOR_ATTACHMENT0, // gl_FragData [0] + gl .COLOR_ATTACHMENT1, // gl_FragData [1] + gl .COLOR_ATTACHMENT2, // gl_FragData [2] + ]); + + // Create depth buffer. + + if (gl .HAS_FEATURE_DEPTH_TEXTURE) + { + this .depthTexture = gl .createTexture (); + + gl .bindTexture (gl .TEXTURE_2D, this .depthTexture); + + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_WRAP_S, gl .CLAMP_TO_EDGE); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_WRAP_T, gl .CLAMP_TO_EDGE); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_MAG_FILTER, gl .NEAREST); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_MIN_FILTER, gl .NEAREST); + + const internalFormat = gl .getVersion () >= 2 ? gl .DEPTH_COMPONENT24 : gl .DEPTH_COMPONENT; + + gl .texImage2D (gl .TEXTURE_2D, 0, internalFormat, 1, 1, 0, gl .DEPTH_COMPONENT, gl .UNSIGNED_INT, null); + gl .framebufferTexture2D (gl .FRAMEBUFFER, gl .DEPTH_ATTACHMENT, gl .TEXTURE_2D, this .depthTexture, 0); + } + else + { + this .depthBuffer = gl .createRenderbuffer (); + + gl .bindRenderbuffer (gl .RENDERBUFFER, this .depthBuffer); + gl .renderbufferStorage (gl .RENDERBUFFER, gl .DEPTH_COMPONENT16, 1, 1); + gl .framebufferRenderbuffer (gl .FRAMEBUFFER, gl .DEPTH_ATTACHMENT, gl .RENDERBUFFER, this .depthBuffer); + } + + const status = gl .checkFramebufferStatus (gl .FRAMEBUFFER) === gl .FRAMEBUFFER_COMPLETE; + + gl .bindFramebuffer (gl .FRAMEBUFFER, this .lastBuffer); + + // Always check that our frame buffer is ok. + + if (!status) + throw new Error ("Couldn't create frame buffer."); +} + +Object .assign (PointingBuffer .prototype, +{ + bind () + { + const gl = this .context; + + this .lastBuffer = gl .getParameter (gl .FRAMEBUFFER_BINDING); + + gl .bindFramebuffer (gl .FRAMEBUFFER, this .frameBuffer); + gl .clearColor (0, 0, 0, 0); + gl .clear (gl .COLOR_BUFFER_BIT); + }, + unbind () + { + const gl = this .context; + + gl .bindFramebuffer (gl .FRAMEBUFFER, this .lastBuffer); + }, + getHit (hit) + { + const { context: gl, array } = this; + + // Id, point + + // gl .readBuffer (gl .COLOR_ATTACHMENT0); // WebGL 2 + gl .bindFramebuffer (gl .FRAMEBUFFER, this .frameBuffers [0]); + gl .readPixels (0, 0, 1, 1, gl .RGBA, gl .FLOAT, array); + + hit .id = array [3]; + hit .point .set (array [0], array [1], array [2]); + + // Normal + + gl .bindFramebuffer (gl .FRAMEBUFFER, this .frameBuffers [1]); + gl .readPixels (0, 0, 1, 1, gl .RGBA, gl .FLOAT, array); + + hit .normal .set (array [0], array [1], array [2]); + + // TexCoord + + gl .bindFramebuffer (gl .FRAMEBUFFER, this .frameBuffers [2]); + gl .readPixels (0, 0, 1, 1, gl .RGBA, gl .FLOAT, array); + + hit .texCoord .set (array [0], array [1], array [2], array [3]); + + // Finish + + gl .bindFramebuffer (gl .FRAMEBUFFER, this .frameBuffer); + }, + dispose () + { + const gl = this .context; + + gl .deleteFramebuffer (this .frameBuffer); + + for (const framebuffer of this .frameBuffers) + gl .deleteFramebuffer (framebuffer); + + for (const colorBuffer of this .colorBuffers) + gl .deleteRenderbuffer (colorBuffer); + + gl .deleteRenderbuffer (this .depthBuffer); + gl .deleteTexture (this .depthTexture); + }, +}); + +const PointingBuffer_default_ = PointingBuffer; +; + +x_ite_Namespace .add ("PointingBuffer", "x_ite/Rendering/PointingBuffer", PointingBuffer_default_); +/* harmony default export */ const Rendering_PointingBuffer = (PointingBuffer_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/PointingDeviceSensor/X3DPointingDeviceSensorContext.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + +const + _pointingDevice = Symbol (), + _pointingDeviceSensorNodes = Symbol (), + _cursorType = Symbol (), + _pointer = Symbol (), + _hit = Symbol (), + _overSensors = Symbol (), + _activeSensors = Symbol (), + _pointingLayer = Symbol (), + _pointingTime = Symbol (), + _pointingBuffer = Symbol (), + _pointingShaders = Symbol (), + _id = Symbol (), + _pointingContexts = Symbol (); + +function X3DPointingDeviceSensorContext () +{ + this [_pointingDevice] = new PointingDeviceSensor_PointingDevice (this .getPrivateScene ()); + this [_pointingDeviceSensorNodes] = new Set (); + this [_pointer] = new Numbers_Vector2 (0, 0); + this [_overSensors] = [ ]; + this [_activeSensors] = [ ]; + this [_pointingLayer] = null; + this [_pointingTime] = new Time_StopWatch (); + this [_pointingBuffer] = new Rendering_PointingBuffer (this); + this [_pointingShaders] = new Map (); + this [_pointingContexts] = [ ]; + + this [_hit] = { + id: 0, + pointer: this [_pointer], + hitRay: null, + sensors: [ ], + modelViewMatrix: new Numbers_Matrix4 (), + point: new Numbers_Vector3 (0, 0, 0), + normal: new Numbers_Vector3 (0, 0, 0), + texCoord: new Numbers_Vector4 (0, 0, 0, 0), + layerNode: null, + shapeNode: null, + }; +} + +Object .assign (X3DPointingDeviceSensorContext .prototype, +{ + initialize () + { + this .setCursor ("DEFAULT"); + + this [_pointingDevice] .setup (); + }, + getPointingTime () + { + return this [_pointingTime]; + }, + addPointingDeviceSensor (node) + { + this [_pointingDeviceSensorNodes] .add (node); + }, + removePointingDeviceSensor (node) + { + this [_pointingDeviceSensorNodes] .delete (node); + }, + setCursor (value) + { + const div = this .getSurface (); + + this [_cursorType] = value; + + switch (value) + { + case "HAND": // Hand with finger + div .css ("cursor", "pointer"); + break; + case "MOVE": // Hand grabbed something + div .css ("cursor", "move"); + break; + case "CROSSHAIR": + div .css ("cursor", "crosshair"); + break; + default: + { + if (this .getDisplayLoadCount ()) + div .css ("cursor", "wait"); + else if (this [_pointingDevice] ?.isOver) + div .css ("cursor", "pointer"); + else + div .css ("cursor", "default"); + break; + } + } + }, + getCursor () + { + return this [_cursorType]; + }, + getPointer () + { + return this [_pointer]; + }, + getPointerFromEvent ({ pageX, pageY }) + { + const + offset = this .getSurface () .offset (), + rect = this .getSurface () [0] .getBoundingClientRect (), + viewport = this .getViewport (), + x = (pageX - offset .left) / rect .width * viewport [2], + y = (1 - (pageY - offset .top) / rect .height) * viewport [3]; + + return new Numbers_Vector2 (x, y); + }, + isPointerInRectangle (rectangle, pointer = this [_pointer]) + { + return pointer .x >= rectangle .x && + pointer .x <= rectangle .x + rectangle .z && + pointer .y >= rectangle .y && + pointer .y <= rectangle .y + rectangle .w; + }, + getPointingLayer () + { + return this [_pointingLayer]; + }, + getHit () + { + return this [_hit]; + }, + addPointingShape (pickingContext) + { + const id = ++ this [_id]; + + this [_pointingContexts] [id] = pickingContext; + + return id; + }, + buttonPressEvent (x, y) + { + if (!this [_pointingDeviceSensorNodes] .size) + return false; + + if (!this .touch (x, y)) + return false; + + const hit = this [_hit]; + + this [_activeSensors] = hit .sensors; + this [_pointingLayer] = hit .layerNode; + + for (const sensor of this [_activeSensors]) + sensor .set_active__ (true, hit); + + return !! hit .sensors .length; + }, + buttonReleaseEvent () + { + if (!this [_pointingDeviceSensorNodes] .size) + return; + + for (const sensor of this [_activeSensors]) + sensor .set_active__ (false, null); + + this [_activeSensors] = Array .prototype; + this [_pointingLayer] = null; + }, + motionNotifyEvent (x, y) + { + if (!this [_pointingDeviceSensorNodes] .size) + return false; + + this .touch (x, y); + this .motion (); + + return !! this [_hit] .sensors .length; + }, + leaveNotifyEvent () + { }, + touch (x, y) + { + this [_pointingTime] .start (); + + if (this .getViewer () ._isActive .getValue ()) + { + this [_pointingTime] .reset (); + return false; + } + + // Pick. + + const hit = this [_hit]; + + this [_id] = 0; + + this [_pointer] .set (x, y); + this [_pointingBuffer] .bind (); + + this .getWorld () .traverse (Rendering_TraverseType .POINTER); + + this [_pointingBuffer] .getHit (hit); + this [_pointingBuffer] .unbind (); + + if (Number .isInteger (hit .id) && hit .id > 0 && hit .id <= this [_id]) + { + const + pickingContext = this [_pointingContexts] [hit .id], + shapeNode = pickingContext .shapeNode, + appearanceNode = shapeNode .getAppearance (), + geometryContext = shapeNode .getGeometryContext (); + + hit .hitRay = pickingContext .renderObject .getHitRay (); + hit .sensors = pickingContext .sensors .slice (); + hit .layerNode = pickingContext .renderObject; + hit .shapeNode = shapeNode; + + hit .modelViewMatrix .assign (pickingContext .modelViewMatrix); + + // A ParticleSystem has only a geometry context. + + if (geometryContext .hasNormals) + hit .modelViewMatrix .submatrix .inverse () .transpose () .multVecMatrix (hit .normal) .normalize (); + else + hit .normal .assign (Numbers_Vector3 .zAxis); + + appearanceNode .getTextureTransform () .transformPoint (hit .texCoord); + } + else + { + hit .id = 0; + hit .hitRay = this [_pointingLayer] ? this [_pointingLayer] .getHitRay () : null; + hit .sensors = Array .prototype; + hit .layerNode = this [_pointingLayer]; + hit .shapeNode = null; + + hit .modelViewMatrix .assign (Numbers_Matrix4 .Identity); + } + + // Picking end. + + this .addBrowserEvent (); + this [_pointingTime] .stop (); + + return !! hit .id; + }, + motion () + { + const hit = this [_hit]; + + // Set isOver to FALSE for appropriate nodes + + if (hit .id) + { + var difference = this [_overSensors] .filter (a => !hit .sensors .find (b => a .node === b .node)); + } + else + { + var difference = this [_overSensors]; + } + + for (const sensor of difference) + sensor .set_over__ (false, hit); + + // Set isOver to TRUE for appropriate nodes + + if (hit .id) + { + this [_overSensors] = hit .sensors; + + for (const sensor of this [_overSensors]) + sensor .set_over__ (true, hit); + } + else + { + this [_overSensors] = Array .prototype; + } + + // Forward motion event to active drag sensor nodes + + for (const sensor of this [_activeSensors]) + sensor .set_motion__ (hit); + }, + getPointingShader (numClipPlanes, shapeNode, humanoidNode) + { + const geometryContext = shapeNode .getGeometryContext (); + + let key = ""; + + key += numClipPlanes; + key += "."; + key += shapeNode .getShapeKey (); + key += geometryContext .geometryType; + key += "."; + key += humanoidNode ?.getHumanoidKey () ?? ""; + key += "."; + + if (geometryContext .geometryType >= 2) + { + key += "0.0.0"; + } + else + { + const appearanceNode = shapeNode .getAppearance (); + + key += appearanceNode .getStyleProperties (geometryContext .geometryType) ? 1 : 0; + key += "."; + key += appearanceNode .getTextureBits () .toString (4); // Textures for point and line. + key += "."; + key += appearanceNode .getMaterial () .getTextureBits () .toString (4); // Textures for point and line. + } + + return this [_pointingShaders] .get (key) || this .createPointingShader (key, numClipPlanes, shapeNode, humanoidNode); + }, + createPointingShader (key, numClipPlanes, shapeNode, humanoidNode) + { + const + appearanceNode = shapeNode .getAppearance (), + geometryContext = shapeNode .getGeometryContext (), + options = [ ]; + + if (numClipPlanes) + { + options .push ("X3D_CLIP_PLANES"); + options .push ("X3D_NUM_CLIP_PLANES " + numClipPlanes); + } + + if (shapeNode .getShapeKey () > 0) + options .push ("X3D_PARTICLE_SYSTEM"); + + options .push (`X3D_GEOMETRY_${geometryContext .geometryType}D`); + + if (appearanceNode .getStyleProperties (geometryContext .geometryType)) + options .push ("X3D_STYLE_PROPERTIES"); + + if (humanoidNode) + { + options .push ("X3D_SKINNING"); + options .push (`X3D_NUM_JOINT_SETS ${humanoidNode .getNumJoints () / 4}`); + options .push (`X3D_NUM_DISPLACEMENTS ${humanoidNode .getNumDisplacements ()}`); + } + + const shaderNode = this .createShader ("PointingShader", "Pointing", "Pointing", options); + + this [_pointingShaders] .set (key, shaderNode); + + return shaderNode; + }, +}); + +const X3DPointingDeviceSensorContext_default_ = X3DPointingDeviceSensorContext; +; + +x_ite_Namespace .add ("X3DPointingDeviceSensorContext", "x_ite/Browser/PointingDeviceSensor/X3DPointingDeviceSensorContext", X3DPointingDeviceSensorContext_default_); +/* harmony default export */ const PointingDeviceSensor_X3DPointingDeviceSensorContext = (X3DPointingDeviceSensorContext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Rendering/MultiSampleFrameBuffer.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +function MultiSampleFrameBuffer (browser, width, height, samples, oit) +{ + const gl = browser .getContext (); + + if (gl .getVersion () === 1 || width === 0 || height === 0) + return Fallback; + + this .context = gl; + this .width = width; + this .height = height; + this .samples = samples; + this .oit = oit; + this .lastBuffer = [ ]; + + // Create frame buffer. + + this .lastBuffer .push (gl .getParameter (gl .FRAMEBUFFER_BINDING)); + + this .frameBuffer = gl .createFramebuffer (); + + gl .bindFramebuffer (gl .FRAMEBUFFER, this .frameBuffer); + + // Create color buffer. + + this .colorBuffer = gl .createRenderbuffer (); + + gl .bindRenderbuffer (gl .RENDERBUFFER, this .colorBuffer); + + if (samples && !oit) + gl .renderbufferStorageMultisample (gl .RENDERBUFFER, samples, gl .RGBA8, width, height); + else + gl .renderbufferStorage (gl .RENDERBUFFER, gl .RGBA8, width, height); + + gl .framebufferRenderbuffer (gl .FRAMEBUFFER, gl .COLOR_ATTACHMENT0, gl .RENDERBUFFER, this .colorBuffer); + + // Create depth buffer. + + this .depthBuffer = gl .createRenderbuffer (); + + gl .bindRenderbuffer (gl .RENDERBUFFER, this .depthBuffer); + + if (samples && !oit) + gl .renderbufferStorageMultisample (gl .RENDERBUFFER, samples, gl .DEPTH_COMPONENT24, width, height); + else + gl .renderbufferStorage (gl .RENDERBUFFER, gl .DEPTH_COMPONENT24, width, height); + + gl .framebufferRenderbuffer (gl .FRAMEBUFFER, gl .DEPTH_ATTACHMENT, gl .RENDERBUFFER, this .depthBuffer); + + const status1 = gl .checkFramebufferStatus (gl .FRAMEBUFFER) === gl .FRAMEBUFFER_COMPLETE; + + gl .bindFramebuffer (gl .FRAMEBUFFER, this .lastBuffer .pop ()); + + // Always check that our frame buffer is ok. + + if (!status1) + throw new Error ("Couldn't create frame buffer."); + + if (!oit) + return; + + // Create oit frame buffer. + + this .lastBuffer .push (gl .getParameter (gl .FRAMEBUFFER_BINDING)); + + this .oitFrameBuffer = gl .createFramebuffer (); + + gl .bindFramebuffer (gl .FRAMEBUFFER, this .oitFrameBuffer); + + // Set draw buffers. + + gl .drawBuffers ([ + gl .COLOR_ATTACHMENT0, // gl_FragData [0] + gl .COLOR_ATTACHMENT1, // gl_FragData [1] + ]); + + if (samples) + { + // Create accum and revealage buffer. + + this .accumRevealageBuffer = gl .createRenderbuffer (); + + gl .bindRenderbuffer (gl .RENDERBUFFER, this .accumRevealageBuffer); + gl .renderbufferStorageMultisample (gl .RENDERBUFFER, samples, gl .RGBA32F, width, height); + gl .framebufferRenderbuffer (gl .FRAMEBUFFER, gl .COLOR_ATTACHMENT0, gl .RENDERBUFFER, this .accumRevealageBuffer); + + // Create alpha buffer. + + this .alphaBuffer = gl .createRenderbuffer (); + + gl .bindRenderbuffer (gl .RENDERBUFFER, this .alphaBuffer); + gl .renderbufferStorageMultisample (gl .RENDERBUFFER, samples, gl .RGBA32F, width, height); + gl .framebufferRenderbuffer (gl .FRAMEBUFFER, gl .COLOR_ATTACHMENT1, gl .RENDERBUFFER, this .alphaBuffer); + + // Add depth buffer. + + this .oitDepthBuffer = gl .createRenderbuffer (); + + gl .bindRenderbuffer (gl .RENDERBUFFER, this .oitDepthBuffer); + gl .renderbufferStorageMultisample (gl .RENDERBUFFER, samples, gl .DEPTH_COMPONENT24, width, height); + gl .framebufferRenderbuffer (gl .FRAMEBUFFER, gl .DEPTH_ATTACHMENT, gl .RENDERBUFFER, this .oitDepthBuffer); + + // Create accum texture buffer. + + this .accumRevealageTextureBuffer = gl .createFramebuffer (); + + gl .bindFramebuffer (gl .FRAMEBUFFER, this .accumRevealageTextureBuffer); + + // Create accum texture. + + this .accumRevealageTexture = gl .createTexture (); + + gl .bindTexture (gl .TEXTURE_2D, this .accumRevealageTexture); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_WRAP_S, gl .CLAMP_TO_EDGE); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_WRAP_T, gl .CLAMP_TO_EDGE); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_MIN_FILTER, gl .NEAREST); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_MAG_FILTER, gl .NEAREST); + + gl .texImage2D (gl .TEXTURE_2D, 0, gl .RGBA32F, width, height, 0, gl .RGBA, gl .FLOAT, null); + gl .framebufferTexture2D (gl .FRAMEBUFFER, gl .COLOR_ATTACHMENT0, gl .TEXTURE_2D, this .accumRevealageTexture, 0); + + // Create alpha texture buffer. + + this .alphaTextureBuffer = gl .createFramebuffer (); + + gl .bindFramebuffer (gl .FRAMEBUFFER, this .alphaTextureBuffer); + + // Create alpha texture. + + this .alphaTexture = gl .createTexture (); + + gl .bindTexture (gl .TEXTURE_2D, this .alphaTexture); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_WRAP_S, gl .CLAMP_TO_EDGE); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_WRAP_T, gl .CLAMP_TO_EDGE); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_MIN_FILTER, gl .NEAREST); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_MAG_FILTER, gl .NEAREST); + + gl .texImage2D (gl .TEXTURE_2D, 0, gl .RGBA32F, width, height, 0, gl .RGBA, gl .FLOAT, null); + gl .framebufferTexture2D (gl .FRAMEBUFFER, gl .COLOR_ATTACHMENT0, gl .TEXTURE_2D, this .alphaTexture, 0); + } + else + { + // Create accum texture. + + this .accumRevealageTexture = gl .createTexture (); + + gl .bindTexture (gl .TEXTURE_2D, this .accumRevealageTexture); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_WRAP_S, gl .CLAMP_TO_EDGE); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_WRAP_T, gl .CLAMP_TO_EDGE); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_MIN_FILTER, gl .NEAREST); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_MAG_FILTER, gl .NEAREST); + + gl .texImage2D (gl .TEXTURE_2D, 0, gl .RGBA32F, width, height, 0, gl .RGBA, gl .FLOAT, null); + gl .framebufferTexture2D (gl .FRAMEBUFFER, gl .COLOR_ATTACHMENT0, gl .TEXTURE_2D, this .accumRevealageTexture, 0); + + // Create alpha texture. + + this .alphaTexture = gl .createTexture (); + + gl .bindTexture (gl .TEXTURE_2D, this .alphaTexture); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_WRAP_S, gl .CLAMP_TO_EDGE); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_WRAP_T, gl .CLAMP_TO_EDGE); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_MIN_FILTER, gl .NEAREST); + gl .texParameteri (gl .TEXTURE_2D, gl .TEXTURE_MAG_FILTER, gl .NEAREST); + + gl .texImage2D (gl .TEXTURE_2D, 0, gl .RGBA32F, width, height, 0, gl .RGBA, gl .FLOAT, null); + gl .framebufferTexture2D (gl .FRAMEBUFFER, gl .COLOR_ATTACHMENT1, gl .TEXTURE_2D, this .alphaTexture, 0); + + // Add depth buffer. + + this .oitDepthBuffer = gl .createRenderbuffer (); + + gl .bindRenderbuffer (gl .RENDERBUFFER, this .oitDepthBuffer); + gl .renderbufferStorage (gl .RENDERBUFFER, gl .DEPTH_COMPONENT24, width, height); + gl .framebufferRenderbuffer (gl .FRAMEBUFFER, gl .DEPTH_ATTACHMENT, gl .RENDERBUFFER, this .oitDepthBuffer); + } + + const status2 = gl .checkFramebufferStatus (gl .FRAMEBUFFER) === gl .FRAMEBUFFER_COMPLETE; + + gl .bindTexture (gl .TEXTURE_2D, null); + gl .bindFramebuffer (gl .FRAMEBUFFER, this .lastBuffer .pop ()); + + // Always check that our frame buffer is ok. + + if (!status2) + throw new Error ("Couldn't create frame buffer."); + + // Get compose shader and texture units. + + this .shaderNode = browser .getComposeShader (); + this .program = this .shaderNode .getProgram (); + + gl .useProgram (this .program); + + const + accumRevealageTextureUnit = gl .getUniformLocation (this .program, "x3d_AccumRevealageTexture"), + alphaTextureUnit = gl .getUniformLocation (this .program, "x3d_AlphaTexture"); + + gl .uniform1i (accumRevealageTextureUnit, 0); + gl .uniform1i (alphaTextureUnit, 1); + + // Quad for compose pass. + + this .quadArray = gl .createVertexArray (); + this .quadBuffer = gl .createBuffer (); + + gl .bindVertexArray (this .quadArray); + gl .bindBuffer (gl .ARRAY_BUFFER, this .quadBuffer); + gl .bufferData (gl .ARRAY_BUFFER, new Float32Array ([-1, 1, -1, -1, 1, -1, -1, 1, 1, -1, 1, 1]), gl .STATIC_DRAW); + gl .vertexAttribPointer (0, 2, gl .FLOAT, false, 0, 0); + gl .enableVertexAttribArray (null); +} + +Object .assign (MultiSampleFrameBuffer .prototype, +{ + getWidth () + { + return this .width; + }, + getHeight () + { + return this .height; + }, + getSamples () + { + return this .samples; + }, + getOrderIndependentTransparency () + { + return this .oit; + }, + bind () + { + const { context: gl, lastBuffer, frameBuffer } = this; + + lastBuffer .push (gl .getParameter (gl .FRAMEBUFFER_BINDING)); + + gl .bindFramebuffer (gl .FRAMEBUFFER, frameBuffer); + + gl .clearColor (0, 0, 0, 0); + gl .clear (gl .COLOR_BUFFER_BIT); + }, + blit () + { + const { context: gl, width, height, samples, frameBuffer, oit } = this; + + // Reset viewport before blit, otherwise only last layer size is used. + gl .viewport (0, 0, width, height); + gl .scissor (0, 0, width, height); + + gl .bindFramebuffer (gl .READ_FRAMEBUFFER, frameBuffer); + gl .bindFramebuffer (gl .DRAW_FRAMEBUFFER, null); + + gl .blitFramebuffer (0, 0, width, height, + 0, 0, width, height, + gl .COLOR_BUFFER_BIT, samples && !oit ? gl .LINEAR : gl .NEAREST); + }, + bindForOrderIndependentTransparency () + { + const { context: gl, lastBuffer, oitFrameBuffer } = this; + + lastBuffer .push (gl .getParameter (gl .FRAMEBUFFER_BINDING)); + + gl .bindFramebuffer (gl .FRAMEBUFFER, oitFrameBuffer); + + gl .clearColor (0, 0, 0, 1); + gl .clear (gl .COLOR_BUFFER_BIT); + gl .blendFuncSeparate (gl .ONE, gl .ONE, gl .ZERO, gl .ONE_MINUS_SRC_ALPHA); + }, + unbind () + { + const { context: gl, lastBuffer } = this; + + gl .bindFramebuffer (gl .FRAMEBUFFER, lastBuffer .pop ()); + }, + compose () + { + const { context: gl, width, height, samples, program } = this; + + // TODO: Combining lights and lights with shadows, can cause feedback loop of texture. + // TODO: VolumeRendering shader is not made for OIT. + + // Reset viewport before blit, otherwise only last layer size is used. + gl .viewport (0, 0, width, height); + gl .scissor (0, 0, width, height); + + if (samples) + { + gl .bindFramebuffer (gl .READ_FRAMEBUFFER, this .oitFrameBuffer); + + gl .readBuffer (gl .COLOR_ATTACHMENT0); + gl .bindFramebuffer (gl .DRAW_FRAMEBUFFER, this .accumRevealageTextureBuffer); + + gl .blitFramebuffer (0, 0, width, height, + 0, 0, width, height, + gl .COLOR_BUFFER_BIT, gl .LINEAR); + + gl .readBuffer (gl .COLOR_ATTACHMENT1); + gl .bindFramebuffer (gl .DRAW_FRAMEBUFFER, this .alphaTextureBuffer); + + gl .blitFramebuffer (0, 0, width, height, + 0, 0, width, height, + gl .COLOR_BUFFER_BIT, gl .LINEAR); + } + + gl .useProgram (program); + gl .activeTexture (gl .TEXTURE0 + 0); + gl .bindTexture (gl .TEXTURE_2D, this .accumRevealageTexture); + gl .activeTexture (gl .TEXTURE0 + 1); + gl .bindTexture (gl .TEXTURE_2D, this .alphaTexture); + + gl .bindFramebuffer (gl .FRAMEBUFFER, this .frameBuffer); + gl .disable (gl .DEPTH_TEST); + gl .enable (gl .BLEND); + gl .blendFunc (gl .ONE, gl .ONE_MINUS_SRC_ALPHA); + gl .enable (gl .CULL_FACE); + gl .frontFace (gl .CCW); + gl .bindVertexArray (this .quadArray); + gl .drawArrays (gl .TRIANGLES, 0, 6); + gl .disable (gl .BLEND); + gl .enable (gl .DEPTH_TEST); + }, + dispose () + { + const gl = this .context; + + gl .deleteFramebuffer (this .frameBuffer); + gl .deleteRenderbuffer (this .colorBuffer); + gl .deleteRenderbuffer (this .depthBuffer); + + gl .deleteFramebuffer (this .oitFrameBuffer); + gl .deleteFramebuffer (this .accumRevealageTextureBuffer); + gl .deleteFramebuffer (this .alphaTextureBuffer); + gl .deleteRenderbuffer (this .oitDepthBuffer); + gl .deleteRenderbuffer (this .accumRevealageBuffer); + gl .deleteRenderbuffer (this .alphaBuffer); + gl .deleteTexture (this .accumRevealageTexture); + gl .deleteTexture (this .alphaTexture) + gl .deleteVertexArray (this .quadArray); + gl .deleteBuffer (this .quadBuffer); + }, +}); + +const Fallback = { + getWidth: Function .prototype, + getHeight: Function .prototype, + getSamples: Function .prototype, + getOrderIndependentTransparency: Function .prototype, + bind: Function .prototype, + clear: Function .prototype, + blit: Function .prototype, + compose: Function .prototype, + unbind: Function .prototype, + dispose: Function .prototype, +}; + +const MultiSampleFrameBuffer_default_ = MultiSampleFrameBuffer; +; + +x_ite_Namespace .add ("MultiSampleFrameBuffer", "x_ite/Rendering/MultiSampleFrameBuffer", MultiSampleFrameBuffer_default_); +/* harmony default export */ const Rendering_MultiSampleFrameBuffer = (MultiSampleFrameBuffer_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Rendering/X3DRenderingContext.js +/* provided dependency */ var X3DRenderingContext_$ = __webpack_require__(864); +/* provided dependency */ var ResizeSensor = __webpack_require__(45); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +const + _viewport = Symbol (), + _frameBuffer = Symbol (), + _resizer = Symbol (), + _localObjects = Symbol (), + _composeShader = Symbol (), + _depthShaders = Symbol (); + +function X3DRenderingContext () +{ + this [_viewport] = new Numbers_Vector4 (0, 0, 300, 150); + this [_frameBuffer] = new Rendering_MultiSampleFrameBuffer (this, 300, 150, 4); + this [_localObjects] = [ ]; // shader objects dumpster + this [_depthShaders] = new Map (); +} + +Object .assign (X3DRenderingContext .prototype, +{ + initialize () + { + // Configure context. + + const gl = this .getContext (); + + gl .enable (gl .SCISSOR_TEST); + gl .enable (gl .DEPTH_TEST); + gl .depthFunc (gl .LEQUAL); + gl .clearDepth (1); + + gl .blendFuncSeparate (gl .SRC_ALPHA, gl .ONE_MINUS_SRC_ALPHA, gl .ONE, gl .ONE_MINUS_SRC_ALPHA); + gl .blendEquationSeparate (gl .FUNC_ADD, gl .FUNC_ADD); + + // Configure viewport. + + X3DRenderingContext_$(document) .on ('webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange', this .onfullscreen .bind (this)); + + //https://github.com/sdecima/javascript-detect-element-resize + this [_resizer] = new ResizeSensor (this .getSurface (), this .reshape .bind (this)); + + this .getSurface () .css ("position", ""); // Reset position, set from ResizeSensor. + + this .reshape (); + }, + getRenderer () + { + const gl = this .getContext (); + + if (! navigator .userAgent .match (/Firefox/)) + { + const dbgRenderInfo = gl .getExtension ("WEBGL_debug_renderer_info"); + + if (dbgRenderInfo) + return gl .getParameter (dbgRenderInfo .UNMASKED_RENDERER_WEBGL); + } + + return gl .getParameter (gl .RENDERER); + }, + getVendor () + { + const gl = this .getContext (); + + if (! navigator .userAgent .match (/Firefox/)) + { + const dbgRenderInfo = gl .getExtension ("WEBGL_debug_renderer_info"); + + if (dbgRenderInfo) + return gl .getParameter (dbgRenderInfo .UNMASKED_VENDOR_WEBGL); + } + + return gl .getParameter (gl .VENDOR); + }, + getWebGLVersion () + { + const gl = this .getContext (); + + return gl .getParameter (gl .VERSION); + }, + getMaxSamples () + { + const gl = this .getContext (); + + return gl .getVersion () > 1 ? gl .getParameter (gl .MAX_SAMPLES) : 0; + }, + getMaxClipPlanes () + { + return 6; + }, + getDepthSize () + { + const gl = this .getContext (); + + return gl .getParameter (gl .DEPTH_BITS); + }, + getColorDepth () + { + const gl = this .getContext (); + + return (gl .getParameter (gl .RED_BITS) + + gl .getParameter (gl .BLUE_BITS) + + gl .getParameter (gl .GREEN_BITS) + + gl .getParameter (gl .ALPHA_BITS)); + }, + getViewport () + { + return this [_viewport]; + }, + getLocalObjects () + { + return this [_localObjects]; + }, + getFrameBuffer () + { + return this [_frameBuffer]; + }, + getComposeShader () + { + if (this [_composeShader]) + return this [_composeShader]; + + return this [_composeShader] = this .createShader ("ComposeShader", "Compose", "Compose"); + }, + getDepthShader (numClipPlanes, shapeNode, humanoidNode) + { + const geometryContext = shapeNode .getGeometryContext (); + + let key = ""; + + key += numClipPlanes; + key += "."; + key += shapeNode .getShapeKey (); + key += geometryContext .geometryType; + key += "."; + key += humanoidNode ?.getHumanoidKey () ?? ""; + key += "."; + + if (geometryContext .geometryType >= 2) + { + key += "0.0.0"; + } + else + { + const appearanceNode = shapeNode .getAppearance (); + + key += appearanceNode .getStyleProperties (geometryContext .geometryType) ? 1 : 0; + key += "."; + key += appearanceNode .getTextureBits () .toString (4); // Textures for point and line. + key += "."; + key += appearanceNode .getMaterial () .getTextureBits () .toString (4); // Textures for point and line. + } + + return this [_depthShaders] .get (key) || this .createDepthShader (key, numClipPlanes, shapeNode, humanoidNode); + }, + createDepthShader (key, numClipPlanes, shapeNode, humanoidNode) + { + const + appearanceNode = shapeNode .getAppearance (), + geometryContext = shapeNode .getGeometryContext (), + options = [ ]; + + if (numClipPlanes) + { + options .push ("X3D_CLIP_PLANES"); + options .push ("X3D_NUM_CLIP_PLANES " + numClipPlanes); + } + + if (shapeNode .getShapeKey () > 0) + options .push ("X3D_PARTICLE_SYSTEM"); + + options .push (`X3D_GEOMETRY_${geometryContext .geometryType}D`); + + if (appearanceNode .getStyleProperties (geometryContext .geometryType)) + options .push ("X3D_STYLE_PROPERTIES"); + + if (humanoidNode) + { + options .push ("X3D_SKINNING"); + options .push (`X3D_NUM_JOINT_SETS ${humanoidNode .getNumJoints () / 4}`); + options .push (`X3D_NUM_DISPLACEMENTS ${humanoidNode .getNumDisplacements ()}`); + } + + const shaderNode = this .createShader ("DepthShader", "Depth", "Depth", options); + + this [_depthShaders] .set (key, shaderNode); + + return shaderNode; + }, + reshape () + { + const + $canvas = this .getCanvas (), + contentScale = this .getRenderingProperty ("ContentScale"), + samples = this .getRenderingProperty ("Multisampling"), + oit = this .getBrowserOption ("OrderIndependentTransparency"), + width = $canvas .width () * contentScale, + height = $canvas .height () * contentScale, + canvas = $canvas [0]; + + canvas .width = width; + canvas .height = height; + + this [_viewport] [2] = width; + this [_viewport] [3] = height; + + if (width !== this [_frameBuffer] .getWidth () || + height !== this [_frameBuffer] .getHeight () || + samples !== this [_frameBuffer] .getSamples () || + oit !== this [_frameBuffer] .getOrderIndependentTransparency ()) + { + this [_frameBuffer] .dispose (); + this [_frameBuffer] = new Rendering_MultiSampleFrameBuffer (this, width, height, samples, oit); + } + + this .addBrowserEvent (); + }, + onfullscreen () + { + const element = this .getElement (); + + if (element .fullScreen ()) + element .addClass ("x_ite-fullscreen"); + else + element .removeClass ("x_ite-fullscreen"); + }, +}); + +const X3DRenderingContext_default_ = X3DRenderingContext; +; + +x_ite_Namespace .add ("X3DRenderingContext", "x_ite/Browser/Rendering/X3DRenderingContext", X3DRenderingContext_default_); +/* harmony default export */ const Rendering_X3DRenderingContext = (X3DRenderingContext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Scripting/X3DScriptingContext.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +const _scripts = Symbol (); + +function X3DScriptingContext () +{ + this [_scripts] = [this]; +} + +Object .assign (X3DScriptingContext .prototype, +{ + isExternal () + { + return this [_scripts] .length === 1; + }, + getScriptStack () + { + return this [_scripts]; + }, +}); + +const X3DScriptingContext_default_ = X3DScriptingContext; +; + +x_ite_Namespace .add ("X3DScriptingContext", "x_ite/Browser/Scripting/X3DScriptingContext", X3DScriptingContext_default_); +/* harmony default export */ const Scripting_X3DScriptingContext = (X3DScriptingContext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Shaders/X3DShadersContext.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + +const + _wireframe = Symbol (), + _primitiveModes = Symbol (), + _shaderNodes = Symbol (); + +function X3DShadersContext () +{ + this [_wireframe] = false; + this [_primitiveModes] = new Map (); + this [_shaderNodes] = new Map (); +} + +Object .assign (X3DShadersContext .prototype, +{ + initialize () + { + this .setShading (this .getBrowserOptions () .getShading ()); + }, + getShadingLanguageVersion () + { + const gl = this .getContext (); + + return gl .getParameter (gl .SHADING_LANGUAGE_VERSION); + }, + getMaxVertexUniformVectors () + { + const gl = this .getContext (); + + return gl .getParameter (gl .MAX_VERTEX_UNIFORM_VECTORS); + }, + getMaxFragmentUniformVectors () + { + const gl = this .getContext (); + + return gl .getParameter (gl .MAX_FRAGMENT_UNIFORM_VECTORS); + }, + getMaxVertexAttribs () + { + const gl = this .getContext (); + + return gl .getParameter (gl .MAX_VERTEX_ATTRIBS); + }, + getMaxVaryingVectors () + { + const gl = this .getContext (); + + return gl .getParameter (gl .MAX_VARYING_VECTORS); + }, + getWireframe () + { + return this [_wireframe]; + }, + getPrimitiveMode (primitiveMode) + { + return this [_primitiveModes] .get (primitiveMode); + }, + getShaders () + { + return this [_shaderNodes]; + }, + setShading (type) + { + const gl = this .getContext (); + + switch (type) + { + case Core_Shading .POINT: + { + this [_wireframe] = false; + + this [_primitiveModes] .set (gl .POINTS, gl .POINTS); + this [_primitiveModes] .set (gl .LINES, gl .POINTS); + this [_primitiveModes] .set (gl .TRIANGLES, gl .POINTS); + break; + } + case Core_Shading .WIREFRAME: + { + this [_wireframe] = true; + + this [_primitiveModes] .set (gl .POINTS, gl .POINTS); + this [_primitiveModes] .set (gl .LINES, gl .LINES); + this [_primitiveModes] .set (gl .TRIANGLES, gl .LINE_LOOP); + break; + } + default: + { + // case Shading .FLAT: + // case Shading .GOURAUD: + // case Shading .PHONG: + + this [_wireframe] = false; + + this [_primitiveModes] .set (gl .POINTS, gl .POINTS); + this [_primitiveModes] .set (gl .LINES, gl .LINES); + this [_primitiveModes] .set (gl .TRIANGLES, gl .TRIANGLES); + break; + } + } + }, + createShader (name, vs, fs = vs, options = [ ], uniformNames = [ ], transformFeedbackVaryings = [ ]) + { + if (this .getBrowserOption ("Debug")) + console .info ("Initializing " + name); + + const + gl = this .getContext (), + version = gl .getVersion (); + + const vertexShader = new Shaders_ShaderPart (this .getPrivateScene ()); + vertexShader ._url .push (encodeURI (vs .startsWith ("data:") ? vs : "data:x-shader/x-vertex," + Shaders_ShaderRegistry .vertex [version] [vs])); + vertexShader .setPrivate (true); + vertexShader .setName (name + "Vertex"); + vertexShader .setOptions (options); + vertexShader .setup (); + + const fragmentShader = new Shaders_ShaderPart (this .getPrivateScene ()); + fragmentShader ._type = "FRAGMENT"; + fragmentShader ._url .push (encodeURI (fs .startsWith ("data:") ? fs : "data:x-shader/x-fragment," + Shaders_ShaderRegistry .fragment [version] [fs])); + fragmentShader .setPrivate (true); + fragmentShader .setName (name + "Fragment"); + fragmentShader .setOptions (options); + fragmentShader .setup (); + + const shaderNode = new Shaders_ComposedShader (this .getPrivateScene ()); + shaderNode ._language = "GLSL"; + shaderNode ._parts .push (vertexShader); + shaderNode ._parts .push (fragmentShader); + shaderNode .setPrivate (true); + shaderNode .setName (name); + shaderNode .setUniformNames (uniformNames); + shaderNode .setTransformFeedbackVaryings (transformFeedbackVaryings); + shaderNode .setup (); + + return shaderNode; + }, +}); + +const X3DShadersContext_default_ = X3DShadersContext; +; + +x_ite_Namespace .add ("X3DShadersContext", "x_ite/Browser/Shaders/X3DShadersContext", X3DShadersContext_default_); +/* harmony default export */ const Shaders_X3DShadersContext = (X3DShadersContext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Shape/X3DShapeContext.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + +const + _linetypeTextures = Symbol (), + _hatchStyleTextures = Symbol (), + _defaultAppearance = Symbol (), + _defaultPointProperties = Symbol (), + _defaultLineProperties = Symbol (), + _defaultMaterial = Symbol (), + _lineFillTextureProperties = Symbol (), + _lineTransformShaderNode = Symbol (), + _lineTransformFeedback = Symbol (); + +function X3DShapeContext () +{ + this [_hatchStyleTextures] = [ ]; +} + +Object .assign (X3DShapeContext .prototype, +{ + getDefaultAppearance () + { + this [_defaultAppearance] = new Shape_Appearance (this .getPrivateScene ()); + this [_defaultAppearance] .setPrivate (true); + this [_defaultAppearance] .setup (); + + this .getDefaultAppearance = function () { return this [_defaultAppearance]; }; + + Object .defineProperty (this, "getDefaultAppearance", { enumerable: false }); + + return this [_defaultAppearance]; + }, + getLineStippleScale () + { + return 1 / (this .getPixelPerPoint () * 32); // 32px + }, + getDefaultPointProperties () + { + this [_defaultPointProperties] = new Shape_PointProperties (this .getPrivateScene ()); + this [_defaultPointProperties] .setPrivate (true); + this [_defaultPointProperties] .setup (); + + this .getDefaultPointProperties = function () { return this [_defaultPointProperties]; }; + + Object .defineProperty (this, "getDefaultPointProperties", { enumerable: false }); + + return this [_defaultPointProperties]; + }, + getDefaultLineProperties () + { + this [_defaultLineProperties] = new Shape_LineProperties (this .getPrivateScene ()); + this [_defaultLineProperties] ._applied = false; + this [_defaultLineProperties] .setPrivate (true); + this [_defaultLineProperties] .setup (); + + this .getDefaultLineProperties = function () { return this [_defaultLineProperties]; }; + + Object .defineProperty (this, "getDefaultLineProperties", { enumerable: false }); + + return this [_defaultLineProperties]; + }, + getDefaultMaterial () + { + this [_defaultMaterial] = new Shape_UnlitMaterial (this .getPrivateScene ()); + this [_defaultMaterial] .setPrivate (true); + this [_defaultMaterial] .setup (); + + this .getDefaultMaterial = function () { return this [_defaultMaterial]; }; + + Object .defineProperty (this, "getDefaultMaterial", { enumerable: false }); + + return this [_defaultMaterial]; + }, + getLinetypeTexture () + { + this [_linetypeTextures] = new Texturing_ImageTexture (this .getPrivateScene ()); + this [_linetypeTextures] ._url [0] = Networking_URLs .getLinetypeURL (); + this [_linetypeTextures] ._textureProperties = this .getLineFillTextureProperties (); + this [_linetypeTextures] .setPrivate (true); + this [_linetypeTextures] .setup (); + + this .getLinetypeTexture = function () { return this [_linetypeTextures]; }; + + Object .defineProperty (this, "getLinetypeTexture", { enumerable: false }); + + return this [_linetypeTextures]; + }, + getHatchStyleTexture (index) + { + let hatchStyleTexture = this [_hatchStyleTextures] [index]; + + if (hatchStyleTexture) + return hatchStyleTexture; + + hatchStyleTexture = this [_hatchStyleTextures] [index] = new Texturing_ImageTexture (this .getPrivateScene ()); + + hatchStyleTexture ._url [0] = Networking_URLs .getHatchingURL (index); + hatchStyleTexture ._textureProperties = this .getLineFillTextureProperties (); + hatchStyleTexture .setPrivate (true); + hatchStyleTexture .setup (); + + return hatchStyleTexture; + }, + getLineFillTextureProperties () + { + this [_lineFillTextureProperties] = new Texturing_TextureProperties (this .getPrivateScene ()); + this [_lineFillTextureProperties] ._minificationFilter = "NEAREST_PIXEL"; + this [_lineFillTextureProperties] ._magnificationFilter = "NEAREST_PIXEL"; + this [_lineFillTextureProperties] ._textureCompression = "DEFAULT"; + this [_lineFillTextureProperties] .setPrivate (true); + this [_lineFillTextureProperties] .setup (); + + this .getLineFillTextureProperties = function () { return this [_lineFillTextureProperties]; }; + + Object .defineProperty (this, "getLineFillTextureProperties", { enumerable: false }); + + return this [_lineFillTextureProperties]; + }, + getLineTransformShader () + { + const uniformNames = [ + "viewport", + "modelViewProjectionMatrix", + "invModelViewProjectionMatrix", + "scale", + ]; + + const transformFeedbackVaryings = [ + "coordIndex0", "lineStipple0", "fogDepth0", "color0", "normal0", "vertex0", + "coordIndex1", "lineStipple1", "fogDepth1", "color1", "normal1", "vertex1", + "coordIndex2", "lineStipple2", "fogDepth2", "color2", "normal2", "vertex2", + ]; + + this [_lineTransformShaderNode] = this .createShader ("LineTransformShader", "LineTransform", "LineTransform", [ ], uniformNames, transformFeedbackVaryings); + + this .getLineTransformShader = function () { return this [_lineTransformShaderNode]; }; + + Object .defineProperty (this, "getLineTransformShader", { enumerable: false }); + + return this [_lineTransformShaderNode]; + }, + getLineTransformFeedback () + { + const gl = this .getContext (); + + this [_lineTransformFeedback] = gl .createTransformFeedback (); + + this .getLineTransformFeedback = function () { return this [_lineTransformFeedback]; }; + + Object .defineProperty (this, "getLineTransformFeedback", { enumerable: false }); + + return this [_lineTransformFeedback]; + }, +}); + +const X3DShapeContext_default_ = X3DShapeContext; +; + +x_ite_Namespace .add ("X3DShapeContext", "x_ite/Browser/Shape/X3DShapeContext", X3DShapeContext_default_); +/* harmony default export */ const Shape_X3DShapeContext = (X3DShapeContext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Sound/X3DSoundContext.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +const + _audioContext = Symbol (), + _defaultPeriodicWave = Symbol (); + +function X3DSoundContext () +{ + this [_audioContext] = new AudioContext (); +} + +Object .assign (X3DSoundContext .prototype, +{ + initialize () + { + this .startAudioElement (this [_audioContext], "resume"); + }, + getAudioContext () + { + return this [_audioContext]; + }, + getDefaultPeriodicWave () + { + this [_defaultPeriodicWave] = new Sound_PeriodicWave (this .getPrivateScene ()); + this [_defaultPeriodicWave] .setPrivate (true); + this [_defaultPeriodicWave] .setup (); + + this .getDefaultPeriodicWave = function () { return this [_defaultPeriodicWave]; }; + + Object .defineProperty (this, "getDefaultPeriodicWave", { enumerable: false }); + + return this [_defaultPeriodicWave]; + }, + startAudioElement (audioElement, functionName = "play") + { + const id = `X3DSoundContext-${Base_X3DObject .getId (audioElement)}`; + + const events = [ + "blur", + "click", + "contextmenu", + "dblclick", + "focus", + "keydown", + "keyup", + "mousedown", + "mouseup", + "pointerup", + "touchend", + ] + .map (event => `${event}.${id}`); + + this .getElement () .on (events .join (" "), event => + { + audioElement [functionName] () + .then (() => this .getElement () .off (`.${id}`)) + .catch (Function .prototype); + }); + }, +}); + +const X3DSoundContext_default_ = X3DSoundContext; +; + +x_ite_Namespace .add ("X3DSoundContext", "x_ite/Browser/Sound/X3DSoundContext", X3DSoundContext_default_); +/* harmony default export */ const Sound_X3DSoundContext = (X3DSoundContext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Texturing/X3DTexturingContext.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + +const + _maxTextures = Symbol (), + _combinedTextureUnits = Symbol (), + _texture2DUnits = Symbol (), + _texture3DUnits = Symbol (), + _textureCubeUnits = Symbol (), + _texture2DUnitIndex = Symbol (), + _texture3DUnitIndex = Symbol (), + _textureCubeUnitIndex = Symbol (), + _defaultTexture2D = Symbol (), + _defaultTexture3D = Symbol (), + _defaultTextureCube = Symbol (), + _defaultTextureProperties = Symbol (), + _defaultTextureTransform = Symbol (), + _defaultTextureCoordinate = Symbol (); + +function X3DTexturingContext () +{ + const + gl = this .getContext (), + maxTextureImageUnits = gl .getParameter (gl .MAX_TEXTURE_IMAGE_UNITS); + + // console .log (gl .getParameter (gl .MAX_TEXTURE_IMAGE_UNITS)) + // console .log (gl .getParameter (gl .MAX_ARRAY_TEXTURE_LAYERS)) + + this [_maxTextures] = maxTextureImageUnits > 8 ? 2 : 1; +} + +Object .assign (X3DTexturingContext .prototype, +{ + initialize () + { + const gl = this .getContext (); + + gl .pixelStorei (gl .UNPACK_ALIGNMENT, 1); + + // Get texture Units + + const maxCombinedTextureUnits = gl .getParameter (gl .MAX_COMBINED_TEXTURE_IMAGE_UNITS); + + this [_combinedTextureUnits] = [...Array (maxCombinedTextureUnits) .keys ()] .reverse (); + this [_texture2DUnits] = [this [_combinedTextureUnits] .pop ()]; + this [_texture3DUnits] = [this [_combinedTextureUnits] .pop ()]; + this [_textureCubeUnits] = [this [_combinedTextureUnits] .pop ()]; + + // Default Texture 2D Unit + + const defaultData = new Uint8Array ([ 255, 255, 255, 255 ]); + + this [_defaultTexture2D] = gl .createTexture (); + + gl .activeTexture (gl .TEXTURE0 + this [_texture2DUnits] [0]); + gl .bindTexture (gl .TEXTURE_2D, this [_defaultTexture2D]); + gl .texImage2D (gl .TEXTURE_2D, 0, gl .RGBA, 1, 1, 0, gl .RGBA, gl .UNSIGNED_BYTE, defaultData); + + // Default Texture 3D Unit + + if (gl .getVersion () >= 2) + { + this [_defaultTexture3D] = gl .createTexture (); + + gl .activeTexture (gl .TEXTURE0 + this [_texture3DUnits] [0]); + gl .bindTexture (gl .TEXTURE_3D, this [_defaultTexture3D]); + gl .texImage3D (gl .TEXTURE_3D, 0, gl .RGBA, 1, 1, 1, 0, gl .RGBA, gl .UNSIGNED_BYTE, defaultData); + } + + // Default Texture Cube Unit + + this [_defaultTextureCube] = gl .createTexture (); + + gl .activeTexture (gl .TEXTURE0 + this [_textureCubeUnits] [0]); + gl .bindTexture (gl .TEXTURE_CUBE_MAP, this [_defaultTextureCube]); + gl .texImage2D (gl .TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl .RGBA, 1, 1, 0, gl .RGBA, gl .UNSIGNED_BYTE, defaultData); + gl .texImage2D (gl .TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl .RGBA, 1, 1, 0, gl .RGBA, gl .UNSIGNED_BYTE, defaultData); + gl .texImage2D (gl .TEXTURE_CUBE_MAP_NEGATIVE_X, 0, gl .RGBA, 1, 1, 0, gl .RGBA, gl .UNSIGNED_BYTE, defaultData); + gl .texImage2D (gl .TEXTURE_CUBE_MAP_POSITIVE_X, 0, gl .RGBA, 1, 1, 0, gl .RGBA, gl .UNSIGNED_BYTE, defaultData); + gl .texImage2D (gl .TEXTURE_CUBE_MAP_POSITIVE_Y, 0, gl .RGBA, 1, 1, 0, gl .RGBA, gl .UNSIGNED_BYTE, defaultData); + gl .texImage2D (gl .TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl .RGBA, 1, 1, 0, gl .RGBA, gl .UNSIGNED_BYTE, defaultData); + + // Init texture units. + + this .resetTextureUnits (); + + // Set texture quality. + + this .setTextureQuality (this .getBrowserOptions () .getTextureQuality ()); + }, + getMaxTextures () + { + return this [_maxTextures]; + }, + getMaxTextureTransforms () + { + return 4; + }, + getMaxTexCoords () + { + return 4; + }, + getMinTextureSize () + { + return 16; + }, + getMaxTextureSize () + { + const gl = this .getContext (); + + return gl .getParameter (gl .MAX_TEXTURE_SIZE); + }, + getMaxCombinedTextureUnits () + { + const gl = this .getContext (); + + return gl .getParameter (gl .MAX_COMBINED_TEXTURE_IMAGE_UNITS) + }, + popTexture2DUnit () + { + if (this [_texture2DUnitIndex] > 0) + { + -- this [_texture2DUnitIndex]; + + return this [_texture2DUnits] .pop (); + } + else + { + return this [_combinedTextureUnits] .pop (); + } + }, + pushTexture2DUnit (textureUnit) + { + if (textureUnit === undefined) + return; + + ++ this [_texture2DUnitIndex]; + + this [_texture2DUnits] .push (textureUnit); + }, + getTexture2DUnit () + { + if (this [_texture2DUnitIndex] > 0) + return this [_texture2DUnits] [-- this [_texture2DUnitIndex]]; + + const textureUnit = this [_combinedTextureUnits] .pop (); + + if (textureUnit !== undefined) + this [_texture2DUnits] .push (textureUnit); + + return textureUnit; + }, + getTexture3DUnit () + { + if (this [_texture3DUnitIndex] > 0) + return this [_texture3DUnits] [-- this [_texture3DUnitIndex]]; + + const textureUnit = this [_combinedTextureUnits] .pop (); + + if (textureUnit !== undefined) + this [_texture3DUnits] .push (textureUnit); + + return textureUnit; + }, + getTextureCubeUnit () + { + if (this [_textureCubeUnitIndex] > 0) + return this [_textureCubeUnits] [-- this [_textureCubeUnitIndex]]; + + const textureUnit = this [_combinedTextureUnits] .pop (); + + if (textureUnit !== undefined) + this [_textureCubeUnits] .push (textureUnit); + + return textureUnit; + }, + getTextureUnit (textureType) + { + switch (textureType) + { + case 2: return this .getTexture2DUnit (); + case 3: return this .getTexture3DUnit (); + case 4: return this .getTextureCubeUnit (); + } + }, + resetTextureUnits () + { + this [_texture2DUnitIndex] = this [_texture2DUnits] .length; + this [_texture3DUnitIndex] = this [_texture3DUnits] .length; + this [_textureCubeUnitIndex] = this [_textureCubeUnits] .length; + }, + getDefaultTexture2DUnit () + { + return this [_texture2DUnits] [0]; + }, + getDefaultTexture3DUnit () + { + return this [_texture3DUnits] [0]; + }, + getDefaultTextureCubeUnit () + { + return this [_textureCubeUnits] [0]; + }, + getTextureMemory () + { + return NaN; + }, + getDefaultTextureProperties () + { + this [_defaultTextureProperties] = new Texturing_TextureProperties (this .getPrivateScene ()); + this [_defaultTextureProperties] ._magnificationFilter = "NICEST"; + this [_defaultTextureProperties] ._minificationFilter = "NEAREST_PIXEL_AVG_MIPMAP"; + this [_defaultTextureProperties] ._generateMipMaps = true; + this [_defaultTextureProperties] ._textureCompression = "NICEST"; + + this [_defaultTextureProperties] .setup (); + + this .getDefaultTextureProperties = function () { return this [_defaultTextureProperties]; }; + + Object .defineProperty (this, "getDefaultTextureProperties", { enumerable: false }); + + return this [_defaultTextureProperties]; + }, + getDefaultTextureTransform () + { + this [_defaultTextureTransform] = new Texturing_TextureTransform (this .getPrivateScene ()); + this [_defaultTextureTransform] .setPrivate (true); + this [_defaultTextureTransform] .setup (); + + this .getDefaultTextureTransform = function () { return this [_defaultTextureTransform]; }; + + Object .defineProperty (this, "getDefaultTextureTransform", { enumerable: false }); + + return this [_defaultTextureTransform]; + }, + getDefaultTextureCoordinate () + { + this [_defaultTextureCoordinate] = new Texturing_TextureCoordinate (this .getPrivateScene ()); + this [_defaultTextureCoordinate] .setPrivate (true); + this [_defaultTextureCoordinate] .setup (); + + this .getDefaultTextureCoordinate = function () { return this [_defaultTextureCoordinate]; }; + + Object .defineProperty (this, "getDefaultTextureCoordinate", { enumerable: false }); + + return this [_defaultTextureCoordinate]; + }, + setTextureQuality (textureQuality) + { + const textureProperties = this .getDefaultTextureProperties (); + + switch (textureQuality) + { + case Core_TextureQuality .LOW: + { + textureProperties ._magnificationFilter = "AVG_PIXEL"; + textureProperties ._minificationFilter = "AVG_PIXEL"; + textureProperties ._textureCompression = "FASTEST"; + textureProperties ._generateMipMaps = true; + + //glHint (GL_GENERATE_MIPMAP_HINT, GL_FASTEST); + //glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); + break; + } + case Core_TextureQuality .MEDIUM: + { + textureProperties ._magnificationFilter = "NICEST"; + textureProperties ._minificationFilter = "NEAREST_PIXEL_AVG_MIPMAP"; + textureProperties ._textureCompression = "NICEST"; + textureProperties ._generateMipMaps = true; + + //glHint (GL_GENERATE_MIPMAP_HINT, GL_FASTEST); + //glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); + break; + } + case Core_TextureQuality .HIGH: + { + textureProperties ._magnificationFilter = "NICEST"; + textureProperties ._minificationFilter = "NICEST"; + textureProperties ._textureCompression = "NICEST"; + textureProperties ._generateMipMaps = true; + + //glHint (GL_GENERATE_MIPMAP_HINT, GL_NICEST); + //glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); + break; + } + } + }, +}); + +const X3DTexturingContext_default_ = X3DTexturingContext; +; + +x_ite_Namespace .add ("X3DTexturingContext", "x_ite/Browser/Texturing/X3DTexturingContext", X3DTexturingContext_default_); +/* harmony default export */ const Texturing_X3DTexturingContext = (X3DTexturingContext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/Time/X3DTimeContext.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +const + _currentTime = Symbol (), + _currentFrameRate = Symbol (), + _currentPosition = Symbol (), + _currentSpeed = Symbol (); + +function X3DTimeContext () +{ + this [_currentTime] = Date .now () / 1000; + this [_currentFrameRate] = 60; + this [_currentPosition] = new Numbers_Vector3 (0, 0, 0); + this [_currentSpeed] = 0; +} + +Object .assign (X3DTimeContext .prototype, +{ + getCurrentTime () + { + return this [_currentTime]; + }, + getCurrentFrameRate () + { + return this [_currentFrameRate]; + }, + getCurrentSpeed () + { + return this [_currentSpeed]; + }, + advanceTime: (() => + { + const lastPosition = new Numbers_Vector3 (0, 0, 0); + + return function () + { + const + time = Date .now () / 1000, + interval = time - this [_currentTime]; + + this [_currentTime] = time; + this [_currentFrameRate] = interval ? 1 / interval : 60; + + if (this .getWorld () && this .getActiveLayer ()) + { + const cameraSpaceMatrix = this .getActiveLayer () .getViewpoint () .getCameraSpaceMatrix (); + + lastPosition .assign (this [_currentPosition]); + this [_currentPosition] .set (cameraSpaceMatrix [12], cameraSpaceMatrix [13], cameraSpaceMatrix [14]); + + this [_currentSpeed] = lastPosition .subtract (this [_currentPosition]) .magnitude () * this [_currentFrameRate]; + } + else + { + this [_currentSpeed] = 0; + } + }; + })(), +}); + +const X3DTimeContext_default_ = X3DTimeContext; +; + +x_ite_Namespace .add ("X3DTimeContext", "x_ite/Browser/Time/X3DTimeContext", X3DTimeContext_default_); +/* harmony default export */ const Time_X3DTimeContext = (X3DTimeContext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Routing/X3DRoutingContext.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +const + _taintedFields = Symbol (), + _taintedFieldsTemp = Symbol (), + _taintedNodes = Symbol (), + _taintedNodesTemp = Symbol (); + +function X3DRoutingContext () +{ + this [_taintedFields] = [ ]; + this [_taintedFieldsTemp] = [ ]; + this [_taintedNodes] = [ ]; + this [_taintedNodesTemp] = [ ]; +} + +Object .assign (X3DRoutingContext .prototype, +{ + initialize () { }, + addTaintedField (field, event) + { + this [_taintedFields] .push (field, event); + }, + addTaintedNode (node) + { + this [_taintedNodes] .push (node); + }, + [Symbol .for ("X_ITE.X3DRoutingContext.processEvents")] () + { + do + { + // Process field events + do + { + const taintedFields = this [_taintedFields]; + + // Swap tainted fields. + this [_taintedFields] = this [_taintedFieldsTemp]; + this [_taintedFields] .length = 0; + + for (let i = 0, length = taintedFields .length; i < length; i += 2) + taintedFields [i] .processEvent (taintedFields [i + 1]); + + // Don't know why this must be done after the for loop, otherwise a fatal error could be thrown. + this [_taintedFieldsTemp] = taintedFields; + } + while (this [_taintedFields] .length); + + // Process node events + do + { + const taintedNodes = this [_taintedNodes]; + + // Swap tainted nodes. + this [_taintedNodes] = this [_taintedNodesTemp]; + this [_taintedNodes] .length = 0; + + for (const taintedNode of taintedNodes) + taintedNode .processEvent (); + + // Don't know why this must be done after the for loop, otherwise a fatal error could be thrown. + this [_taintedNodesTemp] = taintedNodes; + } + while (! this [_taintedFields] .length && this [_taintedNodes] .length); + } + while (this [_taintedFields] .length); + }, + dispose () { }, +}); + +const X3DRoutingContext_default_ = X3DRoutingContext; +; + +x_ite_Namespace .add ("X3DRoutingContext", "x_ite/Routing/X3DRoutingContext", X3DRoutingContext_default_); +/* harmony default export */ const Routing_X3DRoutingContext = (X3DRoutingContext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Configuration/AbstractNodesArray.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + +function AbstractNodesArray (values = [ ]) +{ + return Base_X3DInfoArray .call (this, Array .from (values, value => [value .typeName, value]), Function); +} + +Object .assign (Object .setPrototypeOf (AbstractNodesArray .prototype, Base_X3DInfoArray .prototype), +{ + add (typeName, AbstractNode) + { + Base_X3DConstants .addNode (AbstractNode); + + Base_X3DInfoArray .prototype .add .call (this, typeName, AbstractNode); + }, +}); + +for (const key of Object .keys (AbstractNodesArray .prototype)) + Object .defineProperty (AbstractNodesArray .prototype, key, { enumerable: false }); + +Object .defineProperties (AbstractNodesArray, +{ + typeName: + { + value: "AbstractNodesArray", + enumerable: true, + }, +}); + +const AbstractNodesArray_default_ = AbstractNodesArray; +; + +x_ite_Namespace .add ("AbstractNodesArray", "x_ite/Configuration/AbstractNodesArray", AbstractNodesArray_default_); +/* harmony default export */ const Configuration_AbstractNodesArray = (AbstractNodesArray_default_); +;// CONCATENATED MODULE: ./src/x_ite/Configuration/AbstractNodes.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +const AbstractNodes_default_ = new Configuration_AbstractNodesArray (); +; + +x_ite_Namespace .add ("AbstractNodes", "x_ite/Configuration/AbstractNodes", AbstractNodes_default_); +/* harmony default export */ const AbstractNodes = (AbstractNodes_default_); +;// CONCATENATED MODULE: ./src/x_ite/Configuration/ConcreteNodesArray.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function ConcreteNodesArray (values = [ ]) +{ + return Base_X3DInfoArray .call (this, Array .from (values, value => [value .typeName, value]), Function); +} + +Object .assign (Object .setPrototypeOf (ConcreteNodesArray .prototype, Base_X3DInfoArray .prototype), +{ + add (typeName, ConcreteNode) + { + Base_X3DConstants .addNode (ConcreteNode); + Parser_HTMLSupport .addConcreteNode (ConcreteNode); + + Base_X3DInfoArray .prototype .add .call (this, typeName, ConcreteNode); + }, + update (oldTypeName, typeName, ConcreteNode) + { + Base_X3DConstants .addNode (ConcreteNode); + Parser_HTMLSupport .addConcreteNode (ConcreteNode); + + Base_X3DInfoArray .prototype .update .call (this, oldTypeName, typeName, ConcreteNode); + }, +}); + +for (const key of Object .keys (ConcreteNodesArray .prototype)) + Object .defineProperty (ConcreteNodesArray .prototype, key, { enumerable: false }); + +Object .defineProperties (ConcreteNodesArray, +{ + typeName: + { + value: "ConcreteNodesArray", + enumerable: true, + }, +}); + +const ConcreteNodesArray_default_ = ConcreteNodesArray; +; + +x_ite_Namespace .add ("ConcreteNodesArray", "x_ite/Configuration/ConcreteNodesArray", ConcreteNodesArray_default_); +/* harmony default export */ const Configuration_ConcreteNodesArray = (ConcreteNodesArray_default_); +;// CONCATENATED MODULE: ./src/x_ite/Configuration/ConcreteNodes.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +const ConcreteNodes_default_ = new Configuration_ConcreteNodesArray (); +; + +x_ite_Namespace .add ("ConcreteNodes", "x_ite/Configuration/ConcreteNodes", ConcreteNodes_default_); +/* harmony default export */ const ConcreteNodes = (ConcreteNodes_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/X3DBrowserContext.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +const + _world = Symbol (), + _changedTime = Symbol (), + _limitFrameRate = Symbol (), + _traverse = Symbol (), + _renderCallback = Symbol (), + _previousTime = Symbol (), + _systemTime = Symbol (), + _browserTime = Symbol (), + _cameraTime = Symbol (), + _collisionTime = Symbol (), + _displayTime = Symbol (), + _processEvents = Symbol .for ("X_ITE.X3DRoutingContext.processEvents"); + +const + browsers = new Set (), + browserContexts = [ ]; + +function X3DBrowserContext (element) +{ + Base_X3DBaseNode .call (this, this); + Routing_X3DRoutingContext .call (this); + Scripting_X3DScriptingContext .call (this); + Core_X3DCoreContext .call (this, element); + Networking_X3DNetworkingContext .call (this); + Texturing_X3DTexturingContext .call (this); + Shaders_X3DShadersContext .call (this); + Rendering_X3DRenderingContext .call (this); + Shape_X3DShapeContext .call (this); + Grouping_X3DGroupingContext .call (this); + Geometry3D_X3DGeometry3DContext .call (this); + PointingDeviceSensor_X3DPointingDeviceSensorContext .call (this); + Navigation_X3DNavigationContext .call (this); + Layering_X3DLayeringContext .call (this); + EnvironmentalEffects_X3DEnvironmentalEffectsContext .call (this); + Lighting_X3DLightingContext .call (this); + Picking_X3DPickingContext .call (this); + Sound_X3DSoundContext .call (this); + Time_X3DTimeContext .call (this); + + browsers .add (this); + + for (const browserContext of browserContexts) + browserContext .call (this); + + this .addChildObjects (Base_X3DConstants .outputOnly, "initialized", new Fields_SFTime (), + Base_X3DConstants .outputOnly, "shutdown", new Fields_SFTime (), + Base_X3DConstants .outputOnly, "prepareEvents", new Fields_SFTime (), + Base_X3DConstants .outputOnly, "timeEvents", new Fields_SFTime (), + Base_X3DConstants .outputOnly, "sensorEvents", new Fields_SFTime (), + Base_X3DConstants .outputOnly, "displayEvents", new Fields_SFTime (), + Base_X3DConstants .outputOnly, "finishedEvents", new Fields_SFTime ()); + + this [_changedTime] = 0; + this [_previousTime] = 0; + this [_renderCallback] = this [_traverse] .bind (this); + this [_systemTime] = new Time_StopWatch (); + this [_browserTime] = new Time_StopWatch (); + this [_cameraTime] = new Time_StopWatch (); + this [_collisionTime] = new Time_StopWatch (); + this [_displayTime] = new Time_StopWatch (); +}; + +Object .assign (Object .setPrototypeOf (X3DBrowserContext .prototype, Base_X3DBaseNode .prototype), + Core_X3DCoreContext .prototype, + EnvironmentalEffects_X3DEnvironmentalEffectsContext .prototype, + Geometry3D_X3DGeometry3DContext .prototype, + Grouping_X3DGroupingContext .prototype, + Layering_X3DLayeringContext .prototype, + Lighting_X3DLightingContext .prototype, + Navigation_X3DNavigationContext .prototype, + Networking_X3DNetworkingContext .prototype, + Picking_X3DPickingContext .prototype, + PointingDeviceSensor_X3DPointingDeviceSensorContext .prototype, + Rendering_X3DRenderingContext .prototype, + Routing_X3DRoutingContext .prototype, + Scripting_X3DScriptingContext .prototype, + Shaders_X3DShadersContext .prototype, + Shape_X3DShapeContext .prototype, + Sound_X3DSoundContext .prototype, + Texturing_X3DTexturingContext .prototype, + Time_X3DTimeContext .prototype, +{ + initialize () + { + Base_X3DBaseNode .prototype .initialize ?.call (this); + Routing_X3DRoutingContext .prototype .initialize ?.call (this); + Scripting_X3DScriptingContext .prototype .initialize ?.call (this); + Core_X3DCoreContext .prototype .initialize ?.call (this); + Networking_X3DNetworkingContext .prototype .initialize ?.call (this); + Texturing_X3DTexturingContext .prototype .initialize ?.call (this); + Shaders_X3DShadersContext .prototype .initialize ?.call (this); + Rendering_X3DRenderingContext .prototype .initialize ?.call (this); + Shape_X3DShapeContext .prototype .initialize ?.call (this); + Grouping_X3DGroupingContext .prototype .initialize ?.call (this); + Geometry3D_X3DGeometry3DContext .prototype .initialize ?.call (this); + PointingDeviceSensor_X3DPointingDeviceSensorContext .prototype .initialize ?.call (this); + Navigation_X3DNavigationContext .prototype .initialize ?.call (this); + Layering_X3DLayeringContext .prototype .initialize ?.call (this); + EnvironmentalEffects_X3DEnvironmentalEffectsContext .prototype .initialize ?.call (this); + Lighting_X3DLightingContext .prototype .initialize ?.call (this); + Picking_X3DPickingContext .prototype .initialize ?.call (this); + Sound_X3DSoundContext .prototype .initialize ?.call (this); + Time_X3DTimeContext .prototype .initialize ?.call (this); + + for (const browserContext of browserContexts) + browserContext .prototype .initialize ?.call (this); + }, + initialized () + { + return this ._initialized; + }, + shutdown () + { + return this ._shutdown; + }, + prepareEvents () + { + return this ._prepareEvents; + }, + timeEvents () + { + return this ._timeEvents; + }, + sensorEvents () + { + return this ._sensorEvents; + }, + displayEvents () + { + return this ._displayEvents; + }, + finishedEvents () + { + return this ._finishedEvents; + }, + getBrowser () + { + return this; + }, + getWorld () + { + return this [_world]; + }, + getExecutionContext () + { + return this [_world] .getExecutionContext (); + }, + setExecutionContext (executionContext) + { + this [_world] = new Execution_X3DWorld (executionContext); + this [_world] .setup (); + }, + addBrowserEvent () + { + if (this [_changedTime] === this .getCurrentTime ()) + return; + + this [_changedTime] = this .getCurrentTime (); + + requestAnimationFrame (this [_renderCallback]); + }, + [_limitFrameRate] (now) + { + if (now === this [_previousTime]) + { + requestAnimationFrame (this [_renderCallback]); + + return true; + } + else + { + this [_previousTime] = now; + + return false; + } + }, + [_traverse] (now) + { + // Limit frame rate. + + if (this [_limitFrameRate] (now)) + return; + + // Start + + this [_systemTime] .stop (); + this [_browserTime] .start (); + + // time + + this .advanceTime (); + + // Events + + this .addTaintedField (this ._prepareEvents); + this [_processEvents] (); + + this .addTaintedField (this ._timeEvents); + this [_processEvents] (); + + // Camera + + this [_cameraTime] .start (); + this [_world] .traverse (Rendering_TraverseType .CAMERA); + this [_cameraTime] .stop (); + + // Collision + + this [_collisionTime] .start (); + + if (this .getCollisionCount ()) + this [_world] .traverse (Rendering_TraverseType .COLLISION); + + this [_collisionTime] .stop (); + + // Events + + this .addTaintedField (this ._sensorEvents); + this [_processEvents] (); + + // Display + + this [_displayTime] .start () + + this .addTaintedField (this ._displayEvents); + this [_processEvents] (); + + this .getFrameBuffer () .bind (); + + this [_world] .traverse (Rendering_TraverseType .DISPLAY); + + this .addTaintedField (this ._finishedEvents); + this [_processEvents] (); + + this .getFrameBuffer () .blit (); + this .getFrameBuffer () .unbind (); + + this [_displayTime] .stop (); + + // Finish + + this [_browserTime] .stop (); + this [_systemTime] .start (); + }, + getSystemTime () + { + return this [_systemTime]; + }, + getBrowserTime () + { + return this [_browserTime]; + }, + getCameraTime () + { + return this [_cameraTime]; + }, + getCollisionTime () + { + return this [_collisionTime]; + }, + getDisplayTime () + { + return this [_displayTime]; + }, + dispose () + { + browsers .delete (this); + + for (const browserContext of browserContexts) + browserContext .prototype .dispose ?.call (this); + + Time_X3DTimeContext .prototype .dispose ?.call (this); + Sound_X3DSoundContext .prototype .dispose ?.call (this); + Picking_X3DPickingContext .prototype .dispose ?.call (this); + Lighting_X3DLightingContext .prototype .dispose ?.call (this); + EnvironmentalEffects_X3DEnvironmentalEffectsContext .prototype .dispose ?.call (this); + Layering_X3DLayeringContext .prototype .dispose ?.call (this); + Navigation_X3DNavigationContext .prototype .dispose ?.call (this); + PointingDeviceSensor_X3DPointingDeviceSensorContext .prototype .dispose ?.call (this); + Geometry3D_X3DGeometry3DContext .prototype .dispose ?.call (this); + Grouping_X3DGroupingContext .prototype .dispose ?.call (this); + Shape_X3DShapeContext .prototype .dispose ?.call (this); + Rendering_X3DRenderingContext .prototype .dispose ?.call (this); + Shaders_X3DShadersContext .prototype .dispose ?.call (this); + Texturing_X3DTexturingContext .prototype .dispose ?.call (this); + Networking_X3DNetworkingContext .prototype .dispose ?.call (this); + Core_X3DCoreContext .prototype .dispose ?.call (this); + Scripting_X3DScriptingContext .prototype .dispose ?.call (this); + Routing_X3DRoutingContext .prototype .dispose ?.call (this); + Base_X3DBaseNode .prototype .dispose ?.call (this); + }, +}); + +for (const key of Object .keys (X3DBrowserContext .prototype)) + Object .defineProperty (X3DBrowserContext .prototype, key, { enumerable: false }); + +Object .assign (X3DBrowserContext, +{ + addComponent ({ name, concreteNodes, abstractNodes, browserContext, external }) + { + if (concreteNodes) + { + for (const ConcreteNode of concreteNodes) + ConcreteNodes .add (ConcreteNode .typeName, ConcreteNode); + } + + if (abstractNodes) + { + for (const AbstractNode of abstractNodes) + AbstractNodes .add (AbstractNode .typeName, AbstractNode); + } + + if (browserContext) + { + browserContexts .push (browserContext); + + const keys = Object .keys (browserContext .prototype) + .filter (k => !k .match (/^(?:initialize|dispose)$/)) + .concat (Object .getOwnPropertySymbols (browserContext .prototype)); + + for (const key of keys) + { + Object .defineProperty (X3DBrowserContext .prototype, key, + { + value: browserContext .prototype [key], + writable: true, + }); + } + } + + for (const browser of browsers) + { + if (concreteNodes) + { + for (const ConcreteNode of concreteNodes) + browser .addConcreteNode (ConcreteNode); + } + + if (abstractNodes) + { + for (const AbstractNode of abstractNodes) + browser .addAbstractNode (AbstractNode); + } + + if (browserContext) + { + browserContext .call (browser); + browserContext .prototype .initialize ?.call (browser); + + // Process events from context creation. This will setup nodes like + // geometry option nodes before any node is created. + browser [_processEvents] (); + } + } + + if (external && DEVELOPMENT) + console .info (`Done loading external component '${name}'.`); + }, +}); + +const X3DBrowserContext_default_ = X3DBrowserContext; +; + +x_ite_Namespace .add ("X3DBrowserContext", "x_ite/Browser/X3DBrowserContext", X3DBrowserContext_default_); +/* harmony default export */ const Browser_X3DBrowserContext = (X3DBrowserContext_default_); +;// CONCATENATED MODULE: ./src/x_ite/Components.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + + + + + + +let external = false; + +const Components = +{ + add ({ name, concreteNodes, abstractNodes, browserContext }) + { + Browser_X3DBrowserContext .addComponent ({ name, concreteNodes, abstractNodes, browserContext, external }); + }, +}; + +Components .add (Core); +Components .add (EnvironmentalEffects); +Components .add (EnvironmentalSensor); +Components .add (Followers); +Components .add (Geometry3D); +Components .add (Grouping); +Components .add (Interpolation); +Components .add (Layering); +Components .add (Lighting); +Components .add (Navigation); +Components .add (Networking); +Components .add (PointingDeviceSensor); +Components .add (Rendering); +Components .add (Shaders); +Components .add (Components_Shape); +Components .add (Components_Sound); +Components .add (Texturing); +Components .add (Time); + +external = true; + +const Components_default_ = Components; +; + +x_ite_Namespace .add ("Components", "x_ite/Components", Components_default_); +/* harmony default export */ const x_ite_Components = ((/* unused pure expression or super */ null && (Components_default_))); +;// CONCATENATED MODULE: ./src/x_ite/Browser/DOMIntegration.js +/* provided dependency */ var DOMIntegration_$ = __webpack_require__(864); +/******************************************************************************* + * MIT License + * + * Copyright (c) 2016 Andreas Plesch + * taken from https://github.com/andreasplesch/x_ite_dom. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + ******************************************************************************/ + + + + + +class DOMIntegration +{ + constructor (browser) + { + this .browser = browser; + this .rootElement = undefined; + this .canvasObserver = new MutationObserver (() => this .processCanvasMutation (browser)); + + this .canvasObserver .observe (browser .getElement () [0], { + childList: true, + }); + + this .processCanvasMutation (browser) + } + + processCanvasMutation (browser) + { + this .processRootElement (browser, browser .getElement () .children ("X3D") .get (-1)); + } + + async processRootElement (browser, rootElement) + { + try + { + if (rootElement === this .rootElement) + return; + + this .rootElement = rootElement; + + if (rootElement) + { + // Display splash screen. + + browser .setBrowserLoading (true); + browser .addLoadingObject (this); + + // Now also attached node property to each node element. + + const scene = browser .createScene (); + + this .parser = new Parser_XMLParser (scene); + + this .parser .setInput (rootElement); + + await new Promise (this .parser .parseIntoScene .bind (this .parser)); + + browser .replaceWorld (scene); + + // Create an observer instance. + + this .observer = new MutationObserver (mutations => + { + for (const mutation of mutations) + this .processMutation (mutation); + }); + + // Start observing, also catches inlined Inline elements. + + this .observer .observe (rootElement, { + attributes: true, + childList: true, + characterData: false, + subtree: true, + attributeOldValue: true, + }); + + // Add Inline elements from initial scene, and connect to node events. + + this .processInlineElements (rootElement); + this .addEventDispatchersAll (rootElement); + + browser .removeLoadingObject (this); + } + else + { + browser .replaceWorld (null); + } + } + catch (error) + { + console .error ("Error importing document:", error); + } + } + + processMutation (mutation) + { + switch (mutation .type) + { + case "attributes": + { + this .processAttribute (mutation, mutation .target); + break; + } + case "childList": + { + for (const node of mutation .addedNodes) + this .processAddedNode (node); + + for (const node of mutation .removedNodes) + this .processRemovedNode (node); + + break; + } + } + } + + processAttribute (mutation, element) + { + const + parser = this .parser, + node = DOMIntegration_$.data (element, "node"); + + if (node) + { + const + attributeName = mutation .attributeName, + attribute = element .attributes .getNamedItem (attributeName); + + parser .nodeAttribute (attribute, node); + } + else + { + // Is an attribute of non-node child such as fieldValue (or ROUTE). + + const + parentNode = element .parentNode, + node = DOMIntegration_$.data (parentNode, "node"); + + if (node) + { + parser .pushExecutionContext (node .getExecutionContext ()); + parser .pushParent (node); + parser .childElement (element); + parser .popParent (); + parser .popExecutionContext (); + } + } + } + + processAddedNode (element) + { + // Only process element nodes. + + if (element .nodeType !== Node .ELEMENT_NODE) + return; + + if (element .nodeName === "X3D") + return; + + if (DOMIntegration_$.data (element, "node")) + return; + + const + parentNode = element .parentNode, + parser = this .parser; + + if (parentNode .nodeName .match (/^(?:Scene|SCENE)$/)) + { + // Root scene or Inline scene. + + const scene = DOMIntegration_$.data (parentNode, "node"); + + parser .pushExecutionContext (scene); + parser .childElement (element); + parser .popExecutionContext (); + } + else if (DOMIntegration_$.data (parentNode, "node")) + { + // Use parent's scene if non-root, works for Inline. + + const + node = DOMIntegration_$.data (parentNode, "node"), + executionContext = node .getExecutionContext (); + + parser .pushExecutionContext (executionContext); + parser .pushParent (node); + parser .childElement (element); + parser .popParent (); + parser .popExecutionContext (); + } + else + { + const scene = this .browser .currentScene; + + parser .pushExecutionContext (scene); + parser .childElement (element); + parser .popExecutionContext (); + } + + // Now after creating nodes need to look again for Inline elements. + + this .processInlineElements (element); + + // Then attach event dispatchers. + + this .addEventDispatchers (element); + this .addEventDispatchersAll (element); + } + + processRemovedNode (element) + { + // Works also for root nodes, as it has to be, since scene .rootNodes is effectively a MFNode in x-ite. + // Also removes ROUTE elements. + + const node = DOMIntegration_$.data (element, "node"); + + if (!node) + return; + + node .dispose (); + + DOMIntegration_$.data (element, "node", null); + } + + processInlineElements (element) + { + if (element .nodeName .match (/^(?:Inline|INLINE)$/)) + this .processInlineElement (element); + + for (const inlineElement of element .querySelectorAll ("Inline")) + this .processInlineElement (inlineElement); + } + + processInlineElement (element) + { + const node = DOMIntegration_$.data (element, "node"); + + if (!node) + return; + + node ._loadState .addInterest ("appendInlineChildElement", this, element); + + this .appendInlineChildElement (element); + } + + appendInlineChildElement (element) + { + const node = DOMIntegration_$.data (element, "node"); + + switch (node .checkLoadState ()) + { + case Base_X3DConstants .NOT_STARTED_STATE: + case Base_X3DConstants .FAILED_STATE: + { + // Remove all child nodes. + + while (element .firstChild) + element .removeChild (element .lastChild); + + break; + } + case Base_X3DConstants .COMPLETE_STATE: + { + // Remove all child nodes. + + while (element .firstChild) + element .removeChild (element .lastChild); + + // Add scene as child node of Inline element. + + const X3DElement = DOMIntegration_$.data (node .getInternalScene (), "X3D"); + + if (X3DElement) + element .appendChild (X3DElement); + + // Add Inline elements, and connect to node events. + + this .processInlineElements (X3DElement); + this .addEventDispatchersAll (X3DElement); + + break; + } + } + + switch (node .checkLoadState ()) + { + case Base_X3DConstants .COMPLETE_STATE: + { + const event = new CustomEvent ("load", + { + detail: { node: Fields_SFNodeCache .get (node) }, + }); + + element .dispatchEvent (event); + break; + } + case Base_X3DConstants .FAILED_STATE: + { + const event = new CustomEvent ("error", + { + detail: { node: Fields_SFNodeCache .get (node) }, + }); + + element .dispatchEvent (event); + break; + } + } + } + + addEventDispatchersAll (element) + { + const childElements = element .querySelectorAll ("*"); + + for (const childElement of childElements) + this .addEventDispatchers (childElement); + } + + addEventDispatchers (element) + { + // Check for USE nodes; they do not emit events. + + if (element .nodeName === "ROUTE") + return; + + const node = DOMIntegration_$.data (element, "node"); + + if (!node) + return; + + for (const field of node .getPredefinedFields ()) + this .bindFieldCallback (field, element); + + for (const field of node .getUserDefinedFields ()) + this .bindFieldCallback (field, element); + } + + bindFieldCallback (field, element) + { + if (!field .isOutput ()) + return; + + field .addInterest ("fieldCallback", this, element); + } + + fieldCallback (element, field) + { + const node = DOMIntegration_$.data (element, "node"); + + if (!node) + return; + + const event = new CustomEvent (field .getName (), + { + detail: { + node: Fields_SFNodeCache .get (node), + value: field .valueOf (), + }, + }); + + element .dispatchEvent (event); + } +}; + +const DOMIntegration_default_ = DOMIntegration; +; + +x_ite_Namespace .add ("DOMIntegration", "x_ite/Browser/DOMIntegration", DOMIntegration_default_); +/* harmony default export */ const Browser_DOMIntegration = (DOMIntegration_default_); +;// CONCATENATED MODULE: ./src/x_ite/Configuration/ProfileInfo.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +function ProfileInfo (name, title, providerURL, components) +{ + Object .defineProperties (this, + { + name: { value: name, enumerable: true }, + title: { value: title, enumerable: true }, + providerURL: { value: providerURL, enumerable: true }, + components: { value: components, enumerable: true }, + }); +} + +Object .assign (Object .setPrototypeOf (ProfileInfo .prototype, Base_X3DObject .prototype), +{ + toVRMLStream (generator) + { + generator .string += generator .Indent (); + generator .string += "PROFILE"; + generator .string += generator .Space (); + generator .string += this .name; + }, + toXMLStream (generator) + { + generator .string += this .name; + }, + toJSONStream (generator) + { + generator .string += this .name; + }, +}); + +for (const key of Object .keys (ProfileInfo .prototype)) + Object .defineProperty (ProfileInfo .prototype, key, { enumerable: false }); + +Object .defineProperties (ProfileInfo, +{ + typeName: + { + value: "ProfileInfo", + enumerable: true, + }, +}); + +Object .defineProperties (ProfileInfo .prototype, +{ + providerUrl: // legacy + { + get: function () { return this .providerURL; }, + }, +}); + +const ProfileInfo_default_ = ProfileInfo; +; + +x_ite_Namespace .add ("ProfileInfo", "x_ite/Configuration/ProfileInfo", ProfileInfo_default_); +/* harmony default export */ const Configuration_ProfileInfo = (ProfileInfo_default_); +;// CONCATENATED MODULE: ./src/x_ite/Configuration/ProfileInfoArray.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +function ProfileInfoArray (values = [ ]) +{ + return Base_X3DInfoArray .call (this, Array .from (values, value => [value .name, value]), Configuration_ProfileInfo); +} + +Object .assign (Object .setPrototypeOf (ProfileInfoArray .prototype, Base_X3DInfoArray .prototype), +{ + add (name, { title, providerURL, components }) + { + Base_X3DInfoArray .prototype .add .call (this, name, new Configuration_ProfileInfo (name, title, providerURL, new Configuration_ComponentInfoArray (components))); + }, +}); + +for (const key of Object .keys (ProfileInfoArray .prototype)) + Object .defineProperty (ProfileInfoArray .prototype, key, { enumerable: false }); + +Object .defineProperties (ProfileInfoArray, +{ + typeName: + { + value: "ProfileInfoArray", + enumerable: true, + }, +}); + +const ProfileInfoArray_default_ = ProfileInfoArray; +; + +x_ite_Namespace .add ("ProfileInfoArray", "x_ite/Configuration/ProfileInfoArray", ProfileInfoArray_default_); +/* harmony default export */ const Configuration_ProfileInfoArray = (ProfileInfoArray_default_); +;// CONCATENATED MODULE: ./src/x_ite/Configuration/SupportedComponents.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +const SupportedComponents = new Configuration_ComponentInfoArray ([ ]); + +SupportedComponents .add ("Annotation", +{ + title: "Annotation", + level: 2, + external: true, +}); + +SupportedComponents .add ("CADGeometry", +{ + title: "CAD geometry", + level: 2, + external: true, +}); + +SupportedComponents .add ("Core", +{ + title: "Core", + level: 2, +}); + +SupportedComponents .add ("CubeMapTexturing", +{ + title: "Cube map environmental texturing", + level: 3, + external: true, +}); + +SupportedComponents .add ("DIS", +{ + title: "Distributed interactive simulation", + level: 2, + external: true, +}); + +SupportedComponents .add ("EnvironmentalEffects", +{ + title: "Environmental effects", + level: 4, +}); + +SupportedComponents .add ("EnvironmentalSensor", +{ + title: "Environmental sensor", + level: 3, +}); + +SupportedComponents .add ("EventUtilities", +{ + title: "Event utilities", + level: 1, + external: true, +}); + +SupportedComponents .add ("Followers", +{ + title: "Followers", + level: 1, +}); + +SupportedComponents .add ("Geometry2D", +{ + title: "Geometry2D", + level: 2, + external: true, +}); + +SupportedComponents .add ("Geometry3D", +{ + title: "Geometry3D", + level: 4, +}); + +SupportedComponents .add ("Geospatial", +{ + title: "Geospatial", + level: 2, + external: true, +}); + +SupportedComponents .add ("Grouping", +{ + title: "Grouping", + level: 3, +}); + +SupportedComponents .add ("HAnim", +{ + title: "Humanoid animation (HAnim)", + level: 3, + external: true, +}); + +SupportedComponents .alias ("H-Anim", SupportedComponents .get ("HAnim")); + +SupportedComponents .add ("Interpolation", +{ + title: "Interpolation", + level: 5, +}); + +SupportedComponents .add ("KeyDeviceSensor", +{ + title: "Key device sensor", + level: 2, + external: true, +}); + +SupportedComponents .add ("Layering", +{ + title: "Layering", + level: 1, +}); + +SupportedComponents .add ("Layout", +{ + title: "Layout", + level: 2, + external: true, + dependencies: ["Text"], +}); + +SupportedComponents .add ("Lighting", +{ + title: "Lighting", + level: 3, +}); + +SupportedComponents .add ("Navigation", +{ + title: "Navigation", + level: 3, +}); + +SupportedComponents .add ("Networking", +{ + title: "Networking", + level: 4, +}); + +SupportedComponents .add ("NURBS", +{ + title: "NURBS", + level: 4, + external: true, +}); + +SupportedComponents .add ("ParticleSystems", +{ + title: "Particle systems", + level: 3, + external: true, +}); + +SupportedComponents .add ("Picking", +{ + title: "Picking", + level: 3, + external: true, + dependencies: ["RigidBodyPhysics"], +}); + +SupportedComponents .add ("PointingDeviceSensor", +{ + title: "Pointing device sensor", + level: 1, +}); + +SupportedComponents .add ("Shaders", +{ + title: "Programmable shaders", + level: 1, +}); + +SupportedComponents .add ("TextureProjector", +{ + title: "Texture Projector", + level: 2, + external: true, +}); + +SupportedComponents .alias ("ProjectiveTextureMapping", SupportedComponents .get ("TextureProjector")); + +SupportedComponents .add ("Rendering", +{ + title: "Rendering", + level: 5, +}); + +SupportedComponents .add ("RigidBodyPhysics", +{ + title: "Rigid body physics", + level: 2, + external: true, +}); + +SupportedComponents .add ("Scripting", +{ + title: "Scripting", + level: 1, + external: true, +}); + +SupportedComponents .add ("Shape", +{ + title: "Shape", + level: 4, +}); + +SupportedComponents .add ("Sound", +{ + title: "Sound", + level: 3, +}); + +SupportedComponents .add ("Text", +{ + title: "Text", + level: 1, + external: true, +}); + +SupportedComponents .add ("Texturing", +{ + title: "Texturing", + level: 4, +}); + +SupportedComponents .add ("Texturing3D", +{ + title: "Texturing3D", + level: 2, + external: true, +}); + +SupportedComponents .add ("Time", +{ + title: "Time", + level: 2, +}); + +SupportedComponents .add ("VolumeRendering", +{ + title: "Volume rendering", + level: 4, + external: true, + dependencies: ["CADGeometry", "Texturing3D"], +}); + +SupportedComponents .add ("X_ITE", +{ + title: "X_ITE", + level: 1, + external: true, +}); + +const SupportedComponents_default_ = SupportedComponents; +; + +x_ite_Namespace .add ("SupportedComponents", "x_ite/Configuration/SupportedComponents", SupportedComponents_default_); +/* harmony default export */ const Configuration_SupportedComponents = (SupportedComponents_default_); +;// CONCATENATED MODULE: ./src/x_ite/Configuration/SupportedProfiles.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +const SupportedProfiles = new Configuration_ProfileInfoArray (); + +SupportedProfiles .add ("CADInterchange", +{ + title: "Computer-Aided Design (CAD) interchange", + providerURL: Networking_URLs .getProviderURL (), + components: [ + Configuration_SupportedComponents .get ("CADGeometry"), + Configuration_SupportedComponents .get ("Core"), + Configuration_SupportedComponents .get ("Grouping"), + Configuration_SupportedComponents .get ("Lighting"), + Configuration_SupportedComponents .get ("Navigation"), + Configuration_SupportedComponents .get ("Networking"), + Configuration_SupportedComponents .get ("Rendering"), + Configuration_SupportedComponents .get ("Shaders"), + Configuration_SupportedComponents .get ("Shape"), + Configuration_SupportedComponents .get ("Texturing"), + ], +}); + +SupportedProfiles .add ("Core", +{ + title: "Core", + providerURL: Networking_URLs .getProviderURL (), + components: [ + Configuration_SupportedComponents .get ("Core"), + ], +}); + +SupportedProfiles .add ("Full", +{ + title: "Full", + providerURL: Networking_URLs .getProviderURL (), + components: [ + //SupportedComponents .get ("Annotation"), + Configuration_SupportedComponents .get ("CADGeometry"), + Configuration_SupportedComponents .get ("Core"), + Configuration_SupportedComponents .get ("CubeMapTexturing"), + Configuration_SupportedComponents .get ("DIS"), + Configuration_SupportedComponents .get ("EnvironmentalEffects"), + Configuration_SupportedComponents .get ("EnvironmentalSensor"), + Configuration_SupportedComponents .get ("EventUtilities"), + Configuration_SupportedComponents .get ("Followers"), + Configuration_SupportedComponents .get ("Geometry2D"), + Configuration_SupportedComponents .get ("Geometry3D"), + Configuration_SupportedComponents .get ("Geospatial"), + Configuration_SupportedComponents .get ("Grouping"), + Configuration_SupportedComponents .get ("HAnim"), + Configuration_SupportedComponents .get ("Interpolation"), + Configuration_SupportedComponents .get ("KeyDeviceSensor"), + Configuration_SupportedComponents .get ("Layering"), + Configuration_SupportedComponents .get ("Layout"), + Configuration_SupportedComponents .get ("Lighting"), + Configuration_SupportedComponents .get ("Navigation"), + Configuration_SupportedComponents .get ("Networking"), + Configuration_SupportedComponents .get ("NURBS"), + Configuration_SupportedComponents .get ("ParticleSystems"), + Configuration_SupportedComponents .get ("Picking"), + Configuration_SupportedComponents .get ("PointingDeviceSensor"), + Configuration_SupportedComponents .get ("TextureProjector"), + Configuration_SupportedComponents .get ("Rendering"), + Configuration_SupportedComponents .get ("RigidBodyPhysics"), + Configuration_SupportedComponents .get ("Scripting"), + Configuration_SupportedComponents .get ("Shaders"), + Configuration_SupportedComponents .get ("Shape"), + Configuration_SupportedComponents .get ("Sound"), + Configuration_SupportedComponents .get ("Text"), + Configuration_SupportedComponents .get ("Texturing"), + Configuration_SupportedComponents .get ("Texturing3D"), + Configuration_SupportedComponents .get ("Time"), + Configuration_SupportedComponents .get ("VolumeRendering"), + ], +}); + +SupportedProfiles .add ("Immersive", +{ + title: "Immersive", + providerURL: Networking_URLs .getProviderURL (), + components: [ + Configuration_SupportedComponents .get ("Core"), + Configuration_SupportedComponents .get ("EnvironmentalEffects"), + Configuration_SupportedComponents .get ("EnvironmentalSensor"), + Configuration_SupportedComponents .get ("EventUtilities"), + Configuration_SupportedComponents .get ("Geometry2D"), + Configuration_SupportedComponents .get ("Geometry3D"), + Configuration_SupportedComponents .get ("Grouping"), + Configuration_SupportedComponents .get ("Interpolation"), + Configuration_SupportedComponents .get ("KeyDeviceSensor"), + Configuration_SupportedComponents .get ("Lighting"), + Configuration_SupportedComponents .get ("Navigation"), + Configuration_SupportedComponents .get ("Networking"), + Configuration_SupportedComponents .get ("PointingDeviceSensor"), + Configuration_SupportedComponents .get ("Rendering"), + Configuration_SupportedComponents .get ("Scripting"), + Configuration_SupportedComponents .get ("Shape"), + Configuration_SupportedComponents .get ("Sound"), + Configuration_SupportedComponents .get ("Text"), + Configuration_SupportedComponents .get ("Texturing"), + Configuration_SupportedComponents .get ("Time"), + ], +}); + +SupportedProfiles .add ("Interactive", +{ + title: "Interactive", + providerURL: Networking_URLs .getProviderURL (), + components: [ + Configuration_SupportedComponents .get ("Core"), + Configuration_SupportedComponents .get ("EnvironmentalEffects"), + Configuration_SupportedComponents .get ("EnvironmentalSensor"), + Configuration_SupportedComponents .get ("EventUtilities"), + Configuration_SupportedComponents .get ("Geometry3D"), + Configuration_SupportedComponents .get ("Grouping"), + Configuration_SupportedComponents .get ("Interpolation"), + Configuration_SupportedComponents .get ("KeyDeviceSensor"), + Configuration_SupportedComponents .get ("Lighting"), + Configuration_SupportedComponents .get ("Navigation"), + Configuration_SupportedComponents .get ("Networking"), + Configuration_SupportedComponents .get ("PointingDeviceSensor"), + Configuration_SupportedComponents .get ("Rendering"), + Configuration_SupportedComponents .get ("Shape"), + Configuration_SupportedComponents .get ("Texturing"), + Configuration_SupportedComponents .get ("Time"), + ], +}); + +SupportedProfiles .add ("Interchange", +{ + title: "Interchange", + providerURL: Networking_URLs .getProviderURL (), + components: [ + Configuration_SupportedComponents .get ("Core"), + Configuration_SupportedComponents .get ("EnvironmentalEffects"), + Configuration_SupportedComponents .get ("Geometry3D"), + Configuration_SupportedComponents .get ("Grouping"), + Configuration_SupportedComponents .get ("Interpolation"), + Configuration_SupportedComponents .get ("Lighting"), + Configuration_SupportedComponents .get ("Navigation"), + Configuration_SupportedComponents .get ("Networking"), + Configuration_SupportedComponents .get ("Rendering"), + Configuration_SupportedComponents .get ("Shape"), + Configuration_SupportedComponents .get ("Texturing"), + Configuration_SupportedComponents .get ("Time"), + ], +}); + +SupportedProfiles .add ("MedicalInterchange", +{ + title: "Medical interchange", + providerURL: Networking_URLs .getProviderURL (), + components: [ + Configuration_SupportedComponents .get ("Core"), + Configuration_SupportedComponents .get ("EnvironmentalEffects"), + Configuration_SupportedComponents .get ("EventUtilities"), + Configuration_SupportedComponents .get ("Geometry2D"), + Configuration_SupportedComponents .get ("Geometry3D"), + Configuration_SupportedComponents .get ("Grouping"), + Configuration_SupportedComponents .get ("Interpolation"), + Configuration_SupportedComponents .get ("Lighting"), + Configuration_SupportedComponents .get ("Navigation"), + Configuration_SupportedComponents .get ("Networking"), + Configuration_SupportedComponents .get ("Rendering"), + Configuration_SupportedComponents .get ("Shape"), + Configuration_SupportedComponents .get ("Text"), + Configuration_SupportedComponents .get ("Texturing"), + Configuration_SupportedComponents .get ("Texturing3D"), + Configuration_SupportedComponents .get ("Time"), + Configuration_SupportedComponents .get ("VolumeRendering"), + ], +}); + +SupportedProfiles .add ("MPEG-4", +{ + title: "MPEG-4 interactive", + providerURL: Networking_URLs .getProviderURL (), + components: [ + Configuration_SupportedComponents .get ("Core"), + Configuration_SupportedComponents .get ("EnvironmentalEffects"), + Configuration_SupportedComponents .get ("EnvironmentalSensor"), + Configuration_SupportedComponents .get ("Geometry3D"), + Configuration_SupportedComponents .get ("Grouping"), + Configuration_SupportedComponents .get ("Interpolation"), + Configuration_SupportedComponents .get ("Lighting"), + Configuration_SupportedComponents .get ("Navigation"), + Configuration_SupportedComponents .get ("Networking"), + Configuration_SupportedComponents .get ("PointingDeviceSensor"), + Configuration_SupportedComponents .get ("Rendering"), + Configuration_SupportedComponents .get ("Shape"), + Configuration_SupportedComponents .get ("Texturing"), + Configuration_SupportedComponents .get ("Time"), + ], +}); + +const SupportedProfiles_default_ = SupportedProfiles; +; + +x_ite_Namespace .add ("SupportedProfiles", "x_ite/Configuration/SupportedProfiles", SupportedProfiles_default_); +/* harmony default export */ const Configuration_SupportedProfiles = (SupportedProfiles_default_); +;// CONCATENATED MODULE: ./src/x_ite/Browser/X3DBrowser.js +/* provided dependency */ var X3DBrowser_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + + + + + + + + + + + +const + _DOMIntegration = Symbol (), + _supportedProfiles = Symbol (), + _supportedComponents = Symbol (), + _concreteNodes = Symbol (), + _abstractNodes = Symbol (), + _reject = Symbol (), + _fileLoader = Symbol (), + _browserCallbacks = Symbol (), + _console = Symbol (), + X3DBrowser_processEvents = Symbol .for ("X_ITE.X3DRoutingContext.processEvents"); + +function X3DBrowser (element) +{ + element = X3DBrowser_$(element); + + if (element .prop ("browser")) + throw new Error ("Couldn't create browser, element has already a browser."); + + Browser_X3DBrowserContext .call (this, element); + + this .addType (Base_X3DConstants .X3DBrowser); + + this [_supportedProfiles] = Configuration_SupportedProfiles .copy (); + this [_supportedComponents] = Configuration_SupportedComponents .copy (); + this [_concreteNodes] = ConcreteNodes .copy (); + this [_abstractNodes] = AbstractNodes .copy (); + this [_console] = document .getElementsByClassName ("x_ite-console"); + + this [_browserCallbacks] = new Map ([ + [Base_X3DConstants .CONNECTION_ERROR, new Map ()], + [Base_X3DConstants .BROWSER_EVENT, new Map ()], + [Base_X3DConstants .INITIALIZED_EVENT, new Map ()], + [Base_X3DConstants .SHUTDOWN_EVENT, new Map ()], + [Base_X3DConstants .INITIALIZED_ERROR, new Map ()], + ]); + + this .setup (); +}; + +Object .assign (Object .setPrototypeOf (X3DBrowser .prototype, Browser_X3DBrowserContext .prototype), +{ + initialize () + { + Browser_X3DBrowserContext .prototype .initialize .call (this); + + this .replaceWorld (this .createScene ()) + .catch (DEVELOPMENT ? error => console .error (error) : Function .prototype); + + this [_DOMIntegration] = new Browser_DOMIntegration (this); + + Browser_Legacy .browser (this); + + // Process events from context creation. This will setup nodes like + // geometry option nodes before any node is created. + this [X3DBrowser_processEvents] .call (this); + + // Print welcome message. + + if (this .getInstanceId () > 1) + return; + + if (!this .getBrowserOption ("Debug")) + return; + + this .print (this .getWelcomeMessage ()); + }, + getWelcomeMessage () + { + return `Welcome to ${this .name} X3D Browser v${this .version}:\n` + + ` Current Graphics Renderer\n` + + ` Name: ${this .getVendor ()} ${this .getRenderer ()}\n` + + ` WebGL version: ${this .getWebGLVersion ()}\n` + + ` Shading language: ${this .getShadingLanguageVersion ()}\n` + + ` Rendering Properties\n` + + ` Antialiased: ${this .getRenderingProperty ("Antialiased")}\n` + + ` Max samples: ${this .getMaxSamples ()}\n` + + ` Depth size: ${this .getDepthSize ()} bits\n` + + ` Color depth: ${this .getColorDepth ()} bits\n` + + ` Max clip planes per shape: ${this .getMaxClipPlanes ()}\n` + + ` Max lights per shape: ${this .getMaxLights ()}\n` + + ` Max multi textures per shape: ${this .getMaxTextures ()}\n` + + ` Texture units: ${this .getMaxCombinedTextureUnits ()}\n` + + ` Max texture size: ${this .getMaxTextureSize ()} × ${this .getMaxTextureSize ()} pixels\n` + + ` Texture memory: ${this .getTextureMemory ()}\n` + + ` Max vertex uniform vectors: ${this .getMaxVertexUniformVectors ()}\n` + + ` Max fragment uniform vectors: ${this .getMaxFragmentUniformVectors ()}\n` + + ` Max vertex attribs: ${this .getMaxVertexAttribs ()}\n` + + ` Max varying vectors: ${this .getMaxVaryingVectors ()}\n`; + }, + getName () + { + return "X_ITE"; + }, + getVersion () + { + return VERSION; + }, + getDescription () + { + return this .getNotification () ._string .getValue () + }, + setDescription (value) + { + this .getNotification () ._string = value; + }, + getWorldURL () + { + return this .currentScene .worldURL; + }, + getProfile (name) + { + name = String (name); + + const profile = this [_supportedProfiles] .get (name); + + if (profile) + return profile; + + throw Error (`Profile '${name}' is not supported.`); + }, + addSupportedProfile: function (profile) + { + this [_supportedProfiles] .add (profile .name, profile); + }, + updateSupportedProfile: function (profile) + { + this [_supportedProfiles] .update (profile .name, profile .name, profile); + }, + removeSupportedProfile (name) + { + return this [_supportedProfiles] .remove (String (name)); + }, + getSupportedProfile (name) + { + const profile = this [_supportedProfiles] .get (String (name)); + + if (profile) + return profile; + + throw new Error (`Supported profile '${name}' does not exists.`); + }, + getSupportedProfiles () + { + return this [_supportedProfiles]; + }, + getComponent (name, level) + { + name = String (name); + level |= 0; + + const component = this [_supportedComponents] .get (name); + + if (component) + { + return new Configuration_ComponentInfo (component .name, + Math_Algorithm .clamp (level || component .level, 1, component .level), + component .title, + component .providerURL, + component .external, + component .dependencies); + } + + throw Error (`Component '${name}' at level '${level}' is not supported.`); + }, + addSupportedComponent (component) + { + this [_supportedComponents] .add (component .name, component); + }, + updateSupportedComponent (component) + { + this [_supportedComponents] .update (component .name, component .name, component); + }, + removeSupportedComponent (name) + { + this [_supportedComponents] .remove (String (name)); + }, + getSupportedComponent (name) + { + const component = this [_supportedComponents] .get (String (name)); + + if (component) + return component; + + throw new Error (`Supported component '${name}' does not exists.`); + }, + getSupportedComponents () + { + return this [_supportedComponents]; + }, + loadComponents: (() => + { + function loadComponents (components, seen) + { + return Promise .all (components .map (component => loadComponent .call (this, component, seen))) + } + + async function loadComponent ({ name, providerURL, external, dependencies }, seen) + { + if (seen .has (name)) return; seen .add (name); + + await loadComponents .call (this, dependencies .map (name => this [_supportedComponents] .get (name)), seen); + + if (!external) + return; + + switch (x_ite_Features .ENVIRONMENT) + { + case "NODE": + { + __webpack_require__.g .require (__webpack_require__.g .require ("url") .fileURLToPath (providerURL)) + break; + } + case "BROWSER": + case "MODULE": + { + await import (/* webpackIgnore: true */ providerURL); + break; + } + } + } + + return function (... args) + { + const component = [ ]; + + for (const arg of args) + { + if (arg instanceof Configuration_ProfileInfo) + component .push (... arg .components); + + else if (arg instanceof Configuration_ComponentInfoArray) + component .push (... arg); + + else if (arg instanceof Configuration_ComponentInfo) + component .push (arg); + + else if (typeof arg === "string") + component .push (this [_supportedComponents] .get (arg)) + } + + // Load array of component names. + return loadComponents .call (this, component, new Set ()); + }; + })(), + addConcreteNode (ConcreteNode) + { + this [_concreteNodes] .add (ConcreteNode .typeName, ConcreteNode); + }, + updateConcreteNode (ConcreteNode) + { + this [_concreteNodes] .update (ConcreteNode .typeName, ConcreteNode .typeName, ConcreteNode); + }, + removeConcreteNode (typeName) + { + this [_concreteNodes] .remove (String (typeName)); + }, + getConcreteNode (typeName) + { + const concreteNode = this [_concreteNodes] .get (String (typeName)); + + if (concreteNode) + return concreteNode; + + throw new Error (`Concrete node '${typeName}' does not exists.`); + }, + getConcreteNodes () + { + return this [_concreteNodes]; + }, + addAbstractNode (AbstractNode) + { + this [_abstractNodes] .add (AbstractNode .typeName, AbstractNode); + }, + updateAbstractNode (AbstractNode) + { + this [_abstractNodes] .update (AbstractNode .typeName, AbstractNode .typeName, AbstractNode); + }, + removeAbstractNode (typeName) + { + this [_abstractNodes] .remove (String (typeName)); + }, + getAbstractNode (typeName) + { + const abstractNode = this [_abstractNodes] .get (String (typeName)); + + if (abstractNode) + return abstractNode; + + throw new Error (`Abstract node '${typeName}' does not exists.`); + }, + getAbstractNodes () + { + return this [_abstractNodes]; + }, + createScene (profile, ... components) + { + const scene = new Execution_X3DScene (this); + + if (arguments .length) + { + if (!(profile instanceof Configuration_ProfileInfo)) + throw new Error ("Couldn't create scene: profile must be of type ProfileInfo."); + + scene .setProfile (profile); + + for (const component of components) + { + if (!(component instanceof Configuration_ComponentInfo)) + throw new Error ("Couldn't create scene: component must be of type ComponentInfo."); + + scene .addComponent (component); + } + } + + scene .setup (); + + return scene; + }, + replaceWorld (scene) + { + return new Promise ((resolve, reject) => + { + this [_fileLoader] ?.abort (); + + this [_reject] ?.("Replacing world aborted."); + this [_reject] = reject; + + // Remove world. + + if (this .initialized () .getValue ()) + { + this .getExecutionContext () .setLive (false); + this .shutdown () .processInterests (); + this .callBrowserCallbacks (Base_X3DConstants .SHUTDOWN_EVENT); + this .callBrowserEventHandler ("shutdown"); + } + + // Replace world. + + if (scene instanceof x_ite_Fields .MFNode) + { + // VRML version of replaceWorld has a MFNode value as argument. + + const rootNodes = scene; + + scene = this .createScene (); + + for (const node of rootNodes .filter (node => node)) + scene .getLive () .addInterest ("setLive", node .getValue () .getExecutionContext ()); + + scene .setRootNodes (rootNodes); + } + + if (!(scene instanceof Execution_X3DScene)) + scene = this .createScene (); + + // Detach scene from parent. + + scene .getExecutionContext () .getLive () .removeInterest ("setLive", scene); + scene .setExecutionContext (scene); + + // Replace. + + this .setDescription (""); + this .setBrowserLoading (true); + this ._loadCount .addInterest ("checkLoadCount", this, resolve); + + for (const object of scene .getLoadingObjects ()) + this .addLoadingObject (object); + + this .setExecutionContext (scene); + this .getWorld () .bindBindables (); + + scene .setLive (this .isLive ()); + }); + }, + checkLoadCount (resolve, loadCount) + { + if (loadCount .getValue ()) + return; + + loadCount .removeInterest ("checkLoadCount", this); + this .setBrowserLoading (false); + this .initialized () .set (this .getCurrentTime ()); + this .initialized () .processInterests (); + this .callBrowserCallbacks (Base_X3DConstants .INITIALIZED_EVENT); + this .callBrowserEventHandler ("initialized load"); + resolve (); + }, + createVrmlFromString (vrmlSyntax) + { + const + external = this .isExternal (), + currentScene = this .currentScene, + worldURL = external ? this .getBaseURL () : currentScene .getWorldURL (), + fileLoader = new InputOutput_FileLoader (this .getWorld ()), + scene = fileLoader .createX3DFromString (worldURL, `#VRML V2.0 utf8\n\n${vrmlSyntax}`); + + if (!external) + { + currentScene .getLive () .addInterest ("setLive", scene); + scene .setExecutionContext (currentScene); + scene .setLive (currentScene .isLive ()); + } + + return scene .rootNodes; + }, + createX3DFromString: async function (x3dSyntax) + { + x3dSyntax = String (x3dSyntax); + + const + external = this .isExternal (), + currentScene = this .currentScene, + worldURL = external ? this .getBaseURL () : currentScene .getWorldURL (), + fileLoader = new InputOutput_FileLoader (this .getWorld ()); + + const scene = await new Promise ((resolve, reject) => + { + fileLoader .createX3DFromString (worldURL, x3dSyntax, resolve, reject); + }); + + if (!external) + { + currentScene .getLive () .addInterest ("setLive", scene); + scene .setExecutionContext (currentScene); + scene .setLive (currentScene .isLive ()); + } + + return scene; + }, + createVrmlFromURL (url, node, event) + { + node = Base_X3DCast (Base_X3DConstants .X3DNode, node, false); + event = String (event); + + if (!(url instanceof x_ite_Fields .MFString)) + throw new Error ("Browser.createVrmlFromURL: url must be of type MFString."); + + if (!node) + throw new Error ("Browser.createVrmlFromURL: node must be of type X3DNode."); + + const field = node .getField (event); + + if (!field .isInput ()) + throw new Error (`Browser.createVrmlFromURL: event named '${event}' must be a input field.`); + + if (field .getType () !== Base_X3DConstants .MFNode) + throw new Error (`Browser.createVrmlFromURL: event named '${event}' must be of type MFNode.`); + + const + currentScene = this .currentScene, + external = this .isExternal (), + fileLoader = new InputOutput_FileLoader (this .getWorld ()); + + this .addLoadingObject (fileLoader); + + fileLoader .createX3DFromURL (url, null, (scene) => + { + this .removeLoadingObject (fileLoader); + + if (scene) + { + // Handle getLive for script scenes here: + + if (!external) + { + currentScene .getLive () .addInterest ("setLive", scene); + scene .setExecutionContext (currentScene); + scene .setLive (currentScene .isLive ()); + } + + // Wait until scene is completely loaded, scene ._loadCount must be 0. + field .setValue (scene .rootNodes); + } + }); + }, + createX3DFromURL (url, node, event) + { + if (arguments .length === 3) + return this .createVrmlFromURL (url, node, event); + + // arguments .length === 1 + + if (!(url instanceof x_ite_Fields .MFString)) + throw new Error ("Browser.createX3DFromURL: url must be of type MFString."); + + return new Promise ((resolve, reject) => + { + const + currentScene = this .currentScene, + external = this .isExternal (), + fileLoader = new InputOutput_FileLoader (this .getWorld ()); + + this .addLoadingObject (fileLoader); + + fileLoader .createX3DFromURL (url, null, (scene) => + { + this .removeLoadingObject (fileLoader); + + if (scene) + { + if (!external) + { + currentScene .getLive () .addInterest ("setLive", scene); + scene .setExecutionContext (currentScene); + scene .setLive (currentScene .isLive ()); + } + + resolve (scene); + } + else + { + reject (new Error ("Couldn't load X3D file.")); + } + }) + }); + }, + loadURL (url, parameter = new x_ite_Fields .MFString ()) + { + return new Promise ((resolve, reject) => + { + if (!(url instanceof x_ite_Fields .MFString)) + throw new Error ("Browser.loadURL: url must be of type MFString."); + + if (!(parameter instanceof x_ite_Fields .MFString)) + throw new Error ("Browser.loadURL: parameter must be of type MFString."); + + // Start loading. + + const fileLoader = new InputOutput_FileLoader (this .getWorld ()); + + fileLoader .createX3DFromURL (url, parameter, (scene) => + { + if (this [_fileLoader] !== fileLoader) + { + reject (new Error ("Loading of X3D file aborted.")); + } + else + { + if (!this .getBrowserOption ("SplashScreen")) + this .getCanvas () .show (); + + if (scene) + { + this .addLoadingObject (this); // Prevent resetLoadCount. + this .replaceWorld (scene) .then (resolve) .catch (reject); + this .removeLoadingObject (this); + this .removeLoadingObject (fileLoader); + } + else + { + this .callBrowserCallbacks (Base_X3DConstants .CONNECTION_ERROR); + this .callBrowserEventHandler ("error"); + + setTimeout (() => + { + this .getSplashScreen () + .find (".x_ite-private-spinner-text") + .text (locale_gettext ("Failed loading world.")); + }); + + reject (new Error ("Couldn't load X3D file.")); + } + } + }, + (fragment) => + { + fileLoader .ready = true; + + this .changeViewpoint (fragment); + this .removeLoadingObject (fileLoader); + + resolve (); + }, + (url, target) => + { + fileLoader .ready = true; + + if (target) + window .open (url, target); + else + location = url; + + this .removeLoadingObject (fileLoader); + + resolve (); + }); + + if (!fileLoader .ready) + { + this [_fileLoader] ?.abort (); + + this .setBrowserLoading (true); + this .addLoadingObject (this [_fileLoader] = fileLoader); + } + }); + }, + addBrowserListener (callback, object) + { + // The string describes the name of the callback function to be called within the current ECMAScript context. + }, + removeBrowserListener (callback) + { + // The string describes the name of the callback function to be called within the current ECMAScript context. + }, + addBrowserCallback (... args) + { + switch (args .length) + { + case 2: + { + const [key, object] = args; + + this [_browserCallbacks] .forEach (map => map .set (key, object)); + break; + } + case 3: + { + const [key, event, object] = args; + + this [_browserCallbacks] .get (event) .set (key, object); + break; + } + } + }, + removeBrowserCallback (key, event) + { + if (arguments .length === 2) + this [_browserCallbacks] .get (event) .delete (key); + else + this [_browserCallbacks] .forEach (map => map .delete (key)); + }, + getBrowserCallbacks (event) + { + if (arguments .length === 1) + return this [_browserCallbacks] .get (event); + else + return new Map ([... this [_browserCallbacks]] .flatMap (([event, map]) => [... map])); + }, + callBrowserCallbacks: (() => + { + const values = [ ]; + + return function (event) + { + const browserCallbacks = this [_browserCallbacks] .get (event); + + if (browserCallbacks .size) + { + for (const callback of Utility_MapUtilities .values (values, browserCallbacks)) + callback (event); + } + }; + })(), + importDocument (dom) + { + const + currentScene = this .currentScene, + scene = this .createScene (), + external = this .isExternal (); + + if (!external) + { + currentScene .getLive () .addInterest ("setLive", scene); + scene .setExecutionContext (currentScene); + scene .setLive (currentScene .isLive ()); + } + + const parser = new Parser_XMLParser (scene); + + parser .setInput (dom) + + return new Promise (parser .parseIntoScene .bind (parser)); + }, + importJS (json) + { + const + currentScene = this .currentScene, + scene = this .createScene (), + external = this .isExternal (); + + if (!external) + { + currentScene .getLive () .addInterest ("setLive", scene); + scene .setExecutionContext (currentScene); + scene .setLive (currentScene .isLive ()); + } + + const parser = new Parser_JSONParser (scene); + + parser .setInput (json); + + return new Promise (parser .parseIntoScene .bind (parser)); + }, + getBrowserProperty (name) + { + return this .getBrowserProperties () .getField (name) .getValue (); + }, + setBrowserOption (name, value) + { + this .getBrowserOptions () .getField (name) .setValue (value); + }, + getBrowserOption (name) + { + return this .getBrowserOptions () .getField (name) .getValue (); + }, + getRenderingProperty (name) + { + return this .getRenderingProperties () .getField (name) .getValue (); + }, + viewAll (layerNode, transitionTime = 1) + { + if (arguments .length === 1 && typeof layerNode === "number") + transitionTime = layerNode; + + layerNode = Base_X3DCast (Base_X3DConstants .X3DLayerNode, layerNode) ?? this .getActiveLayer (); + + if (!layerNode) + return; + + layerNode .viewAll (transitionTime, 1, this .getBrowserOption ("StraightenHorizon")); + }, + firstViewpoint (layerNode) + { + layerNode = Base_X3DCast (Base_X3DConstants .X3DLayerNode, layerNode) ?? this .getActiveLayer (); + + const viewpoints = layerNode .getUserViewpoints (); + + if (viewpoints .length) + this .bindViewpoint (layerNode, viewpoints [0]); + }, + previousViewpoint (layerNode) + { + layerNode = Base_X3DCast (Base_X3DConstants .X3DLayerNode, layerNode) ?? this .getActiveLayer (); + + if (!layerNode) + return; + + const viewpoints = layerNode .getUserViewpoints (); + + if (viewpoints .length === 0) + return; + + for (var i = 0, length = viewpoints .length; i < length; ++ i) + { + if (viewpoints [i] ._isBound .getValue ()) + break; + } + + if (i < viewpoints .length) + { + if (i === 0) + this .bindViewpoint (layerNode, viewpoints .at (-1)); + + else + this .bindViewpoint (layerNode, viewpoints [i - 1]); + } + else + this .bindViewpoint (layerNode, viewpoints .at (-1)); + }, + nextViewpoint (layerNode) + { + layerNode = Base_X3DCast (Base_X3DConstants .X3DLayerNode, layerNode) ?? this .getActiveLayer (); + + if (!layerNode) + return; + + const viewpoints = layerNode .getUserViewpoints (); + + if (viewpoints .length === 0) + return; + + for (var i = 0, length = viewpoints .length; i < length; ++ i) + { + if (viewpoints [i] ._isBound .getValue ()) + break; + } + + if (i < viewpoints .length) + { + if (i === viewpoints .length - 1) + this .bindViewpoint (layerNode, viewpoints [0]); + + else + this .bindViewpoint (layerNode, viewpoints [i + 1]); + } + else + this .bindViewpoint (layerNode, viewpoints [0]); + }, + lastViewpoint (layerNode) + { + layerNode = Base_X3DCast (Base_X3DConstants .X3DLayerNode, layerNode) ?? this .getActiveLayer (); + + if (!layerNode) + return; + + const viewpoints = layerNode .getUserViewpoints (); + + if (viewpoints .length) + this .bindViewpoint (layerNode, viewpoints .at (-1)); + }, + changeViewpoint (layerNode, name) + { + if (arguments .length === 1) + { + name = String (layerNode); + layerNode = this .getActiveLayer (); + } + + layerNode = Base_X3DCast (Base_X3DConstants .X3DLayerNode, layerNode) ?? this .getActiveLayer (); + + if (!layerNode) + return; + + for (const viewpointNode of layerNode .getViewpoints () .get ()) + { + if (viewpointNode .getName () !== name) + continue; + + this .bindViewpoint (layerNode, viewpointNode); + break; + } + }, + bindViewpoint (layerNode, viewpointNode) + { + layerNode = Base_X3DCast (Base_X3DConstants .X3DLayerNode, layerNode); + viewpointNode = Base_X3DCast (Base_X3DConstants .X3DViewpointNode, viewpointNode); + + if (!layerNode) + throw new Error ("Browser.bindViewpoint: layerNode must be of type X3DLayerNode.") + + if (!viewpointNode) + throw new Error ("Browser.bindViewpoint: viewpointNode must be of type X3DViewpointNode.") + + viewpointNode .setVRMLTransition (true); + + viewpointNode ._set_bind = true; + }, + addRoute (fromNode, fromEventOut, toNode, toEventIn) + { + this .currentScene .addRoute (fromNode, fromEventOut, toNode, toEventIn); + }, + deleteRoute (fromNode, fromEventOut, toNode, toEventIn) + { + try + { + const route = this .currentScene .getRoute (fromNode, fromEventOut, toNode, toEventIn); + + if (route) + this .currentScene .deleteRoute (route); + } + catch (error) + { + console .error (error); + } + }, + beginUpdate () + { + this .setLive (true); + this .getExecutionContext () .setLive (true); + this .advanceTime (); + this .addBrowserEvent (); + }, + endUpdate () + { + this .setLive (false); + this .getExecutionContext () .setLive (false); + }, + print (... args) + { + const string = args .join (" "); + + console .log (string); + + for (const element of this [_console]) + element .append (document .createTextNode (string)); + }, + println (... args) + { + const string = args .join (" "); + + console .log (string); + + for (const element of this [_console]) + element .append (document .createTextNode (`${string}\n`)); + }, + toVRMLStream (generator) + { + this .currentScene .toVRMLStream (generator); + }, + toXMLStream (generator) + { + this .currentScene .toXMLStream (generator); + }, + toJSONStream (generator) + { + this .currentScene .toJSONStream (generator); + }, +}); + +for (const key of Object .keys (X3DBrowser .prototype)) + Object .defineProperty (X3DBrowser .prototype, key, { enumerable: false }); + +Object .defineProperties (X3DBrowser .prototype, +{ + name: + { + get: X3DBrowser .prototype .getName, + enumerable: true, + }, + version: + { + value: VERSION, + enumerable: true, + }, + providerURL: + { + get: X3DBrowser .prototype .getProviderURL, + enumerable: true, + }, + providerUrl: // legacy + { + get: X3DBrowser .prototype .getProviderURL, + enumerable: false, + }, + currentFrameRate: + { + get: X3DBrowser .prototype .getCurrentFrameRate, + enumerable: true, + }, + currentSpeed: + { + get: X3DBrowser .prototype .getCurrentSpeed, + enumerable: true, + }, + description: + { + get: X3DBrowser .prototype .getDescription, + set: X3DBrowser .prototype .setDescription, + enumerable: true, + }, + baseURL: + { + get: X3DBrowser .prototype .getBaseURL, + set: X3DBrowser .prototype .setBaseURL, + enumerable: true, + }, + currentScene: + { + get () + { + return this .getScriptStack () .at (-1) .getExecutionContext (); + }, + enumerable: true, + }, + supportedProfiles: + { + get () + { + return this [_supportedProfiles]; + }, + enumerable: true, + }, + supportedComponents: + { + get () + { + return this [_supportedComponents]; + }, + enumerable: true, + }, + concreteNodes: + { + get () + { + return this [_concreteNodes]; + }, + enumerable: true, + }, + abstractNodes: + { + get () + { + return this [_abstractNodes]; + }, + enumerable: true, + }, +}); + +Object .defineProperties (X3DBrowser, +{ + typeName: + { + value: "X3DBrowser", + enumerable: true, + }, +}); + +Base_X3DConstants .addNode (X3DBrowser); + +const X3DBrowser_default_ = X3DBrowser; +; + +x_ite_Namespace .add ("X3DBrowser", "x_ite/Browser/X3DBrowser", X3DBrowser_default_); +/* harmony default export */ const Browser_X3DBrowser = (X3DBrowser_default_); +;// CONCATENATED MODULE: ./src/x_ite/X3DCanvasElement.js +/* provided dependency */ var X3DCanvasElement_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + +class X3DCanvasElement extends HTMLElement +{ + constructor () + { + try + { + super (); + + new Browser_X3DBrowser (this) + } + catch (error) + { + console .error (error); + + X3DCanvasElement_$(this .shadowRoot) + .append (X3DCanvasElement_$("")) + .children (".x_ite-private-browser") .remove (); + } + } + + connectedCallback () + { + this .browser ?.connectedCallback (); + } + + static get observedAttributes () + { + return [ + "antialiased", + "baseURL", + "baseurl", + "cache", + "contentScale", + "contentscale", + "contextMenu", + "contextmenu", + "debug", + "multisampling", + "notifications", + "oninitialized", + "onshutdown", + "orderIndependentTransparency", + "orderindependenttransparency", + "splashScreen", + "splashscreen", + "src", + "timings", + "update", + "url", + ]; + } + + attributeChangedCallback (name, oldValue, newValue) + { + this .browser ?.attributeChangedCallback (name, oldValue, newValue); + } + + captureStream (... args) + { + return this .browser ?.getCanvas () [0] .captureStream (... args); + } + + toBlob (... args) + { + return this .browser ?.getCanvas () [0] .toBlob (... args); + } + + toDataURL (... args) + { + return this .browser ?.getCanvas () [0] .toDataURL (... args); + } +} + +// IE fix. +document .createElement ("X3DCanvas"); + +const X3DCanvasElement_default_ = X3DCanvasElement; +; + +x_ite_Namespace .add ("X3DCanvasElement", "x_ite/X3DCanvasElement", X3DCanvasElement_default_); +/* harmony default export */ const x_ite_X3DCanvasElement = (X3DCanvasElement_default_); +;// CONCATENATED MODULE: ./src/lib/jquery.js +/* provided dependency */ var jquery_$ = __webpack_require__(864); +/* provided dependency */ var pako = __webpack_require__(61); +Object .assign (jquery_$, +{ + decodeText (input) + { + if (typeof input === "string") + return input; + + return new TextDecoder () .decode (input); + }, + ungzip (arrayBuffer) + { + try + { + return pako .ungzip (arrayBuffer, { to: "raw" }) .buffer; + } + catch (exception) + { + return arrayBuffer; + } + }, + toLowerCaseFirst (string) + { + return string [0] .toLowerCase () + string .slice (1); + }, + try (callback, logError = false) + { + try + { + return callback (); + } + catch (error) + { + if (logError) + console .error (error .message); + } + }, + enum (object, property, defaultValue) + { + return object .hasOwnProperty (property) ? object [property] : defaultValue; + }, +}); + +// // decorator: @iffe fn (... args) { return function () { }; } +// function iife (target, key, descriptor) +// { +// descriptor .value = descriptor .value (); +// +// return descriptor; +// } +// +// class C { +// @iffe fn (... args) { return function () { }; } +// } + +Object .assign (jquery_$.fn, +{ + isInViewport () + { + const + $this = jquery_$(this), + $window = jquery_$(window), + elementTop = $this .offset () .top, + elementBottom = elementTop + $this .outerHeight (), + viewportTop = $window .scrollTop (), + viewportBottom = viewportTop + $window .height (); + + return elementBottom > viewportTop && elementTop < viewportBottom; + }, +}); + +const jquery_default_ = jquery_$; +; + +x_ite_Namespace .add ("jquery", "lib/jquery", jquery_default_); +/* harmony default export */ const jquery = ((/* unused pure expression or super */ null && (jquery_default_))); +;// CONCATENATED MODULE: ./src/lib/libtess.js +/* provided dependency */ var libtess_libtess = __webpack_require__(180); +const libtess_default_ = libtess_libtess; +; + +x_ite_Namespace .add ("libtess", "lib/libtess", libtess_default_); +/* harmony default export */ const lib_libtess = ((/* unused pure expression or super */ null && (libtess_default_))); +;// CONCATENATED MODULE: ./src/x_ite/X3D.js +/* provided dependency */ var X3D_$ = __webpack_require__(864); +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +const + callbacks = X3D_$.Deferred (), + fallbacks = X3D_$.Deferred (); + +let initialized = false; + +/** + * + * @param {function?} callback + * @param {function?} fallback + * @returns {Promise} Promise + */ +function X3D (callback, fallback) +{ + return new Promise ((resolve, reject) => + { + if (typeof callback === "function") + callbacks .done (callback); + + if (typeof fallback === "function") + fallbacks .done (fallback); + + callbacks .done (resolve); + fallbacks .done (reject); + + if (initialized) + return; + + initialized = true; + + X3D_$(() => + { + try + { + Browser_Legacy .elements (X3D_$("X3DCanvas"), Browser_X3DBrowser); + + if ([... X3D_$("x3d-canvas")] .every (canvas => canvas .browser)) + callbacks .resolve (); + else + fallbacks .resolve (new Error ("Couldn't create browser.")); + } + catch (error) + { + Browser_Legacy .error (X3D_$("X3DCanvas"), error); + fallbacks .resolve (error); + } + }); + }); +} + +Object .assign (X3D, x_ite_Namespace, x_ite_Namespace .Fields, +{ + require (id) + { + if (!x_ite_Namespace .has (id)) + throw new Error (`Unknown module '${id}'.`); + + return x_ite_Namespace .get (id); + }, + noConflict: (() => + { + const + _had = window .hasOwnProperty ("X3D"), + _X3D = window .X3D; + + return function () + { + if (window .X3D === X3D) + { + if (_had) + window .X3D = _X3D; + else + delete window .X3D; + } + + return X3D; + }; + })(), + getBrowser (element) + { + return X3D_$(element || "x3d-canvas, X3DCanvas") .prop ("browser"); + }, + createBrowser (url, parameter) + { + const element = document .createElement ("x3d-canvas"); + + if (arguments .length) + element .browser .loadURL (url, parameter); + + return element; + }, +}); + +Object .assign (X3D, +{ + X3DConstants: Base_X3DConstants, + X3DBrowser: Browser_X3DBrowser, + X3DExecutionContext: Execution_X3DExecutionContext, + X3DScene: Execution_X3DScene, + ComponentInfo: Configuration_ComponentInfo, + ComponentInfoArray: Configuration_ComponentInfoArray, + ProfileInfo: Configuration_ProfileInfo, + ProfileInfoArray: Configuration_ProfileInfoArray, + ConcreteNodesArray: Configuration_ConcreteNodesArray, // non-standard + AbstractNodesArray: Configuration_AbstractNodesArray, // non-standard + UnitInfo: Configuration_UnitInfo, + UnitInfoArray: Configuration_UnitInfoArray, + NamedNodesArray: Execution_NamedNodesArray, // non-standard + ImportedNodesArray: Execution_ImportedNodesArray, // non-standard + X3DImportedNode: Execution_X3DImportedNode, // non-standard + ExportedNodesArray: Execution_ExportedNodesArray, // non-standard + X3DExportedNode: Execution_X3DExportedNode, // non-standard + ExternProtoDeclarationArray: Prototype_ExternProtoDeclarationArray, + ProtoDeclarationArray: Prototype_ProtoDeclarationArray, + X3DExternProtoDeclaration: Prototype_X3DExternProtoDeclaration, + X3DProtoDeclaration: Prototype_X3DProtoDeclaration, + X3DProtoDeclarationNode: Prototype_X3DProtoDeclarationNode, // non-standard + RouteArray: Routing_RouteArray, + X3DRoute: Routing_X3DRoute, + + X3DBaseNode: Base_X3DBaseNode, // non-standard + + X3DFieldDefinition: Base_X3DFieldDefinition, + FieldDefinitionArray: Base_FieldDefinitionArray, + + X3DField: Base_X3DField, + X3DArrayField: Base_X3DArrayField, + + SFColor: x_ite_Fields .SFColor, + SFColorRGBA: x_ite_Fields .SFColorRGBA, + SFImage: x_ite_Fields .SFImage, + SFMatrix3d: x_ite_Fields .SFMatrix3d, + SFMatrix3f: x_ite_Fields .SFMatrix3f, + SFMatrix4d: x_ite_Fields .SFMatrix4d, + SFMatrix4f: x_ite_Fields .SFMatrix4f, + SFNode: x_ite_Fields .SFNode, + SFRotation: x_ite_Fields .SFRotation, + SFVec2d: x_ite_Fields .SFVec2d, + SFVec2f: x_ite_Fields .SFVec2f, + SFVec3d: x_ite_Fields .SFVec3d, + SFVec3f: x_ite_Fields .SFVec3f, + SFVec4d: x_ite_Fields .SFVec4d, + SFVec4f: x_ite_Fields .SFVec4f, + VrmlMatrix: x_ite_Fields .VrmlMatrix, + + MFBool: x_ite_Fields .MFBool, + MFColor: x_ite_Fields .MFColor, + MFColorRGBA: x_ite_Fields .MFColorRGBA, + MFDouble: x_ite_Fields .MFDouble, + MFFloat: x_ite_Fields .MFFloat, + MFImage: x_ite_Fields .MFImage, + MFInt32: x_ite_Fields .MFInt32, + MFMatrix3d: x_ite_Fields .MFMatrix3d, + MFMatrix3f: x_ite_Fields .MFMatrix3f, + MFMatrix4d: x_ite_Fields .MFMatrix4d, + MFMatrix4f: x_ite_Fields .MFMatrix4f, + MFNode: x_ite_Fields .MFNode, + MFRotation: x_ite_Fields .MFRotation, + MFString: x_ite_Fields .MFString, + MFTime: x_ite_Fields .MFTime, + MFVec2d: x_ite_Fields .MFVec2d, + MFVec2f: x_ite_Fields .MFVec2f, + MFVec3d: x_ite_Fields .MFVec3d, + MFVec3f: x_ite_Fields .MFVec3f, + MFVec4d: x_ite_Fields .MFVec4d, + MFVec4f: x_ite_Fields .MFVec4f, +}); + +/* harmony default export */ const x_ite_X3D = (X3D); + +;// CONCATENATED MODULE: ./src/shim.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + +(() => +{ + // Added at February 2022 + // https://github.com/tc39/proposal-relative-indexing-method#polyfill + + function at (n) + { + // ToInteger() abstract op + n = Math.trunc(n) || 0; + // Allow negative indexing from the end + if (n < 0) n += this.length; + // OOB access is guaranteed to return undefined + if (n < 0 || n >= this.length) return undefined; + // Otherwise, this is just normal property access + return this[n]; + } + + const TypedArray = Reflect .getPrototypeOf (Int8Array); + for (const C of [Array, String, TypedArray]) + { + if (C .prototype .at === undefined) + { + Object .defineProperty (C .prototype, "at", + { + value: at, + writable: true, + enumerable: false, + configurable: true, + }); + } + } +})(); + +const shim_default_ = undefined; +; + +x_ite_Namespace .add ("shim", "shim", shim_default_); +/* harmony default export */ const shim = ((/* unused pure expression or super */ null && (shim_default_))); +;// CONCATENATED MODULE: ./src/x_ite.js +/******************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. + * + * All rights reserved. Holger Seelig . + * + * The copyright notice above does not evidence any actual of intended + * publication of such source code, and is an unpublished work by create3000. + * This material contains CONFIDENTIAL INFORMATION that is the property of + * create3000. + * + * No permission is granted to copy, distribute, or create derivative works from + * the contents of this software, in whole or in part, without the prior written + * permission of create3000. + * + * NON-MILITARY USE ONLY + * + * All create3000 software are effectively free software with a non-military use + * restriction. It is free. Well commented source is provided. You may reuse the + * source in any way you please with the exception anything that uses it must be + * marked to indicate is contains 'non-military use only' components. + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2011 - 2022, Holger Seelig . + * + * This file is part of the X_ITE Project. + * + * X_ITE is free software: you can redistribute it and/or modify it under the + * terms of the GNU General Public License version 3 only, as published by the + * Free Software Foundation. + * + * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more + * details (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License version 3 + * along with X_ITE. If not, see for a + * copy of the GPLv3 License. + * + * For Silvio, Joy and Adi. + * + ******************************************************************************/ + + + + + +// Assign X3D to global namespace. + +window [Symbol .for ("X_ITE.X3D-8.12.4")] = x_ite_X3D; + +customElements .define ("x3d-canvas", x_ite_X3DCanvasElement); + +x_ite_X3D (); + +const x_ite_default_ = x_ite_X3D; +; + +x_ite_Namespace .add ("x_ite", "x_ite", x_ite_default_); +/* harmony default export */ const x_ite = (x_ite_default_); +})(); + +var __webpack_exports__default = __webpack_exports__.Z; +export { __webpack_exports__default as default }; diff --git a/etc/manifest.json b/etc/manifest.json new file mode 100644 index 0000000..abdae11 --- /dev/null +++ b/etc/manifest.json @@ -0,0 +1,23 @@ +{ + "manifest_version": 3, + "name": "archematics", + "version": "0.1", + + "description": "unearths mathematical treasures lost in the web.", + + "content_scripts": [ + { + "matches": ["*://*/*"], + "js": ["giveAwrl.js"] + } + ], + "web_accessible_resources": [{ + "matches": [""], + "resources": [ + "deps/x_ite/x_ite.mjs", + "deps/x_ite/x_ite.css", + "deps/x_ite/assets/components/Scripting.js", + "deps/x_ite/assets/components/Text.js" + ] + }] +} diff --git a/package.json5 b/package.json5 index d247c36..259e167 100644 --- a/package.json5 +++ b/package.json5 @@ -1,6 +1,6 @@ { name: 'archematics', - version: '0.0.1', + version: '0.1.0', description: 'Uncovering lost digital mathematical treasures', scripts: { test: 'echo "Error: no test specified" && exit 1', @@ -14,11 +14,12 @@ // Use the Typescript compiler to create the final .js files: build_js: 'tsc && mkdir -p public/js && cp -r jsbuild/* public/js', build_deps: 'bash tools/copyDeps.bash public/js/deps', + build_plugin: 'bash tools/makePlugin.bash extension', build: 'pnpm --sequential /build_/', start: 'node public/js', go: 'pnpm --sequential "/build|start/"', serve: 'pnpm build && http-server', - clean: 'rm -rf tsbuild jsbuild public/js', + clean: 'rm -rf tsbuild jsbuild public/js extension', }, packageManager: 'pnpm', keywords: [ @@ -34,8 +35,10 @@ }, devDependencies: { '@danielx/civet': '^0.6.39', + '@types/firefox-webext-browser': '^111.0.2', '@types/jquery': '^3.5.19', 'http-server': '^14.1.1', + rollup: '^3.29.3', typescript: '^5.2.2', }, dependencies: { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4f7938d..ce6831b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,12 +16,18 @@ devDependencies: '@danielx/civet': specifier: ^0.6.39 version: 0.6.39(typescript@5.2.2) + '@types/firefox-webext-browser': + specifier: ^111.0.2 + version: 111.0.2 '@types/jquery': specifier: ^3.5.19 version: 3.5.19 http-server: specifier: ^14.1.1 version: 14.1.1 + rollup: + specifier: ^3.29.3 + version: 3.29.3 typescript: specifier: ^5.2.2 version: 5.2.2 @@ -66,6 +72,10 @@ packages: '@jridgewell/sourcemap-codec': 1.4.15 dev: true + /@types/firefox-webext-browser@111.0.2: + resolution: {integrity: sha512-NS7izfYOnQI/Opf3YdZSKkI5Ox89SqEffJHK2zfGY2BYEVuWuM6pSwDRglGl4W0SM84oUQfvLyYH4X6EQZAJ2w==} + dev: true + /@types/jquery@3.5.19: resolution: {integrity: sha512-KFbmk+dXfphHGuVCmlopgcNRCegN/21mkeoD4BzuJhVH0SJW3Uo2mLuAwb6oqTNV79EsRp6J7yC1BbKymjpx/g==} dependencies: @@ -428,6 +438,14 @@ packages: resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} dev: true + /rollup@3.29.3: + resolution: {integrity: sha512-T7du6Hum8jOkSWetjRgbwpM6Sy0nECYrYRSmZjayFcOddtKJWU4d17AC3HNUk7HRuqy4p+G7aEZclSHytqUmEg==} + engines: {node: '>=14.18.0', npm: '>=8.0.0'} + hasBin: true + optionalDependencies: + fsevents: 2.3.3 + dev: true + /safe-buffer@5.1.2: resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} dev: true diff --git a/src/giveAwrl.civet b/src/giveAwrl.civet index 76ff036..4bb52d5 100644 --- a/src/giveAwrl.civet +++ b/src/giveAwrl.civet @@ -1,20 +1,22 @@ -import https://code.jquery.com/jquery-3.7.1.js -X3D from https://create3000.github.io/code/x_ite/latest/x_ite.mjs +import ./deps/jquery.js {convert} from ./deps/vrml1to97/index.js knownExtensions := /[.](?:wrl|x3d|gltf|glb|obj|stl|ply)$/ certainlyHandled := knownExtensions.source.slice(0, -2).split('wrl|')[1].split '|' -function makeBrowser(url: string) +function makeBrowser(url: string, width: string, height: string) + x_ite_rel := 'deps/x_ite/x_ite.mjs' + x_ite_url .= './' + x_ite_rel + unless typeof browser is 'undefined' + if browser?.runtime?.getURL + x_ite_url = browser.runtime.getURL x_ite_rel + console.log 'LOADING', x_ite_url + const { default: X3D } = await import x_ite_url canvas := X3D.createBrowser() // Fix up css: smaller browser, but we can see the world info - $(canvas).css - width: '150px' - height: '150px' - overflow: 'visible' - 'vertical-align': 'top' + $(canvas).css {width, height, overflow: 'visible', 'vertical-align': 'top'} x_ite_shadow := canvas.shadowRoot if x_ite_shadow x_ite_style := x_ite_shadow.querySelector 'link' @@ -30,8 +32,8 @@ function makeBrowser(url: string) $(x_ite_browser).css overflow: 'visible' // Now get the browser and load the requested VRML, converting if need be - browser := X3D.getBrowser canvas - browser.setBrowserOption 'StraightenHorizon', false + browser3D := X3D.getBrowser canvas + browser3D.setBrowserOption 'StraightenHorizon', false if certainlyHandled.some((ext) => url.includes ext) canvas.setAttribute 'src', url @@ -41,31 +43,62 @@ function makeBrowser(url: string) text .= await response.text() if /#\s*VRML\s*V?1[.]/i.test text text = convert text - browser.baseURL = url - scene := await browser.createX3DFromString text - browser.replaceWorld scene + browser3D.baseURL = url + scene := await browser3D.createX3DFromString text + browser3D.replaceWorld scene canvas // Put eye icons after all of the eligible links links := $('a').filter -> knownExtensions.test @.getAttribute('href') ?? '' links.after -> newSpan := $('ðŸ‘') + newSpan.css 'overflow', 'visible' + floatLike := this.lastElementChild as HTMLElement + float .= '' + if floatLike + float = (floatLike.getAttribute('align') ?? '') + or floatLike.style.getPropertyValue 'float' + or window.getComputedStyle(floatLike).getPropertyValue 'float' + switch float + /left/i + float = 'left' + newSpan.css {float, position: 'relative'} + /right/i + float = 'right' + newSpan.css {float, position: 'relative'} + else float = '' newSpan.hover (-> $(@).css 'background-color', 'lightblue'), (-> $(@).css 'background-color', 'inherit') newSpan.on 'click', @, - (e) => - eye := e.target - state .= eye.getAttribute 'data' - unless state - state = 'off' - url := e.data.getAttribute('href') ?? '' - $(eye).after await makeBrowser url - if state is 'off' - eye.setAttribute 'data', 'on' - $(eye).css 'text-decoration', 'line-through 3px' - $(eye.nextSibling as Element).show() - else - eye.setAttribute 'data', 'off' - $(eye).css 'text-decoration', 'none' - $(eye.nextSibling as Element).hide() + (e) => + eye := e.target + state .= eye.getAttribute 'data' + unless state + state = 'off' + url := e.data.getAttribute('href') ?? '' + overImg := floatLike and floatLike.tagName is 'IMG' + width := overImg ? ($(floatLike).width() + 'px') : '150px' + height := overImg ? ($(floatLike).height() + 'px') : '150px' + canvas := await makeBrowser url, width, height + if float + canvas.style.float = float + if overImg + canvas.style.position = 'absolute' + imgSty := window.getComputedStyle floatLike + canvas.style.marginTop = imgSty.getPropertyValue 'margin-top' + canvas.style.marginLeft = imgSty.getPropertyValue 'margin-left' + canvas.style.marginRight = imgSty.getPropertyValue 'margin-right' + if float is 'right' + canvas.style.left = $(eye).width() + 'px' + else + canvas.style.right = $(eye).width() + 'px' + $(eye).append canvas + if state is 'off' + eye.setAttribute 'data', 'on' + $(eye).css 'text-decoration', 'line-through 3px' + $(eye.lastElementChild as Element).show() + else + eye.setAttribute 'data', 'off' + $(eye).css 'text-decoration', 'none' + $(eye.lastElementChild as Element).hide() diff --git a/src/index.civet b/src/index.civet deleted file mode 100644 index faae65c..0000000 --- a/src/index.civet +++ /dev/null @@ -1,4 +0,0 @@ -console.log """ - Hello, world -- - This is the beginning of something! -""" diff --git a/tools/copyDeps.bash b/tools/copyDeps.bash index 87b3aac..b444023 100644 --- a/tools/copyDeps.bash +++ b/tools/copyDeps.bash @@ -1,5 +1,7 @@ # Takes one parameter, the destination directory mkdir -p $1 +cp etc/deps/jquery.js $1 +cp -r etc/deps/x_ite $1 cp -rL node_modules/vrml1to97/{deps,vrml1to97,streamToString.js} $1 cp -rL node_modules/colorsea/dist/index.esm.js $1/colorsea.js cp -rL node_modules/colorsea/dist/index.d.ts $1/colorsea.d.ts diff --git a/tools/fetchDeps.bash b/tools/fetchDeps.bash index 1b56c88..f84e2e8 100644 --- a/tools/fetchDeps.bash +++ b/tools/fetchDeps.bash @@ -1,5 +1,6 @@ mkdir -p etc/deps/geogebra -mkdir etc/deps/x_ite +mkdir -p etc/deps/x_ite/assets/components +mkdir etc/deps/x_ite/assets/images cp etc/geogebraPreamble.txt etc/deps/geogebra/api.ts curl 'https://raw.githubusercontent.com/netless-io/netless-app/master/packages/app-geogebra/src/types/api.ts' >> etc/deps/geogebra/api.ts @@ -10,7 +11,12 @@ curl 'https://raw.githubusercontent.com/netless-io/netless-app/master/packages/a cp etc/geogebraPreamble.txt etc/deps/geogebra/params.ts curl 'https://raw.githubusercontent.com/netless-io/netless-app/master/packages/app-geogebra/src/types/params.ts' >> etc/deps/geogebra/params.ts -curl 'https://raw.githubusercontent.com/create3000/x_ite/development/dist/x_ite.d.ts' > etc/deps/x_ite/x_ite.d.ts.tmp -sed -i -e 's/declare//g' etc/deps/x_ite/x_ite.d.ts.tmp -cat etc/x_itePreamble.txt etc/deps/x_ite/x_ite.d.ts.tmp etc/x_itePostamble.txt > etc/deps/x_ite/x_ite.d.ts -rm etc/deps/x_ite/x_ite.d.ts.tmp +curl 'https://code.jquery.com/jquery-3.7.1.js' > etc/deps/jquery.js + +curl 'https://create3000.github.io/code/x_ite/latest/x_ite.mjs' > etc/deps/x_ite/x_ite.mjs +curl 'https://create3000.github.io/code/x_ite/latest/x_ite.css' > etc/deps/x_ite/x_ite.css +curl 'https://create3000.github.io/code/x_ite/latest/assets/components/Scripting.js' > etc/deps/x_ite/assets/components/Scripting.js +curl 'https://create3000.github.io/code/x_ite/latest/assets/components/Text.js' > etc/deps/x_ite/assets/components/Text.js +curl 'https://create3000.github.io/code/x_ite/latest/assets/images/logo.128.png' > etc/deps/x_ite/assets/images/logo.128.png + +curl 'https://raw.githubusercontent.com/create3000/x_ite/development/dist/x_ite.d.ts' > etc/deps/x_ite/x_ite.d.mts diff --git a/tools/makePlugin.bash b/tools/makePlugin.bash new file mode 100644 index 0000000..8df65df --- /dev/null +++ b/tools/makePlugin.bash @@ -0,0 +1,12 @@ +# Takes one parameter, the destination directory +mkdir -p $1/deps/x_ite/assets/images +mkdir -p $1/deps/x_ite/assets/components +cp etc/manifest.json $1 +cp etc/deps/x_ite/x_ite.css $1/deps/x_ite +cp etc/deps/x_ite/assets/images/logo.128.png $1/deps/x_ite/assets/images +cp etc/deps/x_ite/x_ite.mjs $1/deps/x_ite +cp etc/deps/x_ite/assets/components/* $1/deps/x_ite/assets/components +npx rollup public/js/giveAwrl.js --dir extension + +# sed -i -e 's/import..meta..//g' extension/giveAwrl.js +# sed -i -e 's/return "MODULE"/return "BROWSER"/g' extension/giveAwrl.js -- 2.34.1 From 58469f793ede14493d7a7dc02757578d4040078d Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Wed, 4 Oct 2023 16:39:55 -0700 Subject: [PATCH 2/3] feat: Get plugin working with Joyce Geometry Applets as well Since third-party code may not be loaded from the web in an extension, requires bundling many GeoGebra app files into the extension. Still to come: control panel for the extension. --- .../HTML5/5.0/css/bundles/simple-bundle.css | 1 + .../5F2C6F84737382D2A3B062804F6250CE.cache.js | 14231 ++++++++++++++++ .../HTML5/5.0/webSimple/clear.cache.gif | Bin 0 -> 43 bytes .../1.cache.js | 1 + .../10.cache.js | 1 + .../2.cache.js | 1 + .../3.cache.js | 1 + .../4.cache.js | 1 + .../5.cache.js | 1 + .../6.cache.js | 1 + .../7.cache.js | 1 + .../8.cache.js | 1 + .../9.cache.js | 1 + .../HTML5/5.0/webSimple/webSimple.nocache.js | 23 + etc/deps/GeoGebra/deployggb.js | 5 + etc/deps/README.txt | 11 + etc/deps/geogebraAmbient.d.ts | 2 +- etc/deps/{geogebra => geotypes}/api.ts | 0 etc/deps/{geogebra => geotypes}/entry.ts | 0 etc/deps/{geogebra => geotypes}/params.ts | 0 etc/deps/x_ite/assets/components/Scripting.js | 78 +- etc/deps/x_ite/assets/components/Text.js | 48 +- etc/deps/x_ite/x_ite.css | 2 +- etc/deps/x_ite/x_ite.mjs | 1678 +- etc/manifest.json | 41 +- public/index.html | 1 + public/jelts/book1/joyceDefI2.html | 82 + src/adapptext.civet | 49 + src/adapptlet.civet | 83 +- src/adapptypes.civet | 20 + src/giveAwrl.civet | 1 - tools/copyDeps.bash | 1 + tools/fetchDeps.bash | 19 +- tools/makePlugin.bash | 6 +- 34 files changed, 15341 insertions(+), 1051 deletions(-) create mode 100644 etc/deps/GeoGebra/HTML5/5.0/css/bundles/simple-bundle.css create mode 100644 etc/deps/GeoGebra/HTML5/5.0/webSimple/5F2C6F84737382D2A3B062804F6250CE.cache.js create mode 100644 etc/deps/GeoGebra/HTML5/5.0/webSimple/clear.cache.gif create mode 100644 etc/deps/GeoGebra/HTML5/5.0/webSimple/deferredjs/5F2C6F84737382D2A3B062804F6250CE/1.cache.js create mode 100644 etc/deps/GeoGebra/HTML5/5.0/webSimple/deferredjs/5F2C6F84737382D2A3B062804F6250CE/10.cache.js create mode 100644 etc/deps/GeoGebra/HTML5/5.0/webSimple/deferredjs/5F2C6F84737382D2A3B062804F6250CE/2.cache.js create mode 100644 etc/deps/GeoGebra/HTML5/5.0/webSimple/deferredjs/5F2C6F84737382D2A3B062804F6250CE/3.cache.js create mode 100644 etc/deps/GeoGebra/HTML5/5.0/webSimple/deferredjs/5F2C6F84737382D2A3B062804F6250CE/4.cache.js create mode 100644 etc/deps/GeoGebra/HTML5/5.0/webSimple/deferredjs/5F2C6F84737382D2A3B062804F6250CE/5.cache.js create mode 100644 etc/deps/GeoGebra/HTML5/5.0/webSimple/deferredjs/5F2C6F84737382D2A3B062804F6250CE/6.cache.js create mode 100644 etc/deps/GeoGebra/HTML5/5.0/webSimple/deferredjs/5F2C6F84737382D2A3B062804F6250CE/7.cache.js create mode 100644 etc/deps/GeoGebra/HTML5/5.0/webSimple/deferredjs/5F2C6F84737382D2A3B062804F6250CE/8.cache.js create mode 100644 etc/deps/GeoGebra/HTML5/5.0/webSimple/deferredjs/5F2C6F84737382D2A3B062804F6250CE/9.cache.js create mode 100644 etc/deps/GeoGebra/HTML5/5.0/webSimple/webSimple.nocache.js create mode 100644 etc/deps/GeoGebra/deployggb.js create mode 100644 etc/deps/README.txt rename etc/deps/{geogebra => geotypes}/api.ts (100%) rename etc/deps/{geogebra => geotypes}/entry.ts (100%) rename etc/deps/{geogebra => geotypes}/params.ts (100%) create mode 100644 public/jelts/book1/joyceDefI2.html create mode 100644 src/adapptext.civet create mode 100644 src/adapptypes.civet diff --git a/etc/deps/GeoGebra/HTML5/5.0/css/bundles/simple-bundle.css b/etc/deps/GeoGebra/HTML5/5.0/css/bundles/simple-bundle.css new file mode 100644 index 0000000..69c576d --- /dev/null +++ b/etc/deps/GeoGebra/HTML5/5.0/css/bundles/simple-bundle.css @@ -0,0 +1 @@ +:root{--ggb-primary-color: #6557D2;--ggb-primary-variant-color: #9984FF;--ggb-dark-color: #4C42A1;--ggb-light-color: #9984FF;--ggb-selection-color: rgba(101, 87, 210, 0.2)}.GeoGebraFrame{box-sizing:content-box;-webkit-text-size-adjust:auto}.GeoGebraFrame *{margin:initial;padding:initial;border:initial;outline:initial;height:initial;width:initial;border-collapse:initial;border-spacing:initial;letter-spacing:normal;font-weight:normal;font-variant:normal;font-stretch:normal;font-kerning:auto;text-decoration:none;box-sizing:content-box;text-shadow:none;box-shadow:none;min-height:initial;min-width:initial;text-align:initial;background:initial;line-height:initial}.GeoGebraFrame .gwt-Button{height:initial;text-shadow:initial}.GeoGebraFrame table tr,.GeoGebraFrame table td,.GeoGebraFrame img,.GeoGebraFrame li,.GeoGebraFrame input,.GeoGebraFrame button,.GeoGebraFrame input[type=number],.GeoGebraFrame input[type=text],.GeoGebraFrame ul{margin:0;padding:0;margin:initial;padding:initial;border:initial;outline:initial;height:initial;width:initial;max-width:initial;background-color:initial;box-sizing:initial;text-shadow:initial;transition:initial}.GeoGebraFrame strong{font-weight:bold}.GeoGebraFrame select,.GeoGebraFrame img{display:initial}.GeoGebraFrame div{box-sizing:initial}.GeoGebraFrame input[type=checkbox]{position:initial;left:initial;opacity:initial;pointer-events:initial}.GeoGebraFrame input[type=checkbox]+label{position:initial;padding-left:initial;cursor:initial;display:initial;height:initial;line-height:initial;font-size:initial}.GeoGebraFrame input[type=checkbox]+label:after,.GeoGebraFrame input[type=checkbox]+label:before{content:none}.GeoGebraFrame table{border-collapse:initial;border-spacing:initial;border-width:0px;background:initial;table-layout:initial}.GeoGebraFrame .thumb{display:none}.GeoGebraFrame .btn{text-transform:initial;line-height:initial;box-shadow:initial}.GeoGebraFrame input:not([type]):focus:not([readonly]),.GeoGebraFrame input[type=text]:focus:not([readonly]),.GeoGebraFrame input[type=password]:focus:not([readonly]),.GeoGebraFrame input[type=email]:focus:not([readonly]),.GeoGebraFrame input[type=url]:focus:not([readonly]),.GeoGebraFrame input[type=time]:focus:not([readonly]),.GeoGebraFrame input[type=date]:focus:not([readonly]),.GeoGebraFrame input[type=datetime]:focus:not([readonly]),.GeoGebraFrame input[type=datetime-local]:focus:not([readonly]),.GeoGebraFrame input[type=tel]:focus:not([readonly]),.GeoGebraFrame input[type=number]:focus:not([readonly]),.GeoGebraFrame input[type=search]:focus:not([readonly]){border:initial;box-shadow:initial}.GeoGebraFrame input[type=range]{-webkit-appearance:none;width:129px}.GeoGebraFrame input[type=range]::-webkit-slider-runnable-track{height:5px;background-color:rgba(0,0,0,.4);border:none}.GeoGebraFrame input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;border:none;height:15px;width:15px;border-radius:50%;background-color:#000;transform-origin:50% 50%;margin:-5px 0 0 0;transition:initial;cursor:pointer}.GeoGebraFrame input[type=range]::-webkit-slider-thumb:hover{height:19px;width:19px;margin:-7px 0 0 0}.GeoGebraFrame input[type=range]::-moz-range-thumb:hover{height:19px;width:19px;margin:-7px 0 0 0}.GeoGebraFrame input[type=range]::-moz-range-track{height:5px;background:rgba(0,0,0,.4);border:none}.GeoGebraFrame input[type=range]::-moz-range-thumb{border:none;height:15px;width:15px;border-radius:50%;background:#000;margin-top:-5px;cursor:pointer}.GeoGebraFrame input[type=range]:-moz-focusring{outline:1px solid #fff;outline-offset:-1px}.GeoGebraFrame input[type=range]:focus::-moz-range-track{background:rgba(0,0,0,.6)}.GeoGebraFrame input[type=range]::-ms-track{height:5px;background:rgba(0,0,0,0);border-color:rgba(0,0,0,0);border-width:5px 0;color:rgba(0,0,0,0)}.GeoGebraFrame input[type=range]::-ms-fill-lower{background:rgba(0,0,0,.4)}.GeoGebraFrame input[type=range]::-ms-fill-upper{background:rgba(0,0,0,.4)}.GeoGebraFrame input[type=range]::-ms-thumb{border:none;height:15px;width:15px;border-radius:50%;background:#000}.GeoGebraFrame input[type=range]:focus::-ms-fill-lower{background:rgba(0,0,0,.6)}.GeoGebraFrame input[type=range]:focus::-ms-fill-upper{background:rgba(0,0,0,.6)}.GeoGebraFrame [type=radio]:not(:checked),.GeoGebraFrame [type=radio]:checked{position:absolute;left:-9999px;opacity:0}.GeoGebraFrame .MaterialDialogBox .gwt-RadioButton [type=radio]+label{padding-left:35px}.GeoGebraFrame [type=radio]:not(:checked)+label,.GeoGebraFrame [type=radio]:checked+label{position:relative;padding-left:35px;cursor:pointer;display:inline-block;height:25px;line-height:25px;font-size:1rem;transition:.28s ease;-khtml-user-select:none;user-select:none}.GeoGebraFrame [type=radio]+label:before,.GeoGebraFrame [type=radio]+label:after{content:"";position:absolute;left:0;top:0;margin:4px;width:16px;box-sizing:border-box;height:16px;z-index:0;transition:.28s ease}.GeoGebraFrame [type=radio]:not(:checked)+label:before,.GeoGebraFrame [type=radio]:not(:checked)+label:after,.GeoGebraFrame [type=radio]:checked+label:before,.GeoGebraFrame [type=radio]:checked+label:after,.GeoGebraFrame [type=radio].with-gap:checked+label:before,.GeoGebraFrame [type=radio].with-gap:checked+label:after{border-radius:50%}.GeoGebraFrame [type=radio]:not(:checked)+label:before,.GeoGebraFrame [type=radio]:not(:checked)+label:after{border:2px solid #ccc}.GeoGebraFrame [type=radio]:not(:checked)+label:after{transform:scale(0)}.GeoGebraFrame [type=radio]:checked+label:before{border:2px solid rgba(0,0,0,0)}.GeoGebraFrame [type=radio]:checked+label:after,.GeoGebraFrame [type=radio].with-gap:checked+label:before,.GeoGebraFrame [type=radio].with-gap:checked+label:after{border:#66f}.GeoGebraFrame [type=radio]:checked+label:after,.GeoGebraFrame [type=radio].with-gap:checked+label:after{background-color:#66f}.GeoGebraFrame .MaterialDialogBox [type=radio]:checked+label:after,.GeoGebraFrame .MaterialDialogBox [type=radio].with-gap:checked+label:before,.GeoGebraFrame .MaterialDialogBox [type=radio].with-gap:checked+label:after{border:#4cb4a4}.GeoGebraFrame .MaterialDialogBox [type=radio]:checked+label:after,.GeoGebraFrame .MaterialDialogBox [type=radio].with-gap:checked+label:after{background-color:#008475}.GeoGebraFrame [type=radio]:checked+label:after{transform:scale(1.02)}.GeoGebraFrame [type=radio].with-gap:checked+label:after{transform:scale(0.5)}.GeoGebraFrame [type=radio].tabbed:focus+label:before{box-shadow:0 0 0 10px rgba(0,0,0,.1)}.GeoGebraFrame [type=radio].with-gap:disabled:checked+label:before{border:2px solid #ccc}.GeoGebraFrame [type=radio].with-gap:disabled:checked+label:after{border:none;background-color:#ccc}.GeoGebraFrame [type=radio]:disabled:not(:checked)+label:before,.GeoGebraFrame [type=radio]:disabled:checked+label:before{background-color:rgba(0,0,0,0);border-color:#ccc}.GeoGebraFrame [type=radio]:disabled+label{color:#ccc}.GeoGebraFrame [type=radio]:disabled:not(:checked)+label:before{border-color:#ccc}.GeoGebraFrame [type=radio]:disabled:checked+label:after{background-color:#ccc;border-color:#ccc}body.application[dir=rtl] .gwt-Label{text-align:right}body.application[dir=rtl] .TitleBarPanelContent{border-bottom-left-radius:0;border-bottom-right-radius:5px;padding-right:5px;padding-left:40px}body.application[dir=rtl] .DragPanel{border-bottom-left-radius:0;border-bottom-right-radius:5px}body.application[dir=rtl] .TitleBarPanel .toggleStyleBar{right:auto;left:0}body.application[dir=rtl] .StyleBarPanel{padding-left:0;padding-right:31px}body.application[dir=rtl] .StyleBarPanel{float:right;margin-left:0;margin-right:-4px}body.application[dir=rtl] .VerticalSeparator{margin:0 5px 0 2px}body.application[dir=rtl] .MyToggleButton,body.application[dir=rtl] .MyCanvasButton{margin-left:0;margin-right:4px}body.application[dir=rtl] .gwt-Label.textIconButton{padding-left:0;padding-right:28px;text-align:right;background-position:center right}body.application[dir=rtl] .dialogContent .gwt-CheckBox{margin-right:0;margin-left:10px}body.application[dir=rtl] .Dialog-messagePanel img{margin-left:10px;margin-right:0}body.application[dir=rtl] .DialogRbPanel td{padding-right:0;padding-left:20px}body.application[dir=rtl] .dialogContent .sliderIntervalPanel div,body.application[dir=rtl] .dialogContent .sliderWidthPanel div{margin-right:0;margin-left:10px;float:right}body.application[dir=rtl] .GeoGebraFileChooser .titlePanel input{float:left}body.application[dir=rtl] .GeoGebraFileChooser .titlePanel .gwt-Label{padding-right:0;padding-left:10px}body.application[dir=rtl] .GeoGebraMenuBar table{margin-left:auto}body.application[dir=rtl] .signInDialog .headerPanel .gwt-Button{right:auto;left:-5px}body.application[dir=rtl] .inputHelp-cmdSyntax{padding-left:0;padding-right:35px}body.application[dir=rtl] .elemHeadingName{padding:15px 40px 10px 10px}body.application[dir=rtl] .algebraOpenButton{left:auto;right:0}body.application[dir=rtl] .imageCorner{align:right;padding-left:0;padding-right:20px}body.application[dir=rtl] .AutoCompleteTextFieldW.SymbolCanBeShown .TextField,body.application[dir=rtl] .GeoGebraFrame .AutoCompleteTextFieldW.SymbolCanBeShown.FromDrawTextFieldNew input[type=text].TextField{padding-right:0;padding-left:40px}body.application[dir=rtl] .GeoGebraFrame .algebraViewObjectStylebar{right:auto;left:0;border-bottom-right-radius:5px;border-bottom-left-radius:0}body.application[dir=rtl] .TitleBarPanel{left:0 !important;right:auto !important}body.application[dir=rtl] .AutoCompleteTextFieldW .SymbolToggleButton{right:auto;left:.6em}* html .gwt-DecoratedPopupPanel .popupTopLeftInner{width:6px;height:5px;overflow:hidden}* html .gwt-DecoratedPopupPanel .popupTopRightInner{width:6px;height:5px;overflow:hidden}* html .gwt-DecoratedPopupPanel .popupBottomLeftInner{width:6px;height:6px;overflow:hidden}* html .gwt-DecoratedPopupPanel .popupBottomRightInner{width:6px;height:6px;overflow:hidden}* html .gwt-TreeItem .gwt-RadioButton input,* html .gwt-TreeItem .gwt-CheckBox input{margin-left:-4px}.printScalePanel div{display:inline-block}.printScalePanel input{width:60px !important;margin:10px}.printScalePanel select{width:auto}.aPixelsOnScreen{margin:10px}.geogebraweb{display:inline-block;-ms-touch-action:none;-webkit-tap-highlight-color:rgba(255,255,255,0)}.geogebraweb .splash{position:absolute}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.startscreen .mk-spinner-ring,.GeoGebraFrame .mk-spinner-ring{height:50px;margin-top:-25px;border-radius:50%;border:3px solid var(--ggb-primary-color);border-left-color:rgba(0,0,0,0);background:rgba(0,0,0,0);-webkit-animation:a 1s infinite linear;animation:a 1s infinite linear}.startscreen .mk-spinner-ring,.GeoGebraFrame .mk-spinner-ring{content:"";display:inline-block;position:absolute;width:50px;top:50%;left:50%;margin-left:-25px;z-index:1}.startscreen .mk-spinner-wrap,.GeoGebraFrame .mk-spinner-wrap{min-height:100px;width:100%;position:absolute;top:50%;transform:translateY(-50%);z-index:1000}.GeoGebraFrame.appletStyle{overflow:hidden;box-sizing:border-box;position:relative}.GeoGebraFrame div[data-title]:after,.GeoGebraFrame button[data-title]:after{opacity:0;content:""}.GeoGebraFrame div[data-title]:hover:after,.GeoGebraFrame button[data-title]:hover:after{transition:opacity 0s linear 1s;content:attr(data-title);font-size:65%;white-space:nowrap;position:absolute;top:30px;left:-8px;height:22px;line-height:21px !important;padding-left:8px !important;padding-right:8px !important;vertical-align:middle;border-radius:2px;background:#616161;color:#fff;opacity:.9;z-index:1000}.GeoGebraFrame .matDragger .splitPaneDragger{background-color:#fff}.GeoGebraFrame .matDragger .gwt-SplitLayoutPanel-HDragger{z-index:60;cursor:ew-resize;border-left:none;padding-right:8px}.GeoGebraFrame .matDragger .gwt-SplitLayoutPanel-VDragger{border-bottom:none}.GeoGebraFrame .matDragger .splitPaneDragger:after{content:"";position:absolute;background-color:#dadbdf;border-radius:2px}.GeoGebraFrame .matDragger .gwt-SplitLayoutPanel-HDragger:after{top:calc(50% - 14px);left:2px;height:28px;width:4px;transition:top .2s}.GeoGebraFrame .matDragger .gwt-SplitLayoutPanel-VDragger:after{left:calc(50% - 14px);bottom:2px;width:28px;height:4px;transition:left .2s}.GeoGebraFrame .matDragger.singlePanel .gwt-SplitLayoutPanel-HDragger:after{top:12px}.GeoGebraFrame .matDragger.singlePanel .gwt-SplitLayoutPanel-VDragger:after{left:calc(100% - 48px)}.GeoGebraFrame .matDragger .draggerParentHorizontal{border-top-right-radius:8px;border-bottom-right-radius:8px;z-index:1;box-shadow:0 2px 4px -1px rgba(0,0,0,.2),0 1px 10px 0 rgba(0,0,0,.12),0 4px 5px 0 rgba(0,0,0,.14)}.GeoGebraFrame .matDragger .draggerParentVertical{border-top-left-radius:8px;border-top-right-radius:8px;z-index:1;box-shadow:2px 0 4px -1px rgba(0,0,0,.2),1px 0 10px 0 rgba(0,0,0,.12),4px 0 5px 0 rgba(0,0,0,.14)}.GeoGebraFrame .dockPanelParent{overflow:visible !important}.GeoGebraFrame .hideDragger .draggerParent{overflow-x:hidden !important}.GeoGebraFrame .hideDragger .draggerParentHorizontal{display:none}.GeoGebraFrame .moveUpDragger .toolbar{overflow:visible}.GeoGebraFrame .moveUpDragger .draggerParentVerical{border:none;box-shadow:0px -5px 8px rgba(0,0,0,.2)}.GeoGebraFrame .moveUpDragger .splitPaneDragger{display:none}.GeoGebraFrame .hideDragger .hiddenHDraggerRightPanel{left:-16px !important}.GeoGebraFrame .hidden,.GeoGebraFrame .temporarilyHidden{display:none}.GeoGebraFrame .menu{position:absolute;top:4px;left:0px}.GeoGebraFrame .menu:hover img,.GeoGebraFrame .menu:focus img{opacity:1}.GeoGebraFrame .flatButton{margin:6px;padding:6px;width:24px;height:24px;cursor:pointer;z-index:60}.GeoGebraFrame .flatButton img{opacity:.85}.GeoGebraFrame .tabButton{position:relative;box-sizing:border-box;min-width:24px;cursor:pointer;display:flex;flex-wrap:wrap;justify-content:center;opacity:.54}.GeoGebraFrame .tabButton .gwt-Label{width:100%;line-height:12px;min-height:28px;font-size:10px;text-align:center;word-break:break-word;margin-left:4px;margin-right:4px}.GeoGebraFrame .tabButton .gwt-Image{height:24px}.GeoGebraFrame .tabButton.selected .gwt-Label{color:#6557d2}.GeoGebraFrame .tabButton:hover{background-color:#f3f2f7}.GeoGebraFrame .tabButton.selected:hover{background-color:#f3f0ff}.GeoGebraFrame .tabButton.selected{opacity:1}.GeoGebraFrame .textWrap{white-space:normal}.GeoGebraFrame .advanced-ListPopupPanel{z-index:500;background:#fff;border:1px solid #dcdcdc;cursor:pointer;border-radius:2px;padding:0px;box-shadow:none}.GeoGebraFrame .advanced-ListPopupPanel .item:hover{color:#008475;background:#fff}.GeoGebraFrame .advanced-ListPopupPanel .gwt-Label{position:relative;left:8px}.GeoGebraFrame .verticalScroll{overflow-y:auto}.GeoGebraFrame .mowColorPlusButton img{padding:3px}.GeoGebraFrame .matDynStyleBar{will-change:transform}.screenReaderStyle{position:fixed;bottom:20px;width:1px;height:1px;padding:0;outline-width:0;overflow:hidden;margin:0;border-width:0;clip:rect(0 0 0 0)}.GeoGebraFrame .TitleBarPanel{z-index:60}.GeoGebraFrame .graphicsControlsPanel{left:auto !important;z-index:60}.GeoGebraFrame .flatButton.graphicsContextMenuBtn{margin-top:10px;margin-right:10px;position:relative;right:0px;border-radius:50%;transition:background-color 150ms ease 0ms}.GeoGebraFrame .flatButton.graphicsContextMenuBtn img{opacity:.54}.GeoGebraFrame .flatButton.graphicsContextMenuBtn:hover img{opacity:.84}.GeoGebraFrame .flatButton.graphicsContextMenuBtn.mow:hover{background-color:#e5e5e5}.GeoGebraFrame .flatButton.graphicsContextMenuBtn.mow:hover img{opacity:1}.GeoGebraFrame .flatButton.keyboardFocus:focus{outline:#212121 5px auto}.GeoGebraFrame .matDynStyleBar{z-index:499;position:absolute;border-radius:2px;padding:8px 4px 8px 16px;background-color:#fff;box-shadow:0 0 2px 1px rgba(102,102,102,.3)}.GeoGebraFrame .matDynStyleBar.noContextBtn{padding:8px 0px 8px 8px}.GeoGebraFrame .matDynStyleBar .MyCanvasButton{text-align:center;border-radius:2px;border:#dcdcdc solid 1px;background-color:#fff;width:24px;height:24px;margin-left:0px;margin-right:8px;cursor:pointer}.GeoGebraFrame .matDynStyleBar .MyCanvasButton img,.GeoGebraFrame .matDynStyleBar .MyCanvasButton .buttonContent{opacity:.7}.GeoGebraFrame .matDynStyleBar .btnBold,.GeoGebraFrame .matDynStyleBar .btnItalic{border-radius:2px;margin-left:0px;margin-right:8px}.GeoGebraFrame .matDynStyleBar .btnBold img,.GeoGebraFrame .matDynStyleBar .btnItalic img{opacity:.7}.GeoGebraFrame .matDynStyleBar .btnBold:hover,.GeoGebraFrame .matDynStyleBar .btnBold:focus,.GeoGebraFrame .matDynStyleBar .btnItalic:hover,.GeoGebraFrame .matDynStyleBar .btnItalic:focus{border:#6557d2 solid 1px}.GeoGebraFrame .matDynStyleBar .btnBold.gwt-ToggleButton-down,.GeoGebraFrame .matDynStyleBar .btnItalic.gwt-ToggleButton-down{border:#6557d2 solid 1px}.GeoGebraFrame .matDynStyleBar .matDynStyleContextButton{margin-right:0px !important;margin-left:0px !important;border:none !important}.GeoGebraFrame .matDynStyleBar .matDynStyleContextButton.noOpacity img,.GeoGebraFrame .matDynStyleBar .matDynStyleContextButton.noOpacity:hover img{opacity:1 !important}.GeoGebraFrame .matDynStyleBar .matDynStyleContextButton:hover img{opacity:1 !important}.GeoGebraFrame .mowDynStyleBar.matDynStyleBar.noContextBtn{padding:8px 0px 8px 8px}.GeoGebraFrame .mowDynStyleBar.matDynStyleBar.noContextBtn .MyCanvasButton.delete{margin-right:-12px}.GeoGebraFrame .textSizePopupPanel{border-radius:2px;padding:8px 0px 8px 0px;margin:0px}.GeoGebraFrame .textSizePopupPanel .matSelectionTable{border-collapse:separate;border-spacing:0px 0px}.GeoGebraFrame .textSizePopupPanel .matSelectionTable .gwt-Label{padding:0px 16px 0px 16px;height:24px;line-height:24px}.GeoGebraFrame .textSizePopupPanel .matSelectionTable .gwt-Label:hover{background-color:#eee}.GeoGebraFrame .matPopupPanel{border-radius:2px;padding:5px !important;background-color:#fff;box-shadow:0 0 2px 1px #dcdcdc;z-index:501;min-height:30px}.GeoGebraFrame .matPopupPanel .ButtonPopupMenu .panelRow2.showSlider{display:inline-block;width:144px}.GeoGebraFrame .matPopupPanel .ButtonPopupMenu .panelRow2.hideSlider{display:none}.GeoGebraFrame .matPopupPanel .ButtonPopupMenu .panelRow2{padding-bottom:8px;padding-top:8px}.GeoGebraFrame .matPopupPanel .ButtonPopupMenu .panelRow2 .popupSliderLabel{margin:0px 10px;cursor:default}.GeoGebraFrame .matPopupPanel .ButtonPopupMenu .panelRow2 input[type=range]{padding:5px 0;margin:0px 0px 0px 8px;width:calc(100% - 56px);cursor:pointer}.GeoGebraFrame .matPopupPanel .ButtonPopupMenu .panelRow2 .opacityLabel{display:block;margin-bottom:15px;margin-left:5px;margin-top:5px;cursor:default}.GeoGebraFrame .matPopupPanel .ButtonPopupMenu .panelRow2 .thicknessLabel{display:block;margin-bottom:10px;margin-left:5px;margin-top:5px;cursor:default}.GeoGebraFrame .matPopupPanel .ButtonPopupMenu .panelRow2 .pointSizeLabel{display:block;margin-left:5px;margin-top:5px;cursor:default}.GeoGebraFrame .matPopupPanel .ButtonPopupMenu .panelRow2 .preview{margin:3px 0px 3px 12px}.GeoGebraFrame .matPopupPanel .labelPopupPanel{padding:8px 8px;width:192px}.GeoGebraFrame .matPopupPanel .labelPopupPanel .panelRow{height:32px !important;display:flex}.GeoGebraFrame .matPopupPanel .labelPopupPanel .panelRow .gwt-Label{line-height:30px;cursor:default}.GeoGebraFrame .matPopupPanel .labelPopupPanel .panelRow .AutoCompleteTextFieldW{width:134px;margin:0px !important;border-radius:2px}.GeoGebraFrame .matPopupPanel .labelPopupPanel .panelRow .AutoCompleteTextFieldW .TextField{padding:2px;padding-left:8px;margin-bottom:2px;border:none;border-bottom:1px solid #dcdcdc;background:rgba(0,0,0,0);box-shadow:none;border-radius:0px !important}.GeoGebraFrame .matPopupPanel .labelPopupPanel .checkMarkMenuItem{cursor:pointer;display:flex}.GeoGebraFrame .matPopupPanel .labelPopupPanel .checkMarkMenuItem .gwt-HTML{line-height:32px}.GeoGebraFrame .matPopupPanel .labelPopupPanel .checkMarkMenuItem img{opacity:.54;position:absolute;right:8px;padding:4px}.GeoGebraFrame .matSelectionTable{border-collapse:separate;border-spacing:8px 8px}.GeoGebraFrame .matSelectionTable td{padding:0px}.GeoGebraFrame .matSelectionTable .gwt-Label{margin:0px}.GeoGebraFrame .matSelectionTable .gwt-Label.border{border-radius:2px}.GeoGebraFrame .matSelectionTable .gwt-Label.borderButton{border:1px solid;border-radius:2px;height:24px;width:24px}.GeoGebraFrame .matSelectionTable .gwt-Label.borderButton:hover{opacity:.65}.GeoGebraFrame .matSelectionTable .gwt-Label.borderButton.plusButton{border:rgba(0,0,0,.3) solid 1px;opacity:.54}.GeoGebraFrame .matSelectionTable .gwt-Label.borderButton.plusButton:hover{opacity:1;background-color:rgba(255,255,255,.9)}.GeoGebraFrame .graphicsWithSpotlight .overlayGraphics{z-index:500}.GeoGebraFrame .spotlightOffBtn{position:absolute;right:8px;top:92px;width:40px;height:40px;border-radius:50%;background-color:#fff;cursor:pointer;z-index:501}.GeoGebraFrame .spotlightOffBtn img{opacity:.54;padding:8px}.GeoGebraFrame .pointerEventsNoneWhenDragging{pointer-events:none}.GeoGebraFrame .zoomPanel{position:absolute;cursor:default;top:auto !important;left:auto !important;z-index:60;will-change:transform;user-select:none}.GeoGebraFrame .zoomPanel .zoomPanelBtn{display:block;position:relative;width:36px;height:36px;margin-bottom:8px;background-color:#fff;border-radius:50%;box-shadow:0 1px 3px 0 rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 2px 1px -1px rgba(0,0,0,.12);cursor:pointer;transition:background-color 150ms ease 0ms}.GeoGebraFrame .zoomPanel .zoomPanelBtn img{padding:6px;opacity:.54}.GeoGebraFrame .zoomPanel .zoomPanelBtn:hover{background-color:#f3f2f7}.GeoGebraFrame .zoomPanel .zoomPanelBtn:hover img{opacity:1}.GeoGebraFrame .zoomPanel .zoomPanelBtn.keyboardFocus:focus img{opacity:1;outline:#212121 5px auto}.GeoGebraFrame .zoomPanel .zoomPanelBtnSmall img{padding:8px}.GeoGebraFrame .zoomPanel .zoomPanelHomeIn{opacity:1;visibility:visible;transition:all .2s ease}.GeoGebraFrame .zoomPanel .zoomPanelHomeOut{cursor:default;opacity:0;visibility:hidden;transition:all .2s ease}.GeoGebraFrame .zoomPanel .zoomPanelHomeOut img{opacity:0}.GeoGebraFrame .zoomPanel .zoomPanelHomeOut:hover,.GeoGebraFrame .zoomPanel .zoomPanelHomeOut:focus{background-color:#f3f2f7}.GeoGebraFrame .zoomPanel .zoomPanelHomeOut:hover img,.GeoGebraFrame .zoomPanel .zoomPanelHomeOut:focus img{opacity:0}.GeoGebraFrame .zoomPanelPosition{bottom:8px !important;right:16px !important}.GeoGebraFrame .zoomPanelForFullscreenAV{bottom:60px !important;right:16px !important;transition:bottom 250ms cubic-bezier(0.4, 0, 1, 1) 0ms}.GeoGebraFrame .zoomPanelForFullscreenAVMoveUpNoMoveBtn{bottom:80px !important;right:16px !important;transition:bottom 250ms cubic-bezier(0.4, 0, 1, 1) 0ms}.GeoGebraFrame .zoomPanelForFullscreenAVMoveUp{bottom:140px !important;right:16px !important;transition:bottom 250ms cubic-bezier(0.4, 0, 1, 1) 0ms}.GeoGebraFrame .mowZoomPanel{will-change:transform;top:-6px !important;position:relative}.GeoGebraFrame .mowZoomPanel .zoomPanelBtn{display:block;position:relative;margin:6px;padding:6px;cursor:pointer;border-radius:50%;width:24px;height:24px;transition:background-color 150ms ease 0ms}.GeoGebraFrame .mowZoomPanel .zoomPanelBtn.zoomPanelBtnSmall{padding:8px;width:20px;height:20px}.GeoGebraFrame .mowZoomPanel .zoomPanelBtn.zoomPanelBtnSmall img{width:20px;height:20px}.GeoGebraFrame .mowZoomPanel .zoomPanelBtn img{width:24px;height:24px;opacity:.54}.GeoGebraFrame .mowZoomPanel .zoomPanelBtn:hover,.GeoGebraFrame .mowZoomPanel .zoomPanelBtn:focus,.GeoGebraFrame .mowZoomPanel .zoomPanelBtn.selected{background-color:#f3f2f7}.GeoGebraFrame .mowZoomPanel .zoomPanelBtn:hover img,.GeoGebraFrame .mowZoomPanel .zoomPanelBtn:focus img,.GeoGebraFrame .mowZoomPanel .zoomPanelBtn.selected img{opacity:1}.GeoGebraFrame .mowZoomPanel .zoomPanelHomeIn{opacity:1;visibility:visible;transition:all .2s ease}.GeoGebraFrame .mowZoomPanel .zoomPanelHomeOut{cursor:default;opacity:0;visibility:hidden;transition:all .2s ease}.GeoGebraFrame .mowZoomPanel .zoomPanelHomeOut img{opacity:0}.GeoGebraFrame .mowZoomPanel .zoomPanelHomeOut:hover,.GeoGebraFrame .mowZoomPanel .zoomPanelHomeOut:focus{background-color:#e5e5e5}.GeoGebraFrame .mowZoomPanel .zoomPanelHomeOut:hover img,.GeoGebraFrame .mowZoomPanel .zoomPanelHomeOut:focus img{opacity:1}.GeoGebraFrame .zoomPanelWithPageControl{margin-bottom:64px;right:22px !important}.GeoGebraFrame .undoRedoPanel{padding-left:12px;margin-top:4px;position:absolute;z-index:60}.GeoGebraFrame .undoRedoPanel.withTransition{transition:left .2s}.GeoGebraFrame .undoRedoPanel .flatButton{display:inline-block}.GeoGebraFrame .undoRedoPanel .hideButton{display:none}.GeoGebraFrame .undoRedoPosition,.GeoGebraFrame .undoRedoPositionMebis{top:0px}.GeoGebraFrame .undoRedoPosition .flatButton,.GeoGebraFrame .undoRedoPositionMebis .flatButton{border-radius:50%;transition:background-color 150ms ease 0ms}.GeoGebraFrame .undoRedoPosition .flatButton.buttonActive:hover,.GeoGebraFrame .undoRedoPositionMebis .flatButton.buttonActive:hover{background-color:#e5e5e5}.GeoGebraFrame .undoRedoPosition .flatButton.buttonActive:hover img,.GeoGebraFrame .undoRedoPositionMebis .flatButton.buttonActive:hover img{opacity:1}.GeoGebraFrame .undoRedoPositionMebis{left:40px}.GeoGebraFrame input[type=text],.GeoGebraFrame input[type=number],.GeoGebraFrame .gwt-TextBox,.GeoGebraFrame select,.GeoGebraFrame textarea,.GeoGebraFrame .gwt-TextArea,.GeoGebraFrame .gwt-SuggestBox,.GeoGebraFrame .objectPropertiesTextEditor{border:#dcdcdc solid 1px;background:#fff;padding:4px 5px;color:#1c1c1f;border-radius:5px;box-sizing:border-box;font-size:100%;font-family:geogebra-sans-serif,Arial Unicode MS,Arial,sans-serif;box-shadow:inset 1px 1px rgba(102,102,102,.1)}.GeoGebraFrame input[type=text]:focus,.GeoGebraFrame input[type=text]:focus:not([readonly]),.GeoGebraFrame input[type=number]:focus,.GeoGebraFrame input[type=number]:focus:not([readonly]),.GeoGebraFrame .gwt-TextBox:focus,.GeoGebraFrame .gwt-TextBox:focus:not([readonly]),.GeoGebraFrame textarea:focus,.GeoGebraFrame textarea:focus:not([readonly]),.GeoGebraFrame .gwt-TextArea:focus,.GeoGebraFrame .gwt-TextArea:focus:not([readonly]){border:1px #6161ff solid}.GeoGebraFrame .InputPanel .html-face,.GeoGebraFrame .AutoCompleteTextFieldW .html-face{cursor:hand;cursor:pointer}.GeoGebraFrame .AutoCompleteTextFieldW{box-sizing:border-box;position:relative}.GeoGebraFrame .AutoCompleteTextFieldW .TextField{display:inline-block;box-sizing:border-box;-moz-box-sizing:border-box;padding-left:5px;padding-right:5px}.GeoGebraFrame .AutoCompleteTextFieldW.FromDrawTextFieldNew{line-height:70%}.GeoGebraFrame .AutoCompleteTextFieldW.FromDrawTextFieldNew input[type=text].TextField{padding-left:2px;padding-right:2px;height:inherit}.GeoGebraFrame .mathTextField.errorStyle{border:2px #b00020 dashed}.GeoGebraFrame .evInputEditor.errorStyle{border:2px #ce5c71 dashed;background-color:#f1d1d7}.GeoGebraFrame .AutoCompleteTextFieldW.FromDrawTextField .TextField{margin:0px}.GeoGebraFrame .InputTreeItem .hasCursorPermanent{border-color:#dcdcdc}.GeoGebraFrame .gwt-TreeItem .noPadding{padding-left:0}.GeoGebraFrame .NoHorizontalScroll .InputTreeItem .hasCursorPermanent{border-color:#6161ff}.GeoGebraFrame .SymbolToggleButton{width:20px;height:20px;line-height:20px;text-align:center;display:none}.GeoGebraFrame .AutoCompleteTextFieldW .SymbolToggleButton{position:absolute;right:.6em;top:50%;margin-top:-0.66em}.GeoGebraFrame .advanced-TextButtonPanel .AutoCompleteTextFieldW .SymbolToggleButton{right:1.6em}.GeoGebraFrame .AutoCompleteTextFieldW.SymbolCanBeShown input:focus+.SymbolToggleButton{display:inline-block}.GeoGebraFrame .AutoCompleteTextFieldW.SymbolCanBeShown input:focus.TextField{padding-right:40px}.GeoGebraFrame input[type=text]::-ms-clear{display:none}.GeoGebraFrame .SymbolTablePopup{z-index:501;background-color:#fff;border-radius:0px;padding:16px;-webkit-box-shadow:0 2px 10px rgba(0,0,0,.2);box-shadow:0 2px 10px rgba(0,0,0,.2)}.GeoGebraFrame .SymbolTablePopup .SymbolTable tr{cursor:pointer}.GeoGebraFrame .SymbolTablePopup .SymbolTable td{padding:8px;text-align:center}.GeoGebraFrame .SymbolTablePopup .SymbolTable td:hover,.GeoGebraFrame .SymbolTablePopup .GeoGebraFrame .SymbolTable td.focus{background:#fff;color:#4cb4a4}.GeoGebraFrame .mathTextField,.GeoGebraFrame .evInputEditor{padding-top:0px;padding-left:0px;border-radius:4px;overflow:hidden}.GeoGebraFrame .mathTextField{border:1px #dcdcdc solid}.GeoGebraFrame .mathTextField.disabled{background-color:#f0f0f0}.GeoGebraFrame .evInputEditor{position:absolute;border:2px solid #6557d2}.GeoGebraFrame .accessibilityView{position:absolute;top:0;pointer-events:none}.GeoGebraFrame .accessibilityView .gwt-Button,.GeoGebraFrame .accessibilityView .gwt-Label{color:rgba(0,0,0,0);border:rgba(0,0,0,0)}.GeoGebraFrame .accessibilityControl{opacity:.01;position:fixed;width:1px;height:1px;overflow:scroll}.GeoGebraFrame .accessibleInput{width:20px;height:20px;z-index:200;position:absolute}.GeoGebraFrame input[type=text].accessibleInput{max-width:5px;padding:0}.GeoGebraFrame .invisible{visibility:hidden}.GeoGebraFrame .tooltipChip{position:absolute;display:inline-flex;padding:2px 4px;border-radius:16px;font-size:12px;align-items:center;cursor:default;height:18px;box-sizing:border-box;z-index:60}.GeoGebraFrame .mathFieldEditor{will-change:transform}.GeoGebraFrame .h5pEmbed{overflow:auto;height:100%}.GeoGebraFrame .graphicsResetIcon{padding-top:10px;padding-right:10px}.GeoGebraFrame .cursorOverlay{z-index:60;padding:2px;width:100%;position:absolute;left:0;top:0;pointer-events:none;display:flex;align-items:center;box-sizing:border-box;overflow:hidden}.GeoGebraFrame .cursorOverlay .gwt-InlineLabel{color:inherit;font-size:inherit}.GeoGebraFrame .cursorOverlay .virtualCursor{font-size:inherit;margin-left:-2px;animation:blink 1s steps(2) infinite;color:#6557d2}.GeoGebraFrame .withCursorOverlay input{color:rgba(0,0,0,0)}@keyframes blink{0%{opacity:0}}.GeoGebraFullscreenContainer{background-color:#000;top:0px;left:0px;z-index:2500}.gbox{will-change:transform;z-index:60}.ggbLightBox{width:80%;height:80%;position:fixed;top:10%;left:10%;border:7px solid rgba(0,0,0,.5);background:#fff;z-index:100000000}.GeoGebraFrame .gwt-DialogBox{z-index:501;background-color:rgba(255,255,255,.9);border-radius:2px;box-shadow:0px 0px 2px 1px rgba(102,102,102,.3);padding:15px}.GeoGebraFrame .gwt-DialogBox .Caption{cursor:default;font-family:geogebra-sans-serif,Arial Unicode MS,Arial,sans-serif;font-size:110%;padding-bottom:5px;color:#333;border-bottom:1px solid #dcdcdc;margin-bottom:15px}.GeoGebraFrame .dialogContent{color:#666}.GeoGebraFrame .dialogContent table{width:100%}.GeoGebraFrame .dialogContent input[type=text],.GeoGebraFrame .dialogContent select{margin-top:5px;margin-bottom:10px;width:100%}.GeoGebraFrame .dialogContent textarea{margin-top:5px}.GeoGebraFrame .dialogContent .optionsPanel>*{margin:3px 0px}.GeoGebraFrame .panelRow.rows>*{width:100%;display:block}.GeoGebraFrame .dialogContent .gwt-CheckBox{margin-right:10px}.GeoGebraFrame .shareDialog,.GeoGebraFrame .shareLink,.GeoGebraFrame .shareLinkMebis{min-width:320px}.GeoGebraFrame .shareDialog>div>table,.GeoGebraFrame .shareLink>div>table,.GeoGebraFrame .shareLinkMebis>div>table{width:100%;padding-right:16px}.GeoGebraFrame .shareDialog .dialogContent input[type=text],.GeoGebraFrame .shareLink .dialogContent input[type=text],.GeoGebraFrame .shareLinkMebis .dialogContent input[type=text]{width:350px}.GeoGebraFrame .GeoGebraTabLayout{width:500px}.GeoGebraFrame .GeoGebraTabLayout .gwt-TabPanelBottom{min-height:220px;margin-bottom:8px}.GeoGebraFrame .GeoGebraLinkPanel{height:100%}.GeoGebraFrame .GeoGebraCopyLinkPanel img{margin-top:10px;margin-left:5px;margin-bottom:10px}.GeoGebraFrame .GeoGebraIconPanel{display:block}.GeoGebraFrame .GeoGebraIconPanel img,.GeoGebraFrame .GeoGebraShareOnGClassroom{margin:5px}.GeoGebraFrame .GeoGebraEmailPanel{height:100%}.GeoGebraFrame .GeoGebraEmailPanel textarea{resize:none;width:100%}.GeoGebraFrame .GeoGebraImagePanel{height:100%}.GeoGebraFrame .AutoCompleteTextFieldW input{width:100%}.GeoGebraFrame .AutoCompleteTextFieldW button{visibility:hidden;position:absolute;float:right;right:0px;opacity:1;margin-left:8px}.GeoGebraFrame .AutoCompleteTextFieldW button img{opacity:.54;transition:opacity .3s ease}.GeoGebraFrame .AutoCompleteTextFieldW button img:hover,.GeoGebraFrame .AutoCompleteTextFieldW button img:active{opacity:1}.GeoGebraFrame .AutoCompleteTextFieldW.kbdInput input[type=text].gwt-SuggestBox{width:calc(100% - 32px) !important;border:0px}.GeoGebraFrame .AutoCompleteTextFieldW.kbdInput .cursorOverlay{width:calc(100% - 32px) !important}.GeoGebraFrame .AutoCompleteTextFieldW.kbdInput button{visibility:visible}.GeoGebraFrame .AutoCompleteTextFieldW.noKeyboard input[type=text].gwt-SuggestBox{border:0px}.GeoGebraFrame .AutoCompleteTextFieldW.noKeyboard input{border:0px}.GeoGebraFrame .AutoCompleteTextFieldW.FromDrawTextFieldNew .fieldContainer{border:2px solid;border-radius:5px}.GeoGebraFrame .AutoCompleteTextFieldW.FromDrawTextFieldNew.errorStyle .fieldContainer{background-color:#f1d1d7;border:2px dashed #ce5c71}.GeoGebraFrame .AutoCompleteTextFieldW.FromDrawTextFieldNew input,.GeoGebraFrame .AutoCompleteTextFieldW.FromDrawTextFieldNew .cursorOverlay{background-color:rgba(0,0,0,0);line-height:26px}.GeoGebraFrame .AutoCompleteTextFieldW.FromDrawTextFieldNew button{top:50%;transform:translate(-50%, -50%)}.GeoGebraFrame .gwt-Button,.GeoGebraFrame .buttonPanel .button,.GeoGebraFrame .headerbar .headerSecond .signInButton,.GeoGebraFrame .gwt-DialogBox .gwt-Button,.GeoGebraFrame .inputHelp-detailPanelTitle .button,.GeoGebraFrame .optionsPopup .gwt-Button,.GeoGebraFrame .customizeToolbarButtonPanel .button,.GeoGebraFrame .buttonSpreadsheet{border-radius:5px;border:1px solid #6161ff;color:#6161ff;background:none;font-size:110%;padding:4px 15px;box-shadow:inset 0 1px 1px rgba(255,255,255,.65),0 0 2px rgba(204,204,204,.5);cursor:pointer;margin-left:5px;min-height:0}.GeoGebraFrame .gwt-Button.downloadBtn,.GeoGebraFrame .buttonPanel .button.downloadBtn,.GeoGebraFrame .headerbar .headerSecond .signInButton.downloadBtn,.GeoGebraFrame .gwt-DialogBox .gwt-Button.downloadBtn,.GeoGebraFrame .inputHelp-detailPanelTitle .button.downloadBtn,.GeoGebraFrame .optionsPopup .gwt-Button.downloadBtn,.GeoGebraFrame .customizeToolbarButtonPanel .button.downloadBtn,.GeoGebraFrame .buttonSpreadsheet.downloadBtn{float:right;width:64px} diff --git a/etc/deps/GeoGebra/HTML5/5.0/webSimple/5F2C6F84737382D2A3B062804F6250CE.cache.js b/etc/deps/GeoGebra/HTML5/5.0/webSimple/5F2C6F84737382D2A3B062804F6250CE.cache.js new file mode 100644 index 0000000..6058892 --- /dev/null +++ b/etc/deps/GeoGebra/HTML5/5.0/webSimple/5F2C6F84737382D2A3B062804F6250CE.cache.js @@ -0,0 +1,14231 @@ +var $wnd = $wnd || window.parent;var __gwtModuleFunction = $wnd.webSimple;var $sendStats = __gwtModuleFunction.__sendStats;$sendStats('moduleStartup', 'moduleEvalStart');var $gwt_version = "2.10.0";var $strongName = '5F2C6F84737382D2A3B062804F6250CE';var $gwt = {};var $doc = $wnd.document;var $moduleName, $moduleBase;function __gwtStartLoadingFragment(frag) {var fragFile = 'deferredjs/' + $strongName + '/' + frag + '.cache.js';return __gwtModuleFunction.__startLoadingFragment(fragFile);}function __gwtInstallCode(code) {return __gwtModuleFunction.__installRunAsyncCode(code);}function __gwt_isKnownPropertyValue(propName, propValue) {return __gwtModuleFunction.__gwt_isKnownPropertyValue(propName, propValue);}function __gwt_getMetaProperty(name) {return __gwtModuleFunction.__gwt_getMetaProperty(name);}var $stats = $wnd.__gwtStatsEvent ? function(a) {return $wnd.__gwtStatsEvent && $wnd.__gwtStatsEvent(a);} : null;var $sessionId = $wnd.__gwtStatsSessionId ? $wnd.__gwtStatsSessionId : null;function Ub(){} +function ce(){} +function Md(){} +function Xd(){} +function Cqb(){} +function xqb(){} +function Qqb(){} +function frb(){} +function lrb(){} +function nrb(){} +function prb(){} +function jtb(){} +function mub(){} +function Lwb(){} +function NAb(){} +function ICb(){} +function fDb(){} +function iEb(){} +function uEb(){} +function vEb(){} +function wEb(){} +function xEb(){} +function zEb(){} +function AEb(){} +function BEb(){} +function CEb(){} +function DEb(){} +function EEb(){} +function FEb(){} +function GEb(){} +function HEb(){} +function IEb(){} +function JEb(){} +function KEb(){} +function LEb(){} +function MEb(){} +function NEb(){} +function OEb(){} +function PEb(){} +function QEb(){} +function REb(){} +function SEb(){} +function TEb(){} +function UEb(){} +function VEb(){} +function WEb(){} +function XEb(){} +function YEb(){} +function ZEb(){} +function $Eb(){} +function _Eb(){} +function aFb(){} +function bFb(){} +function cFb(){} +function dFb(){} +function eFb(){} +function fFb(){} +function gFb(){} +function hFb(){} +function iFb(){} +function jFb(){} +function kFb(){} +function lFb(){} +function mFb(){} +function nFb(){} +function oFb(){} +function pFb(){} +function qFb(){} +function rFb(){} +function sFb(){} +function tFb(){} +function uFb(){} +function vFb(){} +function wFb(){} +function xFb(){} +function yFb(){} +function zFb(){} +function AFb(){} +function BFb(){} +function CFb(){} +function DFb(){} +function EFb(){} +function FFb(){} +function GFb(){} +function HFb(){} +function IFb(){} +function JFb(){} +function KFb(){} +function LFb(){} +function MFb(){} +function NFb(){} +function OFb(){} +function PFb(){} +function QFb(){} +function RFb(){} +function SFb(){} +function TFb(){} +function UFb(){} +function VFb(){} +function WFb(){} +function XFb(){} +function YFb(){} +function ZFb(){} +function $Fb(){} +function _Fb(){} +function aGb(){} +function bGb(){} +function cGb(){} +function dGb(){} +function eGb(){} +function fGb(){} +function gGb(){} +function hGb(){} +function iGb(){} +function jGb(){} +function kGb(){} +function lGb(){} +function mGb(){} +function nGb(){} +function oGb(){} +function pGb(){} +function qGb(){} +function rGb(){} +function sGb(){} +function tGb(){} +function uGb(){} +function vGb(){} +function wGb(){} +function xGb(){} +function yGb(){} +function zGb(){} +function AGb(){} +function lLb(){} +function aSb(){} +function bSb(){} +function cSb(){} +function dSb(){} +function eSb(){} +function fSb(){} +function gSb(){} +function hSb(){} +function iSb(){} +function jSb(){} +function kSb(){} +function lSb(){} +function mSb(){} +function nSb(){} +function oSb(){} +function pSb(){} +function qSb(){} +function rSb(){} +function uSb(){} +function vSb(){} +function wSb(){} +function xSb(){} +function BSb(){} +function CSb(){} +function DSb(){} +function ESb(){} +function FSb(){} +function GSb(){} +function HSb(){} +function ISb(){} +function JSb(){} +function KSb(){} +function MSb(){} +function USb(){} +function VSb(){} +function XSb(){} +function YSb(){} +function ZSb(){} +function $Sb(){} +function _Sb(){} +function aTb(){} +function bTb(){} +function cTb(){} +function wTb(){} +function xTb(){} +function yTb(){} +function CTb(){} +function DTb(){} +function ETb(){} +function FTb(){} +function GTb(){} +function HTb(){} +function ITb(){} +function JTb(){} +function KTb(){} +function LTb(){} +function NTb(){} +function OTb(){} +function PTb(){} +function QTb(){} +function RTb(){} +function STb(){} +function TTb(){} +function UTb(){} +function VTb(){} +function WTb(){} +function XTb(){} +function YTb(){} +function ZTb(){} +function $Tb(){} +function _Tb(){} +function aUb(){} +function bUb(){} +function cUb(){} +function eUb(){} +function fUb(){} +function gUb(){} +function hUb(){} +function iUb(){} +function jUb(){} +function kUb(){} +function lUb(){} +function mUb(){} +function nUb(){} +function oUb(){} +function pUb(){} +function qUb(){} +function rUb(){} +function sUb(){} +function tUb(){} +function uUb(){} +function vUb(){} +function wUb(){} +function xUb(){} +function yUb(){} +function zUb(){} +function AUb(){} +function BUb(){} +function EUb(){} +function FUb(){} +function GUb(){} +function HUb(){} +function IUb(){} +function JUb(){} +function KUb(){} +function LUb(){} +function MUb(){} +function RUb(){} +function SUb(){} +function TUb(){} +function UUb(){} +function VUb(){} +function WUb(){} +function XUb(){} +function YUb(){} +function ZUb(){} +function $Ub(){} +function _Ub(){} +function bVb(){} +function cVb(){} +function dVb(){} +function eVb(){} +function fVb(){} +function gVb(){} +function hVb(){} +function iVb(){} +function jVb(){} +function kVb(){} +function lVb(){} +function mVb(){} +function nVb(){} +function oVb(){} +function tVb(){} +function uVb(){} +function vVb(){} +function wVb(){} +function xVb(){} +function yVb(){} +function zVb(){} +function AVb(){} +function BVb(){} +function CVb(){} +function DVb(){} +function EVb(){} +function FVb(){} +function GVb(){} +function HVb(){} +function IVb(){} +function JVb(){} +function KVb(){} +function LVb(){} +function MVb(){} +function OVb(){} +function QVb(){} +function RVb(){} +function SVb(){} +function TVb(){} +function UVb(){} +function VVb(){} +function WVb(){} +function XVb(){} +function YVb(){} +function ZVb(){} +function $Vb(){} +function aWb(){} +function cWb(){} +function dWb(){} +function eWb(){} +function fWb(){} +function gWb(){} +function hWb(){} +function iWb(){} +function jWb(){} +function kWb(){} +function lWb(){} +function mWb(){} +function nWb(){} +function oWb(){} +function pWb(){} +function qWb(){} +function rWb(){} +function sWb(){} +function tWb(){} +function uWb(){} +function vWb(){} +function yWb(){} +function zWb(){} +function AWb(){} +function BWb(){} +function CWb(){} +function DWb(){} +function EWb(){} +function FWb(){} +function GWb(){} +function HWb(){} +function IWb(){} +function JWb(){} +function KWb(){} +function LWb(){} +function MWb(){} +function NWb(){} +function OWb(){} +function PWb(){} +function QWb(){} +function RWb(){} +function SWb(){} +function TWb(){} +function UWb(){} +function gZb(){} +function nZb(){} +function oZb(){} +function QZb(){} +function VZb(){} +function y$b(){} +function v_b(){} +function w_b(){} +function R_b(){} +function S_b(){} +function T_b(){} +function B1b(){} +function Bcc(){} +function wcc(){} +function Ccc(){} +function Dcc(){} +function chc(){} +function fac(){} +function jac(){} +function sac(){} +function vac(){} +function Qac(){} +function Rac(){} +function tbc(){} +function rec(){} +function Uec(){} +function Yec(){} +function ufc(){} +function Dfc(){} +function Efc(){} +function Ffc(){} +function Lgc(){} +function Mgc(){} +function Ngc(){} +function Ogc(){} +function ahc(){} +function aGc(){} +function bGc(){} +function cGc(){} +function czc(){} +function ezc(){} +function fzc(){} +function fGc(){} +function rmc(){} +function dtc(){} +function mtc(){} +function XAc(){} +function XFc(){} +function VFc(){} +function CMc(){} +function DMc(){} +function PSc(){} +function PZc(){} +function NZc(){} +function OZc(){} +function SZc(){} +function TZc(){} +function UZc(){} +function VZc(){} +function qTc(){} +function oUc(){} +function tUc(){} +function vUc(){} +function p$c(){} +function E1c(){} +function P3c(){} +function Q3c(){} +function R3c(){} +function S3c(){} +function H5c(){} +function y6c(){} +function U7c(){} +function W7c(){} +function Dad(){} +function fdd(){} +function Hed(){} +function skd(){} +function Ykd(){} +function Ysd(){} +function Nsd(){} +function Xsd(){} +function bnd(){} +function Rnd(){} +function _nd(){} +function _3d(){} +function cod(){} +function c4d(){} +function a4d(){} +function b4d(){} +function e4d(){} +function u4d(){} +function x4d(){} +function $4d(){} +function Gtd(){} +function K0d(){} +function s5d(){} +function R5d(){} +function Q8d(){} +function S8d(){} +function W9d(){} +function Wee(){} +function iee(){} +function kee(){} +function lee(){} +function mee(){} +function Mbe(){} +function Nbe(){} +function Vbe(){} +function $be(){} +function xde(){} +function gfe(){} +function Ofe(){} +function Pfe(){} +function ghe(){} +function Ghe(){} +function Mhe(){} +function Rhe(){} +function Vhe(){} +function Zhe(){} +function bie(){} +function fie(){} +function jie(){} +function nie(){} +function tie(){} +function Hie(){} +function Mie(){} +function Pie(){} +function Tie(){} +function Wie(){} +function bje(){} +function gje(){} +function oje(){} +function sje(){} +function tje(){} +function bke(){} +function Hke(){} +function Ike(){} +function Jke(){} +function Kke(){} +function Lke(){} +function Nke(){} +function Oke(){} +function $ke(){} +function _ke(){} +function ale(){} +function ble(){} +function cle(){} +function dle(){} +function ele(){} +function wue(){} +function Mxe(){} +function WJe(){} +function HLe(){} +function cQe(){} +function dQe(){} +function fQe(){} +function bUe(){} +function p$e(){} +function q$e(){} +function y_e(){} +function m1e(){} +function P3e(){} +function U4e(){} +function Uaf(){} +function Jaf(){} +function aef(){} +function agf(){} +function bgf(){} +function egf(){} +function ekf(){} +function dkf(){} +function lmf(){} +function frf(){} +function Rtf(){} +function awf(){} +function bwf(){} +function gOf(){} +function pOf(){} +function DQf(){} +function MUf(){} +function NUf(){} +function OUf(){} +function AVf(){} +function AZf(){} +function H_f(){} +function j6f(){} +function n6f(){} +function o6f(){} +function p6f(){} +function q6f(){} +function r6f(){} +function fcg(){} +function Eeg(){} +function $ig(){} +function _ig(){} +function $jg(){} +function vkg(){} +function Bkg(){} +function Hkg(){} +function Bqg(){} +function lrg(){} +function Wrg(){} +function hsg(){} +function otg(){} +function ytg(){} +function ywg(){} +function twg(){} +function uwg(){} +function vwg(){} +function wwg(){} +function xwg(){} +function dug(){} +function jvg(){} +function Exg(){} +function Txg(){} +function Hzg(){} +function RAg(){} +function bBg(){} +function fBg(){} +function iBg(){} +function YBg(){} +function _Bg(){} +function dCg(){} +function aDg(){} +function xEg(){} +function JFg(){} +function HGg(){} +function MGg(){} +function OGg(){} +function CHg(){} +function QHg(){} +function RHg(){} +function nIg(){} +function EIg(){} +function iJg(){} +function zJg(){} +function yNg(){} +function FNg(){} +function YNg(){} +function ZNg(){} +function iPg(){} +function jPg(){} +function KPg(){} +function KTg(){} +function wTg(){} +function DTg(){} +function FTg(){} +function ITg(){} +function JTg(){} +function LTg(){} +function OTg(){} +function VTg(){} +function VVg(){} +function eVg(){} +function tVg(){} +function BVg(){} +function WVg(){} +function _Vg(){} +function MQg(){} +function rSg(){} +function UUg(){} +function tWg(){} +function L_g(){} +function O_g(){} +function T_g(){} +function Z_g(){} +function a0g(){} +function d0g(){} +function g0g(){} +function j0g(){} +function m0g(){} +function p0g(){} +function s0g(){} +function v0g(){} +function X0g(){} +function r1g(){} +function t1g(){} +function e2g(){} +function f2g(){} +function g2g(){} +function h2g(){} +function i2g(){} +function j2g(){} +function k2g(){} +function l2g(){} +function m2g(){} +function n2g(){} +function o2g(){} +function p2g(){} +function q2g(){} +function r2g(){} +function t2g(){} +function u2g(){} +function v2g(){} +function w2g(){} +function x2g(){} +function y2g(){} +function z2g(){} +function A2g(){} +function B2g(){} +function C2g(){} +function D2g(){} +function E2g(){} +function F2g(){} +function G2g(){} +function H2g(){} +function I2g(){} +function J2g(){} +function K2g(){} +function L2g(){} +function M2g(){} +function N2g(){} +function O2g(){} +function P2g(){} +function Q2g(){} +function R2g(){} +function S2g(){} +function T2g(){} +function U2g(){} +function V2g(){} +function W2g(){} +function X2g(){} +function Y2g(){} +function Z2g(){} +function $2g(){} +function _2g(){} +function e3g(){} +function l3g(){} +function m3g(){} +function w3g(){} +function d4g(){} +function _Oh(){} +function FAb(a){} +function GAb(a){} +function tKb(a){} +function nLb(a){} +function qLb(a){} +function INb(a){} +function Iuc(a){} +function mug(a){} +function Wjd(a){} +function vsd(a){} +function X9d(a){} +function _be(a){} +function qde(a){} +function NIe(a){} +function Oef(a){} +function oNh(a){} +function aPh(a,b){} +function bRb(){aRb()} +function dvb(){cvb()} +function pxb(){fxb()} +function fTb(){eTb()} +function CZb(){BZb()} +function ded(){Ydd()} +function _d(a){$d()} +function RVf(){mac()} +function qhg(){mhg()} +function Zfg(){Yfg()} +function isg(){asg()} +function jsg(){asg()} +function ksg(){asg()} +function lsg(){asg()} +function msg(){asg()} +function nsg(){asg()} +function R1g(){x0g()} +function ztg(){Bad()} +function KOh(){zac()} +function VOh(a){ggc()} +function GNh(a,b,c){} +function GXf(a){a.a=0} +function Ykg(a){Xkg=a} +function qlg(a){jlg=a} +function Ec(a){this.c=a} +function Cd(a){this.a=a} +function Rd(a){this.a=a} +function Sd(a){this.a=a} +function Yd(a){this.a=a} +function ge(a){this.a=a} +function Oqb(a,b){a.a=b} +function Iub(a,b){a.b=b} +function Jub(a,b){a.c=b} +function Kub(a,b){a.d=b} +function xAb(a,b){a.e=b} +function MAb(a,b){a.j=b} +function iCb(a,b){a.o=b} +function jCb(a,b){a.q=b} +function kCb(a,b){a.s=b} +function wNb(a,b){a.f=b} +function xNb(a,b){a.i=b} +function qQb(a,b){a.r=b} +function aoc(a,b){a.f=b} +function btc(a,b){a.e=b} +function bwc(a,b){a.Y=b} +function ewc(a,b){a.Z=b} +function REc(a,b){a.O=b} +function RLc(a,b){a.d=b} +function XOc(a,b){a.A=b} +function fPc(a,b){a.L=b} +function kPc(a,b){a._=b} +function hVc(a,b){a.u=b} +function iVc(a,b){a.v=b} +function zVc(a,b){a.p=b} +function zWc(a,b){a.P=b} +function $2c(a,b){a.g=b} +function c3c(a,b){a.k=b} +function jkd(a,b){a.n=b} +function Amd(a,b){a.X=b} +function Cmd(a,b){a.$=b} +function Iqd(a,b){a.Q=b} +function Nqd(a,b){a.K=b} +function tHd(a,b){a.F=b} +function EHd(a,b){a.g=b} +function THd(a,b){a.B=b} +function WHd(a,b){a.D=b} +function tPd(a){a.a=100} +function G4c(a){a.c=a.d} +function wc(){wc=xqb} +function EVf(){new Xbc} +function FVf(){new occ} +function iQg(){new n9b} +function dZb(){ZYb(XYb)} +function eZb(){$Yb(XYb)} +function fZb(){_Yb(XYb)} +function CSc(){this.b=2} +function E3d(){this.c=0} +function Fae(a,b){a.n=b} +function hXe(a,b){a.n=b} +function Sce(a,b){a.k=b} +function S2e(a,b){a.c=b} +function V2e(a,b){a.k=b} +function AOe(a,b){a.w=b} +function CPe(a,b){a.H=b} +function C0e(a,b){a.I=b} +function _Ze(a,b){a.I=b} +function zUe(a,b){a.e=b} +function XVe(a,b){a.r=b} +function a$e(a,b){a.L=b} +function y$e(a,b){a.j=b} +function yPf(a,b){a.V=b} +function YWf(a,b){a.t=b} +function jXf(a,b){a.J=b} +function sXf(a,b){a.W=b} +function Yxg(a,b){a.C=b} +function jMg(a,b){a.G=b} +function cCg(){this.a=5} +function Cub(a){this.a=a} +function Hwb(){this.a=''} +function Kwb(a){this.a=a} +function IVh(){++this.c} +function ZOh(){return 0} +function RPh(){return 5} +function $Ph(){return 9} +function eQh(){return 1} +function EQh(){return 2} +function SQh(){return 8} +function cRh(){return 4} +function sSh(){return 3} +function sSb(a){this.a=a} +function ASb(a){this.a=a} +function QSb(a){this.a=a} +function RSb(a){this.a=a} +function SSb(a){this.a=a} +function TSb(a){this.a=a} +function WSb(a){this.a=a} +function WGb(a){this.a=a} +function NGb(a){this.a=a} +function VHb(a){this.a=a} +function dKb(a){this.a=a} +function DUb(a){this.a=a} +function _Vb(a){this.a=a} +function bWb(a){this.a=a} +function aYb(a){this.a=a} +function fYb(a){this.a=a} +function u$b(a){this.a=a} +function S$b(a){this.a=a} +function P1b(a){this.a=a} +function E1b(a){this.b=a} +function wOb(a){this.e=a} +function j2b(a){this.a=a} +function q3b(a){this.a=a} +function z3b(a){this.a=a} +function Z7b(a){this.a=a} +function l8b(a){this.a=a} +function m8b(a){this.a=a} +function n8b(a){this.a=a} +function o8b(a){this.a=a} +function A8b(a){this.a=a} +function B8b(a){this.a=a} +function g8b(a){this.d=a} +function z8b(a){this.b=a} +function t9b(a){this.c=a} +function rac(a){this.a=a} +function wac(a){this.a=a} +function Jac(a){this.a=a} +function Sac(a){this.a=a} +function yac(a){this.b=a} +function Aac(a){this.b=a} +function gbc(a){this.a=a} +function bcc(a){this.a=a} +function jdc(a){this.a=a} +function kdc(a){this.a=a} +function ldc(a){this.a=a} +function mdc(a){this.a=a} +function Rec(a){this.a=a} +function Tec(a){this.a=a} +function Vec(a){this.a=a} +function dgc(a){this.a=a} +function zgc(a){this.a=a} +function Bic(a){this.a=a} +function Jmc(a){this.a=a} +function Imc(a){this.c=a} +function Snc(a){this.a=a} +function Ypc(a){this.a=a} +function Cxc(a){this.a=a} +function zyc(a){this.a=a} +function Xyc(a){this.a=a} +function fAc(a){this.a=a} +function rAc(a){this.a=a} +function Ewc(a){this.b=a} +function yzc(a){this.c=a} +function Mzc(a){this.f=a} +function WFc(a){this.a=a} +function gGc(a){this.a=a} +function $Gc(a){this.a=a} +function rvc(a,b){a.Lc=b} +function GAc(a,b){a.Lb=b} +function HAc(a,b){a.yb=b} +function gwc(a,b){a.cb=b} +function XEc(a,b){a.rb=b} +function hKc(a,b){a.rb=b} +function aKc(a,b){a.hb=b} +function jKc(a,b){a.vb=b} +function mKc(a,b){a.xb=b} +function rKc(a,b){a.Vb=b} +function tKc(a,b){a.Db=b} +function uKc(a,b){a.Eb=b} +function zKc(a,b){a.Jb=b} +function CKc(a,b){a.Mb=b} +function FKc(a,b){a.Qb=b} +function GKc(a,b){a.Rb=b} +function IKc(a,b){a.Tb=b} +function WKc(a,b){a.lb=b} +function VKc(a,b){a.lc=b} +function NKc(a,b){a.ac=b} +function PKc(a,b){a.dc=b} +function RKc(a,b){a.fc=b} +function XKc(a,b){a.nc=b} +function aLc(a,b){a.sc=b} +function cLc(a,b){a.uc=b} +function eLc(a,b){a.Cc=b} +function nPc(a,b){a.gb=b} +function pPc(a,b){a.pb=b} +function qPc(a,b){a.qb=b} +function sPc(a,b){a.sb=b} +function xPc(a,b){a.zb=b} +function APc(a,b){a.Ob=b} +function HPc(a,b){a.cc=b} +function KPc(a,b){a.gc=b} +function LPc(a,b){a.kc=b} +function NPc(a,b){a.mc=b} +function RCb(a,b){a.u+=b} +function BRb(a,b){a.b+=b} +function cRc(a){this.a=a} +function SRc(a){this.a=a} +function QQc(a){this.a=a} +function QZc(a){this.a=a} +function RZc(a){this.a=a} +function WZc(a){this.a=a} +function XZc(a){this.a=a} +function dTc(a){this.a=a} +function ATc(a){this.a=a} +function uVc(a){this.a=a} +function PXc(a){this.a=a} +function BYc(a){this.a=a} +function DYc(a){this.a=a} +function GYc(a){this.b=a} +function x0c(a){this.b=a} +function d0c(a){this.a=a} +function q$c(a){this.a=a} +function T3c(a){this.a=a} +function p6c(a){this.a=a} +function p8c(a){this.a=a} +function e7c(a){this.a=a} +function m7c(a){this.a=a} +function Y7c(a){this.a=a} +function L4c(a){this.b=a} +function vcd(a){this.a=a} +function Scd(a){this.a=a} +function Tcd(a){this.a=a} +function Mgd(a){this.a=a} +function Ngd(a){this.a=a} +function njd(a){this.a=a} +function Ejd(a){this.a=a} +function dnd(a){this.a=a} +function qrd(a){this.a=a} +function jud(a){this.a=a} +function PFd(a){this.a=a} +function vQd(a){this.a=a} +function wQd(a){this.a=a} +function pRd(a){this.a=a} +function fSd(a){this.a=a} +function kSd(a){this.a=a} +function ISd(a){this.a=a} +function VSd(a){this.a=a} +function jTd(a){this.a=a} +function CZd(a){this.a=a} +function DZd(a){this.a=a} +function EZd(a){this.a=a} +function WZd(a){this.a=a} +function XZd(a){this.a=a} +function YZd(a){this.a=a} +function l0d(a){this.a=a} +function i3d(a){this.a=a} +function o3d(a){this.a=a} +function Z4d(a){this.a=a} +function msd(a){this.t=a} +function Tbe(a){this.a=a} +function Iie(a){this.a=a} +function pje(a){this.a=a} +function qje(a){this.a=a} +function rje(a){this.a=a} +function $je(a){this.a=a} +function eke(a){this.a=a} +function Gke(a){this.a=a} +function Zke(a){this.a=a} +function Dqe(a){this.a=a} +function Gqe(a){this.b=a} +function pse(a){this.a=a} +function qse(a){this.a=a} +function Tte(a){this.a=a} +function Vte(a){this.a=a} +function xue(a){this.a=a} +function Pwe(a){this.a=a} +function NJe(a){this.a=a} +function RJe(a){this.a=a} +function YJe(a){this.a=a} +function Zxe(a){a.a=null} +function pMe(a,b){a.n*=b} +function oMe(a,b){a.p*=b} +function OUe(a,b){a.s*=b} +function Oqd(a,b){a.eb=b} +function Rqd(a,b){a.ib=b} +function Sqd(a,b){a.kb=b} +function v_c(a,b){a.Ib=b} +function z0e(a,b){a.Cc=b} +function dWe(a){a.c=!a.c} +function JWe(a){this.a=a} +function KSe(a){this.a=a} +function LSe(a){this.a=a} +function e_e(a){this.a=a} +function R3e(a){this.a=a} +function S3e(a){this.a=a} +function D6e(a){this.b=a} +function taf(a){this.a=a} +function Kcf(a){this.a=a} +function Ucf(a){this.a=a} +function Uhf(a){this.a=a} +function Dhf(a){this.a=a} +function Thf(a){this.a=a} +function Vhf(a){this.a=a} +function Nef(a){this.a=a} +function Hff(a){this.a=a} +function yff(a){this.d=a} +function Bif(a){this.a=a} +function Xif(a){this.a=a} +function Yif(a){this.a=a} +function Zif(a){this.a=a} +function $if(a){this.a=a} +function _if(a){this.a=a} +function gjf(a){this.a=a} +function hjf(a){this.a=a} +function rmf(a){this.a=a} +function uQf(a){this.a=a} +function GQf(a){this.a=a} +function BZf(a){this.a=a} +function FZf(a){this.a=a} +function KZf(a){this.a=a} +function i$f(a){this.a=a} +function B$f(a){this.b=a} +function f_f(){this.a=''} +function o3f(a){this.a=a} +function k6f(a){this.a=a} +function l6f(a){this.a=a} +function m6f(a){this.a=a} +function s6f(a){this.a=a} +function t6f(a){this.a=a} +function u6f(a){this.a=a} +function v6f(a){this.a=a} +function w6f(a){this.a=a} +function x6f(a){this.a=a} +function y6f(a){this.a=a} +function z6f(a){this.a=a} +function A6f(a){this.a=a} +function C6f(a){this.a=a} +function J6f(a){this.a=a} +function M6f(a){this.a=a} +function O6f(a){this.a=a} +function P6f(a){this.b=a} +function Ecg(a){this.a=a} +function ppg(a){this.i=a} +function rrg(a){this.c=a} +function zsg(a){this.F=a} +function mtg(a){this.a=a} +function ntg(a){this.a=a} +function qtg(a){this.a=a} +function Itg(a){this.a=a} +function Ztg(a){this.a=a} +function $tg(a){this.a=a} +function _tg(a){this.a=a} +function aug(a){this.a=a} +function bug(a){this.a=a} +function cug(a){this.a=a} +function lug(a){this.a=a} +function svg(a){this.a=a} +function Fxg(a){this.a=a} +function Oyg(a){this.a=a} +function Izg(a){this.a=a} +function Lzg(a){this.a=a} +function Mzg(a){this.a=a} +function Ozg(a){this.a=a} +function aAg(a){this.a=a} +function bAg(a){this.a=a} +function yAg(a){this.a=a} +function AAg(a){this.a=a} +function BAg(a){this.a=a} +function HAg(a){this.C=a} +function VAg(a){this.a=a} +function _Ag(a){this.b=a} +function aBg(a){this.a=a} +function pBg(a){this.b=a} +function rBg(a){this.a=a} +function ABg(a){this.a=a} +function LCg(a){this.a=a} +function PDg(a){this.a=a} +function QDg(a){this.a=a} +function RDg(a){this.a=a} +function SDg(a){this.a=a} +function OEg(a){this.a=a} +function TEg(a){this.a=a} +function aFg(a){this.a=a} +function BFg(a){this.a=a} +function CFg(a){this.a=a} +function GGg(a){this.a=a} +function dHg(a){this.C=a} +function VHg(a){this.a=a} +function WHg(a){this.a=a} +function gIg(a){this.a=a} +function HIg(a){this.a=a} +function KIg(a){this.a=a} +function ZIg(a){this.a=a} +function $Ig(a){this.a=a} +function aJg(a){this.a=a} +function uJg(a){this.a=a} +function ZJg(a){this.a=a} +function $Jg(a){this.a=a} +function _Jg(a){this.a=a} +function aKg(a){this.a=a} +function bKg(a){this.a=a} +function gKg(a){this.a=a} +function nKg(a){this.a=a} +function vKg(a){this.a=a} +function DKg(a){this.a=a} +function EKg(a){this.a=a} +function FKg(a){this.a=a} +function GKg(a){this.a=a} +function HKg(a){this.a=a} +function IKg(a){this.a=a} +function kMg(a,b){a.Ab=b} +function BPf(a,b){a.mb=b} +function MPf(a,b){a.nb=b} +function SPf(a,b){a.Hb=b} +function $Pf(a,b){a.Yb=b} +function bQf(a,b){a._b=b} +function e6e(a,b){a.Cc=b} +function vMg(a){this.a=a} +function xMg(a){this.a=a} +function BMg(a){this.a=a} +function CMg(a){this.a=a} +function EMg(a){this.a=a} +function FMg(a){this.a=a} +function GMg(a){this.a=a} +function NMg(a){this.a=a} +function NNg(a){this.a=a} +function zNg(a){this.a=a} +function ANg(a){this.a=a} +function MNg(a){this.a=a} +function UNg(a){this.a=a} +function VNg(a){this.a=a} +function $Ng(a){this.a=a} +function hPg(a){this.a=a} +function mPg(a){this.a=a} +function nPg(a){this.a=a} +function JPg(a){this.a=a} +function OPg(a){this.a=a} +function RPg(a){this.a=a} +function SPg(a){this.a=a} +function gQg(a){this.a=a} +function sQg(a){this.a=a} +function tQg(a){this.a=a} +function tSg(a){this.a=a} +function xSg(a){this.a=a} +function WSg(a){this.a=a} +function lRg(a){this.a=a} +function mRg(a){this.a=a} +function mTg(a){this.a=a} +function HTg(a){this.a=a} +function MTg(a){this.a=a} +function MUg(a){this.a=a} +function DUg(a){this.a=a} +function EUg(a){this.a=a} +function FUg(a){this.a=a} +function HUg(a){this.a=a} +function OUg(a){this.a=a} +function WUg(a){this.a=a} +function uVg(a){this.a=a} +function DVg(a){this.a=a} +function YVg(a){this.a=a} +function aWg(a){this.a=a} +function bWg(a){this.a=a} +function iWg(a){this.a=a} +function yWg(a){this.a=a} +function zWg(a){this.a=a} +function AWg(a){this.a=a} +function A0g(a){this.a=a} +function Y0g(a){this.a=a} +function u1g(a){this.a=a} +function v1g(a){this.a=a} +function z3g(a){this.a=a} +function J3g(a){this.a=a} +function i4g(a){this.a=a} +function u4g(a){this.a=a} +function E4g(a){this.c=a} +function cOg(a){this.c=a} +function eWg(a){this.C=a} +function tOh(a){return a} +function PPh(a){return 0} +function lQh(){return 10} +function _Qh(){return 19} +function aQh(){return 49} +function YQh(){return 47} +function xQh(){return 38} +function DQh(){return 61} +function bRh(){return -1} +function hRh(){return 44} +function jRh(){return 65} +function kRh(){return 16} +function tRh(){return 18} +function BRh(){return 13} +function CRh(){return 17} +function IRh(){return 37} +function wRh(){return 32} +function ERh(){return 31} +function lRh(){Wvc(this)} +function QPh(){Uvc(this)} +function JSh(){QJc(this)} +function vOh(){f8b(this)} +function n9b(){X8b(this)} +function cEb(){aEb(this)} +function kkd(){Wjd(this)} +function DSh(a){this.k=a} +function WSh(a){this.s=a} +function XSh(a){this.v=a} +function hTh(a){this.b=a} +function oTh(a){this.j=a} +function yTh(a){this.t=a} +function zTh(a){this.D=a} +function OTh(a){this.c=a} +function sUh(a){this.w=a} +function wUh(a){this.a=a} +function EUh(a){this.o=a} +function kVh(a){this.e=a} +function gVh(){this.Cc=5} +function prd(){this.a=koh} +function jRd(a){a.b=false} +function mWd(a){a.j=false} +function arg(a){a.c=a.b=0} +function GTh(){return 50} +function _Sh(){return 58} +function oVh(){return 42} +function PVh(){return ''} +function XVh(){return 15} +function HPh(){return -10} +function kTh(){return 100} +function KSh(){return X4g} +function vUh(){return k9g} +function iWh(){return o9g} +function jWh(){return p9g} +function kWh(){return J_g} +function lWh(){return M_g} +function mWh(){return R_g} +function nWh(){return X_g} +function oWh(){return $_g} +function pWh(){return b0g} +function qWh(){return e0g} +function rWh(){return h0g} +function sWh(){return k0g} +function tWh(){return n0g} +function uWh(){return q0g} +function vWh(){return t0g} +function yWh(){return N1g} +function mSh(a){return ''} +function hNh(a){null.pD()} +function UOh(a){Hfc(this)} +function dWh(a){uNg(this)} +function cWh(){uNg(this)} +function BVh(){Gqg(this)} +function TVg(){this.a=VHh} +function kJe(){this.a=null} +function FPh(a){this.xb=a} +function DHg(){this.a=null} +function cqg(){_pg(this,0)} +function plg(a){llg(jlg,a)} +function I4f(a,b){s5f(b,a)} +function A4e(a,b){z4e(a,b)} +function Ahc(a,b){yhc(a,b)} +function VNe(a,b){b.Ey(a)} +function Qyc(a,b){a.j=b.Nb} +function Vgc(a,b){a.push(b)} +function Zgc(a,b){a.sort(b)} +function mVh(a,b){return b} +function iNh(){return this} +function sNh(){return true} +function xNh(){return null} +function JPh(){return ':='} +function ehc(){return ++bhc} +function Dhc(a,b,c){a[b]=c} +function CDc(a,b){b||SBc(a)} +function OJc(a){bqd(a.Mc,a)} +function MJc(a){Mpd(a.Mc,a)} +function NJc(a){Vpd(a.Mc,a)} +function Rmc(a){Nmc(this,a)} +function lc(){ic.call(this)} +function Xc(a){a.b=0;a.c=0} +function qIb(a){a.b=new n9b} +function IJb(a){a.a=new n9b} +function h7e(a){a.c=new h5b} +function Gxd(a){a.p=new l4d} +function dpg(a){a.c=0;a.a=0} +function Lyg(a){a.d=0;a.c=0} +function Cad(a){Bad();Aad=a} +function VUg(a,b){Ad(a.a,b)} +function q0c(a,b){b.Dh(a.a)} +function f7c(a,b){b.th(a.a)} +function hLc(a,b){a.Hc=b.Hc} +function iLc(a,b){a.Ic=b.Ic} +function hWg(a){var b=hc(a)} +function uOh(a){Qbc(this,a)} +function QOh(a){ndc(this,a)} +function ROh(a){idc(this,a)} +function tPh(a){oWc(this,a)} +function uPh(a){OWc(this,a)} +function LSh(a){SHc(this,a)} +function rTh(a){JKc(this,a)} +function wTh(a){TVe(this,a)} +function ETh(a){_We(this,a)} +function TRh(a){Yad(this,a)} +function hUh(a){eKc(this,a)} +function IPh(a){return this} +function oOh(a){return true} +function uNh(a){return null} +function kNh(){return false} +function LTh(){this.b=false} +function cUh(){this.i=false} +function tUh(){this.d=false} +function OVh(){this.a=false} +function zOh(){this.a.zf()} +function V_g(){this.c=++U_g} +function urb(){ic.call(this)} +function S1b(){lc.call(this)} +function S3b(){lc.call(this)} +function ktb(){lc.call(this)} +function TUh(a){JMe(this,a)} +function SVh(a){KEg(this,a)} +function Tc(a){Gc();Oc(Fc,a)} +function Nd(a){return a.ed()} +function whc(a){return a>>>0} +function zPh(a,b){return ''} +function Ygc(a,b){a.length=b} +function _Cb(a,b,c){a.a[b]=c} +function CHb(a,b,c){a.k[b]=c} +function TIb(a,b){Z8b(a.b,b)} +function NJb(a,b){Z8b(a.a,b)} +function $Ob(a,b){D8b(a.q,b)} +function l$b(a,b){g9b(a.c,b)} +function a_b(a,b){A_b(a.d,b)} +function k9b(a,b){Ygc(a.i,b)} +function Mnc(a,b){Z8b(a.A,b)} +function awc(a,b,c){a.Y[b]=c} +function jPc(a,b,c){a.T[b]=c} +function D2c(a,b){s3c(a.j,b)} +function E2c(a,b){t3c(a.j,b)} +function b3c(a,b){Jub(a.i,b)} +function N3c(a,b){D3c(b,a.c)} +function s7c(a,b){f7c(a.e,b)} +function vid(a,b){qQb(a.r,b)} +function Hkd(a,b){KRg(a.i,b)} +function ald(a,b){Z8b(a.d,b)} +function dld(a,b){Gec(a.F,b)} +function kmd(a,b){g9b(a.d,b)} +function mmd(a,b){Mec(a.F,b)} +function nmd(a,b){g9b(a.I,b)} +function zmd(a,b){xdc(a.W,b)} +function Qrd(a,b){Nrd(a.a,b)} +function zNd(a,b){g9b(a.b,b)} +function mOd(a){g9b(a.f.Z,a)} +function vXd(a,b){Dxd(a.d,b)} +function A4d(a,b){Z8b(a.c,b)} +function Hae(a,b){Z7d(a.n,b)} +function jge(a,b){O4b(a.b,b)} +function Hqe(a,b){xxe(a.c,b)} +function Gxe(a,b){g9b(a.e,b)} +function tPe(a,b){Jub(a.d,b)} +function uPe(a,b){r4e(a.d,b)} +function dUe(a,b){a.c=tig(b)} +function EZe(a,b){f9b(a.k,b)} +function I4e(a,b){g9b(a.F,b)} +function pgf(a,b){gff(a.a,b)} +function K4c(a){a.d=rZe(a.b)} +function yOb(){yOb=xqb;zDb()} +function A1b(){ic.call(this)} +function k3b(){lc.call(this)} +function m3b(){lc.call(this)} +function p5b(){lc.call(this)} +function Tac(){lc.call(this)} +function _ac(){lc.call(this)} +function Gcc(){lc.call(this)} +function grf(){lc.call(this)} +function arf(){ic.call(this)} +function KXf(a){TXf();xQf(a)} +function D5f(a,b){MPf(a.b,b)} +function Ivf(a,b){MYb(a.b,b)} +function XTf(a,b){Z8b(a.e,b)} +function u3f(a,b){qPc(a.b,b)} +function v3f(a,b){uKc(a.b,b)} +function w3f(a,b){GAc(a.b,b)} +function tEg(a,b){Gec(a.d,b)} +function lEg(a,b){JKg(a.b,b)} +function sEg(a,b){KKg(a.b,b)} +function hkg(a,b){Lkg(a.b,b)} +function gkg(a,b){Lkg(a.a,b)} +function ikg(a,b){Lkg(a.r,b)} +function Jxg(a,b){Xzg(a.a,b)} +function KKg(a,b){NKg(a.a,b)} +function MAg(a,b){OWg(a.C,b)} +function OFg(a,b){dDg(a.q,b)} +function BGg(a,b){cHg(a.b,b)} +function DGg(a,b){pHg(a.b,b)} +function OOg(a,b){BPf(a.b,b)} +function PKg(a,b){Z8b(a.p,b)} +function XQg(a,b){x3g(a.a,b)} +function s3g(a,b){x3g(a.a,b)} +function x3g(a,b){OWg(a.a,b)} +function GTg(a,b){ATg(a.a,b)} +function L5f(a,b){Jqd(a.d,b)} +function gZf(a,b){a.a=Zuc(b)} +function TIg(a,b){YIg(b,a.f)} +function LRg(a){PAg(a.b,a.a)} +function HMg(a){NLg(a.a,a.b)} +function lHg(){lHg=xqb;n4g()} +function B3g(){B3g=xqb;d_g()} +function y1g(){y1g=xqb;$1g()} +function NOh(a){this.a.sg(a)} +function lNh(a){return false} +function bNh(){return this.g} +function fNh(){return this.f} +function jNh(){return this.j} +function mNh(){return this.a} +function nNh(){return this.b} +function qNh(){return this.c} +function AOh(){return this.e} +function POh(){return this.d} +function yPh(){return this.k} +function UPh(){return this.n} +function gQh(){return this.H} +function MQh(){return this.Y} +function XRh(){return this.i} +function BSh(){return this.o} +function CSh(){return this.p} +function QSh(){return this.t} +function RSh(){return this.w} +function TSh(){return this.q} +function VSh(){return this.v} +function $Sh(){return this.V} +function $Th(){return this.C} +function lTh(){return this.r} +function nTh(){return this.s} +function sTh(){return this.D} +function VTh(){return this.u} +function WTh(){return this.F} +function XTh(){return this.G} +function lUh(){return this.J} +function MUh(){return this.Z} +function NUh(){return this.$} +function $c(a){return a.c-a.b} +function Ac(a,b){wc();a.src=b} +function Wc(a,b){a.a[a.c++]=b} +function CWh(a){$1g();c2g(a)} +function zWh(a){$1g();D1g(a)} +function uCb(){NAb.call(this)} +function XGb(){NAb.call(this)} +function mIb(){NAb.call(this)} +function QIb(){NAb.call(this)} +function ARb(){NAb.call(this)} +function bHb(){XGb.call(this)} +function lTb(){kTb.call(this)} +function mTb(){kTb.call(this)} +function nTb(){kTb.call(this)} +function oTb(){kTb.call(this)} +function pTb(){kTb.call(this)} +function qTb(){kTb.call(this)} +function rTb(){kTb.call(this)} +function sTb(){kTb.call(this)} +function tTb(){kTb.call(this)} +function uTb(){kTb.call(this)} +function vTb(){kTb.call(this)} +function zTb(){yTb.call(this)} +function NUb(){yTb.call(this)} +function NVb(){yTb.call(this)} +function aVb(){yTb.call(this)} +function dXb(){cXb.call(this)} +function fXb(){eXb.call(this)} +function EZb(){mCb.call(this)} +function U1b(){S1b.call(this)} +function Ndc(){Gdc.call(this)} +function voc(){toc.call(this)} +function Oec(){this.a=new iec} +function Gdc(){this.a=new n9b} +function afc(){this.a=new cEb} +function tub(){this.a=new cEb} +function Fub(){this.a=new cEb} +function PYb(){this.a=new cEb} +function jrb(){this.a=new prb} +function NSc(){this.a=new n9b} +function uSc(){n9b.call(this)} +function WSc(){VSc.call(this)} +function jTc(){Ryc.call(this)} +function kWc(){MAc.call(this)} +function mXc(){MAc.call(this)} +function TOc(a){BPc(a,a.Pb,1)} +function kOc(a,b){UQc(a.bb,b)} +function yPc(a,b){_Qc(a.bb,b)} +function zBc(a,b){fcc(a.rc,b)} +function aFc(a,b){yPc(a.kc,b)} +function yEc(a,b){$Db(a.qc,b)} +function Bhc(a,b){return a[b]} +function YHc(a,b){return b==a} +function Emd(a,b,c){a.eb[c]=b} +function Knd(){this.a=new n9b} +function a_d(){this.a=new n9b} +function abd(){this.A=new n9b} +function _ff(){this.a=new n9b} +function qgf(){this.a=new mff} +function Gif(){this.a=new mff} +function q_f(){this.a=new n9b} +function k0f(){this.a=new m0f} +function m0f(){this.a=new n9b} +function Kcd(){this.a=new Prg} +function Vgd(){this.a=new occ} +function Rgg(){this.a=new cEb} +function Tgg(){this.e=new n9b} +function beg(){Xbc.call(this)} +function med(){cEb.call(this)} +function Jkg(){n9b.call(this)} +function xPg(){cEb.call(this)} +function BQf(){zQf.call(this)} +function vQf(a,b){hcc(a.ab,b)} +function GWf(a){a.XA();a.UA()} +function yad(a){!wad&&(wad=a)} +function Fad(a){!Ead&&(Ead=a)} +function Had(a){!Gad&&(Gad=a)} +function xtg(a){!wtg&&(wtg=a)} +function dWg(a,b){a.C.width=b} +function uBg(){this.a=new h5b} +function a1g(){this.a=new h5b} +function yJg(){this.a=new cEb} +function UQg(){this.a=new cEb} +function bUg(){this.a=new n9b} +function wOh(){this.a.clear()} +function y0g(){V_g.call(this)} +function ePh(){return this.Kc} +function fPh(){return this.Mc} +function hPh(){return this.xb} +function iPh(){return this.Ab} +function qPh(a){return this.b} +function STh(a){return this.F} +function YTh(a){return this.H} +function QVh(a){return this.a} +function cQh(){return this.tb} +function fQh(){return this.pb} +function FSh(){return this.Cc} +function rUh(){return !this.f} +function oPh(){return new Bqg} +function $Uh(a){return P9e(a)} +function he(a){return nhc(a),a} +function aVh(a,b){return null} +function Kc(a,b){return a.d[b]} +function Yc(a){return a.a[a.b]} +function TVh(a){Z8b(this.a,a)} +function hWh(a){Z8b(this.c,a)} +function $qb(a){Sqb();this.a=a} +function AWh(a){$1g();!D1g(a)} +function jc(a){ec.call(this,a)} +function mc(a){jc.call(this,a)} +function oc(a){kc.call(this,a)} +function pc(a){mc.call(this,a)} +function PIb(a){OIb();this.a=a} +function gNb(a){fNb();this.a=a} +function sVb(a){rVb();this.a=a} +function Pcc(a){Mcc();this.a=a} +function Cfc(a){mac();this.a=a} +function Qdc(a){a.b=null;a.c=0} +function vRc(a,b){uRc(a);a.p=b} +function uHb(a,b){return a.p*b} +function vHb(a,b){return a.t*b} +function wHb(a,b){return a.w*b} +function MJb(a,b){Y8b(a.a,0,b)} +function hEb(a,b,c){hBb(a.a,c)} +function dPc(a,b){!!b&&(a.G=b)} +function G5d(a,b){!!b&&(a.o=b)} +function H5d(a,b){!!b&&(a.q=b)} +function ase(a,b){!!a&&a.hk(b)} +function kge(a,b){e5b(a.b,0,b)} +function TSc(a,b){a.g=b;a.uq()} +function k3c(a){a.f=null;a.d=0} +function ogf(a){this.a=a;a.d=0} +function zQf(){this.ab=new occ} +function gmf(){gmf=xqb;new imf} +function EIb(){EIb=xqb;new dZb} +function Ed(){Ed=xqb;Dd=new Md} +function tc(){tc=xqb;sc=new Ub} +function Fcd(){Fcd=xqb;w3b(-1)} +function z6e(a){a.d=evd(a.b.o)} +function x4f(a,b){Lld(a.d.o,b)} +function T5f(a,b){Kmd(a.d.o,b)} +function z4f(a,b){HPc(a.d.j,b)} +function K4f(a,b){EPf(a.b,b.a)} +function C5f(a,b){KPf(a.b,b,1)} +function Yjf(a,b){Wjf(a,b,a.a)} +function Kbg(a,b){Obg(a,a.b,b)} +function Lbg(a,b){Obg(a,a.d,b)} +function Mbg(a,b){Obg(a,a.f,b)} +function Nbg(a,b){Obg(a,a.g,b)} +function Sbg(a,b){Obg(a,a.k,b)} +function Tbg(a,b){Obg(a,a.n,b)} +function Vbg(a,b){Obg(a,a.q,b)} +function $bg(a,b){_bg(a,a.e,b)} +function acg(a,b){_bg(a,a.p,b)} +function gAg(a,b,c){lAg(a,c,b)} +function jAg(a,b,c){nAg(a,c,b)} +function eDg(a,b){tyg(a,b,a.C)} +function XOg(a,b){GDg(a.b.a,b)} +function pGg(a,b){pHg(a.s.b,b)} +function v4g(a,b){y4g(a,b,a.c)} +function LXf(a,b){a.a=b;xQf(a)} +function cWg(a,b){a.C.height=b} +function ggg(a){bgg();this.d=a} +function gug(a){fug();this.a=a} +function P5c(a){M5c();this.e=a} +function rNh(){return this.c.j} +function FNh(){return this.b.j} +function YSh(a){return this.Xb} +function mUh(){return !!this.K} +function nUh(){return !!this.G} +function yUh(){return !!this.a} +function HVh(){return this.c>5} +function URh(a){return a==this} +function _ef(a){return a.c>a.a} +function Arg(a){return a.c+a.b} +function Brg(a){return a.d+a.a} +function Z1b(a){return nhc(a),a} +function b3b(a){return nhc(a),a} +function C4b(a){return nhc(a),a} +function wNh(a){return new YJb} +function rPh(a,b){return false} +function OPh(a,b,c,d){return 1} +function Cc(a,b){a.a=b;return a} +function qc(){this.a=Date.now()} +function Fqb(a){ec.call(this,a)} +function T1b(a){mc.call(this,a)} +function T3b(a){rc.call(this,a)} +function U3b(a){mc.call(this,a)} +function oub(a){mc.call(this,a)} +function XWb(a){mc.call(this,a)} +function R1b(a){mc.call(this,a)} +function l3b(a){mc.call(this,a)} +function n3b(a){mc.call(this,a)} +function R3b(a){mc.call(this,a)} +function q5b(a){mc.call(this,a)} +function g5b(a){L1b(a);return a} +function F9b(a){J9b(a,a.length)} +function eub(a){return a.b[a.r]} +function fub(a){return a.d[a.r]} +function hub(a){return a.d[a.e]} +function gub(a){return a.b[a.e]} +function I8b(a){return a.b==a.c} +function $dc(a){return !!a&&a.b} +function of(a){return pf(a)&Q4g} +function fd(a){return $stats(a)} +function Gvc(a,b){return a.V[b]} +function Kvc(a,b){return a.Y[b]} +function tPc(a,b){!!b&&(a.ub=b)} +function Nwc(a){!!a.b&&a.b.nj()} +function KSc(a){JSc(a.a);LSc(a)} +function rOc(a){TAc(a.w);ozg(a)} +function iac(a){nhc(a);this.a=a} +function Hcc(a){mc.call(this,a)} +function J_b(a,b){a.fillStyle=b} +function v3c(a,b,c){a.f=b;a.e=c} +function j1c(a,b,c){a.d=b;a.e=c} +function gvc(a,b,c){a.a=b;a.b=c} +function lvc(a,b,c){a.c=b;a.d=c} +function CHc(a,b,c){a.s=b;a.r=c} +function _2c(a,b,c){a.g=b;a.k=c} +function Dvd(a,b){return a.B==b} +function j7d(a,b){return b==a.q} +function Wod(a){return a.k&&a.N} +function Z3c(a){return a.a&&a.c} +function jQe(a,b){return a.$[b]} +function nSe(a,b){vQe();b.aq(a)} +function oSe(a,b){vQe();b.Xp(a)} +function GSe(a,b){vQe();b.Up(a)} +function HSe(a,b){vQe();b.Tp(a)} +function MUe(a,b,c){a.s=b;a.p=c} +function UZd(a,b){b.Iz(a.s,a.c)} +function Iad(a){a.b=(dud(),bud)} +function S5d(a){a.q=(_8f(),q8f)} +function DXc(a){a.i=(_8f(),q8f)} +function fYe(a){a.c=(Ubf(),Tbf)} +function Zre(a){!!a.c&&Bxe(a.c)} +function ard(a){!!a.o&&Ymd(a.o)} +function Vkd(a){mc.call(this,a)} +function ulf(a){vlf(a);return a} +function Laf(a,b){return b==a.b} +function ggf(a,b){return a.c==b} +function JXe(a,b){return a.c[b]} +function y1e(a,b){return a.p[b]} +function FWf(a,b){return a.L[b]} +function A9e(a){return ff(a,33)} +function lOf(a){!!a.a&&aEb(a.a)} +function erf(a){jc.call(this,a)} +function r_f(a){jc.call(this,a)} +function Ttf(a){mc.call(this,a)} +function nrg(a){jc.call(this,a)} +function brg(){Xqg.call(this,1)} +function sqg(){gqg();this.b=fqg} +function rIg(){rIg=xqb;new cEb} +function zPf(a,b){a.W=b;a.X=3*b} +function fXf(a,b,c){a.U=b;a.Y=c} +function yYe(a,b,c){a.k=b;a.j=c} +function y4e(a,b,c){a.s=b;a.t=c} +function r6e(a,b,c){a.p=b;a.n=c} +function Nrg(a,b,c){a.b=b;a.a=c} +function MWg(a,b){a.className=b} +function Xug(a,b){b!=0&&(a.p=b)} +function _xg(a,b){MWg(a.eC(),b)} +function byg(a,b){fyg(a.aC(),b)} +function dyg(a,b){E1g(a.aC(),b)} +function KLg(a){pDg(a.a);uMg(a)} +function IAg(a){!!a.c&&OAg(a.c)} +function sDg(a){!!a.i&&eEg(a.i)} +function J4g(a){jc.call(this,a)} +function O3g(){Q3g.call(this,2)} +function eNh(){return fhc(this)} +function cPh(){return pac(this)} +function jPh(){return YIc(this)} +function mPh(){return kJc(this)} +function xPh(){return wXc(this)} +function XPh(){return LFd(this)} +function gPh(){return this.Bk()} +function SPh(){return this.ou()} +function TPh(){return this.vu()} +function bQh(){return this.bv()} +function LOh(a){return this===a} +function nQh(){return mJd(this)} +function oQh(){return rJd(this)} +function qQh(){return K3d(),J3d} +function pQh(){return EIe(),Jze} +function kQh(){return EIe(),eze} +function mQh(){return EIe(),zze} +function vQh(){return EIe(),dAe} +function wQh(){return EIe(),jAe} +function yQh(){return EIe(),JAe} +function zQh(){return EIe(),QAe} +function AQh(){return EIe(),gBe} +function BQh(){return EIe(),lBe} +function FQh(){return EIe(),VBe} +function CQh(){return EIe(),Gze} +function GQh(){return EIe(),kFe} +function IQh(){return EIe(),nFe} +function OQh(){return EIe(),DCe} +function PQh(){return EIe(),ICe} +function QQh(){return EIe(),LCe} +function RQh(){return EIe(),RCe} +function TQh(){return EIe(),QCe} +function WQh(){return EIe(),ECe} +function XQh(){return EIe(),UCe} +function UQh(){return EIe(),wAe} +function VQh(){return EIe(),nBe} +function VPh(){return EIe(),oye} +function ZPh(){return EIe(),qye} +function _Ph(){return EIe(),Bye} +function ZQh(){return EIe(),bDe} +function $Qh(){return EIe(),hDe} +function aRh(){return EIe(),iDe} +function dRh(){return EIe(),KDe} +function eRh(){return EIe(),MDe} +function fRh(){return EIe(),$De} +function gRh(){return EIe(),jEe} +function iRh(){return EIe(),oEe} +function mRh(){return EIe(),pEe} +function nRh(){return EIe(),sEe} +function oRh(){return EIe(),xEe} +function pRh(){return EIe(),KEe} +function qRh(){return EIe(),QEe} +function rRh(){return EIe(),WEe} +function vRh(){return EIe(),oFe} +function yRh(){return EIe(),QFe} +function zRh(){return EIe(),lHe} +function ARh(){return EIe(),mHe} +function DRh(){return EIe(),BHe} +function FRh(){return EIe(),MHe} +function GRh(){return EIe(),$He} +function HRh(){return EIe(),eIe} +function JRh(){return EIe(),fIe} +function xSh(){return EIe(),kAe} +function ySh(){return EIe(),pDe} +function jQh(){return Hje(),Aje} +function hSh(){return Rfe(this)} +function tSh(){return Tke(this)} +function zSh(){return XLe(this)} +function ESh(){return uMe(this)} +function MSh(){return eOe(this)} +function bTh(){return xSe(this)} +function jTh(){return uUe(this)} +function LRh(){return Vad(this)} +function pTh(){return VUe(this)} +function cTh(){return Hje(),wje} +function mTh(){return Hje(),Dje} +function tTh(){return Hje(),xje} +function PSh(){return Hje(),uje} +function SSh(){return Hje(),Gje} +function NSh(){return RTe(),QTe} +function CTh(){return Nkf(),Jkf} +function ZTh(){return Hje(),yje} +function dUh(){return Hje(),Bje} +function eUh(){return N$e(this)} +function fUh(){return f_e(this)} +function uTh(){return IVe(this)} +function vTh(){return CVe(this)} +function FTh(){return xXe(this)} +function KTh(){return dYe(this)} +function UTh(){return oZe(this)} +function iUh(){return Z_e(this)} +function jUh(){return S_e(this)} +function kUh(){return U_e(this)} +function xUh(){return x2e(this)} +function BUh(){return g3e(this)} +function CUh(){return m3e(this)} +function OUh(){return X5e(this)} +function UUh(){return o6e(this)} +function dVh(){return Zcf(this)} +function jVh(){return _8f(),q8f} +function DUh(){return RTe(),OTe} +function RUh(){return $Te(),ZTe} +function _Uh(a){return ff(a,74)} +function lVh(){return Jjf(this)} +function RVh(){return iOc(this)} +function HSh(){return this.Em()} +function ISh(){return this.Sx()} +function gUh(){return this.dz()} +function rQh(){return this.a.Gb} +function tQh(){return this.b.Gb} +function Zc(a){return a.a[a.b++]} +function ie(a,b){return N2b(a,b)} +function iVh(a,b,c){return null} +function KVh(a,b){wrg(this,a,b)} +function EVh(a,b){Tqg(this,a,b)} +function FVh(a,b){Uqg(this,a,b)} +function aWh(a){l0f(this.a.C.a)} +function Awb(a){a>0&&nwb(this,a)} +function k5b(a){T1b.call(this,a)} +function UGb(a){SGb.call(this,a)} +function FJb(a){SGb.call(this,a)} +function iLb(a){SGb.call(this,a)} +function VLb(a,b){a.b=b;return a} +function KAb(a,b){a.j=b;return a} +function hCb(a,b){a.n=b;return a} +function tOb(a,b){a.c=b;return a} +function Dc(a){a.b=true;return a} +function V1b(a){T1b.call(this,a)} +function _3b(a){l3b.call(this,a)} +function Q4b(){P1b.call(this,'')} +function R4b(){P1b.call(this,'')} +function h5b(){P1b.call(this,'')} +function i5b(){P1b.call(this,'')} +function Dac(a){Bac.call(this,a)} +function Uc(a,b){Gc();Pc(Fc,a,b)} +function $gc(a,b){return qe(a,b)} +function Tcc(a){return a.a?a.b:0} +function ivc(){this.a=0;this.b=0} +function mvc(){this.c=0;this.d=0} +function uic(a){pic.call(this,a)} +function woc(a){uoc.call(this,a)} +function TAc(a){mac();l9b(a,a.a)} +function ROb(a,b,c){ZDb(a.a,b,c)} +function SOb(a,b,c){ZDb(a.b,b,c)} +function g_b(a,b,c){I_b(a.d,b,c)} +function m_b(a,b,c){N_b(a.d,b,c)} +function f2c(a,b,c){F2c(a.a,b,c)} +function i2c(a,b,c){I2c(a.a,b,c)} +function j2c(a,b,c){H2c(a.a,b,c)} +function vdc(a,b,c){b.sg(a.a[c])} +function s3c(a,b){r3c(a,a.k.j,b)} +function nTc(a,b){a.a=b;pTc(a,b)} +function USc(a,b){a.j=b.Nb;a.e=b} +function jpd(a,b){return a.sb[b]} +function mpd(a,b){return a.tb[b]} +function ppd(a,b){return a.ub[b]} +function rpd(a,b){return a.vb[b]} +function tpd(a,b){return a.wb[b]} +function vpd(a,b){return a.xb[b]} +function Owd(a,b){return b.Dk(a)} +function eOc(a){return a.Nc/a.Ec} +function Lcd(a){f2c(a.c,a.d,a.e)} +function Twd(a){kwc.call(this,a)} +function mxd(a){kwc.call(this,a)} +function qFd(a){kwc.call(this,a)} +function EFd(a){rFd.call(this,a)} +function HFd(a){DFd.call(this,a)} +function HDd(a){_Cd.call(this,a)} +function VEd(a){_Cd.call(this,a)} +function gRd(a){mxd.call(this,a)} +function rRd(a){mxd.call(this,a)} +function hRd(a){gRd.call(this,a)} +function IXd(a){Twd.call(this,a)} +function fne(a){kwc.call(this,a)} +function sse(a){_Cd.call(this,a)} +function Dse(a){_Cd.call(this,a)} +function Hse(a){_Cd.call(this,a)} +function Ise(a){_Cd.call(this,a)} +function Mse(a){_Cd.call(this,a)} +function Pse(a){_Cd.call(this,a)} +function Qse(a){Pse.call(this,a)} +function Zse(a){_Cd.call(this,a)} +function cte(a){_Cd.call(this,a)} +function ete(a){_Cd.call(this,a)} +function fte(a){_Cd.call(this,a)} +function gte(a){fte.call(this,a)} +function jte(a){_Cd.call(this,a)} +function nte(a){_Cd.call(this,a)} +function ote(a){nte.call(this,a)} +function pte(a){_Cd.call(this,a)} +function qte(a){pte.call(this,a)} +function rte(a){_Cd.call(this,a)} +function xte(a){_Cd.call(this,a)} +function Dte(a){_Cd.call(this,a)} +function Hte(a){_Cd.call(this,a)} +function Ite(a){_Cd.call(this,a)} +function Jte(a){_Cd.call(this,a)} +function Kte(a){_Cd.call(this,a)} +function Ste(a){VEd.call(this,a)} +function Xte(a){_Cd.call(this,a)} +function $te(a){_Cd.call(this,a)} +function _te(a){_Cd.call(this,a)} +function aue(a){_Cd.call(this,a)} +function gue(a){_Cd.call(this,a)} +function iue(a){_Cd.call(this,a)} +function uue(a){_Cd.call(this,a)} +function zue(a){_Cd.call(this,a)} +function Nue(a){_Cd.call(this,a)} +function Oue(a){_Cd.call(this,a)} +function Pue(a){_Cd.call(this,a)} +function Sue(a){_Cd.call(this,a)} +function Tue(a){_Cd.call(this,a)} +function Vue(a){_Cd.call(this,a)} +function Yue(a){_Cd.call(this,a)} +function Zue(a){_Cd.call(this,a)} +function ave(a){_Cd.call(this,a)} +function bve(a){_Cd.call(this,a)} +function cve(a){_Cd.call(this,a)} +function hve(a){_Cd.call(this,a)} +function kve(a){_Cd.call(this,a)} +function lve(a){_Cd.call(this,a)} +function qve(a){_Cd.call(this,a)} +function tve(a){_Cd.call(this,a)} +function uve(a){_Cd.call(this,a)} +function vve(a){_Cd.call(this,a)} +function xve(a){_Cd.call(this,a)} +function yve(a){_Cd.call(this,a)} +function Cve(a){_Cd.call(this,a)} +function Dve(a){_Cd.call(this,a)} +function Fve(a){_Cd.call(this,a)} +function Ive(a){_Cd.call(this,a)} +function Kve(a){_Cd.call(this,a)} +function Pve(a){_Cd.call(this,a)} +function Tve(a){_Cd.call(this,a)} +function Vve(a){_Cd.call(this,a)} +function Xve(a){_Cd.call(this,a)} +function Yve(a){_Cd.call(this,a)} +function Zve(a){_Cd.call(this,a)} +function $ve(a){_Cd.call(this,a)} +function bwe(a){_Cd.call(this,a)} +function cwe(a){_Cd.call(this,a)} +function dwe(a){_Cd.call(this,a)} +function ewe(a){_Cd.call(this,a)} +function fwe(a){_Cd.call(this,a)} +function hwe(a){HDd.call(this,a)} +function jwe(a){_Cd.call(this,a)} +function owe(a){_Cd.call(this,a)} +function rwe(a){_Cd.call(this,a)} +function uwe(a){_Cd.call(this,a)} +function vwe(a){_Cd.call(this,a)} +function wwe(a){_Cd.call(this,a)} +function xwe(a){_Cd.call(this,a)} +function Bwe(a){_Cd.call(this,a)} +function Dwe(a){_Cd.call(this,a)} +function Hwe(a){_Cd.call(this,a)} +function Kwe(a){_Cd.call(this,a)} +function Rwe(a){rte.call(this,a)} +function Vwe(a){_Cd.call(this,a)} +function Ywe(a){_Cd.call(this,a)} +function bxe(a){_Cd.call(this,a)} +function cxe(a){_Cd.call(this,a)} +function dxe(a){_Cd.call(this,a)} +function exe(a){_Cd.call(this,a)} +function fxe(a){_Cd.call(this,a)} +function gxe(a){_Cd.call(this,a)} +function hxe(a){_Cd.call(this,a)} +function ixe(a){_Cd.call(this,a)} +function jxe(a){_Cd.call(this,a)} +function kxe(a){_Cd.call(this,a)} +function lxe(a){_Cd.call(this,a)} +function oxe(a){_Cd.call(this,a)} +function qxe(a){_Cd.call(this,a)} +function jye(a){Fqb.call(this,a)} +function lJe(a){_Cd.call(this,a)} +function _Je(a){YJe.call(this,a)} +function bbe(a,b){bae(a,a.n,b,0)} +function jWd(a,b){lvc(a,b.A,b.B)} +function N4d(a,b,c){j9b(a.c,b,c)} +function j4d(a,b){a.b[0]=b;a.a=1} +function Z7d(a,b){a.t=b;return a} +function YHd(a){a.H=NaN;a.k=null} +function Ddf(a){a.d=false;sdf(a)} +function fLf(a){HDd.call(this,a)} +function Ljf(a){Ijf.call(this,a)} +function GZf(a){FZf.call(this,a)} +function HZf(a){GZf.call(this,a)} +function A2e(a){BLc.call(this,a)} +function uXe(a){return a[2]0&&a=a.c.c} +function lYe(a){a.j=null;a.k=null} +function m0e(a){a.G=null;a.H=null} +function Rte(a,b){a==null&&DLg(b)} +function Byg(a,b){tyg(a,b,a.aC())} +function ECg(a,b){FAg(a,b);xCg(a)} +function S5f(a,b){fQf(a.b,b,true)} +function Gkf(a,b){Klf(a.k[1],b.f)} +function Hkf(a,b){Klf(a.k[2],b.f)} +function uzg(a,b,c){PRc(a.Bb,b,c)} +function bHg(a,b){Dhc(a.C,tvh,!b)} +function IEg(a,b){zUf(XOf(a.a),b)} +function gEg(a){oyg(a);hEg(a.b.a)} +function zHg(a){!!a.b&&wHg(a.b.b)} +function Azg(a){!!a.Wb&&a.Wb.yq()} +function VFg(a){return a.b&&a.p.j} +function gNh(a){return a.jd(this)} +function zNh(){return zKb(this.b)} +function CNh(){return this.b.yd()} +function DNh(){return this.b.zd()} +function pNh(){return this.a.Sd()} +function ENh(){return this.d.Sd()} +function HNh(){return this.a.yd()} +function INh(){return this.a.zd()} +function KNh(){return this.a.wd()} +function LNh(){return this.a.Ad()} +function MNh(){return this.a.Bd()} +function yOh(){return this.a.xf()} +function dNh(a){return this.k-a.k} +function OOh(a){this.a.sg(w3b(a))} +function jZf(){this.a=(Huc(),Ztc)} +function DOh(){throw Qpb(new Gcc)} +function YOh(){throw Qpb(new Fkc)} +function APh(){return H1c(this.c)} +function sPh(){return H1c(this.s)} +function wPh(){return H1c(this.b)} +function KPh(a){return a.ik(this)} +function LPh(a){return a.zj(this)} +function SRh(a){return this.yw(a)} +function WRh(a){return this.Kw(a)} +function YRh(a){return this.jj(a)} +function gSh(a){return this.Tw(a)} +function bVh(){return this.a.lp()} +function wWh(){return k4b(this.a)} +function Skg(){Tkg.call(this,0,0)} +function hDg(){iDg.call(this,Mbh)} +function nc(a,b){fc.call(this,a,b)} +function Vc(a,b){this.a=a;this.b=b} +function dd(a,b){this.b=a;this.a=b} +function _Vh(a){this.C.tabIndex=a} +function EQg(a){OAg(a.e);a.c=true} +function YAg(a){a.d=null;a.a=null} +function RWg(a){a=E4b(a);return a} +function gEb(){aEb(this);fEb(this)} +function rqb(){pqb==null&&(pqb=[])} +function cvb(){cvb=xqb;bvb=new dvb} +function WCb(){WCb=xqb;VCb=new dDb} +function EGb(){EGb=xqb;CGb=new QXb} +function EOb(){EOb=xqb;DOb=new IOb} +function qJb(){qJb=xqb;pJb=new cEb} +function uJb(){uJb=xqb;tJb=new cEb} +function jKb(){jKb=xqb;iKb=new pKb} +function eTb(){eTb=xqb;dTb=new hTb} +function _Zb(){_Zb=xqb;$Zb=new m$b} +function U_b(){U_b=xqb;O_b=new T_b} +function V_b(){V_b=xqb;P_b=new R_b} +function W_b(){W_b=xqb;Q_b=new S_b} +function m5b(){m5b=xqb;l5b=new B1b} +function mac(){mac=xqb;lac=new sac} +function uac(){uac=xqb;tac=new vac} +function Scc(){Scc=xqb;Rcc=new Ucc} +function iec(){jec.call(this,null)} +function PSb(){QSb.call(this,null)} +function $fc(){Jfc.call(this,null)} +function rbc(a){this.c=a;obc(this)} +function Swb(a,b){b.f=a;Z8b(a.d,b)} +function o1b(a,b){a.setLineDash(b)} +function mgc(a,b){Hfc(a);a.a.wf(b)} +function HQb(a){return a.c?a.a:a.b} +function bEb(a){return a.e.c+a.g.c} +function Id(a){return !!a.a||!!a.f} +function td(){gd!=0&&(gd=0);jd=-1} +function ggc(){ggc=xqb;fgc=new Mgc} +function gtc(){gtc=xqb;ftc=new mtc} +function Xec(){Xec=xqb;Wec=new Yec} +function Byc(){Byc=xqb;Ayc=new iec} +function lUc(){lUc=xqb;kUc=new yUc} +function NHc(){NHc=xqb;LHc=new bUe} +function ZZc(){ZZc=xqb;YZc=new p$c} +function Bad(){Bad=xqb;Aad=new Dad} +function Hjd(a){a.d=true;a.e=false} +function AAc(a,b){a.wb=true;a.Hb=b} +function ROc(a){a.pb=null;a._=null} +function Agc(){Jfc.call(this,null)} +function Ouc(a){Iuc(this);this.b=a} +function i5d(a){return a.b?a.b.a:0} +function Ard(a,b){return b.Kc==a.e} +function DHd(a,b){a.f=NaN;eKc(a,b)} +function ySc(a,b){a.c=b;a.d=b.xr()} +function TDc(a,b,c){a.kb.Ps(b,c,0)} +function bde(a){cde.call(this,a,0)} +function wde(){wde=xqb;vde=new xde} +function wee(){wee=xqb;vee=new xee} +function oee(){oee=xqb;nee=new pee} +function see(){see=xqb;ree=new tee} +function Aee(){Aee=xqb;zee=new Bee} +function Uee(){Uee=xqb;Tee=new Wee} +function Uhe(){Uhe=xqb;The=new Vhe} +function Fhe(){Fhe=xqb;Ehe=new Ghe} +function Lhe(){Lhe=xqb;Khe=new Mhe} +function Qhe(){Qhe=xqb;Phe=new Rhe} +function Yhe(){Yhe=xqb;Xhe=new Zhe} +function aie(){aie=xqb;_he=new bie} +function eie(){eie=xqb;die=new fie} +function hie(){hie=xqb;gie=new jie} +function mie(){mie=xqb;lie=new nie} +function sie(){sie=xqb;rie=new tie} +function Aie(){Aie=xqb;zie=new Bie} +function Gie(){Gie=xqb;Fie=new Hie} +function Kie(){Kie=xqb;Jie=new Mie} +function Oie(){Oie=xqb;Nie=new Pie} +function Sie(){Sie=xqb;Rie=new Tie} +function Vie(){Vie=xqb;Uie=new Wie} +function aje(){aje=xqb;_ie=new bje} +function ake(){ake=xqb;_je=new bke} +function fje(){fje=xqb;eje=new gje} +function Xbe(){Xbe=xqb;Wbe=new $be} +function OJd(){OJd=xqb;NJd=new Ykd} +function w4d(){w4d=xqb;v4d=new x4d} +function n5d(){n5d=xqb;m5d=new s5d} +function Pff(){Pff=xqb;Off=new egf} +function nff(a){off.call(this,a,a)} +function wjf(a){ujf(a,a.p,a.k,a.i)} +function ajf(a,b){return b.ca.a.a} +function j3f(a,b){return b?a.a:a.d} +function Tcg(a,b){return -b0} +function Msg(a){return a.a.QB(a.d)} +function c_b(a){a.b>0||d_b(a,true)} +function yQf(a,b){DYb(a.ab,b,true)} +function IYf(a,b){a.a=b;MYb(a.p,b)} +function Iwg(){Iwg=xqb;Fvg=new ywg} +function Fwg(){Fwg=xqb;Cvg=new wwg} +function Mwg(){Mwg=xqb;Jvg=new xwg} +function Pwg(){Pwg=xqb;Mvg=new vwg} +function ixg(){ixg=xqb;gwg=new twg} +function qxg(){qxg=xqb;owg=new uwg} +function EBg(){EBg=xqb;DBg=new FBg} +function xBg(){xBg=xqb;wBg=new occ} +function gqg(){gqg=xqb;fqg=new Gdc} +function kDg(){kDg=xqb;jDg=new n9b} +function kIg(){kIg=xqb;jIg=new nIg} +function QQg(){QQg=xqb;PQg=new UQg} +function aOg(){aOg=xqb;_Ng=new cEb} +function oVg(){oVg=xqb;nVg=new cdc} +function kWg(){kWg=xqb;jWg=new tWg} +function sug(a){mug(this);this.c=a} +function fJe(a){NIe(this);this.p=a} +function m7e(a){h7e(this);this.b=a} +function NQg(){this.a=16;this.b=14} +function Q3g(a){this.a=a;L3g(this)} +function lPh(a){return LIc(this,a)} +function dPh(a){return pvc(this,a)} +function WPh(a){return Hvc(this,a)} +function bPh(a){return b8b(this,a)} +function XNh(a){return oBb(this.a)} +function KRh(a){return B4d(this,a)} +function PRh(a){return w5d(this,a)} +function QRh(a){return K5d(this,a)} +function RRh(a){return P6d(this,a)} +function $Rh(a){return wce(this,a)} +function dSh(a){return kfe(this,a)} +function jSh(a){return dge(this,a)} +function lSh(a){return Rge(this,a)} +function rSh(a){return Rke(this,a)} +function ZSh(a){return XOe(this,a)} +function QTh(a){return AYe(this,a)} +function KUh(a){return x5e(this,a)} +function bWh(){return uNg(this),''} +function sPg(a){return !a?null:a.d} +function yd(b,a){return b[a]?b[a]:0} +function Ypb(a,b){return Tpb(a,b)>0} +function _pb(a,b){return Tpb(a,b)<0} +function Eub(a,b){return WDb(a.a,b)} +function Gqb(a,b){fc.call(this,a,b)} +function gPg(a,b){a.a.call(null,b)} +function gDg(a,b,c){yyg(a,b,a.C,c)} +function zOg(a,b,c){qDg(a.b.a,b,c)} +function Tgc(a,b,c){a.splice(b,0,c)} +function Sub(a,b){return Uub(b,a.a)} +function Wub(a,b){return Uub(b,a.d)} +function Tub(a,b){return rub(a.b,b)} +function Mub(a,b){this.a=a;this.b=b} +function hDb(a,b){this.a=a;this.b=b} +function iDb(a,b){this.a=a;this.b=b} +function nub(a,b){this.d=a;this.c=b} +function _Gb(a,b){this.d=a;this.c=b} +function cJb(a,b){this.b=a;this.c=b} +function QAb(a,b){this.b=a;this.a=b} +function tCb(a,b){this.b=a;this.a=b} +function tSb(a,b){this.b=a;this.a=b} +function ySb(a,b){this.a=a;this.b=b} +function LSb(a,b){this.a=a;this.b=b} +function dJb(a,b){this.a=a;this.b=b} +function NQb(a,b){this.a=a;this.b=b} +function BTb(a,b){this.a=a;this.c=b} +function Gub(a,b){this.e=a;this.f=b} +function hvb(a,b){this.j=a;this.k=b} +function o$b(a,b){this.a=a;this.b=b} +function p$b(a,b){this.a=a;this.b=b} +function r_b(a,b){this.a=a;this.b=b} +function zZb(a){this.a=!a?new nZb:a} +function GOh(a){throw Qpb(new p5b)} +function G1b(a,b){return m4b(a.a,b)} +function F1b(a,b){return a4b(a.a,b)} +function I1b(a,b){return p4b(a.a,b)} +function NYb(a,b){return SDb(a.a,b)} +function E9b(a,b){I9b(a,a.length,b)} +function G9b(a,b){I9b(a,a.length,b)} +function V3b(a,b){this.b=a;this.a=b} +function ibc(a,b){this.b=a;this.a=b} +function Iac(a,b){this.a=a;this.b=b} +function q8b(a,b){this.d=a;this.e=b} +function CBb(){tBb();this.a=new n9b} +function Ibc(){Ebc();return new Dbc} +function aOh(a){bPb(a);return true} +function uOb(a){a.d=w3b(0);return a} +function sd(a){$wnd.clearTimeout(a)} +function hdc(a){gdc.call(this,a,21)} +function bYb(a){cYb.call(this,a,-1)} +function Rfc(a,b){this.a=a;this.b=b} +function cgc(a,b){this.a=a;this.b=b} +function Dgc(a,b){this.a=a;this.b=b} +function Ggc(a,b){this.a=a;this.b=b} +function Jgc(a,b){this.a=a;this.b=b} +function Pgc(a,b){this.b=a;this.a=b} +function Vac(){this.a=new $wnd.Date} +function rcc(a){return a.b.b!=a.d.a} +function Kbc(a,b){return a.a.get(b)} +function Sbc(a,b){return SDb(a.d,b)} +function xdc(a,b){return Z8b(a.a,b)} +function Fdc(a,b){return m9b(a.a,b)} +function Iec(a,b){return u8b(a.a,b)} +function gic(a,b){return jic(a.a,b)} +function lic(a,b,c){return ab} +function c1c(a){return a<8?12+a:3*a} +function P6c(a){return Jff(a.b,a.c)} +function MOc(a){a.zc=a.yc;a.Ic=a.Hc} +function X4c(a){a.b=false;a.c=false} +function M2c(a){XZe(a.d,a.g.c,true)} +function Egc(a,b,c){b.hg(a.a.wg(c))} +function Hgc(a,b,c){b.sg(a.a.We(c))} +function q7c(a,b){this.d=a;this.c=b} +function D7c(a,b){this.a=a;this.b=b} +function N7c(a,b){this.a=a;this.b=b} +function p1c(a,b){this.a=a;this.b=b} +function U3c(a,b){this.a=a;this.b=b} +function f5c(a,b){this.a=a;this.b=b} +function Ogd(a,b){this.a=a;this.b=b} +function Pgd(a,b){this.a=a;this.b=b} +function Qgd(a,b){this.a=a;this.b=b} +function Rgd(a,b){this.a=a;this.b=b} +function Sgd(a,b){this.a=a;this.b=b} +function Wgd(a,b){this.b=a;this.a=b} +function G6c(a,b){this.b=a;this.a=b} +function v8c(a,b){this.o=a;this.n=b} +function E7c(a,b){return Xff(a.b,b)} +function Gpd(a,b){return Xld(a.o,b)} +function Fpd(a,b){return Wld(a.o,b)} +function Uld(a,b){return Iec(a.V,b)} +function Vrd(a,b){return b9b(a.a,b)} +function sdd(a,b){return YPg(b,a.a)} +function esd(a){return fsd(a,a.B*2)} +function Xnd(a){return Znd(a,a,koh)} +function Pqd(a,b){a.fb=b;Cmd(a.o,b)} +function jmd(a,b){!!a.B&&_Db(a.B,b)} +function yqd(a,b){Iub(YOf(a.j).a,b)} +function Cqd(a,b){Oqb(YOf(a.j).i,b)} +function Zud(a,b){a.f||(b.a+=' ',b)} +function QHd(a,b){a.v=b;bqd(a.Mc,a)} +function zHd(a,b){!!a.j&&g9b(a.j,b)} +function kOd(a,b){return b9b(a.d,b)} +function lOd(a,b){return m9b(a.d,b)} +function Dwd(a,b){this.b=b;this.d=a} +function Fwd(a,b){this.a=b;this.d=a} +function Gwd(a,b){this.a=b;this.d=a} +function Hwd(a,b){this.a=b;this.d=a} +function Iwd(a,b){this.a=b;this.d=a} +function Lwd(a,b){this.a=b;this.d=a} +function xQd(a,b){this.a=a;this.b=b} +function H3d(a,b){this.a=a;this.b=b} +function VWd(a,b){this.b=a;this.a=b} +function k5d(a,b){this.b=a;this.a=b} +function E9d(a,b){this.b=a;this.a=b} +function j5d(){this.b=null;this.a=0} +function zsd(){vsd(this);this.b=NaN} +function pee(){hvb.call(this,DAh,0)} +function tee(){hvb.call(this,DAh,0)} +function xee(){hvb.call(this,DAh,0)} +function Bee(){hvb.call(this,DAh,0)} +function Dee(a){cde.call(this,a,-1)} +function Efe(a){Ffe.call(this,a,20)} +function Ihe(){Jhe.call(this,false)} +function Bhe(a,b){this.a=a;this.b=b} +function Bae(a,b){!!a.n&&M7d(a.n,b)} +function kae(a,b){return S6d(a.n,b)} +function Kae(a,b){return m8d(a.n,b)} +function Lae(a,b){return n8d(a.n,b)} +function Mae(a,b){return o8d(a.n,b)} +function Y4d(a,b){return V4d(a.a,b)} +function E4d(a,b){return b9b(a.c,b)} +function pke(a,b){return Dke(a.c,b)} +function sre(a,b){return Dxe(a.c,b)} +function lre(a,b){return Kqf(a.q,b)} +function yre(a,b){return Oqf(a.q,b)} +function oke(a,b){return Xvd(b,a.b)} +function sde(a,b){return Xvd(b,a.a)} +function que(a,b){return rde(b,a.f)} +function hNe(a,b){NNe(b,a.$,-a.Z,0)} +function qOe(a,b){wKc(a,null);a.e=b} +function mse(a,b){this.a=a;this.b=b} +function lye(a,b){this.a=a;this.b=b} +function VJe(a,b){this.a=a;this.b=b} +function $Je(a,b){this.a=a;this.b=b} +function zJe(a,b){this.b=a;this.a=b} +function MSe(a,b){this.b=a;this.a=b} +function PLe(a,b){this.c=a;this.b=b} +function MJe(a){this.b=a;this.a=a.o} +function eJe(){fJe.call(this,false)} +function pOe(a){a.c=false;a.e=false} +function PRe(a,b){a.r=b[0];a.s=b[1]} +function DRe(a,b){!!a.L&&g9b(a.L,b)} +function UVe(a,b){!!a.d&&Bae(a.d,b)} +function aWe(a,b){!!a.d&&Hae(a.d,b)} +function ZVe(a,b){!!a.d&&zVc(a.d,b)} +function e$e(a,b){!!a.e&&g9b(a.e,b)} +function cZe(a,b){return b9b(a.k,b)} +function MTe(a,b){return Xvd(b,a.a)} +function HVe(a){return !!a.d&&a.d.p} +function TWe(a){return !!a.d&&a.d.r} +function d4e(a){return !!a.f||!!a.H} +function Kff(a,b){return NYb(a.b,b)} +function pSe(a,b,c){vQe();c.Yp(a,b)} +function ISe(a,b,c){vQe();c.Dp(a,b)} +function JRe(a,b,c){qQe(a,S_e(b),c)} +function _hf(a,b){return Nhf(a.b,b)} +function cif(a,b){return Cif(a.e,b)} +function fif(a,b){return Ohf(a.b,b)} +function iif(a,b){return Phf(a.b,b)} +function jif(a,b){return Qhf(a.b,b)} +function kif(a,b){return Rhf(a.b,b)} +function rif(a,b){return Fif(a.e,b)} +function Aff(a,b){this.a=a;this.b=b} +function Vff(a,b){this.a=a;this.b=b} +function ijf(a,b){this.a=a;this.b=b} +function b7e(a,b){this.a=a;this.b=b} +function g7e(a,b){this.a=a;this.b=b} +function Uff(a,b){this.b=a;this.a=b} +function yjf(a,b){this.d=a;this.e=b} +function f7e(a){this.b=a;this.a=a.o} +function jrf(a,b){this.b=a;this.a=b} +function Stf(a,b){this.d=a;this.c=b} +function Ulf(a,b){a.f[3]=b;a.a=true} +function Vlf(a,b){a.f[0]=b;a.a=true} +function Wlf(a,b){a.f[1]=b;a.a=true} +function Xlf(a,b){a.f[2]=b;a.a=true} +function T_e(a,b){b[0]=a.A;b[1]=a.B} +function Gvf(a,b){return NYb(a.b,b)} +function rSf(a,b){return DZf(a.g,b)} +function uPf(a){mQc(a.cb);Zpd(a.pb)} +function AQf(a){this.ab=a;xQf(this)} +function p$f(a,b){this.b=a;this.d=b} +function r$f(a,b){this.a=a;this.b=b} +function s$f(a,b){this.a=a;this.b=b} +function yWf(){this.a=new n9b;SNf()} +function D_f(){u_f();this.a=new Xbc} +function oaf(){maf.call(this,V6g,0)} +function fmf(){_lf.call(this,0,0,0)} +function imf(){hmf.call(this,0,0,0)} +function dhf(){Sgf.call(this,ZCh,1)} +function B6f(a,b){this.a=a;this.b=b} +function D6f(a,b){this.b=a;this.a=b} +function E6f(a,b){this.b=a;this.a=b} +function F6f(a,b){this.b=a;this.a=b} +function G6f(a,b){this.b=a;this.a=b} +function H6f(a,b){this.b=a;this.a=b} +function I6f(a,b){this.b=a;this.a=b} +function L6f(a,b){this.a=a;this.b=b} +function o4f(a,b){return bPf(a.b,b)} +function p3f(a,b){vTg((dLg(a.b),b))} +function Xbg(a,b){g9b(a.d,Ibg(a,b))} +function Wbg(a,b){g9b(a.b,Ibg(a,b))} +function Ybg(a,b){g9b(a.f,Ibg(a,b))} +function Zbg(a,b){g9b(a.g,Ibg(a,b))} +function bcg(a,b){g9b(a.k,Ibg(a,b))} +function ccg(a,b){g9b(a.n,Ibg(a,b))} +function dcg(a,b){g9b(a.o,Ibg(a,b))} +function ecg(a,b){g9b(a.q,Ibg(a,b))} +function ocg(a,b){this.b=a;this.c=b} +function yog(a,b){this.a=a;this.b=b} +function Aog(a,b){this.a=a;this.b=b} +function Bog(a,b){this.b=a;this.a=b} +function xqg(a,b){this.b=a;this.a=b} +function mrg(a,b){this.c=a;this.a=b} +function Jtg(a,b){this.a=a;this.b=b} +function Ktg(a,b){this.a=a;this.b=b} +function kvg(a,b){this.a=a;this.b=b} +function vvg(a,b){this.a=a;this.b=b} +function lvg(a,b){this.b=a;this.a=b} +function jyg(a,b){!!a.A&&D0g(a.A,b)} +function xyg(a,b){return w4g(a.t,b)} +function Pyg(a,b){!!a.d&&Byg(a.d,b)} +function oXf(a,b,c){a.N[b]=c;a.UA()} +function uXf(a,b,c){a.Z=b;c&&a.UA()} +function Kzg(a,b){this.b=a;this.a=b} +function wAg(a,b){this.d=a;this.b=b} +function zAg(a,b){this.a=a;this.b=b} +function CAg(a,b){this.a=a;this.b=b} +function vBg(a,b){this.a=a;this.b=b} +function ZBg(a,b){this.a=a;this.b=b} +function $Bg(a,b){this.a=a;this.b=b} +function NBg(a,b){this.b=a;this.a=b} +function cDg(a,b){this.a=a;this.b=b} +function QEg(a,b){this.a=a;this.b=b} +function bFg(a,b){this.a=a;this.b=b} +function cFg(a,b){this.a=a;this.b=b} +function nFg(a,b){this.a=a;this.b=b} +function oFg(a,b){this.a=a;this.b=b} +function LFg(a,b){this.b=a;this.a=b} +function sHg(a,b){this.a=a;this.b=b} +function QIg(a,b){this.a=a;this.b=b} +function gJg(a,b){this.a=a;this.b=b} +function oJg(a,b){this.a=a;this.b=b} +function yMg(a,b){this.a=a;this.b=b} +function zMg(a,b){this.a=a;this.b=b} +function AMg(a,b){this.a=a;this.b=b} +function IMg(a,b){this.a=a;this.b=b} +function JMg(a,b){this.a=a;this.b=b} +function MMg(a,b){this.b=a;this.a=b} +function _Mg(a,b){Z8b(a.b,b);$Mg(a)} +function bCg(a,b){return aCg(b,a.a)} +function Scg(a){return Iqh=0} +function Wpb(a,b){return Tpb(a,b)==0} +function aqb(a,b){return Tpb(a,b)<=0} +function eqb(a,b){return Tpb(a,b)!=0} +function V7b(a,b){hvb.call(this,a,b)} +function r8b(a,b){q8b.call(this,a,b)} +function rdc(a,b){pdc.call(this,a,b)} +function qdc(a,b){pdc.call(this,a,b)} +function sdc(a,b){pdc.call(this,a,b)} +function Bec(a,b){hvb.call(this,a,b)} +function Afc(a,b){hvb.call(this,a,b)} +function Ukc(a,b){vkc.call(this,a,b)} +function Kwc(a,b){hvb.call(this,a,b)} +function uzc(a,b){hvb.call(this,a,b)} +function qHc(a,b){hvb.call(this,a,b)} +function hcc(a,b){icc(a,b,a.c.b,a.c)} +function gcc(a,b){icc(a,b,a.a,a.a.a)} +function xKc(a,b){ff(b,16)&&(a.jb=b)} +function XJc(a){a.ub.bc&&xPf(a.ub,a)} +function Pfc(a,b,c){b.sg(zff(a.a,c))} +function c3g(a,b,c){s2g(c,Bhc(b,c))} +function cDb(a,b,c){a.a[b].Xd(c,c.f)} +function KMc(a,b){hvb.call(this,a,b)} +function NNc(a,b){return VDb(a.jb,b)} +function AOc(a,b){return WQc(a.bb,b)} +function FOc(a,b){return ZQc(a.bb,b)} +function YPc(a,b){return bRc(a.bb,b)} +function wTc(a,b){hvb.call(this,a,b)} +function NUc(a,b){hvb.call(this,a,b)} +function iZc(a,b){hvb.call(this,a,b)} +function zZc(a,b){return NNc(a.Pb,b)} +function Q4c(a,b){hvb.call(this,a,b)} +function t6c(a,b,c){a.c=bOc(a.k,b,c)} +function V3c(a,b,c,d){u4c(a.b,b,c,d)} +function _3c(a,b){a.a&&a.b.a&&b.Lh()} +function U6c(a){a.d&&T6c(a);c7c(a.c)} +function JSc(a){mac();l9b(a,new PSc)} +function VOc(a){vDc(a.lb)&&Nxg(a.lb)} +function mcd(a,b){hvb.call(this,a,b)} +function Ccd(a,b){hvb.call(this,a,b)} +function Zcd(a,b){hvb.call(this,a,b)} +function Zdd(a,b){hvb.call(this,a,b)} +function Fdd(a,b){hvb.call(this,a,b)} +function Qjd(a,b){hvb.call(this,a,b)} +function Std(a,b){hvb.call(this,a,b)} +function eud(a,b){hvb.call(this,a,b)} +function RPd(a,b){hvb.call(this,a,b)} +function HTd(a,b){GTd.call(this,a,b)} +function ITd(a,b){GTd.call(this,a,b)} +function JTd(a,b){GTd.call(this,a,b)} +function KZd(a,b){hvb.call(this,a,b)} +function d0d(a,b){hvb.call(this,a,b)} +function z1d(a,b){hvb.call(this,a,b)} +function Wkd(a){mc.call(this,a._c())} +function d9d(a,b){hvb.call(this,a,b)} +function Abe(a,b){a.n=Lbe(a.n,a.o,b)} +function W7d(a,b){a.o=b;a.o.Oo(true)} +function hWd(a,b,c){gWd(a,b.A,b.B,c)} +function NWd(a,b,c){MWd(a,b.A,b.B,c)} +function ZJe(a,b,c){return c.tx(a,b)} +function pwd(a,b){return b+kxh+a+P7g} +function ahe(a){return _ge(a)/Zge(a)} +function JNc(a){a.tc=true;return a.Y} +function iNe(a,b){b[0]=a.$;b[1]=-a.Z} +function ONe(a,b){NNe(a,b.Z,b.$,b._)} +function JQe(a,b,c){IQe(a,b.Z,b.$,c)} +function Jje(a,b){hvb.call(this,a,b)} +function bee(a,b){hvb.call(this,a,b)} +function STe(a,b){hvb.call(this,a,b)} +function _Te(a,b){hvb.call(this,a,b)} +function E7e(a,b){hvb.call(this,a,b)} +function W8e(a,b){hvb.call(this,a,b)} +function maf(a,b){hvb.call(this,a,b)} +function Kbf(a,b){hvb.call(this,a,b)} +function Vbf(a,b){hvb.call(this,a,b)} +function Sgf(a,b){hvb.call(this,a,b)} +function pwf(a,b){hvb.call(this,a,b)} +function TNf(a,b){hvb.call(this,a,b)} +function XQf(a,b){hvb.call(this,a,b)} +function sVf(a,b){hvb.call(this,a,b)} +function LVf(a,b){hvb.call(this,a,b)} +function _Vf(a){this.b=a;this.c=true} +function $Gb(a){this.d=a;this.c=null} +function Ucc(){this.b=0;this.a=false} +function BYf(a,b){hvb.call(this,a,b)} +function z$f(a,b){hvb.call(this,a,b)} +function d_f(a,b){hvb.call(this,a,b)} +function Z_f(a,b){hvb.call(this,a,b)} +function l9f(a,b){hvb.call(this,a,b)} +function R9f(){l9f.call(this,Qqh,15)} +function Bag(){l9f.call(this,'OR',4)} +function Abg(){l9f.call(this,KAh,96)} +function Bbg(){l9f.call(this,QEh,97)} +function vcg(a,b){ocg.call(this,a,b)} +function _cg(a,b){hvb.call(this,a,b)} +function OSe(a,b){return tNe(a.G[b])} +function G2e(a,b){return a.v.A+b*a.$} +function H2e(a,b){return a.v.B-b*a.Z} +function sYe(a){return a.i&&a.d.qm()} +function meg(a){aEb(a);a.a.a.clear()} +function b$f(a){g$f(a,zjd(a.b,true))} +function H$b(){G$b(this,0,0,0,0,0,0)} +function glg(a){++blg;clg=Rpb(clg,a)} +function ilg(a){++$kg;Zkg=Rpb(Zkg,a)} +function Dlg(a,b){hvb.call(this,a,b)} +function Cig(a,b){hvb.call(this,a,b)} +function Kig(a,b){hvb.call(this,a,b)} +function Pig(a,b){hvb.call(this,a,b)} +function skg(a,b){hvb.call(this,a,b)} +function QCg(a,b){hvb.call(this,a,b)} +function NHg(a,b){hvb.call(this,a,b)} +function stg(a,b){return a.a.test(b)} +function hOf(a,b,c,d){return a*d-c*b} +function pXf(a,b,c){a.P=new xqg(b,c)} +function bDg(a,b,c){yCg(a.a,a.b,b,c)} +function Uxg(a,b){eyg(a.eC(),b,true)} +function Iyg(a){qWg((kWg(),jWg),a.e)} +function rVg(a){qVg(a.c,a.a,a.b*$ph)} +function KMg(a){this.a=a;this.b=null} +function Npg(){Apg();this.a=this.e=1} +function _Yg(){zYg.call(this,Qih,32)} +function RYg(){zYg.call(this,X8g,23)} +function w_g(){u_g.call(this,'PX',0)} +function y_g(){u_g.call(this,'EM',2)} +function z_g(){u_g.call(this,'EX',3)} +function A_g(){u_g.call(this,'PT',4)} +function B_g(){u_g.call(this,'PC',5)} +function C_g(){u_g.call(this,'IN',6)} +function D_g(){u_g.call(this,'CM',7)} +function E_g(){u_g.call(this,'MM',8)} +function e_g(a,b){hvb.call(this,a,b)} +function u_g(a,b){hvb.call(this,a,b)} +function u$g(a,b){hvb.call(this,a,b)} +function K$g(a,b){hvb.call(this,a,b)} +function V$g(a,b){hvb.call(this,a,b)} +function vXg(a,b){hvb.call(this,a,b)} +function zYg(a,b){hvb.call(this,a,b)} +function RZg(a,b){hvb.call(this,a,b)} +function o4g(a,b){hvb.call(this,a,b)} +function L1g(a,b){y1g();Dhc(a,hGh,b)} +function T0g(a){L0g(a.a,a.d,a.c,a.b)} +function pSh(a){return Xvd(a,this.b)} +function wSh(a){return gwf(this.d,a)} +function JNh(a){return nBb(this.a,a)} +function MRh(a){return b9b(this.c,a)} +function cSh(a){return new bfe(this)} +function HUh(a){return new A5e(this)} +function NPh(a){return new Sid(this)} +function UVh(a){return ff(a,50)&&a.i} +function d3b(a){return pf((nhc(a),a))} +function te(a){return ue(a.l,a.m,a.h)} +function qwb(a,b){return c9b(a.d,b,0)} +function Tb(a,b){return nf(a)===nf(b)} +function m4b(a,b){return a.indexOf(b)} +function QDb(a){return !a?null:a.ef()} +function RDb(a){return !a?null:a.ff()} +function sOh(){return this.size()==0} +function BTh(){!!this.d&&Z9d(this.d)} +function eEb(a){aEb(this);ODb(this,a)} +function rIb(a,b){uIb(a,b);Z8b(a.b,b)} +function FHb(a,b,c){a.oe(a.c,c&Q4g,b)} +function JOh(a,b){throw Qpb(new p5b)} +function vOb(a,b){a.g=w3b(b);return a} +function qVh(a,b,c,d,e,f,g){return b} +function bYf(){bYf=xqb;CYf().length} +function tBb(){tBb=xqb;sBb=new DBb(0)} +function jIb(){jIb=xqb;iIb=new uLb(0)} +function yAb(){zAb.call(this,new Xub)} +function yRb(a){zRb.call(this,a,true)} +function Lub(a){Gub.call(this,a,a+'')} +function gDb(a){hDb.call(this,a,null)} +function YJb(){ZJb.call(this,0,0,0,0)} +function kwc(a){lwc.call(this,a,true)} +function zbc(a){this.a=Ibc();this.b=a} +function Nbc(a){this.a=Ibc();this.b=a} +function Mdc(a,b){Z8b(a.a,b);return b} +function $Fc(a,b){dGc(a.b,b);CFc(a.a)} +function C9b(a,b){H9b(a,0,a.length,b)} +function W9b(a,b){Q9b(a,0,a.length,b)} +function YLc(a,b){UKc(a,b);DHc(a.a,b)} +function g$b(a,b){return WDb(a.b,b).a} +function p3b(a,b){return s3b(a.a,b.a)} +function d8b(a){return a.b0||a.zb==2} +function dQc(a,b){return (a.Hc-b)*a.Eb} +function cQc(a,b){return (b-a.yc)*a.Db} +function qRc(a,b){return Sqg(pRc(a),b)} +function tRc(a,b){return _qg(pRc(a),b)} +function iYc(a){return gOc(a.Pb,a.b,a)} +function Jcc(a){return a!=null?Xb(a):0} +function Apd(a){return !!a.i&&Gkd(a.i)} +function xLc(a){vLc(a,false);Zpd(a.Mc)} +function cAc(a,b){b&&(a.a=false);a.i=b} +function zqd(a,b){b==3?(a.d=0):(a.d=b)} +function Srd(a,b){bmd(a.a,b,true,null)} +function V4b(a,b){a.a+=nqb(b);return a} +function ofc(a,b){if(ffc){return}a.b=b} +function V0d(a,b){j$d.call(this,a,b,2)} +function rFd(a){lwc.call(this,a,false)} +function cdd(){Zcd.call(this,'TYPE',1)} +function zad(a){rxc();wxc.call(this,a)} +function lHd(a){return !a.F?0:a.F.qz()} +function mHd(a){return !a.F?0:a.F.rz()} +function hPe(a){return !a.G&&a.f==null} +function iTe(a){return a.k&&!!dTe(a,0)} +function w8d(a,b){return !b?a:z7d(a,b)} +function V4d(a,b){return p8d(b,a).Ap()} +function N_e(a){return x0e(a,null),a.s} +function Yxe(){Yxe=xqb;Xxe=(Sud(),oud)} +function fug(){fug=xqb;eug=new gug(1)} +function X8b(a){a.i=me(gu,Z4g,1,0,5,1)} +function vYe(a,b){a.c=b;gqd(a.Mc,a,13)} +function Nee(a,b){ff(a.c,167)&&(a.c=b)} +function X1e(a,b){$1e(a,b);b2e(a,a.Kc)} +function i$e(a){vLc(a,false);Zpd(a.Mc)} +function YDc(a){a.vv()&&a.vp();a.zp(2)} +function sMe(a,b,c){a.d=c;a.e=b;a.Ox()} +function She(a){Qhe();Ohe=a;return Phe} +function c2e(a){o1e();d2e.call(this,a)} +function Xgf(){Sgf.call(this,'EXP',11)} +function Ygf(){Sgf.call(this,'LOG',12)} +function fhf(){Sgf.call(this,'SEC',20)} +function ghf(){Sgf.call(this,'SIN',21)} +function jhf(){Sgf.call(this,'TAN',24)} +function ohf(){Sgf.call(this,'ATAN',5)} +function nhf(){Sgf.call(this,'ASIN',4)} +function mhf(){Sgf.call(this,'ACOS',3)} +function qhf(){Sgf.call(this,'COSH',7)} +function hag(){l9f.call(this,'COS',31)} +function lag(){l9f.call(this,'LOG',35)} +function iag(){l9f.call(this,'SIN',32)} +function jag(){l9f.call(this,'TAN',33)} +function kag(){l9f.call(this,'EXP',34)} +function zag(){l9f.call(this,'ABS',47)} +function Aag(){l9f.call(this,'SGN',48)} +function Qag(){l9f.call(this,'SEC',62)} +function Pag(){l9f.call(this,'CSC',61)} +function Rag(){l9f.call(this,'COT',63)} +function jbg(){l9f.call(this,'ERF',80)} +function kbg(){l9f.call(this,'PSI',81)} +function qbg(){l9f.call(this,'NPR',87)} +function ybg(){l9f.call(this,'ARG',94)} +function zbg(){l9f.call(this,'ALT',95)} +function w9f(){l9f.call(this,'IF',103)} +function Tkg(a,b){Pkg.call(this,a,b,0)} +function Dbg(a){ic.call(this);this.a=a} +function oQf(a){a.Wb==1&&pMg(a);a.Wb=2} +function WLg(a){!!a.cb&&Qzg(a.cb.lb.a)} +function ZLg(a){!!a.d&&VSg(a.d,yvh,'')} +function Pbg(a,b,c){a.e=Qbg(a,a.e,b,c)} +function Rbg(a,b,c){a.p=Qbg(a,a.p,b,c)} +function Rzg(a,b){vOf(a.o,b.f.a,b.f.b)} +function u0f(a,b){x0f(a,(_1f(),K0f),b)} +function ZWg(a,b){jXg(a,(yYg(),CXg),b)} +function $Wg(a,b){jXg(a,(yYg(),EXg),b)} +function bXg(a,b){jXg(a,(yYg(),JXg),b)} +function dDg(a,b){tyg(a,!b?null:b,a.C)} +function F1g(a,b){y1g();W1g();b2g(a,b)} +function RVg(a){NVg();g9b(MVg,a);QVg()} +function SVg(a){NVg();Z8b(LVg,a);QVg()} +function SAg(a){a.f||(a.g=null);a.Nf()} +function mdf(a){return a.u&&cdf(a),a.r} +function NZf(a){return !a.d?-1:a.d.a-1} +function PUg(a,b){return a.b.format(b)} +function zUh(a,b){return DNe(this,a,b)} +function VRh(a){return new Gbe(this,a)} +function IOh(){return new gdc(this,16)} +function $Vh(){return Zbd(iOc(this.a))} +function fe(a){return Kc((Gc(),Fc),a.a)} +function yBb(a,b){return b9b(a.a,b+1).a} +function zBb(a,b){return b9b(a.a,b+1).b} +function Vub(a,b,c){return wub(a.c,b,c)} +function ue(a,b,c){return {l:a,m:b,h:c}} +function FCb(a){return new UCb(a.a,a.c)} +function fjf(){this.a=new off(k9g,h9g)} +function DBb(a){tBb();this.a=new o9b(a)} +function uSh(){dwf(this.d,(owf(),nwf))} +function mCb(){nCb.call(this,null,null)} +function OCb(a,b){NCb.call(this,a,-1,b)} +function F0g(a){G0g.call(this,a,false)} +function P$g(){K$g.call(this,'AUTO',3)} +function wIb(){mCb.call(this);qIb(this)} +function XHb(a){mCb.call(this);this.u=a} +function pHb(a){ICb.call(this);this.a=a} +function aHb(a){XGb.call(this);this.a=a} +function gHb(a){XGb.call(this);this.a=a} +function hHb(a){XGb.call(this);this.a=a} +function jHb(a){NAb.call(this);this.a=a} +function gCb(a){NAb.call(this);this.a=a} +function gKb(a){NAb.call(this);this.a=a} +function BIb(a){NAb.call(this);this.a=a} +function DIb(a){NAb.call(this);this.a=a} +function mLb(a){NAb.call(this);this.a=a} +function zLb(a){NAb.call(this);this.a=a} +function ALb(a){NAb.call(this);this.a=a} +function KQb(a){NAb.call(this);this.a=a} +function RQb(a){NAb.call(this);this.a=a} +function SQb(a){NAb.call(this);this.a=a} +function CRb(a){NAb.call(this);this.b=a} +function PJb(){mCb.call(this);IJb(this)} +function TYb(){PYb.call(this);SYb(this)} +function bZb(a){XYb=a;EGb();!BGb&&JGb()} +function VOb(a){NOb();return XDb(MOb,a)} +function FOb(a,b){return a.a*uRb(a.b,b)} +function OOb(a,b){return he(WDb(a.a,b))} +function O1b(a,b,c){return z4b(a.a,b,c)} +function H1b(a,b,c){return n4b(a.a,b,c)} +function s3b(a,b){return ab?1:0} +function M3b(a,b){return Tpb(a,b)<0?a:b} +function L3b(a){return Tpb(a,10)>0?a:10} +function yLb(a){return a==3||a==4||a==5} +function p2b(a){return a>=j5g&&a<=56319} +function pbc(a){return a.a0||a.Mb.a} +function fNc(a){return EWf(a.bc)-a.bc.S} +function Hec(a,b){return QDb(a.a.Yf(b))} +function Jec(a,b){return QDb(a.a._f(b))} +function Kec(a,b){return QDb(a.a.ag(b))} +function Lec(a,b){return QDb(a.a.cg(b))} +function vSc(a,b,c){return Jrg(a.a,b,c)} +function XQc(a,b){return new EVc(a.a,b)} +function YQc(a,b){return new n$c(a.a,b)} +function WQc(a,b){return b.ho(iOc(a.a))} +function xJc(a,b){return a==b||wJc(a,b)} +function FVc(a,b,c){return K1c(a.s,b,c)} +function NVc(a,b,c){return xrg(a.n,b,c)} +function AYc(a){return a.a.v.a+hYc(a.a)} +function x2c(a){return !a.e.c?0:a.e.c.b} +function M3c(a){this.a=a;this.b=new n9b} +function ASc(a){this.b=a;this.a=new Prg} +function WUc(a){this.b=a;this.a=new lrg} +function AHc(a,b){b.lb==a.t&&(a.t=null)} +function oTc(a,b){a.b=b;a.c=(vTc(),sTc)} +function w6c(a,b,c,d){a.b=b;a.a=c;a.c=d} +function C4c(a,b,c){return Jrg(a.c,b,c)} +function A4c(a,b,c){return Jrg(a.b,b,c)} +function M7c(a,b){return J7c(a.a,a.b,b)} +function yhc(a,b){for(var c in a){b(c)}} +function b4c(a,b){k3c(a.e.j);c4c(a,b.a)} +function nQc(a){!!a.Y&&rNc(a,a.Y,false)} +function bTc(a){Ryc.call(this);this.a=a} +function kTc(a){Ryc.call(this);this.i=a} +function pZc(a){n9b.call(this);this.a=a} +function vrd(a){n9b.call(this);this.a=a} +function Mad(){mvc.call(this);Iad(this)} +function ddd(){Zcd.call(this,'ORDER',2)} +function edd(){Zcd.call(this,'LAYER',3)} +function hrd(a){dod();return a==2||a==8} +function GCd(a,b,c){return FCd(a,b.i,c)} +function HCd(a,b,c){return FCd(a,c.i,b)} +function Jae(a,b,c){return l8d(a.n,b,c)} +function abe(a,b,c){return t6d(a.n,b,c)} +function rde(a,b){return new ude(b,a.a)} +function o7d(a){return a.n&&ff(a.o,111)} +function NRd(a){return ff(a,56)&&CVe(a)} +function xfe(a,b,c){return j9b(a.d,b,c)} +function AId(a,b,c){s0e(a.b,b,c,1,true)} +function cse(a,b,c){return Ixe(a.c,b,c)} +function Ove(a,b,c){return hqd(a.f,b,c)} +function Qve(a,b,c){return jqd(a.f,b,c)} +function cKe(a,b){return a.b^NYb(a.a,b)} +function Nmd(a,b){a.e=b;C3d(b);a.e=null} +function BFd(a,b,c,d){a.i=b;a.k=c;a.j=d} +function Uke(a,b,c,d){a.e=b;a.f=c;a.g=d} +function w0e(a,b,c,d){a.Z=b;a.$=c;a._=d} +function r0e(a,b,c,d){s0e(a,b,c,d,true)} +function t0e(a,b){s0e(a,b.d,b.e,1,true)} +function E1e(a,b,c){return h2e(b,c,a.p)} +function K5e(a,b,c){c.d=a.d/b;c.e=a.e/b} +function L5e(a,b){a.d=b.d;a.e=b.a;a.b=5} +function lsd(a){a.e=a.i;a.j=a.f;a.o=a.g} +function _ee(a){a.a=new h5b;a.b=new gfe} +function Mge(a){this.b=new n9b;this.a=a} +function TNd(a){this.b=new n9b;this.a=a} +function L7c(a){this.a=new y6c;this.b=a} +function y5e(a){abd.call(this);this.a=a} +function r8d(){abd.call(this);S5d(this)} +function V9e(){W8e.call(this,'PATH',50)} +function Zgf(){Sgf.call(this,'LOG2',13)} +function chf(){Sgf.call(this,'PLUS',18)} +function hhf(){Sgf.call(this,'SINH',22)} +function ihf(){Sgf.call(this,'SQRT',23)} +function khf(){Sgf.call(this,'TANH',25)} +function paf(){maf.call(this,'ARROW',1)} +function $ff(a){f9b(a.a,a.a.i.length-1)} +function Dff(a){return !!a&&Zef(a.oA())} +function zff(a,b){return wff(a.a,a.b,b)} +function oif(a,b,c){return xhf(a.a,b,c)} +function pif(a,b,c){return yhf(a.a,b,c)} +function mif(a,b,c){return zif(a.c,b,c)} +function Ref(a,b){return b>=a.c&&b<=a.a} +function b4e(a){return a.v==null?'':a.v} +function U3e(a,b){if(a._b){return}a.j=b} +function N5e(a,b,c){c.d=a.d*b;c.e=a.e*b} +function Jlf(a,b,c){a.f[b-1]=c;a.a=true} +function Ujf(a,b,c,d){Jlf(a.f[c-1],b,d)} +function c6e(a,b){NNe(a,b[0],b[1],b[2])} +function Sif(a,b){N6c(a.b,b,Tff(a.d,b))} +function Pif(a,b){Q6c(a.b,b,Tff(a.d,b))} +function Qif(a,b){M6c(a.b,b,Tff(a.d,b))} +function Tif(a,b){O6c(a.b,b,Tff(a.d,b))} +function h6f(a,b,c){hXf(a,b,(nhc(c),c))} +function i6f(a,b,c){oXf(a,b,(nhc(c),c))} +function jkf(){fkf();$jf.call(this,4,4)} +function C9f(){l9f.call(this,'LESS',10)} +function X9f(){l9f.call(this,'PLUS',20)} +function H9f(){l9f.call(this,'SUM',113)} +function xag(){l9f.call(this,'SQRT',45)} +function Iag(){l9f.call(this,'COSH',55)} +function Jag(){l9f.call(this,'SINH',56)} +function Kag(){l9f.call(this,'TANH',57)} +function gag(){l9f.call(this,'DATA',30)} +function Uag(){l9f.call(this,'COTH',66)} +function Sag(){l9f.call(this,'CSCH',64)} +function Tag(){l9f.call(this,'SECH',65)} +function Wag(){l9f.call(this,'CEIL',68)} +function Gag(){l9f.call(this,'REAL',53)} +function fbg(){l9f.call(this,'BETA',77)} +function vbg(){l9f.call(this,'CBRT',91)} +function obg(){l9f.call(this,'LOG2',85)} +function pbg(){l9f.call(this,'LOGB',86)} +function IXf(){zQf.call(this);GXf(this)} +function _Xf(){zQf.call(this);XXf(this)} +function Deg(a){Xbc.call(this);this.a=a} +function Gyg(a){Ayg.call(this);this.C=a} +function Cxg(a){this.a=new PYb;this.b=a} +function sBg(a){this.a=a;RAg.call(this)} +function _Cg(a){this.a=a;RAg.call(this)} +function jEg(a){this.a=a;RAg.call(this)} +function kEg(a){this.a=a;RAg.call(this)} +function TVf(a){this.b=a;this.c=new n9b} +function seg(){aEb(this);this.a=new Oec} +function epg(a){cpg(a,1,0);a.d[a.c++]=4} +function zGg(a){Yxg(a,Xxg());return a.C} +function Qyg(a){a.c=(Y1b(),true);jzg(a)} +function vJg(a){a.f!=null&&a.f.remove()} +function vHg(a){this.a=a;RAg.call(this)} +function xHg(a){this.a=a;RAg.call(this)} +function yHg(a){this.a=a;RAg.call(this)} +function wMg(a){this.a=a;RAg.call(this)} +function QJg(a){DJg(a.f,a.C,a.b);TJg(a)} +function sMg(a){if(!a.Tb||a.lb){return}} +function sKg(a,b,c){XZf(a,MZf(a,b),b,c)} +function Cqg(a,b,c,d){E$b(this,a,b,c,d)} +function Xrg(a,b,c,d){E$b(this,a,b,c,d)} +function jrg(a){return new nvc(a.b,a.d)} +function irg(a){return new nvc(a.a,a.c)} +function qSf(a,b){return CZf(a.g,b,a.i)} +function eOg(a,b){Hpd(a.b.pb,b,false,0)} +function pHg(a,b){a.C[Yph]=b!=null?b:''} +function JQg(a){this.a=a;RAg.call(this)} +function ORg(a){this.a=a;RAg.call(this)} +function a$g(){RZg.call(this,'FLEX',17)} +function c$g(){RZg.call(this,'BLOCK',1)} +function i$g(){RZg.call(this,'TABLE',7)} +function D$g(){u$g.call(this,'RIDGE',7)} +function B$g(){u$g.call(this,'INSET',5)} +function E$g(){u$g.call(this,'SOLID',8)} +function BXg(){vXg.call(this,'SOLID',4)} +function BYg(){zYg.call(this,'FLOAT',0)} +function XYg(){zYg.call(this,'WIDTH',2)} +function $$g(){V$g.call(this,'FIXED',3)} +function F4g(a,b){Dhc(a.style,'clip',b)} +function ITh(a,b){return eQg(this.Pb.b)} +function uQh(a){return n8d(this.b.Gb,a)} +function sQh(a){return n8d(this.a.Gb,a)} +function WVh(a){return ff(a,34)&&a.sv()} +function J4b(a){return K4b(a,0,a.length)} +function Qpb(a){return a.backingJsObject} +function ff(a,b){return a!=null&&bf(a,b)} +function C0g(a,b,c){return I0g(a.a,b,c)} +function GVh(a,b,c,d){Wqg(this,a,b,c,d)} +function MCb(a){NCb.call(this,a,0,false)} +function aUh(a){jJc(this,a);PIc(this,a)} +function DTh(a){!!this.d&&Aae(this.d,a)} +function S0g(a){this.d=new cEb;this.c=a} +function lub(a){this.c=a;this.b=a.length} +function LUh(a){a[0]=this.Z;a[1]=this.$} +function VGb(a,b){a.b=false;a.c=-1;a.a=b} +function Pqb(a,b){a.b=$wnd.Math.max(b,0)} +function VIb(a,b,c){a.d=new xLb(b,c,0,0)} +function UZb(a,b,c){TZb.call(this,a,b,c)} +function POb(a,b){return HOb(WDb(a.b,b))} +function GOb(a){return new JOb(a.b,-a.a)} +function xac(a,b){return a.b.contains(b)} +function Vbc(a,b){if(a.b){Zbc(b);Ybc(b)}} +function Z8b(a,b){Vgc(a.i,b);return true} +function CCb(){CCb=xqb;BCb=ZLb(y9g,true)} +function OIb(){OIb=xqb;NIb=ZLb(Hbh,true)} +function BZb(){BZb=xqb;AZb=ZLb(Hbh,true)} +function AJb(){AJb=xqb;zJb=ZLb(mah,true)} +function Mcc(){Mcc=xqb;Lcc=new Pcc(null)} +function gKc(a,b){XEc(a,new cde(a.Mc,b))} +function $Ec(a,b,c){ZEc(a,a.mc-b,a.oc-c)} +function ZJc(a,b){_Jc(a,b);lKc(a,b.wb.a)} +function bdc(a,b,c){a.a=b^1502;a.b=c^Ylh} +function kzc(a,b,c){a.p=true;a.q=b;a.r=c} +function DAc(a,b,c){return Jrg(a.Eb,b,c)} +function ALc(a){return new t8d(a.vi(),a)} +function X7c(a){return zLg(a.a)=0} +function J8d(a){return ff(a,141)&&k5e(a)} +function uqd(a){a.ib&&XOf(a.j).b&&vqd(a)} +function g4c(a){a.f=(h3c(),f3c);Qcd(a.d)} +function Z9d(a){if(!a.j){return}Rbc(a.j)} +function cie(a){aie();_he.a=a;return _he} +function Xee(a){Uee();Tee.a=a;return Tee} +function hje(a){fje();eje.a=a;return eje} +function eOb(a){HNb();INb(this);this.g=a} +function G3d(a){this.b=a;this.a=this.b.a} +function S8b(){this.a=me(gu,Z4g,1,8,5,1)} +function Yb(a){a.j=me(iu,W4g,4281,0,0,1)} +function BRe(a,b,c){ARe(a,b.Z,b.$,b._,c)} +function WSe(a,b,c,d){tjf(a.a,a.W,b,c,d)} +function nQe(a,b,c,d){a.V=new ULe(b,c,d)} +function w3e(a,b){return new ude(a.Mc,b)} +function gTe(a,b){return qbe(dTe(a,0),b)} +function sZe(a,b){return mZe(a,qZe(a),b)} +function r7e(a,b){return L7e(a.b,z2b(b))} +function L7e(a,b){return MDb(a.a,b,b+'')} +function iZe(a,b){return b9b(a.c,b).lp()} +function Ije(a,b,c){return b.cm()==a?a:c} +function nTe(a,b,c){a.o=b;a.f=c;a.k=b<=c} +function aMe(a){a.H=NaN;a.k=null;a.e=NaN} +function C1e(a){return a.t==null?n1e:a.t} +function eif(a,b){return hif(Fif(a.e,b))} +function qif(a,b){return hif(Cif(a.e,b))} +function gff(a,b){fff(a,b.c,b.a);a.b=b.b} +function Ndf(a){if(!a.a){return}a.u=true} +function Qtf(a){this.c=a;this.b=a.length} +function gaf(){W8e.call(this,'GEORAY',6)} +function K9f(){l9f.call(this,'ZETA',116)} +function L9f(){l9f.call(this,'DIFF',117)} +function Y9f(){l9f.call(this,'MINUS',21)} +function _gf(){Sgf.call(this,'MINUS',15)} +function $gf(){Sgf.call(this,'LOG10',14)} +function ehf(){Sgf.call(this,'POWER',19)} +function bhf(){Sgf.call(this,'NROOT',17)} +function vag(){l9f.call(this,'NROOT',44)} +function Vag(){l9f.call(this,'FLOOR',67)} +function dag(){l9f.call(this,'POWER',28)} +function Lag(){l9f.call(this,'ACOSH',58)} +function Nag(){l9f.call(this,'ASINH',59)} +function Oag(){l9f.call(this,'ATANH',60)} +function $ag(){l9f.call(this,'ROUND',70)} +function abg(){l9f.call(this,'GAMMA',72)} +function bbg(){l9f.call(this,'DIRAC',73)} +function nbg(){l9f.call(this,'LOG10',84)} +function Qrg(a,b){Rrg.call(this,0,0,a,b)} +function Rng(a,b,c){Sng.call(this,a,b,c)} +function mgf(a,b,c){ngf.call(this,a,b,c)} +function RIg(a,b){var c;c=a.C;tyg(a,b,c)} +function Jyg(a,b){!!a.a.P&&ayg(a.a.P,!b)} +function KNg(a){evg(a.b);!!a.a&&Jzg(a.a)} +function lIg(a){if(!a.a){return}oIg(a.a)} +function oUg(a,b){return WDb(a.b,Zhg(b))} +function xsg(a,b){return a.F==b?a:a.GB()} +function Rtg(a,b){return a!=null&&!!a[b]} +function AFg(a,b){this.c=a.cb.u;this.a=b} +function VSg(a,b,c){a.a.cC(b,c);return a} +function pQg(a,b,c){a.e=b;a.f=c;return a} +function Qvf(a,b,c,d,e){Hvf(a.c,b,c,d,e)} +function Qxg(a,b,c,d,e){BUc(a.a,b,c,d,e)} +function Rxg(a,b,c,d,e){CUc(a.a,b,c,d,e)} +function MOg(a,b){SQg((QQg(),PQg),a.b,b)} +function zXg(){vXg.call(this,'DASHED',2)} +function x$g(){u$g.call(this,'DASHED',1)} +function z$g(){u$g.call(this,'DOUBLE',3)} +function C$g(){u$g.call(this,'OUTSET',6)} +function h$g(){RZg.call(this,'RUN_IN',6)} +function d$g(){RZg.call(this,'INLINE',2)} +function A$g(){u$g.call(this,'GROOVE',4)} +function O$g(){K$g.call(this,'SCROLL',2)} +function N$g(){K$g.call(this,'HIDDEN',1)} +function AXg(){vXg.call(this,'HIDDEN',3)} +function ZYg(){zYg.call(this,'COLOR',30)} +function $Yg(){zYg.call(this,'CLEAR',31)} +function X$g(){V$g.call(this,'STATIC',0)} +function c1g(){c1g=xqb;new b1g('');j1g()} +function Y1b(){Y1b=xqb;W1b=false;X1b=true} +function cNh(a){var b;Ud((b=this,a,b).a)} +function ZRh(a){return new ude(a,this.a)} +function aSh(a){return new Zee(a,this.c)} +function oSh(a){return new tke(a,this.b)} +function fhc(a){return a.$H||(a.$H=++bhc)} +function I4b(a){return a==null?T4g:Bqb(a)} +function o4b(a){return $1b(P4g,typeof(a))} +function e3b(a){return $1b(N4g,typeof(a))} +function p4b(a,b){return a.lastIndexOf(b)} +function n4b(a,b,c){return a.indexOf(b,c)} +function aDb(a,b,c){return bDb(a,b,c,c.f)} +function kDb(a,b){lDb.call(this,a,b,null)} +function dLb(a,b){oDb.call(this,a,b,null)} +function eHb(a,b){fHb.call(this,a,b,null)} +function LCb(a){NCb.call(this,a,-1,false)} +function OLb(a,b){NLb();this.a=a;this.b=b} +function oJb(a,b){nJb();this.a=a;this.b=b} +function JOb(a,b){EOb();this.b=a;this.a=b} +function yQb(){YOb();BQb.call(this,false)} +function PUb(a,b){OUb.call(this,a,null,b)} +function VWb(a,b){XWb.call(this,YWb(b,a))} +function rOb(a,b){a.a=b;a.f=true;return a} +function e5b(a,b,c){K1b(a,b,b,c);return a} +function OYb(a,b){return $Db(a.a,b)!=null} +function ywb(a){return a.d?a.d.i.length:0} +function De(a){return a.l+a.m*E5g+a.h*F5g} +function s2b(a){return a>=56320&&a<=57343} +function $yc(a){return new Nad(a[0],a[1])} +function pBc(a){return a==0||a==77||a==78} +function NIc(a){return Haf((ROf(a.ub),a))} +function j5b(a){P1b.call(this,(nhc(a),a))} +function Bac(a){yac.call(this,a);this.a=a} +function Cac(a){Aac.call(this,a);this.a=a} +function w1c(a,b){r1c();this.j=a;this.c=b} +function sRh(){TMe(this.a,this.c,this.b)} +function NQh(){UMe(this.a,this.b,this.d)} +function pec(a){this.a=a;z8b.call(this,a)} +function _c(a){this.a=me(uf,v5g,5,a,15,1)} +function fwc(a,b){a.Y=me(fY,qnh,13,b,0,1)} +function QKc(a,b){a.ec=$wnd.Math.max(0,b)} +function S5c(){S5c=xqb;$wnd.Math.tan(Wqh)} +function S6c(a){b7c(a.c);Ygc(a.b.d.a.i,0)} +function e8c(a){Ygc(a.a.i,0);Ygc(a.c.i,0)} +function Tgd(a,b,c){fcc(a.a,new Wgd(b,c))} +function M6c(a,b,c){NJb(a.d,new Vff(b,c))} +function Q6c(a,b,c){MJb(a.d,new Vff(b,c))} +function DOd(a,b,c,d){EOd(a,c,AOd(b,c),d)} +function l3d(a,b,c){p0e(b,a.d.Kp(c),true)} +function Dxd(a,b){s0e(a,b.Z,b.$,b._,true)} +function p0c(a,b){a.e.c&&!!a.a&&b.Dh(a.a)} +function G7c(a,b){return bV4g?a.T:CWf(a)} +function Sef(a,b){return b.c>a.c&&b.a0?(a.cb=true):xQf(a)} +function jYf(){bYf();zQf.call(this);AYf()} +function Wgf(){Sgf.call(this,'DIVIDE',10)} +function bag(){l9f.call(this,'DIVIDE',26)} +function mag(){l9f.call(this,'ARCCOS',36)} +function oag(){l9f.call(this,'ARCSIN',38)} +function rag(){l9f.call(this,'ARCTAN',40)} +function Cag(){l9f.call(this,'XCOORD',49)} +function Dag(){l9f.call(this,'YCOORD',50)} +function Eag(){l9f.call(this,'ZCOORD',51)} +function _ag(){l9f.call(this,'ROUND2',71)} +function wbg(){l9f.call(this,'RANDOM',92)} +function NVf(){LVf.call(this,'GENERIC',0)} +function cff(a){fff(a,-a.a,-a.c);return a} +function Tig(a){if(!a.q){return}a.q=a.q.b} +function Lkg(a,b){a.a=b.a;a.b=b.b;a.c=b.c} +function qAg(a,b){Rzg(a.d.a,b);Mxg(a.d,b)} +function rAg(a,b){lIg(a.d.a.j);Kxg(a.d,b)} +function qGg(a,b){lXg(a.s.C.style,tGg(b))} +function Zxg(a,b){Dhc(a.aC().style,tih,b)} +function cyg(a,b){Dhc(a.aC().style,sih,b)} +function Ndg(a,b){O4b(a.b,(mhg(),gig(b)))} +function nMg(a,b){if(!a.mb){return}zVf(b)} +function gMg(a,b){if(a.j==b){return}a.j=b} +function EHg(a,b){a.C.setAttribute(d9g,b)} +function $Sg(a,b){aTg.call(this,a,null,b)} +function _Sg(a,b){aTg.call(this,a,b,null)} +function oXg(a,b){jXg(a,(yYg(),xYg),b+'')} +function hOg(a,b,c,d){UMg(cLg(a.b),b,c,d)} +function iOg(a,b,c,d){VMg(cLg(a.b),b,c,d)} +function KDg(a,b,c){return new RMg(b,c,a)} +function qNg(a){return jvb((tNg(),sNg),a)} +function hlg(a){++elg;dlg=mqb(Rpb(dlg,a))} +function flg(a){++alg;_kg=mqb(Rpb(_kg,a))} +function MRg(a){a.b.g!=null||QAg(a.b,a.a)} +function MYg(){zYg.call(this,'Z_INDEX',1)} +function PYg(){zYg.call(this,'MARGIN',21)} +function SYg(){zYg.call(this,'HEIGHT',24)} +function YYg(){zYg.call(this,'CURSOR',29)} +function h_g(){e_g.call(this,'JUSTIFY',1)} +function r4g(){o4g.call(this,'JUSTIFY',1)} +function M$g(){K$g.call(this,'VISIBLE',0)} +function zVg(){new h5b;this.a=(Clg(),vlg)} +function JVg(a,b){HVg();this.a=a;this.b=b} +function ic(){Yb(this);this.Wc();this.ad()} +function VNh(a){this.a=gTb(a);return true} +function eOh(a){this.a=nPb(a);return true} +function kOh(a){this.a=rQb(a);return true} +function Stb(a,b,c){a.d=c;a.e=b;return b+1} +function l4b(a,b,c){return n4b(a,G4b(b),c)} +function XCb(a,b,c){return jDb(a.a[b],c.f)} +function BNh(){return (EGb(),EGb(),CGb).U} +function gTh(){return me(sf,g9g,5,2,15,1)} +function IUh(a){return new z5e(a,NaN,NaN)} +function zc(a){a.parentNode.removeChild(a)} +function ghc(a){if(!a){throw Qpb(new k3b)}} +function rhc(a){if(!a){throw Qpb(new m3b)}} +function lhc(a){if(!a){throw Qpb(new Gcc)}} +function IAb(){IAb=xqb;new Xub;HAb=new n9b} +function fNb(){fNb=xqb;eNb=ZLb('bar',true)} +function fBb(a,b){cBb();dBb.call(this,a,b)} +function Z5b(a,b){C5b();Y5b.call(this,a,b)} +function SGb(a){TGb.call(this,a,null,null)} +function dHb(a){fHb.call(this,a,null,null)} +function $bc(a){_bc.call(this,a,null,null)} +function Pec(a){Oec.call(this);CYb(this,a)} +function Vcc(a){Scc();this.b=a;this.a=true} +function VBc(a){cUf(a.Jb);WBc(a,true,true)} +function q_b(a){s_b(a.b);a.a.b-=1;c_b(a.a)} +function UGc(a,b){UEc(a.a,b.a,b.f.a,b.f.b)} +function c5b(a,b){K1b(a,b,b+1,'');return a} +function b5b(a,b,c){K1b(a,b,c,'');return a} +function jcc(a){lhc(a.b!=0);return a.c.b.c} +function EHc(a,b){a.w!=b&&(a.D=true);a.w=b} +function GHc(a,b){a.B!=b&&(a.D=true);a.B=b} +function DPc(a,b){!!a.Wb&&a.Wb.vq();a.Wb=b} +function Fwc(a,b){a.a+=Xah;a.a+=b;a.a+='u'} +function GNc(a,b){a.f.e.C.focus();LOc(a,b)} +function UYc(a,b){return !!a.s&&frg(a.s,b)} +function I3c(a,b){return w3b(c9b(a.b,b,0))} +function lRc(a,b,c){return Jqg(pRc(a),b,c)} +function u9b(a,b){return v9b(a,a.length,b)} +function G3b(a){return Tpb(a,0)<0?dqb(a):a} +function Gld(a){return !a.S?new cId(a):a.S} +function ltc(a){throw Qpb(new Hkc(w3b(a)))} +function T8b(a){if(!a){throw Qpb(new Tac)}} +function a4c(a){if(!a.a){return}b4c(a,a.f)} +function dpd(a,b,c){return Vwc(a.yt(),b,c)} +function m$d(a,b,c){k$d.call(this,a,b,c,5)} +function W0d(a,b,c){k$d.call(this,a,b,c,2)} +function D6c(a,b,c){i7c(a.b,z6c(b),z6c(c))} +function E6c(a,b,c){j7c(a.b,z6c(b),z6c(c))} +function c7c(a){b7c(a);F7c(a.b,new e7c(a))} +function Q7d(a,b){x6d(a,b);_7d(a,b);a8d(a)} +function ogd(a,b){a.n=Jed(a,b);a.n.Vo(255)} +function hfe(a,b){a.d.add(b);a.f=-1;a.e=-1} +function P9d(a,b){a.a+=wAh;a.a+=b;a.a+='}'} +function Crd(a,b){b==null?(a.c=''):(a.c=b)} +function Eqe(a,b){Fqe(a);return Cbe(a.a,b)} +function D4d(a,b){return Ire(Jod(a.e),a,b)} +function SWe(a,b){return !a.d?'':a.d.gu(b)} +function jJe(a,b){return b==null||$1b(b,a)} +function M5e(a,b,c){c3c(c,a.d*b.d+a.e*b.e)} +function Y6e(a,b,c){return Z6e(c,a,null,b)} +function Zkd(){jc.call(this,(yTf(),TSf).b)} +function _8e(){W8e.call(this,'GEOANGLE',0)} +function x9e(){W8e.call(this,'GEOLIST',30)} +function L9e(){W8e.call(this,'GEOTEXT',42)} +function tde(a){bde.call(this,a);qde(this)} +function t7e(a){this.a=a;this.b=new M7e(a)} +function Eke(a){this.b=a;this.a=new eke(a)} +function iTc(a){this.b=a;this.a=this.b.K.o} +function l4d(){this.b=me(sf,g9g,5,30,15,1)} +function lif(a,b){return jff(new pff(a),b)} +function nif(a,b){return Pef(new pff(a),b)} +function Gdf(a,b){return a.Xb+X4g+Hdf(a,b)} +function Wdf(a,b){return a.length>b?a[b]:0} +function MWf(a,b){if(a.i!=b){a.i=b;a.UA()}} +function NWf(a,b){if(a.j!=b){a.j=b;a.UA()}} +function PWf(a,b){if(a.p!=b){a.p=b;a.UA()}} +function cXf(a,b){if(a.C!=b){a.C=b;a.UA()}} +function kXf(a,b){if(a.K!=b){a.K=b;a.UA()}} +function t3f(a,b){sZf(a.b.U.a)||DOf(a.b,b)} +function h$f(a,b){return !!b&&$1b(a.a,b.a)} +function y2e(a){!!a.a&&UEd(a.a,a.b);QJc(a)} +function UPe(a){!a.P&&!!a.O&&a.O.Go(false)} +function HPe(a){qPe(a,TBh);!!a.O&&a.O.cp()} +function KOf(a){HOf(a);aEb(a.H);return a.Z} +function JXf(a){AQf.call(this,a);GXf(this)} +function aYf(a){AQf.call(this,a);XXf(this)} +function Ukg(a){Pkg.call(this,a.a,a.b,a.c)} +function F9f(){l9f.call(this,'ARBINT',111)} +function N9f(){l9f.call(this,'GREATER',11)} +function V9f(){l9f.call(this,'SEQUENCE',1)} +function sag(){l9f.call(this,'ARCTAND',41)} +function tag(){l9f.call(this,'ARCTAN2',42)} +function qag(){l9f.call(this,'ARCSIND',39)} +function nag(){l9f.call(this,'ARCCOSD',37)} +function hvg(a){gvg.call(this,a);evg(this)} +function NLg(a,b){_Mg(cLg(a),new JMg(a,b))} +function nBg(a){lBg(a);PAg(new sBg(a),a.c)} +function dJg(a){a.d.s&&WGg(a.c,SGg(a.c)+1)} +function kzg(a){!!a.j&&(a.c=(Y1b(),false))} +function oAg(a){a.a=null;a.c=null;a.e=null} +function NWg(a,b){a.innerHTML=b==null?'':b} +function Vsg(a,b){return (a.g*b+a.f)*b+a.e} +function tvg(a,b,c){return ZDb(a.b,c,b[c])} +function _Wg(a,b,c){iXg(a,(yYg(),GXg),b,c)} +function aXg(a,b,c){iXg(a,(yYg(),HXg),b,c)} +function cXg(a,b,c){iXg(a,(yYg(),QXg),b,c)} +function dXg(a,b,c){iXg(a,(yYg(),RXg),b,c)} +function eXg(a,b,c){iXg(a,(yYg(),WXg),b,c)} +function fXg(a,b,c){iXg(a,(yYg(),YXg),b,c)} +function kXg(a,b,c){iXg(a,(yYg(),kYg),b,c)} +function mXg(a,b,c){iXg(a,(yYg(),sYg),b,c)} +function nXg(a,b,c){iXg(a,(yYg(),wYg),b,c)} +function wNg(a,b,c,d){iOg(uNg(a),b+'',c,d)} +function vNg(a,b,c,d){hOg(uNg(a),b+'',c,d)} +function cHg(a,b){b?a.C.focus():a.C.blur()} +function r3g(a,b){b?a.b.focus():a.b.blur()} +function $3g(a){Gyg.call(this,a);lyg(this)} +function FYg(){zYg.call(this,'PADDING',12)} +function JYg(){zYg.call(this,'OPACITY',16)} +function WYg(){zYg.call(this,'DISPLAY',28)} +function vZg(){zYg.call(this,'POSITION',7)} +function _Zg(){RZg.call(this,'INITIAL',16)} +function Y$g(){V$g.call(this,'RELATIVE',1)} +function Z$g(){V$g.call(this,'ABSOLUTE',2)} +function g4g(a){this.c=a;this.a=!!this.c.u} +function eVh(){aIc(this);Lmd(this.Kc,this)} +function qSh(){return new t8d(this.a,this)} +function xWh(){return 'safe: "'+this.a+'"'} +function MVh(){return this.b<=0||this.a<=0} +function kPh(){return this.jj((Sud(),oud))} +function _1b(a){return (nhc(a),a)?1231:1237} +function fvb(a){return a.j!=null?a.j:''+a.k} +function gvb(a){return a.j!=null?a.j:''+a.k} +function R8b(a){return a.c-a.b&a.a.length-1} +function k8b(a,b){return a.a.containsKey(b)} +function lbc(a,b){return ff(b,28)&&mbc(a,b)} +function Td(a,b){var c;c=Vd(a.c);c&&Ad(a,b)} +function kfc(a,b){if(ffc){return}Z8b(a.a,b)} +function D2b(a){if(a.o!=null){return}P2b(a)} +function f5b(a,b,c,d){K1b(a,b,c,d);return a} +function Mfc(a,b){Jfc.call(this,a);this.a=b} +function Zfc(a,b){Jfc.call(this,a);this.a=b} +function Wwb(){Awb.call(this,0);nwb(this,0)} +function zvc(a){a.X=true;cwc(a);ald(a.Kc,a)} +function mnc(a){return new rnc(a.b,a.c,a.d)} +function Dnc(a){return new Inc(a.a,a.b,a.c)} +function Lad(a,b){return new Oad(a.c,a.d,b)} +function _ad(a,b,c){return $ad(a,a.jj(b),c)} +function IJc(a){return zJc(a)||a.ib&&a.ip()} +function o$c(a){return !a.ur()&&AJc(a.lp())} +function d6c(a){return Scg(a[0])&&Scg(a[1])} +function Mcd(a){return !!a.b&&a.b.b.g!=null} +function $od(a,b){return !a.O?-1:Xrd(a.O,b)} +function Yqd(a,b,c,d){return rrd(a.o,b,c,d)} +function zFc(a,b,c,d,e){XEc(a,Xeg(b-d,c-e))} +function Dyc(a,b){_dc(Ayc,a,t4b(b,'_',Unh))} +function t3c(a,b){a.f=null;a.d=0;r3c(a,1,b)} +function Kmd(a,b){var c;c=yld(a,b);Jmd(a,c)} +function btd(a,b,c,d){return ctd(b,c,d,a.c)} +function oFd(a,b){return !b.j?Fld(a.Kc):b.j} +function ysd(a,b){if(isNaN(b)){return}a.b=b} +function Ssd(a,b){if(isNaN(b)){return}a.c=b} +function ord(a){if(a>0){return 43}return 45} +function GNd(a,b,c,d){return srd(a.a,b,c,d)} +function SLd(a,b){return znd(a.a.r,b?52:50)} +function dWd(a,b){return b.A!=a.p||b.B!=a.q} +function q8d(a){if(a.n){return a.o}return a} +function qsd(a){msd.call(this,a);this.b=a.j} +function Uge(a){dde.call(this,a);this.a=a.a} +function Lse(a,b){_Cd.call(this,a);this.a=b} +function Tse(a,b){_Cd.call(this,a);this.a=b} +function ate(a,b){_Cd.call(this,a);this.a=b} +function Ote(a,b){_Cd.call(this,a);this.a=b} +function nxe(a,b){_Cd.call(this,a);this.a=b} +function kJd(a,b){kwc.call(this,a);this.n=b} +function twd(){gwd.call(this,'xmlTemplate')} +function dod(){dod=xqb;$wnd.Math.sqrt(2)/2} +function u_f(){u_f=xqb;s_f=-0.;t_f=new H_f} +function cBb(){cBb=xqb;XAb();bBb=new uLb(1)} +function lne(){lne=xqb;ine=ivd((Sud(),rud))} +function pWe(a){NHc();tWe.call(this,a,true)} +function IWe(a,b){this.a=a;Dbe.call(this,b)} +function cSe(a,b){XRe(a,3);b!=null&&(a.K=b)} +function PVe(a,b){dVe(a,new cde(a.Mc,-1),b)} +function axe(a,b,c,d){return Yqd(a.f,b,c,d)} +function D_e(a,b,c){return Xeg(b-a.A,c-a.B)} +function mxe(a,b,c){throw Qpb(FCd(a,b.i,c))} +function L2e(a,b,c){var d;d=a.lb;KUd(d,b,c)} +function qhd(a){a.b=new iec;a.k=166;a.c=301} +function FIe(a){return a.j!=null?a.j:''+a.k} +function JVe(a){return CVe(a)||!!a.d&&a.d.p} +function gif(a,b,c,d){return Cff(a.d,b,c,d)} +function EPf(a,b){var c;c=ZOf(a).a;wZf(c,b)} +function UPf(a,b){if(a.Nb==b){return}a.Nb=b} +function hSf(a){if(a.c){pMg(a.b);a.c=false}} +function XXf(a){a.c=true;a.b=false;a.a=true} +function O_f(a,b){j9b(a.b,a.b.i.length-1,b)} +function y9f(){l9f.call(this,'IF_ELSE',105)} +function z9f(){l9f.call(this,'IF_LIST',106)} +function I9f(){l9f.call(this,'PRODUCT',114)} +function Q9f(){l9f.call(this,'PARALLEL',14)} +function _9f(){l9f.call(this,'MULTIPLY',24)} +function ahf(){Sgf.call(this,'MULTIPLY',16)} +function h9e(){W8e.call(this,'GEOCONIC',16)} +function z9e(){W8e.call(this,'GEOLOCUS',32)} +function B9e(){W8e.call(this,'GEOPOINT',33)} +function w9e(){W8e.call(this,'GEOIMAGE',29)} +function a9e(){W8e.call(this,'GEOVECTOR',9)} +function Z9e(){W8e.call(this,'MOVEABLE',54)} +function W9e(){W8e.call(this,'REGION3D',51)} +function iaf(){W8e.call(this,'GEOLINEND',8)} +function fag(){l9f.call(this,'FREEHAND',29)} +function uag(){l9f.call(this,'ARCTAN2D',43)} +function mbg(){l9f.call(this,'LAMBERTW',83)} +function sbg(){l9f.call(this,'NOT_EQUAL',8)} +function Sxg(a){RFc.call(this,a.j);this.K=a} +function mkg(a,b){var c;c=a.j;a.j=b.j;b.j=c} +function nkg(a,b){var c;c=a.q;a.q=b.q;b.q=c} +function Hbg(a,b){return Ecc(a.j,b,new fcg)} +function dKg(a,b,c){Ajd(a.a,b,new E1b(c.a))} +function LIg(a,b){XHg(a.C,OEh,new QIg(a,b))} +function kJg(a,b){XHg(a.C,OEh,new oJg(a,b))} +function ILg(a){qWg((kWg(),jWg),new xMg(a))} +function hXg(a,b){jXg(a,(yYg(),jYg),b.fD())} +function gXg(a,b){jXg(a,(yYg(),bYg),b.fD())} +function lXg(a,b){jXg(a,(yYg(),mYg),b.fD())} +function aIg(a,b,c){c?FWg(a.C,b):LWg(a.C,b)} +function gGg(a,b){a.s.C.setAttribute(d9g,b)} +function rQg(a,b){qQg.call(this,a);this.i=b} +function GYg(){zYg.call(this,'OVERFLOW',13)} +function g$g(){RZg.call(this,'LIST_ITEM',5)} +function oUh(a){i1e(a,this.Z,this.$,this._)} +function GSh(){vLc(this,false);Zpd(this.Mc)} +function VVh(){return mac(),new wac(this.a)} +function XSg(a,b){return new aTg(b,a.d,a.a)} +function lf(a,b){return a&&b&&a instanceof b} +function Sgc(a,b){return $gc(new Array(b),a)} +function df(a){return String.fromCharCode(a)} +function nWg(a){return a.a!=null||a.e!=null} +function ld(a,b,c){return a.apply(b,c);var d} +function htb(a,b){return new Kwb(rub(b.b,a))} +function kBb(a,b,c){return b9b(b9b(a.a,b),c)} +function vrb(a,b,c){jc.call(this,xrb(a,b,c))} +function qHb(a){cBb();dBb.call(this,a,false)} +function I3g(){G3g();$wnd.Object.call(this)} +function MBg(a){q3f(a.b+' loaded');a.a.Nf()} +function oIg(a){a.a=0;a.b=0;a.c=null;OAg(a)} +function Ld(a,b){a.a=Od(a.a,[b,false]);Jd(a)} +function cc(a,b){a.backingJsObject=b;_b(a,b)} +function bIb(a,b){this.a=a;this.b=new HKb(b)} +function UCb(a,b){this.b=a;this.c=b;this.a=b} +function TQb(a,b){this.b=a;this.c=a;this.a=b} +function CJb(a){NAb.call(this);this.a=mBb(a)} +function $Jb(a,b,c,d){ZJb.call(this,a,b,c,d)} +function OQb(a,b,c,d){LQb[a][b]=new NQb(c,d)} +function tVh(a,b,c,d,e,f,g){return wag(a,b)} +function u8b(a,b){var c;c=b;return !!a.Zf(c)} +function p8b(a,b){var c;c=a.e;a.e=b;return c} +function Ehc(a,b){var c;c={};c[a]=b;return c} +function Bbc(a,b){var c;c=a[Xlh];c.call(a,b)} +function nbc(a,b){this.a=a;this.b=b;this.c=0} +function Rbc(a){aEb(a.d);a.c.b=a.c;a.c.a=a.c} +function uEg(a){a.e.a=true;XOf(a.c).d=false} +function d_b(a,b){if(a.e){KNg(a.e);a.e=null}} +function JAc(a){if(a.Vb){a.Qj(false);a.Hi()}} +function SFc(a){if(a.Wl()!=3){a.Ms();a.yp()}} +function PJc(a){if(!a.Hb){return}j4e(a.Hb,a)} +function TBc(a,b){eUf(a.Jb,b,true);ozg(a.kc)} +function Rvc(a,b){return ff(b,50)&&!Qvc(a,b)} +function i2b(a,b){return ff(b,507)&&b.a==a.a} +function Mec(a,b){return a.a.remove(b)!=null} +function rLb(a,b,c){return a==0?0:a*uRb(b,c)} +function b2b(a,b){Y1b();return a==b?0:a?1:-1} +function X3c(a,b,c){return a.a&&B4c(a.b,b,c)} +function Y3c(a,b,c){return a.a&&A4c(a.b,b,c)} +function $3c(a,b,c){return a.a&&C4c(a.b,b,c)} +function xgc(a,b,c){ggc();Oqb(a,b.rg(a.a,c))} +function B3c(a,b,c){a.a=new xqg(pf(b),pf(c))} +function a5b(a,b,c){a.a+=K4b(b,0,c);return a} +function TKc(a,b){a.jc=a.Xb;a.Xb=b;a.hc=true} +function AVc(a){a.k=false;a.t=null;a.n=false} +function b7c(a){uRc(a.e.a);a.f=null;iff(a.j)} +function sLc(a){if(!a.Hb){return}I4e(a.Hb,a)} +function c4c(a,b){if(!a.a){return}Q2c(a.e,b)} +function fld(a,b){if(a.J){return}Gec(a.cb,b)} +function yhd(a,b){return $qe(Jod(a.v),b,a.t)} +function nvd(a,b,c){return c?b.qp(a):b.jj(a)} +function B3b(a){return mqb(iqb(a,32))^mqb(a)} +function nRc(a){return !a.e?new Prg:a.e.oi()} +function E4c(){this.c=new Prg;this.b=new Prg} +function _rd(){this.b=new cEb;this.a=new n9b} +function kId(a,b,c,d){rxd.call(this,a,b,c,d)} +function cOd(a,b,c,d){rxd.call(this,a,b,c,d)} +function fQd(a,b,c,d){rxd.call(this,a,b,c,d)} +function UUd(a,b,c,d){rxd.call(this,a,b,c,d)} +function MXd(a,b,c,d){rxd.call(this,a,b,c,d)} +function dVd(a,b,c,d){YOd.call(this,a,b,c,d)} +function QWd(a,b,c,d){IWd.call(this,a,b,c,d)} +function h2d(a,b,c,d){i2d.call(this,a,b,c,d)} +function M2d(a,b,c,d){s0e(a.f[b],c,d,1,true)} +function _Od(a,b,c,d){s0e(a.d[b],c,d,1,true)} +function i7c(a,b,c){gRc(a.a,b,c,(dud(),bud))} +function j7c(a,b,c){gRc(a.a,b,c,(dud(),cud))} +function eve(a,b,c){return bNd(Kod(a.f),b,c)} +function rae(a,b){return b.ik(a)||e7d(a.n,b)} +function EQe(a,b){return b==a.gb||b==6||b==1} +function ade(a){return new cde(a.j,Bfg(a.k))} +function Gge(a){Hge(a,new cde(a.a,-1),false)} +function d4c(a,b){a.e.j.c?c4c(a,b):c4c(a,-b)} +function nOd(a,b){a.b=b;a.e=!a.f.Kc.$;qOd(a)} +function EMe(a,b){b[0]=a.Z;b[1]=a.$;b[2]=a._} +function GYe(a,b){b[0]=h9g;b[1]=k9g;FYe(a,b)} +function S1e(a){a.ac=false;dKc(a,1);P1e(a,1)} +function Ube(a){Tbe.call(this,!a?R4g:wIc(a))} +function v9e(){W8e.call(this,'GEONUMERIC',2)} +function T9e(){W8e.call(this,'GEOSEGMENT',4)} +function e9e(){W8e.call(this,'GEOBUTTON',13)} +function F9e(){W8e.call(this,'GEOSQUARE',37)} +function bdd(){Zcd.call(this,'DEPENDENCY',0)} +function brf(a,b,c){jc.call(this,drf(a,b,c))} +function T0e(a,b){NHc();U0e.call(this,a,b,3)} +function O0e(a){NHc();T0e.call(this,a,false)} +function Bie(){this.a=new n9b;this.c=new n9b} +function Nff(){this.b=new uhf;this.a=new xif} +function kYf(a){bYf();AQf.call(this,a);AYf()} +function PVf(){LVf.call(this,'BAYERN_CAS',2)} +function QVf(){LVf.call(this,'VLAANDEREN',3)} +function v9f(){l9f.call(this,'INTEGRAL',102)} +function x9f(){l9f.call(this,'IF_SHORT',104)} +function E9f(){l9f.call(this,'ARBCONST',110)} +function Z9f(){l9f.call(this,'PLUSMINUS',22)} +function Fag(){l9f.call(this,'IMAGINARY',52)} +function cbg(){l9f.call(this,'HEAVISIDE',74)} +function Zag(){l9f.call(this,'FACTORIAL',69)} +function lbg(){l9f.call(this,'POLYGAMMA',82)} +function xbg(){l9f.call(this,'CONJUGATE',93)} +function Qsg(a,b){this.c=a;this.b=b;this.e=0} +function R_f(){this.a=new h5b;this.b=new n9b} +function ASf(a){!a.r&&(a.r=new cEb);aEb(a.r)} +function bXe(a,b){!!a.d&&Cae(a.d,b);a.i=null} +function _ug(a,b,c){a.g=b;a.f=c;$xg(a.e,b,c)} +function whf(a,b,c){return Whf(iif(a.a,b),c)} +function CSf(a,b){return $1b(z4b(a.d,0,2),b)} +function umf(a,b){return new cde(a.c,Ghg(b))} +function fsg(a,b,c){return (c&1)==0?a<=b:aa.a.a} +function Ojg(a){return a.b.i==a.a||a.b.p==a.a} +function JHg(a){return a.a==null?0:a.a.length} +function FQf(a){return !(a==18||a==17||a==20)} +function D3f(a,b){return !!Hpd(a.d,b,false,0)} +function xQg(a,b){var c;c=FSg(a.c.d);BQg(c,b)} +function pMg(a){if(a.pb.ib){Wqd(a.pb);cQf(a)}} +function rUg(a){a.b=new cEb;a.a=new cEb;a.c=0} +function gUg(){this.a=new $wnd.XMLHttpRequest} +function L3g(a){a.b=0;a.c=new cEb;a.d=new cEb} +function aNg(a){TMg();this.a=a;this.b=new n9b} +function W3g(a){this.a=new occ;T3g(this,a,'')} +function FOh(){return new wgc(null,this.Ce())} +function nPh(){return new dId(this.Kc,this.c)} +function OSh(){return new Zee(this.Mc,this.e)} +function PNh(a,b,c){return new KHb(b,c,false)} +function wVh(a,b,c,d,e,f,g){return Xag(a,b,c)} +function YVh(){_Oc(this.a,false);return false} +function ZVh(){GPc(this.a,false);return false} +function HYg(){zYg.call(this,'OVERFLOW_X',14)} +function IYg(){zYg.call(this,'OVERFLOW_Y',15)} +function KYg(){zYg.call(this,'MARGIN_TOP',17)} +function wZg(){zYg.call(this,'PADDING_TOP',8)} +function UYg(){zYg.call(this,'FONT_STYLE',26)} +function iZg(){zYg.call(this,'TEXT_ALIGN',40)} +function YZg(){RZg.call(this,'TABLE_CELL',13)} +function RAb(a,b){QAb.call(this,a,ZLb(b,true))} +function Mvb(a,b){hvb.call(this,a,b);this.a=''} +function pIb(a){oIb.call(this,a,0,0);this.t=13} +function AIb(a,b){nCb.call(this,a,b);qIb(this)} +function FIb(a){EIb();HIb.call(this,a,-1,null)} +function mKb(a,b,c){kKb.call(this,a,b,c.a,c.b)} +function NCb(a,b,c){this.a=a;this.b=b;this.i=c} +function fHb(a,b,c){this.c=a;this.b=b;this.a=c} +function JQb(a){this.b=a;this.a=0;this.c=false} +function CUb(a,b,c){this.b=a;this.c=b;this.a=c} +function OUb(a,b,c){this.b=a;this.c=b;this.a=c} +function yJb(a,b){this.a=!a?new XGb:a;this.b=b} +function YYb(a){!a.a&&(a.a=new gZb);return a.a} +function ZYb(a){!a.b&&(a.b=new VZb);return a.b} +function $Yb(a){!a.c&&(a.c=new y$b);return a.c} +function _Yb(a){!a.d&&(a.d=new v_b);return a.d} +function rQb(a){var b;b=a.f;a.f=false;return b} +function ztb(a,b){a.e=a.f=0;a.b=0;a.c=b;Atb(a)} +function Llf(a,b){a.f[0]=b.f[0];a.f[1]=b.f[1]} +function d9b(a,b){return e9b(a,b,a.i.length-1)} +function h3b(a){return !isNaN(a)&&!isFinite(a)} +function $2b(a){return jf(a)?(nhc(a),a):a.Lf()} +function Sec(a,b,c){return Hac(a.a,b,c)<=0?c:b} +function vcc(a,b,c){this.d=a;this.b=c;this.a=b} +function Pbc(a,b,c){this.a=a;this.b=b;this.c=c} +function rnc(a,b,c){this.a=a;this.b=b;this.c=c} +function Inc(a,b,c){this.a=a;this.b=b;this.c=c} +function TZb(a,b,c){this.c=a;this.e=b;this.d=c} +function ZZb(a,b,c){this.c=a;this.a=b;this.b=c} +function ZFc(a,b,c){this.a=a;this.c=b;this.b=c} +function eGc(a,b,c){this.a=a;this.c=b;this.b=c} +function y_b(a,b,c){this.b=a;this.c=b;this.a=c} +function alc(a,b,c){Z8b(a.b,b);Z8b(a.a,_kc(c))} +function a$b(a,b){c9b(a.c,b,0)!=-1||Z8b(a.c,b)} +function JOc(a,b){$Qc(a.bb,b);HHc(BCc(a.lb),b)} +function DHc(a,b){Kuc(a.v,b)||(a.D=true);a.v=b} +function IOc(a,b){qzg(a,a.zc,a.Ic+b,a.Ec,a.Nc)} +function Dzc(a,b,c,d,e){Vyg(a.f,b,c,d,e,a.f.G)} +function tGc(a,b,c){return DLd(Kod(a.a.K),b,c)} +function zQc(a){aNc();return nhg((mhg(),''),a)} +function mwc(a){if(!a){return ''}return a.$v()} +function khc(a,b){if(a!=b){throw Qpb(new Tac)}} +function zPc(a,b){a.Mb=b;b>0&&pQc(a,true,true)} +function C1c(a,b,c){this.b=b;this.a=a;this.c=c} +function VUc(a,b,c){this.b=c;this.e=a;this.a=b} +function Y1c(a,b,c){this.o=a;this.i=b;this.n=c} +function J2c(a,b,c){X2c(a.f,b,c)&&(a.j.i=null)} +function J7c(a,b,c){return Sef(b,Xff(a.b,c).a)} +function O3c(a,b,c){return !!c.g&&Jrg(c.g,a,b)} +function Jcd(a,b,c){return !!a.a&&Jrg(a.a,b,c)} +function rJc(a){return !!a.nb&&a.nb.i.length>0} +function TQc(a){return !a.U&&(a.U=new Npg),a.U} +function r0c(a){return !a.a?null:Rpg(mqg(a.a))} +function o7c(a){yEc(a.a,a.c);!!a.b&&yQf(a.b,a)} +function hmd(a,b){c9b(a.w,b,0)!=-1||Z8b(a.w,b)} +function p7c(a,b){if(b.d||b.a){return}V6c(a.d)} +function S$c(a){a.a=a.xb.lb;a.c=new n9b;U$c(a)} +function Qod(a){!a.s&&(a.s=new Rnd);return a.s} +function Jod(a){!a.c&&(a.c=a.Lt(a));return a.c} +function Sod(a){!a.u&&(a.u=a.Nt(a));return a.u} +function Tod(a){!a.v&&(a.v=new lmf);return a.v} +function fpd(a){if(!a.P){return 5}return a.P.a} +function qmd(a,b){!!a.U&&Mec(a.U,b);b.Wb=false} +function Nad(a,b){nvc.call(this,a,b);Iad(this)} +function Jgd(a,b,c){this.a=a;this.c=b;this.b=c} +function Htd(a,b,c){this.a=a;this.c=b;this.b=c} +function Kgd(a,b,c){this.b=a;this.a=b;this.c=c} +function Lgd(a,b,c){this.b=a;this.d=b;this.c=c} +function Vjd(a,b,c){this.b=a;this.a=b;this.c=c} +function Ewd(a,b,c){this.b=b;this.a=c;this.d=a} +function Jwd(a,b,c){this.a=b;this.b=c;this.d=a} +function cKd(a,b,c){dKd.call(this,a,b,c,false)} +function bGd(a,b,c,d){cGd.call(this,a,b,c,d,1)} +function aGd(a,b,c,d){cGd.call(this,a,b,d,c,0)} +function d5d(a,b,c){this.a=a;this.b=b;this.c=c} +function Ebe(a,b){Vae.call(this,a,b);$ae(this)} +function vwd(){gwd.call(this,'numericNoLocal')} +function PRd(){PRd=xqb;ORd=me(sf,g9g,5,3,15,1)} +function sKb(){sKb=xqb;qKb=new SKb;rKb=new TKb} +function $d(){$d=xqb;var a;!be();a=new ce;Zd=a} +function nKd(a){$vc(a,a.e.n);_vc(a,a.d);Xvc(a)} +function eYd(a){if(!a.d){return a.V}return a.c} +function Gce(a){a.Mw(a.k<0?0:1);a.i=0;return a} +function $Ne(a){YNe.call(this,a.Kc);this.ro(a)} +function bye(a,b){Gqb.call(this,a,b);Zxe(this)} +function ESe(a){CSe.call(this,a.Kc);this.ro(a)} +function gJe(a){NIe(this);this.p=true;this.e=a} +function OJe(a,b,c){this.b=a;this.c=b;this.a=c} +function ULe(a,b,c){this.a=a;this.c=b;this.b=c} +function che(a,b,c){this.a=a;this.b=b;this.c=c} +function wOe(a,b){!!a.w&&g9b(a.w.tz(),a);a.w=b} +function FNe(a,b){return Ocg(b.Z*a.Z,-b.$*a.$)} +function V5d(a,b){return new u8d(a.k,a,b,null)} +function V9d(a,b){return !a?null:K7d(a.Ap(),b)} +function lZe(a,b,c){return mZe(a,b9b(a.k,b),c)} +function vXe(a,b){return !Pcg(a[2],a[3],Uph/b)} +function AXe(a){return a.c[0]?pf(a.c[0].A):a.q} +function BXe(a){return a.c[0]?pf(a.c[0].B):a.r} +function qYe(a){return ff(a.d,56)||ff(a.d,124)} +function xpd(a){return !!a.O&&a.O.a.i.length>0} +function g1e(a){NHc();return a.jn()&&a.Wl()==5} +function NSe(a){if(!a.a){return 1}return a.a.e} +function W_e(a){!a.H&&(a.H=new Asd);return a.H} +function p5e(a,b){a.d=b*a.d;a.e=b*a.e;return a} +function D0e(a,b){b>-1&&b<=10?(a.J=b):(a.J=-1)} +function j4e(a,b){c9b(a.F,b,0)!=-1||Z8b(a.F,b)} +function jef(a,b){if(a*b<=0){return 1}return 0} +function kjf(a){if(!a.p){return NaN}return a.b} +function ljf(a){if(!a.p){return NaN}return a.c} +function njf(a){if(!a.p){return NaN}return a.o} +function laf(){laf=xqb;kaf=new oaf;jaf=new paf} +function caf(){W8e.call(this,'GEOSEGMENTND',5)} +function b9e(){W8e.call(this,'GEOVECTORND',10)} +function s9e(){W8e.call(this,'GEOFUNCTION',26)} +function J9e(){W8e.call(this,'GEOPOLYLINE',40)} +function M9e(){W8e.call(this,'GEOIMPLICIT',43)} +function U9e(){W8e.call(this,'NUMBERVALUE',49)} +function FTf(a,b,c){Yxe();fye.call(this,a,b,c)} +function RUf(a,b,c){YUf(a,null,b,c);UUf(a,c,b)} +function d6f(a,b){MSc(a.c.O,b,a.d);rOc(a.b.cb)} +function Dsf(a,b){a.e=a.f=0;a.b=0;a.c=b;Esf(a)} +function Hlf(a,b,c){a.f[0]=b;a.f[1]=c;a.f[2]=0} +function q$f(a,b,c){this.a=a;this.c=c;this.d=b} +function Raf(a,b,c){this.b=a;this.a=b;this.c=c} +function wcg(a,b,c){this.a=a;this.b=b;this.c=c} +function Pkg(a,b,c){this.a=a;this.b=b;this.c=c} +function Hmf(a,b){this.c=a;this.a=a.j;this.d=b} +function Qpg(a,b){return a.iB(b.c,b.d,b.b,b.a)} +function Spg(a,b){return a.kB(b.c,b.d,b.b,b.a)} +function Srg(a){Rrg.call(this,a.c,a.d,a.b,a.a)} +function t9f(){l9f.call(this,'ELEMENT_OF',100)} +function G9f(){l9f.call(this,'ARBCOMPLEX',112)} +function hbg(){l9f.call(this,'AND_INTERVAL',7)} +function Etg(a,b){b!=null&&b();A4f(hLg(a.b.j))} +function g6f(a,b,c){return mXf(a,b,(nhc(c),c))} +function Xyg(a,b,c){return c?new Kzg(a,b):null} +function kAg(a,b){return !!a&&a.a==b.pointerId} +function Yff(a){return b9b(a.a,a.a.i.length-1)} +function fzg(a){return pf(a.f.e.C.width/a.f.p)} +function gzg(a){return pf(a.f.e.C.width/a.f.p)} +function dLg(a){return !a.i&&(a.i=new wTg),a.i} +function eLg(a){!a.n&&(a.n=new FNg);return a.n} +function gLg(a){!a.r&&(a.r=new bBg);return a.r} +function oLg(a){!a.D&&(a.D=new Zfg);return a.D} +function xLg(a){!a.N&&(a.N=new CHg);return a.N} +function lUf(a){!a.K&&(a.K=new n9b);return a.K} +function cYf(a){!a.a&&(a.a=new ded);return a.a} +function FYf(a){!a.d&&(a.d=new yWf);return a.d} +function Hug(a,b,c,d){a.q||a.j.fillText(b,c,d)} +function yug(a,b,c,d,e){a.j.clearRect(b,c,d,e)} +function lCg(a,b,c){mCg.call(this,a,b,c,false)} +function qHg(){lHg();rHg.call(this,false,null)} +function iRg(a,b){return Hpd(a.C.pb,b,false,0)} +function JNg(a,b){return $wnd.Math.ceil(a*b)/b} +function cRg(a,b){Ygc(a.b.i,0);aEb(a.d);ozg(b)} +function zDg(a){iKg();ESg(a.c);SVg(new RDg(a))} +function DMg(a,b,c){this.a=a;this.c=b;this.b=c} +function LMg(a,b,c){this.a=a;this.c=b;this.b=c} +function rPg(a,b,c){this.a=a;this.c=b;this.b=c} +function DRg(a,b,c){this.a=a;this.c=b;this.b=c} +function sSg(a,b,c){this.a=a;this.c=b;this.b=c} +function tTg(a,b,c){this.a=a;this.c=b;this.b=c} +function ETg(a,b,c){this.a=a;this.c=b;this.b=c} +function kRg(a,b,c){this.a=a;this.b=b;this.c=c} +function dSg(a,b,c){this.a=a;this.b=b;this.c=c} +function eSg(a,b,c){this.a=a;this.b=b;this.c=c} +function fSg(a,b,c){this.a=a;this.b=b;this.c=c} +function gSg(a,b,c){this.a=a;this.b=b;this.c=c} +function GUg(a,b,c){this.a=a;this.b=b;this.c=c} +function cUg(a,b,c){this.b=a;this.c=b;this.a=c} +function NVg(){NVg=xqb;MVg=new n9b;LVg=new n9b} +function Z3g(){Z3g=xqb;X3g=new cEb;Y3g=new PYb} +function i3g(){i3g=xqb;g3g=new l3g;h3g=new m3g} +function e$g(){RZg.call(this,'INLINE_BLOCK',3)} +function b$g(){RZg.call(this,'INLINE_FLEX',18)} +function f$g(){RZg.call(this,'INLINE_TABLE',4)} +function qZg(){zYg.call(this,'LINE_HEIGHT',48)} +function TYg(){zYg.call(this,'FONT_WEIGHT',25)} +function jZg(){zYg.call(this,'TEXT_INDENT',41)} +function NYg(){zYg.call(this,'MARGIN_LEFT',19)} +function sZg(){zYg.call(this,'WHITE_SPACE',49)} +function EPh(a){return !!this.e&&tRc(this.e,a)} +function ORh(a){return Q4d(this,false,false,a)} +function zVh(a,b,c,d){return Zpg(this,a,b,c,d)} +function AVh(a,b,c,d){return zqg(this,a,b,c,d)} +function CVh(a,b,c,d){return Iqg(this,a,b,c,d)} +function QNh(a,b,c){return new IHb(b,c,this.a)} +function rOh(a){return new ZJb(0,VNb(a.i),0,0)} +function a2b(a){Y1b();return $1b(M4g,typeof(a))} +function HKb(a){sKb();GKb.call(this,new iac(a))} +function GIb(a,b){EIb();HIb.call(this,a,b,null)} +function eKb(a,b,c){fKb.call(this,a,b,c,!b||!c)} +function Nvb(a,b,c){hvb.call(this,a,b);this.a=c} +function YRb(a,b,c){ERb.call(this,a,b);this.a=c} +function lJb(a,b){kJb.call(this,a,b,b);this.a=b} +function bXb(){GHb.call(this,0,Cjh,431,0,pih,0)} +function JXb(){GHb.call(this,0,Cjh,431,0,pih,0)} +function tNh(a){aPb(a,this.be(a));return false} +function L2b(){var a;a=I2b(null);a.g=2;return a} +function PLb(a,b){var c;c=SLb(a);c.k=b;return c} +function QLb(a,b){var c;c=SLb(a);c.j=b;return c} +function dub(a,b){a.i+=b;(a.e-=b)<0&&(a.e+=a.f)} +function v8b(a,b){var c;c=b;return RDb(a.Zf(c))} +function jOb(a,b){return !a.b?new YJb:a.b.ud(b)} +function Hac(a,b,c){return f3b(a.vg(b),a.vg(c))} +function sec(a,b){return !!b&&tec(a,b.d)?b:null} +function itc(a,b){return new ktc(a.c,b,a.b,a.d)} +function lcc(a){lhc(a.b!=0);return mcc(a,a.c.b)} +function ttc(a){if(a==null){throw Qpb(new Tkc)}} +function hhc(a,b){if(!a){throw Qpb(new l3b(b))}} +function Y5b(a,b){this.e=b;M5b(this,(nhc(a),a))} +function _bc(a,b,c){this.c=a;r8b.call(this,b,c)} +function Xtc(a,b,c){hvb.call(this,a,b);this.a=c} +function Ugc(a,b,c){Rgc(c,0,a,b,c.length,false)} +function KIc(a,b){return JIc(a,a,false,b,false)} +function DGc(a,b){return bNd(Kod(a.a.K),null,b)} +function FGc(a,b){return rLd(Kod(a.a.K),null,b)} +function AQc(a,b){aNc();return ohg((mhg(),a),b)} +function _Nc(a){if(a.nb){return a.nb.c}return 0} +function aOc(a){if(a.nb){return a.nb.d}return 0} +function RJc(a,b){if(a.nb){g9b(a.nb,b);a.no(b)}} +function lLc(a,b){a.Ao(b);lKc(a,b.wb.a);a.zp(4)} +function QRc(a,b){jSc(a.e);MRc(a,b,(U8e(),M8e))} +function RRc(a,b){jSc(a.e);!!b&&TRc(a.e,b.Kj())} +function EZc(a,b){return b.g||!!b.f&&EZc(a,b.f)} +function NTc(a,b,c){return GGc(vCc(a.c.lb),b,c)} +function I2c(a,b,c){a.i.a?K2c(a,b,c):F2c(a,b,c)} +function vKc(a,b,c){b>=c||b<0?(a.Eb=0):(a.Eb=b)} +function JRc(a,b,c){IRc(a,lKg(b.Pb),b,b.el(),c)} +function eUc(a,b,c){hvb.call(this,a,b);this.a=c} +function i3c(a,b,c){hvb.call(this,a,b);this.a=c} +function E$b(a,b,c,d,e){a.c=b;a.d=c;a.b=d;a.a=e} +function z$b(a,b,c,d,e){a.a=b;a.b=d;a.c=c;a.d=e} +function G5c(a,b,c,d,e){a.b=b;a.a=c;a.d=d;a.c=e} +function Ncd(a,b,c){a.d=b;a.e=c;!!a.b&&LRg(a.b)} +function Ocd(a,b,c){a.d=b;a.e=c;!!a.g&&MRg(a.g)} +function V5c(a,b){a.a.rr(b,a.c);return f6c(a.c)} +function RQc(a){Npd(a.a.Jb,a.a);iod(a.a.Jb,a.a)} +function $dd(a){Ydd();return jvb((bed(),aed),a)} +function Gdd(a){Edd();return jvb((Jdd(),Idd),a)} +function R4c(a){P4c();return jvb((U4c(),T4c),a)} +function Kad(a,b){a.b=b?(dud(),bud):(dud(),cud)} +function u1b(a,b,c,d){a.addEventListener(b,c,d)} +function tdd(a,b,c){hvb.call(this,a,b);this.a=c} +function Fsd(a,b,c){hvb.call(this,a,b);this.a=c} +function uwd(){gwd.call(this,'casCopyTemplate')} +function qwd(){gwd.call(this,'prefixedDefault')} +function X0d(a,b,c){l$d.call(this,a,b,null,c,2)} +function L3d(a,b){hvb.call(this,a,b);this.a=jnh} +function S4d(a,b){T4d.call(this,a,b,false,true)} +function qgd(a,b,c){wYe(b,Hpd(a.B.v,c,false,0))} +function t6d(a,b,c){return r5d(a.o,a.s,a.q,b,c)} +function v5d(a,b){return i6d(a.o,b)||i6d(a.q,b)} +function mld(a,b){var c;c=new Naf(b);Z8b(a.I,c)} +function s8d(a,b){t8d.call(this,a,new cde(a,b))} +function $ee(a,b,c){Zee.call(this,a,b);this.a=c} +function cye(a,b){Yxe();dye.call(this,a,b,null)} +function GIe(a,b,c){hvb.call(this,a,b);this.a=c} +function dsd(a){this.a=dTe(a,0);this.b=dTe(a,1)} +function ivd(a){var b;b=dvd(a);b.t=zwh;return b} +function QIe(a,b){var c;c=PIe(a);c.f=b;return c} +function ZIe(a,b){var c;c=PIe(a);c.s=b;return c} +function _Ie(a,b){var c;c=PIe(a);c.u=b;return c} +function Rje(a,b){Qje();return Sje(a,b,a.k,Pje)} +function JIe(a){EIe();return jvb((MIe(),LIe),a)} +function SJd(a){$vc(a,a.a.Gb);_vc(a,a.a);Xvc(a)} +function YJd(a){$vc(a,a.b.Gb);_vc(a,a.b);Xvc(a)} +function lje(a){Ygc(a.d.i,0);Ygc(a.b.i,0);a.c=0} +function $Qe(a,b){jJc(a,b);PIc(a,b);waf(b,a.Cc)} +function oQe(a,b,c){Jlf(a.cb,1,b);Jlf(a.cb,2,c)} +function kMe(a,b,c){hvb.call(this,a,b);this.a=c} +function qMe(a){BLc.call(this,a);this.o=new mvc} +function tXe(a){pXe.call(this,a.Kc);dXe(this,a)} +function w2e(a){u2e.call(this,a.Kc);t2e(this,a)} +function P4e(a){N4e.call(this,a.Kc);k4e(this,a)} +function j6e(a){i6e.call(this,a.Kc);_5e(this,a)} +function d9e(){W8e.call(this,'GEOTEXTFIELD',12)} +function j9e(){W8e.call(this,'GEOQUADRIC3D',18)} +function n9e(){W8e.call(this,'GEOQUADRICND',21)} +function I9e(){W8e.call(this,'GEOPOLYGON3D',39)} +function g9e(){W8e.call(this,'GEOCONICPART',15)} +function Dbf(a,b,c){hvb.call(this,a,b);this.a=c} +function qWe(a,b){NHc();rWe.call(this,a,b,true)} +function qXe(a,b){NHc();rXe.call(this,a,b,true)} +function J0e(a,b){tLc(a,b);!!a.F&&LLc(a.F,a.Kc)} +function vff(a,b){rff(a,a.a,-a.b,a.b+a.c).zg(b)} +function Jqd(a,b){if(b!=a.R){a.R=b;a.R&&Zpd(a)}} +function shf(a,b){return MDb(a.a,b,(Rgf(),Qgf))} +function Wvf(a,b){return Gvf(a.c,b)||Gvf(a.b,b)} +function ewf(a,b){return cwf(a,b).gx(b,a.b,a.e)} +function gwf(a,b){return cwf(a,b).gx(b,a.d,a.e)} +function JOf(a,b){return b==(P4c(),O4c)?a.X:a.W} +function b0e(a,b){return Xcg(),a0e(a,b)?Vcg:Ucg} +function yZd(a){return new Tkg(a.Z/a._,a.$/a._)} +function u_e(a){r_e();return jvb((x_e(),w_e),a)} +function UNf(a){SNf();return jvb((XNf(),WNf),a)} +function yUf(a,b){if(a.a!=b){a.a=b;IUf(a,true)}} +function YPf(a,b){if(b!=a.Sb){a.Sb=b;mQc(a.cb)}} +function LWf(a,b){if(!Kuc(b,a.f)){a.f=b;a.UA()}} +function UWf(a,b){if(!Kuc(b,a.r)){a.r=b;a.UA()}} +function _Wf(a,b){if(!Kuc(b,a.w)){a.w=b;a.UA()}} +function sdf(a){a.q=true;a.e=-1;a.f=-1;a.b=null} +function qWf(a){a.b=2;a.d=true;a.c=true;a.a=oWf} +function dYf(a){AYf();a.bb>0?(a.cb=true):xQf(a)} +function E_f(a){u_f();F_f.call(this,new j0f(a))} +function zvf(a,b,c){hvb.call(this,a,b);this.a=c} +function UXf(a,b,c){hvb.call(this,a,b);this.a=c} +function J$f(a,b,c){hvb.call(this,a,b);this.a=c} +function a2f(a,b,c){hvb.call(this,a,b);this.a=c} +function kcg(a,b,c){hvb.call(this,a,b);this.a=c} +function Sng(a,b,c){hvb.call(this,a,b);this.a=c} +function S9f(){l9f.call(this,'IS_SUBSET_OF',16)} +function Cbg(){l9f.call(this,'VEC_FUNCTION',98)} +function r9f(){l9f.call(this,'EQUAL_BOOLEAN',9)} +function OVf(){LVf.call(this,'NIEDERSACHSEN',1)} +function Lef(a){this.b=a.$;this.a=new Nef(this)} +function w1b(){w1b=xqb;v1b=$wnd.FileReader.DONE} +function Irg(a){return new Rrg(a.c,a.d,a.b,a.a)} +function Urg(a){return new Xrg(a.c,a.d,a.b,a.a)} +function frg(a,b){return Frg(b,a.a,a.c,a.b,a.d)} +function Erg(a,b){return Crg(a,b.c,b.d,b.b,b.a)} +function kqg(a,b){return jqg(a,b.c,b.d,b.b,b.a)} +function qqg(a,b){return oqg(a,b.c,b.d,b.b,b.a)} +function $qg(a,b){return Iqg(a,b.c,b.d,b.b,b.a)} +function _qg(a,b){return Mqg(a,b.c,b.d,b.b,b.a)} +function bzg(a){return pf(a.f.e.C.height/a.f.p)} +function sRg(a,b){return nUg(a.d,b,false)!=null} +function Elg(a){Clg();return jvb((Hlg(),Glg),a)} +function y0f(a,b){w0f(a,new q0f((_1f(),d1f),b))} +function oOg(a,b,c,d,e){IBg(new qPg(a,e,b,c,d))} +function krg(a,b,c,d,e){a.a=b;a.c=c;a.b=d;a.d=e} +function KRg(a,b){a.a=b;a.b.g!=null&&QAg(a.b,b)} +function lJg(a,b,c){b.UC(a);c.stopPropagation()} +function cEg(a,b,c){hvb.call(this,a,b);this.a=c} +function oNg(a,b,c){hvb.call(this,a,b);this.a=c} +function WQg(a){this.C=a;this.a=new z3g(this.C)} +function CYg(){zYg.call(this,'PADDING_RIGHT',9)} +function DYg(){zYg.call(this,'PADDING_LEFT',10)} +function LYg(){zYg.call(this,'MARGIN_RIGHT',18)} +function aZg(){zYg.call(this,'BORDER_WIDTH',33)} +function bZg(){zYg.call(this,'BORDER_STYLE',34)} +function cZg(){zYg.call(this,'BORDER_COLOR',35)} +function hZg(){zYg.call(this,'TABLE_LAYOUT',39)} +function ZZg(){RZg.call(this,'TABLE_COLUMN',14)} +function j$g(){RZg.call(this,'TABLE_CAPTION',8)} +function kZg(){zYg.call(this,'TEXT_JUSTIFY',42)} +function S_g(){S_g=xqb;R_g=new W_g(OEh,new T_g)} +function __g(){__g=xqb;$_g=new W_g(RGh,new a0g)} +function i0g(){i0g=xqb;h0g=new W_g(VGh,new j0g)} +function u0g(){u0g=xqb;t0g=new W_g(PGh,new v0g)} +function c0g(){c0g=xqb;b0g=new W_g(cIh,new d0g)} +function f0g(){f0g=xqb;e0g=new W_g(dIh,new g0g)} +function l0g(){l0g=xqb;k0g=new W_g(eIh,new m0g)} +function o0g(){o0g=xqb;n0g=new W_g(fIh,new p0g)} +function r0g(){r0g=xqb;q0g=new W_g(gIh,new s0g)} +function _Nh(a,b){return new QAb(b,(dNb(),sMb))} +function UNh(a,b){return new QAb(b,(dNb(),gMb))} +function YNh(a,b){return new QAb(b,(dNb(),nMb))} +function ZNh(a,b){return new QAb(b,(dNb(),cMb))} +function $Nh(a,b){return new QAb(b,(dNb(),rMb))} +function SNh(a,b){return new QAb(b,(dNb(),_Lb))} +function bOh(a,b){return new QAb(b,(dNb(),jMb))} +function gOh(a,b){return new QAb(b,(dNb(),mMb))} +function hOh(a,b){return new QAb(b,(dNb(),DMb))} +function qOh(a,b){return new QAb(b,(dNb(),YMb))} +function mOh(a,b){return new oDb(b,null,this.a)} +function kSh(a){return new lge(this.a,this.b.a)} +function VJb(a){NAb.call(this);this.a=a;this.j=0} +function ZQb(a){NAb.call(this);this.a=a;this.j=0} +function IOb(){EOb();this.b=(tRb(),oRb);this.a=0} +function J2b(a){var b;b=I2b(a);R2b(a,b);return b} +function oBb(a){var b;b=a.g;a.g=new DKb;return b} +function Qgc(a){var b;b=a.slice();return qe(b,a)} +function Xgc(a,b,c){var d;d=a[b];a[b]=c;return d} +function fcc(a,b){icc(a,b,a.c.b,a.c);return true} +function Zbc(a){a.a.b=a.b;a.b.a=a.a;a.a=a.b=null} +function Szg(a){q3f(a.g);N1b(a.g.a,0);a.i=false} +function $Ab(a,b){XAb();_Ab.call(this,a,b,false)} +function Rkc(a){xkc();Okc.call(this,a,wkc,false)} +function ukc(a,b){skc.call(this);alc(this.b,a,b)} +function YFc(a,b){CDc(a.a,a.c);!!a.b&&$Fc(a.b,b)} +function kLc(a,b){a.Ao(b);lKc(a,b.wb.a);EKc(a,b)} +function yNc(a,b,c,d){Uug(a,b);bvg(a,c);Bug(a,d)} +function qic(a,b,c,d,e,f){mic(a,b,c,d,e,f);a.b=c} +function DVh(a,b,c,d,e,f){Qqg(this,a,b,c,d,e,f)} +function M$c(a,b){A$c();N$c.call(this,a,b,false)} +function CCc(a,b,c){uBc(a,gSc(b),c);return false} +function P$b(a,b,c){this.a=olh+a+','+b+','+c+')'} +function OTc(a,b){this.a=a;this.c=b;this.b=a.j.B} +function rUc(a){this.d=new Ndc;this.a=new crg(a)} +function Nec(a,b){return new Rec(a.a.fg(b,true))} +function U5c(a,b,c){return !c6c(a.a,b,c,a.A,a.c)} +function y4c(a){return pf(Irg(a.b).d+Irg(a.b).a)} +function z4c(a){return pf(Irg(a.c).d+Irg(a.c).a)} +function K3b(a){return a==0?a:$wnd.Math.log(a+1)} +function O3b(a){return a==0||isNaN(a)?a:a<0?-1:1} +function Kod(a){!a.e&&(a.e=a.Mt(a.o));return a.e} +function Sad(a,b){!a.w&&(a.w=new n9b);Z8b(a.w,b)} +function fmd(a,b){!a.t&&(a.t=new n9b);Z8b(a.t,b)} +function gmd(a,b){!a.u&&(a.u=new n9b);Z8b(a.u,b)} +function $Hd(a,b){!a.s&&(a.s=new n9b);g9b(a.s,b)} +function yHd(a,b){!a.s&&(a.s=new n9b);a.s.add(b)} +function Ipd(a,b){a.S&&!!a.j.db&&z0f(OOf(a.j),b)} +function Tpd(a,b){a.S&&!!a.j.db&&B0f(OOf(a.j),b)} +function Upd(a,b){a.S&&!!a.j.db&&C0f(OOf(a.j),b)} +function bPc(a,b){a.D[b]=false;ePc(a,dOc(a,b),b)} +function vJd(a,b,c,d,e){tJd.call(this,a,b,c,d,e)} +function sOd(a,b,c,d,e){hJd.call(this,a,b,c,d,e)} +function gQd(a,b,c,d,e){hJd.call(this,a,b,c,d,e)} +function yOd(a,b,c,d,e){wOd.call(this,a,b,c,d,e)} +function VZd(a,b,c,d,e){SZd.call(this,a,b,c,d,e)} +function G9d(a,b,c,d){return F9d(a,b,c,d,d.Vw())} +function Fse(a,b,c,d){return nLd(Kod(a.f),b,c,d)} +function Use(a,b,c,d){return vLd(Kod(a.f),b,c,d)} +function Vse(a,b,c,d){return tLd(Kod(a.f),b,c,d)} +function Bte(a,b,c,d){return HLd(Kod(a.f),b,c,d)} +function Cte(a,b,c,d){return ILd(Kod(a.f),b,c,d)} +function dve(a,b,c,d){return aNd(Kod(a.f),b,c,d)} +function ive(a,b,c,d){return dNd(Kod(a.f),b,c,d)} +function jve(a,b,c,d){return eNd(Kod(a.f),b,c,d)} +function Eve(a,b,c,d){return mNd(Kod(a.f),b,c,d)} +function Gve(a,b,c,d){return qNd(Kod(a.f),b,c,d)} +function _ve(a,b,c,d){return wNd(Kod(a.f),b,c,d)} +function awe(a,b,c,d){return xNd(Kod(a.f),b,c,d)} +function qwe(a,b,c,d){return BNd(Kod(a.f),b,c,d)} +function twe(a,b,c,d){return ENd(Kod(a.f),b,c,d)} +function $we(a,b,c,d){return INd(Kod(a.f),b,c,d)} +function _we(a,b,c,d){return KNd(Kod(a.f),b,c,d)} +function Zwe(a,b,c,d){return ALd(Kod(a.f),b,c,d)} +function pxe(a,b,c,d){return SNd(Kod(a.f),b,c,d)} +function Yge(a,b){return o8d(S9d(a,a.k,false),b)} +function Pge(a,b){Mge.call(this,a);Z8b(this.b,b)} +function Gfe(a){Efe.call(this,a);this.f=this.e=0} +function sXe(a){NHc();BLc.call(this,a);KWe(this)} +function rse(a,b){this.a=a;this.c=false;this.b=b} +function dce(a,b){a.Mw(b.Cg(a.k));a.i=0;return a} +function TIe(a){var b;b=PIe(a);b.i=true;return b} +function WIe(a){var b;b=PIe(a);b.q=true;return b} +function gvd(a){var b;b=dvd(a);b.F=true;return b} +function kvd(a){var b;b=dvd(a);b.G=true;return b} +function HWe(a){jkd(a,new s8d(a.t,NaN));return a} +function e2e(a){o1e();f2e.call(this,a,null,true)} +function Q0e(a,b){NHc();U0e.call(this,a,false,b)} +function Dxe(a,b){!a.c&&Bxe(a);return XDb(a.c,b)} +function DZe(a,b){!a.e&&(a.e=new n9b);Z8b(a.e,b)} +function UZe(a,b){a.lb=b;PZe(a,true);MZe(a,null)} +function F_e(a,b){return tlf(Ylf(U_e(a),b.pz()))} +function ySf(a){return ing(),rng(z4b(a.d,0,2)).e} +function zSf(a){return ing(),rng(z4b(a.d,0,2)).i} +function nYe(a){return a.i&&a.j!=null?a.j:oYe(a)} +function BWh(a){$1g();a.preventDefault();c2g(a)} +function wWf(a){pWf();AQf.call(this,a);qWf(this)} +function IWf(a,b){if(b==a.c){return}a.c=b;a.UA()} +function JWf(a,b){if(b==a.R){return}a.R=b;a.UA()} +function bXf(a,b){if(a.B==b){return}a.B=b;a.UA()} +function Oqf(a,b){Aqf(a,b,false);return tqf(a).c} +function Plf(a,b,c){Olf(a,b,c);a.f[3]=0;a.a=true} +function SVf(a,b){Z8b(a.c,b);Hxe(b,a.a?a.b:null)} +function y4f(a,b){return Nld(Hpd(a.d,b,false,0))} +function MXf(){zQf.call(this);this.a=(TXf(),RXf)} +function u9f(){l9f.call(this,'SUBSTITUTION',101)} +function U9f(){l9f.call(this,'IS_ELEMENT_OF',18)} +function P9f(){l9f.call(this,'GREATER_EQUAL',13)} +function $9f(){l9f.call(this,'VECTORPRODUCT',23)} +function o9e(){W8e.call(this,'GEOPOLYHEDRON',22)} +function Q9e(){W8e.call(this,'GEOCOORDSYS2D',46)} +function S9e(){W8e.call(this,'GEOCOORDSYS1D',48)} +function _9e(){W8e.call(this,'TRANSFORMABLE',56)} +function Y9e(){W8e.call(this,'TRANSLATEABLE',53)} +function utg(a){ttg.call(this);this.a.compile(a)} +function IFg(a){FFg();this.a=a.pb;this.b=new n9b} +function Bjg(a){var b;b=a.j.b;a.j=a.j.a;return b} +function Gzg(a,b,c,d){aNc();a.j.drawImage(b,c,d)} +function TFg(a,b,c,d){SFg(a,b,c,d.c,d.d,d.b,d.a)} +function pAg(a,b,c){Qzg(a.d.a);PEc(a.d,vAg(b),c)} +function $cg(a,b){return Zcg(Ycg(Zcg(a),Zcg(b)))} +function yOg(a){return hQg(qjd(iPf(a.b)),J3f(a))} +function AOg(a){return mhg(),y4b(Yyg(BOg(a)),22)} +function LHg(a,b){return a.a==null?'':a.a.key(b)} +function H0g(a,b){!a.a&&(a.a=new n9b);Z8b(a.a,b)} +function rCg(a,b){!a.d&&(a.d=new n9b);Z8b(a.d,b)} +function Nc(a,b){!!$stats&&fd(ed(a,'begin',b,-1))} +function ke(a,b,c,d,e,f){return le(a,b,c,d,e,0,f)} +function mqb(a){if(jf(a)){return a|0}return Se(a)} +function BOh(){var a;return a=this.a.yf(),a.ef()} +function pUh(){return new dId(this.Kc,v1e(this))} +function yEb(){cEb.call(this);Lbc(this.g,zbh,'c')} +function oLb(a){NAb.call(this);nLb(this);this.a=a} +function XIb(a){NAb.call(this);SIb(this);this.b=a} +function CXb(){GHb.call(this,0,Ujh,431,333,pih,0)} +function DXb(){GHb.call(this,0,Ujh,431,333,pih,0)} +function OYg(){zYg.call(this,'MARGIN_BOTTOM',20)} +function pZg(){zYg.call(this,'OUTLINE_COLOR',47)} +function nZg(){zYg.call(this,'OUTLINE_WIDTH',45)} +function oZg(){zYg.call(this,'OUTLINE_STYLE',46)} +function lZg(){zYg.call(this,'TEXT_OVERFLOW',43)} +function LHb(a,b,c,d){JHb.call(this,a,b,null,c,d)} +function Gac(a,b,c,d){return Pac(b.We(c),b.We(d))} +function W$b(a,b){a.d.strokeRect(b.c,b.d,b.b,b.a)} +function V5b(a,b){this.f=a;this.e=b;this.a=_5b(a)} +function _4b(a,b){a.a+=K4b(b,0,b.length);return a} +function b9b(a,b){mhc(b,a.i.length);return a.i[b]} +function gac(a,b){mhc(b,a.a.length);return a.a[b]} +function wgc(a,b){ggc();Jfc.call(this,a);this.a=b} +function Pac(a,b){return nhc(a),c2b(a,(nhc(b),b))} +function bbc(a,b){return kbc(a.a,b)?a.b[b.k]:null} +function EFc(a,b,c){return SNd(Kod(a.K),null,b,c)} +function VCc(a,b){if(a.d){return 0}return a.ec[b]} +function BIc(a){if(!a.jb){return a.lb}return a.jb} +function dIc(a){if(ff(a,167)){return a.G}return a} +function iIc(a){!a.mb&&(a.mb=new E3d);return a.mb} +function DKc(a,b){b?a.Nm()&&(a.Nb=b):(a.Nb=false)} +function h$b(a,b,c){e$b(a,c,b);return Y1b(),false} +function CQc(a){aNc();return a==62||a==73||a==111} +function CJc(a){return !a.lb&&(!a.Db||!cPe(a.Db))} +function eSc(a,b,c){return dSc(a,b,(U8e(),R8e),c)} +function aTc(a,b,c,d){Tpg(b9b(a.k,b),c,d,c+5,d+5)} +function Y_c(a,b){a.b=true;U_c(a);return X_c(a,b)} +function ZLc(a,b){NHc();this.a=a;TLc.call(this,b)} +function hbc(a){this.c=a;this.a=new rbc(this.c.a)} +function Lod(a){if(!a.O){return null}return a.O.a} +function Mod(a){!a.i&&(a.i=new Mkd(a));return a.i} +function Uod(a){!a.G&&(a.G=new _wc(a));return a.G} +function cpd(a){!a.T&&(a.T=new Zqf(a));return a.T} +function gpd(a){if(!a.mb){return -1}return a.db.c} +function D5c(a){--a.b;return a.b>=0?a.a[a.b]:null} +function HOc(a){szg(a,(pHc(),kHc));Kub(a.cb,true)} +function OHd(a,b){a.u=b;b?_kd(a.Kc,a):qmd(a.Kc,a)} +function mqd(a){var b;b=a.o.Z-1;Bmd(a.o,Pod(a,b))} +function JKd(a,b,c,d){KKd.call(this,a,b,c,d,true)} +function VOd(a,b,c,d){UOd.call(this,a,b,c.lp(),d)} +function dId(a,b){NHc();cId.call(this,a);this.H=b} +function rwd(){gwd.call(this,'prefixedDefaultSF')} +function MYd(a,b,c,d){OYd.call(this,a,b,c,d,true)} +function k$d(a,b,c,d){l$d.call(this,a,b,c,null,d)} +function NCd(a,b,c,d,e){return YCd(a,e,b[c],d[c])} +function d3d(a,b,c,d){a.d[b][c]=d;d.$=true;d.zf()} +function V7d(a,b){a.s=b.s;a.o=b.o;a.n=b.n;a.q=b.q} +function wcd(a,b){return a==91||!b&&a==123||a==40} +function xbe(a,b){return tae(a)||!!lbe(a,b,false)} +function xPd(a){return !a.f?new dId(a.Kc,NaN):a.f} +function wPd(a){return !a.d?new dId(a.Kc,NaN):a.d} +function wbe(a){return a.o.tp().Lm()&&a.s.Lk()>10} +function Mde(a){return a.k==(_8f(),Q7f)||a.k==e8f} +function yue(a,b,c){return lLd(Kod(a.f),b,c,true)} +function ace(a){a.Mw($wnd.Math.abs(a.k));return a} +function xce(a){a.Mw(ufg(0,1,a.k));a.i=0;return a} +function Mce(a,b){a.Mw(Afg(b,a.k));a.i=0;return a} +function vce(a){a.Mw(a.k==0?k9g:0);a.i=0;return a} +function RIe(a){var b;b=PIe(a);b.C=false;return b} +function XIe(a){var b;b=PIe(a);b.a=false;return b} +function YIe(a){var b;b=PIe(a);b.b=false;return b} +function $Ie(a){var b;b=PIe(a);b.t=false;return b} +function TOe(a){!a.r&&(a.r=PPe(a,a.w));return a.r} +function ZMe(a){a.u=false;a.q=h8g;a.w=-1;a.s=true} +function vOe(a,b){NHc();uOe.call(this,a);this.e=b} +function NTe(a,b){NHc();cId.call(this,a);this.a=b} +function tUe(a,b,c){ZDb(a.i,b,c==null?T4g:Bqb(c))} +function GRe(a,b,c){a.W=b.C&&!b.D;pQe(a,S_e(b),c)} +function _Re(a,b,c){a.W=b.C&&!b.D;pQe(a,S_e(b),c)} +function jVe(a){if(!a.d){return null}return a.d.n} +function kVe(a){if(!a.d){return null}return a.d.o} +function OWe(a){if(!a.d){return null}return a.d.n} +function CVe(a){if(a.d){return a.d.r}return false} +function IVe(a){if(a.d){return !a.d.r}return true} +function V_e(a){!a.F&&(a.F=new vrd(a));return a.F} +function pff(a){off.call(this,a.c,a.a);this.b=a.b} +function lgf(a){ngf.call(this,a,null,(Rgf(),Ggf))} +function R9e(){W8e.call(this,'GEODIRECTIONND',47)} +function $9e(){W8e.call(this,'ROTATEMOVEABLE',55)} +function x0g(){x0g=xqb;w0g=sfc((D2b(pob),pob.o))} +function B2b(){B2b=xqb;A2b=me(Rt,R5g,507,128,0,1)} +function y3b(){y3b=xqb;x3b=me($t,Alh,285,256,0,1)} +function F3b(){F3b=xqb;E3b=me(au,Blh,651,256,0,1)} +function n1b(){n1b=xqb;m1b=$wnd.Node.ELEMENT_NODE} +function LOf(a){HOf(a);aEb(a.H);GOf(a);return a.$} +function ROf(a){!a.wb&&(a.wb=new Jaf);return a.wb} +function xOf(a){vTg((!a.i&&(a.i=new wTg),mSf(a)))} +function Rvf(a,b,c,d,e){Z8b(a.d,new _vf(b,c,d,e))} +function X8e(a,b){U8e();return V8e(Z8e(b),Z8e(a))} +function ykf(a,b,c){return xkf(a,b.f[0],b.f[1],c)} +function Akf(a,b,c){return zkf(a,b.f[0],b.f[1],c)} +function aff(a){return Ocg(a.c,h9g)&&Ocg(a.a,k9g)} +function n4f(a,b){return U3f(a,b,new A6f(b),null)} +function E3f(a,b){Uc(1,new zMg(a.b,new L6f(a,b)))} +function G3f(a,b){Uc(1,new AMg(a.b,new L6f(a,b)))} +function H3f(a,b){Uc(1,new yMg(a.b,new L6f(a,b)))} +function nZf(a,b){a.c=b;a.bb>0?(a.cb=true):xQf(a)} +function mZf(a,b){a.b=b;a.bb>0?(a.cb=true):xQf(a)} +function oZf(a,b){a.d=b;a.bb>0?(a.cb=true):xQf(a)} +function EQf(a,b){var c;c=a.a.cb;!!c&&UQc(c.bb,b)} +function q0f(a,b){r0f.call(this,a,b,!b?null:b.Xb)} +function W9f(){l9f.call(this,'SET_DIFFERENCE',19)} +function cag(){l9f.call(this,'INVISIBLE_PLUS',27)} +function srg(a){prg();rrg.call(this,a);this.a=a.a} +function Ahg(a){mhg();return a==null||a.length==0} +function wHg(a){Vxg(a.a,'fadeIn');PAg(a.a.c,2000)} +function mGg(a,b,c){cyg(a.q,b+fGh);Zxg(a.q,c+fGh)} +function BHg(a,b,c){a.a=false;AHg(a,b,c);a.a=true} +function g5f(a,b,c,d,e){FPc(a.b.cb,b,c,d,e,false)} +function $Kg(a){FQg((!a.L&&(a.L=new IQg(a)),a.L))} +function hLg(a){return !a.u&&(a.u=new bPg(a)),a.u} +function jLg(a){return !a.v&&(a.v=new FPg(a)),a.v} +function kLg(a){!a.v&&(a.v=new FPg(a));return a.v} +function iLg(a){!a.u&&(a.u=new bPg(a));return a.u} +function aLg(a){!a.Q&&(a.Q=new vEg(a));return a.Q} +function bLg(a){!a.f&&(a.f=new mTg(a));return a.f} +function Tzg(a){!a.f&&(a.f=new pBg(a));return a.f} +function uLg(a){!a.I&&(a.I=new aSg(a));return a.I} +function wLg(a){!a.L&&(a.L=new IQg(a));return a.L} +function vLg(a){!a.K&&(a.K=new ZUf(a));return a.K} +function MLg(a){GEg((!a.b&&(a.b=new MEg(a)),a.b))} +function eEg(a){a.a=true;a.f&&(oyg(a),hEg(a.b.a))} +function LTf(a){!!jlg&&klg(jlg,(Clg(),vlg),nEh+a)} +function PSg(a){return a.a.bC(CHh)?a.a._B(CHh):''} +function ESg(a){return a.a.bC(wHh)?a.a._B(wHh):''} +function NSg(a){return a.a.bC(BHh)?a.a._B(BHh):''} +function ASg(a){return a.a.bC(Orh)?a.a._B(Orh):''} +function SSg(a){return a.a.bC(KFh)?a.a._B(KFh):''} +function oe(a){return Array.isArray(a)&&a.oD===Cqb} +function BPh(){return oUf(XOf(this.Pb.C),this.xb)} +function nVh(){this.bb>0?(this.cb=true):xQf(this)} +function EYg(){zYg.call(this,'PADDING_BOTTOM',11)} +function fZg(){zYg.call(this,'VERTICAL_ALIGN',38)} +function tZg(){zYg.call(this,'TEXT_DECORATION',5)} +function mZg(){zYg.call(this,'TEXT_TRANSFORM',44)} +function J0g(a,b,c,d){var e;e=N0g(a,b,c);e.add(d)} +function rVh(a,b,c,d,e,f,g){return new cde(a.a,0)} +function sVh(a,b,c,d,e,f,g){return p9d(a,b,c,f,g)} +function nqb(a){if(jf(a)){return ''+a}return Te(a)} +function Zrb(a){if(Asb(a))return true;return false} +function _rb(a){if(Hsb(a))return true;return false} +function asb(a){if(Esb(a))return true;return false} +function bsb(a){if(psb(a))return true;return false} +function csb(a){if(ysb(a))return true;return false} +function dsb(a){if(Dsb(a))return true;return false} +function esb(a){if(zsb(a))return true;return false} +function fsb(a){if(qsb(a))return true;return false} +function gsb(a){if(osb(a))return true;return false} +function hsb(a){if(Yrb(a))return true;return false} +function isb(a){if(Trb(a))return true;return false} +function jsb(a){if(Urb(a))return true;return false} +function ksb(a){if(Xrb(a))return true;return false} +function lsb(a){if(Wrb(a))return true;return false} +function msb(a){if(Vrb(a))return true;return false} +function Jsb(a){if($rb(a))return true;return false} +function nsb(a){if(Bsb(a))return true;return false} +function vsb(a){if(ssb(a))return true;return false} +function xsb(a){if(tsb(a))return true;return false} +function Od(a,b){!a&&(a=[]);a[a.length]=b;return a} +function LAb(a,b){b.j=a.j;b.k=a.k;b.i=a.i;return b} +function gBb(a,b){NAb.call(this);this.b=a;this.a=b} +function bCb(a,b){NAb.call(this);this.a=a;this.b=b} +function KGb(a,b){NAb.call(this);this.a=a;this.b=b} +function RIb(a,b){NAb.call(this);this.a=a;this.b=b} +function BLb(a,b){NAb.call(this);this.b=a;this.a=b} +function QQb(a,b){NAb.call(this);this.b=b;this.a=a} +function zRb(a,b){NAb.call(this);this.a=a;this.b=b} +function bKb(a){NAb.call(this);this.j=a.j;this.a=a} +function PVb(){cEb.call(this);Lbc(this.g,zbh,'cc')} +function lXb(){GHb.call(this,0,Njh,431,358,1022,0)} +function mXb(){GHb.call(this,0,Njh,431,358,1022,0)} +function LIb(a,b,c,d){KIb();MIb.call(this,a,b,c,d)} +function V9b(a,b,c){ihc(0,b,a.length);Q9b(a,0,b,c)} +function Y8b(a,b,c){phc(b,a.i.length);Tgc(a.i,b,c)} +function gqb(a,b){return Upb(Ne(jf(a)?kqb(a):a,b))} +function hqb(a,b){return Upb(Oe(jf(a)?kqb(a):a,b))} +function iqb(a,b){return Upb(Pe(jf(a)?kqb(a):a,b))} +function $Db(a,b){return mf(b)?_Db(a,b):ybc(a.e,b)} +function wbc(a,b){return ubc(a,b,vbc(a,a.b._d(b)))} +function Jbc(a,b){return !(a.a.get(b)===undefined)} +function kRc(a,b,c,d,e){return Iqg(pRc(a),b,c,d,e)} +function sRc(a,b,c,d,e){return Nqg(pRc(a),b,c,d,e)} +function $ic(a,b){ttc(b);return Vic(Yic(Wic(a),b))} +function dOc(a,b){if(b==0){return a.Ec}return a.Nc} +function cOc(a){if(a.bc){return a.bc.H}return a.Ub} +function ooc(a){moc(a);Tnc(a.B,a.w,a.t);return a.t} +function rjd(a){!a.d&&(a.d=a.e.Ot(a.c));return a.d} +function W_c(a,b){a.b=false;U_c(a);return X_c(a,b)} +function imd(a,b){b==null?a.V.a.clear():Gec(a.V,b)} +function Vld(a){return a.cb.a.size()>0||_od(a.M)>0} +function Qcc(a){return a==null?Lcc:new Pcc(nhc(a))} +function ZGb(a,b){this.c=a;this.b=new DKb;this.a=b} +function ocd(){this.b=8;this.d=8;this.c=8;this.a=8} +function p0d(a){lwc.call(this,a.Kc,false);this.a=a} +function q0d(a){lwc.call(this,a.Kc,false);this.b=a} +function n6c(a){xRc.call(this,a);this.b=new bmf(4)} +function MUd(a,b,c){NUd.call(this,a,b,c,null,true)} +function XUd(a,b,c){YUd.call(this,a,b,c,null,null)} +function j$d(a,b,c){l$d.call(this,a,b,null,null,c)} +function lWd(a,b,c,d){aWd.call(this,a,b,c,d,false)} +function Zee(a,b){abd.call(this);this.c=b;this.b=a} +function khe(a){tge.call(this,a.length-1);this.a=a} +function qfe(a){if(a.v){return kfe(a,a.c)}return a} +function xse(a,b,c){return lLd(Kod(a.f),b,c,false)} +function Gse(a,b){throw Qpb(ICd(a,b,b.c.i.length))} +function Whe(a,b){Uhe();The.b=a;The.a=b;return The} +function cje(a,b){aje();_ie.b=a;_ie.a=b;return _ie} +function vSe(a){!a.g&&(a.g=(tkf(),rkf));return a.g} +function U6d(a){!a.r&&(a.r=f6d(a));return a.r.Jl()} +function Z6d(a){!a.r&&(a.r=f6d(a));return a.r.cm()} +function g4e(a){return a.v!=null&&(!a.u||a.u.Em())} +function ANc(a,b,c){!!c&&zNc(a,b,null,a.ec,a.hc,c)} +function OMe(a,b,c,d,e){NHc();NNe(e,0-d,c,a*d-b*c)} +function I9b(a,b,c){var d;for(d=0;d',a)} +function JGb(){EGb();DGb=new cEb;BGb=new cEb;IGb()} +function Xnf(a){if(mof(a))return true;return false} +function aof(a){if(iof(a))return true;return false} +function gof(a){if(Gof(a))return true;return false} +function pof(a){if(_of(a))return true;return false} +function Fof(a){if(tof(a))return true;return false} +function Mof(a){if(Pof(a))return true;return false} +function Aof(a){if(Vnf(a))return true;return false} +function $of(a){if(Bpf(a))return true;return false} +function Xpf(a){if(rpf(a))return true;return false} +function Zpf(a){if(mpf(a))return true;return false} +function Vpf(a){if(Lof(a))return true;return false} +function Ypf(a){if(fof(a))return true;return false} +function $pf(a){if(Qof(a))return true;return false} +function jqf(a){if(Qpf(a))return true;return false} +function aqf(a){if(Ipf(a))return true;return false} +function bqf(a){if(Hpf(a))return true;return false} +function kqf(a){if(bof(a))return true;return false} +function BSf(a,b){if(!b.j){return false}return a.k} +function CWf(a){if(!a.P){return a.Q.a}return a.P.a} +function EWf(a){if(!a.P){return a.Q.b}return a.P.b} +function oPf(a){return a.ob||!a.pb.o||!Vld(a.pb.o)} +function OWf(a,b,c){if(a.o[b]!=c){a.o[b]=c;a.UA()}} +function SWf(a,b,c){if(a.k[b]!=c){a.k[b]=c;a.UA()}} +function vOf(a,b,c){var d;UKg(a);d=a.cb;kNc(d,b,c)} +function Isf(a,b,c){do{Hsf(a,ysf[b])}while(b++!=c)} +function eWf(a,b){$cd(b);a.bb>0?(a.cb=true):xQf(a)} +function UZf(a){if(WZf(a)){m$f(scc(a.d),a);OZf(a)}} +function Uog(a){Dog();Wog.call(this,a,2,0,10,null)} +function Xng(a){this.a=pe(ie(sf,1),g9g,5,15,[a,0])} +function Eig(){return pe(ie(Udb,1),v5g,5,15,[0,1])} +function btg(a,b){return ((a.s*b+a.r)*b+a.q)*b+a.p} +function cvg(a,b){M_b(a.j,b.a,b.d,b.b,b.e,b.c,b.f)} +function zzg(a,b,c){qzg(a,a.zc+b,a.Ic+c,a.Ec,a.Nc)} +function PGg(a,b){tyg(a,b,a.C);Z8b(a.a,b);return b} +function Kxg(a,b){a.u&&Jyg(a.kc.d,true);Yzg(a.a,b)} +function zFg(a,b){if(!b.pn()){return}KAg(a,Y3e(b))} +function QOg(a,b){VSg(a.b.d,tih,b+'');CDg(a.b.a,b)} +function UOg(a,b){VSg(a.b.d,sih,b+'');FDg(a.b.a,b)} +function PEg(a,b){this.a=a;this.b=b;RAg.call(this)} +function MJg(a,b){this.a=a;this.b=b;RAg.call(this)} +function pIg(a,b,c,d){a.c=b;a.a=c;a.b=d;PAg(a,500)} +function cQg(a){a.d==0&&(a.d=a.b.width);return a.d} +function TSg(a,b){return a.a.bC(EHh)?a.a._B(EHh):b} +function $Oh(){return this.V==null?0:this.V.length} +function ef(a){return !Array.isArray(a)&&a.oD===Cqb} +function M2b(a){var b;b=I2b(a);b.n=a;b.g=1;return b} +function _2b(a){return jf(a)?Xpb((nhc(a),a)):a.Mf()} +function a3b(a,b){return f3b((nhc(a),a),(nhc(b),b))} +function Ge(a,b){return ue(a.l&b.l,a.m&b.m,a.h&b.h)} +function Me(a,b){return ue(a.l|b.l,a.m|b.m,a.h|b.h)} +function Ue(a,b){return ue(a.l^b.l,a.m^b.m,a.h^b.h)} +function evb(a,b,c,d){Oub.call(this,b,c,d);this.a=a} +function A9f(){l9f.call(this,'DOLLAR_VAR_ROW',107)} +function B9f(){l9f.call(this,'DOLLAR_VAR_COL',108)} +function J9f(){l9f.call(this,'INVERSE_NORMAL',115)} +function M9f(){l9f.call(this,'MATRIXTOVECTOR',118)} +function gbg(){l9f.call(this,'BETA_INCOMPLETE',78)} +function Hag(){l9f.call(this,'FRACTIONAL_PART',54)} +function XZg(){RZg.call(this,'TABLE_ROW_GROUP',12)} +function mDb(){lDb.call(this,46,ZLb(U9g,true),null)} +function tLb(){NAb.call(this);qLb(this);this.a=true} +function GRb(a,b,c,d){FRb.call(this,a,b,c);this.a=d} +function aLb(a,b,c){cLb.call(this,a,b,c,!ff(a,510))} +function TDb(a,b){return UDb(a,b,a.g)||UDb(a,b,a.e)} +function kbc(a,b){return ff(b,28)&&!!b&&a.b[b.k]==b} +function pdc(a,b){this.e=a;this.d=(b&64)!=0?b|zlh:b} +function nCb(a,b){this.p=a;this.n=b;new eZb;new fZb} +function jec(a){this.b=null;this.a=(Nac(),!a?Kac:a)} +function p9b(a){X8b(this);Ugc(this.i,0,a.toArray())} +function pgc(a,b){return sgc(a,(nhc(b),new Tec(b)))} +function Fac(a,b){nhc(a);nhc(b);return new Iac(b,a)} +function Idc(a,b){if(a<0||a>=b){throw Qpb(new U1b)}} +function Bgc(a,b,c){if(a.a.ug(c)){a.b=true;b.sg(c)}} +function hGc(a,b,c){return nLd(Kod(a.a.K),null,b,c)} +function qGc(a,b,c){return jLd(Kod(a.a.K),null,b,c)} +function yGc(a,b,c){return HLd(Kod(a.a.K),null,b,c)} +function zGc(a,b,c){return ILd(Kod(a.a.K),null,b,c)} +function CGc(a,b,c){return aNd(Kod(a.a.K),null,b,c)} +function EGc(a,b,c){return eNd(Kod(a.a.K),null,b,c)} +function IGc(a,b,c){return iNd(Kod(a.a.K),null,b,c)} +function JGc(a,b,c){return jNd(Kod(a.a.K),null,b,c)} +function NGc(a,b,c){return mNd(Kod(a.a.K),null,b,c)} +function RGc(a,b,c){return new NUd(a,b,c,null,true)} +function SGc(a,b,c){return ENd(Kod(a.a.K),null,b,c)} +function VGc(a,b,c){return ALd(Kod(a.a.K),null,b,c)} +function WGc(a,b,c){return INd(Kod(a.a.K),null,b,c)} +function XGc(a,b,c){return KNd(Kod(a.a.K),null,b,c)} +function YGc(a,b,c){return MNd(Kod(a.a.K),null,b,c)} +function JDb(a){return a-$wnd.Math.floor(a/360)*360} +function aEb(a){a.e=new zbc(a);a.g=new Nbc(a);++a.f} +function swc(a){!a.c&&(a.c=Cyc(a.b.G.j));return a.c} +function TIc(a){if(!a.lb){return 0}return Jvc(a.lb)} +function yTc(a){dUf(a.b,true,true);kPc(a.a.cb,null)} +function J9b(a,b){var c;for(c=0;ca.o.a?b:a.o} +function iHd(a){if(!a.o){return NaN}return a.o.Fp()} +function jHd(a){if(!a.p){return NaN}return a.p.Fp()} +function k8c(a){if(a.d.i.length==0){return}a.b=true} +function d_c(a){a.a=me(sf,g9g,5,2,15,1);a.b=new mvc} +function K_g(){K_g=xqb;J_g=new W_g('blur',new L_g)} +function Y_g(){Y_g=xqb;X_g=new W_g('drop',new Z_g)} +function dIb(){dIb=xqb;cIb=new JOb((tRb(),qRb),0.4)} +function Ryc(){this.k=new n9b;xNb(this,(TRf(),bRf))} +function Exd(a){mxd.call(this,a);this.D=0,undefined} +function ihd(a){while(a4b(a.i,a.f)!=62){++a.f}++a.f} +function GOd(a){var b;b=a.Mc.j.cb;a.j=b.Dc;a.n=b.Bc} +function Rge(a,b){var c;c=new Uge(a);c.j=b;return c} +function ure(a,b){var c;c=new CKd(a.d,b);return c.a} +function bce(a,b){a.i=b?1:0;a.Mw(Ieg(a.k));return a} +function ece(a,b){a.i=b?1:0;a.Mw(Leg(a.k));return a} +function UIe(a){var b;b=PIe(a);b.o=new kJe;return b} +function K8d(a){if(ff(a,13)){return a.Fk()}return a} +function x9d(a,b,c,d,e){return new eye(a.b,d,b,e,c)} +function M3d(a,b){K3d();return !!b.lb&&a==b.lb.Mi()} +function A$e(a,b){if(ff(a.lb,xdh)){a.d=b;a.lb.Ji()}} +function uNe(a,b){jJc(a,b);PIc(a,b);xaf(b,a.Cc,a.q)} +function OYe(a,b){b.xn()?MYe(a,b):MYe(a,b.Dk(a.Kc))} +function eLd(a,b,c){ff(b,242)?Qwd(a,b,c):Rwd(a,b,c)} +function HTe(a,b,c){Abe(dTe(a,0),b);Abe(dTe(a,1),c)} +function SPe(a,b,c){a.e=a.Kc.M.j.B.d;a.D=iPe(a,c,b)} +function NNe(a,b,c,d){a.Z=b;a.$=c;a._=d;wKc(a,null)} +function a6e(a,b,c,d){a.Z=b;a.$=c;a._=d;wKc(a,null)} +function B0e(a,b){a.G=b;!!a.G&&a.G.Tm()&&wQe(a.G,a)} +function bff(a,b){return Pcg(a.c,0,b)&&Pcg(a.a,0,b)} +function djf(a,b){return Ref(a.a,b.c)||Ref(b,a.a.c)} +function fwf(a,b,c){return bbc(a.c,c).gx(b,a.b,a.e)} +function Pqf(a,b,c){return Wge(a.G,b,t4b(c,O6g,''))} +function GMe(a){return Scg(a.Z)&&Scg(a.$)&&Scg(a._)} +function GUf(a,b){var c;c=b.mc;!c?FUf(a,b):HUf(a,c)} +function vPf(a,b){!a.vb&&(a.vb=new n9b);Z8b(a.vb,b)} +function lef(a,b,c){a.a[b][c].g==0&&(a.a[b][c].g=1)} +function N6f(a,b,c){var d;d=a.a[b];d!=null&&c.sg(d)} +function e6f(a,b){return KJc(a,b==-1?512:b==1?1:16)} +function _3e(a){if(!a.j){return a.C}return _3e(a.j)} +function iJe(a){hJe.call(this,a,false);this.A=false} +function mWf(){zQf.call(this);Zxe(this);this.b=true} +function faf(){W8e.call(this,'PATH_NO_FILL_HIT',60)} +function y9e(){W8e.call(this,'GEOLIST_AS_COMBO',31)} +function dbg(){l9f.call(this,'GAMMA_INCOMPLETE',75)} +function E0e(a){a.C=false;F0e(a);wLc(a,false,false)} +function o5e(a,b){a.d=2*b.f[0]-a.d;a.e=2*b.f[1]-a.e} +function hqg(a,b){a.b=bsg(new isg,a.b,b.b);a.a=null} +function lqg(a,b){a.b=bsg(new nsg,a.b,b.b);a.a=null} +function nqg(a,b){a.b=bsg(new ksg,a.b,b.b);a.a=null} +function rqg(a,b){a.b=bsg(new msg,a.b,b.b);a.a=null} +function dMg(a,b){!a.Q&&(a.Q=new vEg(a));lEg(a.Q,b)} +function JKg(a,b){if(!HFg(a.b,b)){return}NKg(a.a,b)} +function sOg(a,b){var c;c=new xPg;return jOg(a,b,c)} +function Mug(a,b){Uug(a,b);Lug(a,0,0,Pug(a),Oug(a))} +function Dyg(a,b,c,d){Cyg(a,b);a.rC(b,c,d);Fyg(a,b)} +function fTg(a,b){var c;c=new wPg;kTg(b,c);gTg(a,c)} +function A_f(a,b){a.a.put(v_f(b9g),g_f(b));return a} +function bQg(a){a.a==0&&(a.a=a.b.height);return a.a} +function APg(a){if($Rf(a)){return true}return false} +function Fzg(a){aNc();if(a){Nug(a.f);ozg(a);yzg(a)}} +function LDg(a){Bad();!!Aad&&!ff(Aad,Hch)||Cad(a.a)} +function rJg(a){a.aC().focus();eyg(a.eC(),WGh,true)} +function vNh(a){return new xLb((tRb(),hRb),0.5,0,0)} +function x4b(a,b){return $1b(a.substr(0,b.length),b)} +function _Hg(a,b){$Hg(a.C,'portrait','landscape',b)} +function ohc(a,b){if(a==null){throw Qpb(new U3b(b))}} +function aSg(a){this.a=a;this.b=new cEb;this.d=a.cb} +function ec(a){Yb(this);this.g=a;this.Wc();this.ad()} +function eZg(){zYg.call(this,'BACKGROUND_COLOR',37)} +function dZg(){zYg.call(this,'BACKGROUND_IMAGE',36)} +function WOh(){var a;return blc((a=this.b,Acc(),a))} +function XOh(){var a;return blc((a=this.a,Acc(),a))} +function krb(a){return ff(a,241)&&a.a.e==(Lvb(),wvb)} +function mrb(a){return ff(a,241)&&a.a.e==(Lvb(),Avb)} +function SDb(a,b){return mf(b)?XDb(a,b):!!wbc(a.e,b)} +function LNb(a,b,c){return NNb(a,b,(MQb(),LQb[0]),c)} +function Jc(a,b,c){a.g[b]=c;Mc(a,b)||Wc(a.j,b);Rc(a)} +function Dub(a,b){ZDb(a.a,fvb(b.e),b);ZDb(a.a,b.d,b)} +function DLb(a){this.b=a==94?(JLb(),ILb):(JLb(),HLb)} +function RYb(a){this.a=new dEb(a.size());CYb(this,a)} +function QJb(a){mCb.call(this);IJb(this);KJb(this,a)} +function O6b(a,b,c){p6b();this.e=a;this.d=b;this.a=c} +function Qbc(a,b){nhc(b);while(a.xf()){b.sg(a.yf())}} +function s9b(a){rhc(a.b!=-1);f9b(a.c,a.a=a.b);a.b=-1} +function H9b(a,b,c,d){var e;for(e=b;e0} +function rLc(a){if(a.jc!=null){a.Xb=a.jc;a.hc=false}} +function _Ic(a){if(a.zb==null){return ''}return a.zb} +function kld(a,b){if(b.Bi(a.Z)){return b}return null} +function Jld(a){!a.ab&&(a.ab=new uKg(a));return a.ab} +function Pld(a){PZf((!a.ab&&(a.ab=new uKg(a)),a.ab))} +function Gmd(a){b$f((!a.ab&&(a.ab=new uKg(a)),a.ab))} +function xId(a){if(!a.a.Em()){E0e(a.b);return}zId(a)} +function _fc(a,b,c){if(M7c(a.a,c)){a.b=true;b.hg(c)}} +function uUc(a,b,c,d){a.a=b-2*c+d;a.b=-2*b+2*c;a.c=b} +function XLc(a,b){a.ec=$wnd.Math.max(0,b);GHc(a.a,b)} +function yKd(a,b,c){zKd.call(this,a,c);JKc(this.a,b)} +function VXd(a,b,c){WXd.call(this,a,c);JKc(this.b,b)} +function I2d(a,b,c){J2d.call(this,a,c);JKc(this.b,b)} +function P2d(a,b,c){O2d.call(this,a,c);H6e(b,this.f)} +function IKd(a,b){KKd.call(this,a,b,false,null,true)} +function dTd(a,b){Vxd(b,0,a.o,a.b);a.o.a>1&&k4d(a.o)} +function p7d(a,b){return a.n&&ff(a.o,130)&&a.o.qs(b)} +function Wge(a,b,c){return new Tge(a,Xge(a.j.B,b,c))} +function yse(a,b,c,d,e){return kLd(Kod(a.f),b,c,d,e)} +function Ese(a,b,c,d,e){return mLd(Kod(a.f),b,c,d,e)} +function Wse(a,b,c,d,e){return uLd(Kod(a.f),b,c,d,e)} +function bte(a,b,c,d,e){return xLd(Kod(a.f),b,c,d,e)} +function dte(a,b,c,d,e){return yLd(Kod(a.f),b,c,d,e)} +function Sve(a,b,c,d,e){return yNd(Kod(a.f),b,c,d,e)} +function vgd(a,b,c,d){var e;e=$qe(b,d,a.B.t);c.Qz(e)} +function BNe(a,b,c){var d;d=glf(b);return CNe(a,d,c)} +function _xe(a,b){var c;c=!a.c?b:XPg(a.c,b);return c} +function n3c(a,b){var c;c=a.e.b-b.b;a.c=c>0;return c} +function O8b(a){var b;b=L8b(a);lhc(b!=null);return b} +function C3d(a){var b;b=a.a;while(b){b.a.Hi();b=b.b}} +function smd(a){return Mld(a)||Iec(a.cb,(i3f(),d3f))} +function I2e(a){return !(a.k==(C7e(),y7e)&&a.c==y7e)} +function ede(a,b,c){c.i=a.i==b.i?a.i:0;c.Mw(a.k+b.k)} +function Ekf(a,b){a.d=-1;a.n=false;Klf(a.c,b);Dkf(a)} +function Fef(a,b){b.b=(dud(),bud);hcc(a.b,a.a);a.a=b} +function _df(a){a.a=(m5b(),jqb(Xpb(Date.now()),a.b))} +function OOf(a){!a.db&&(a.db=new E0f(a));return a.db} +function cPf(a){!a.Zb&&(a.Zb=new nVf(a));return a.Zb} +function L9d(a,b){if(b.k&&b.N){return Nah+a}return a} +function tQf(a){if(a==512){return true}return a==513} +function eXf(a,b){if(Ocg(a.F,b)){return}a.F=b;a.UA()} +function B0f(a,b){w0f(a,new r0f((_1f(),n1f),null,b))} +function v2e(a,b){YMe();u2e.call(this,a);TNe(this,b)} +function O4e(a,b){NHc();N4e.call(this,a);C4e(this,b)} +function Rsg(a,b){zsg.call(this,1);this.a=a;this.b=b} +function hmf(a,b,c){gmf();this.a=a;this.b=b;this.c=c} +function Uug(a,b){if(Kuc(b,a.i)){return}a.i=b;evg(a)} +function bfg(a,b){Heg();return $wnd.Math.ceil(a/b)*b} +function Dog(){Dog=xqb;Cog=loh*($wnd.Math.sqrt(2)-1)} +function aHg(a){var b;lyg(a);b=a.RC();-1==b&&a.SC(0)} +function hHg(a){var b;IIg(a,(b=gHg(a),b==null?'':b))} +function TLg(a){if(a.A){OWg(a.A.C,'');a.A.C.focus()}} +function URg(a,b,c){YDb(a.b,c,b);jQc(a.d,c);ozg(a.d)} +function bVg(a,b,c){aVg(this,a);_Ug(this,b);this.b=c} +function B1g(a,b,c){y1g();_1g(a,iIh in b?b[iIh]:b,c)} +function _3g(a){Z3g();try{a.mC()}finally{OYb(Y3g,a)}} +function R3g(a){return uhc(1,a.length+1),a.substr(1)} +function qbf(){mbf.call(this,'NO_SAVE',2,false,true)} +function rbf(){mbf.call(this,'YES_SAVE',3,true,true)} +function p9e(){W8e.call(this,'GEOCURVECARTESIAN',23)} +function UZg(){RZg.call(this,'TABLE_COLUMN_GROUP',9)} +function N_g(){N_g=xqb;M_g=new W_g('change',new O_g)} +function yUg(){this.b=new cEb;this.a=new cEb;new cEb} +function clc(){this.b=new n9b;this.a=new n9b;new cEb} +function hIb(a,b,c){this.d=a>=1?a:1;this.c=c;this.e=b} +function lKb(a,b,c){jKb();mKb.call(this,a,b,nKb(a,c))} +function j4b(a,b,c,d,e){while(b0?1:0} +function Gec(a,b){return a.a.put(b,(Y1b(),W1b))==null} +function pcc(a,b){icc(a.d,b,a.b.b,a.b);++a.a;a.c=null} +function edc(a){if(!a.d){a.d=a.b.rd();a.c=a.b.size()}} +function TGc(a,b){b.Ps(a.a.X.a,a.a.X.b,1);return true} +function qLc(a,b){if(a.hc){return a.Xb}return a.qp(b)} +function eIc(a){if(ff(a,46)){return a.Fp()}return NaN} +function Csb(a){if(Tsb(a,41))return true;return false} +function rsb(a){if(Tsb(a,35))return true;return false} +function Ksb(a){if(Tsb(a,37))return true;return false} +function Dsb(a){if(Tsb(a,17))return true;return false} +function ysb(a){if(Tsb(a,10))return true;return false} +function A3c(a,b){if(!b){return false}return a.d==b.d} +function Xad(a){if(!a.w){return 0}return a.w.i.length} +function gOc(a,b,c){return !a.wc?null:XAg(a.wc,b.c,c)} +function B4c(a,b,c){return Jrg(a.c,b,c)||Jrg(a.b,b,c)} +function r_c(a,b,c,d){return erg(a.f,b-d,c-d,2*d,2*d)} +function K1c(a,b,c){return Jpg(a.j,new nvc(b,c),null)} +function UQd(a,b){return a.a.ay(b,Amh)&&a.b.ay(b,Amh)} +function _Rd(a,b){return a.n.ay(b,Amh)&&a.g.ay(b,Amh)} +function jYc(a){return QOf(a.Pb.C,a.b.g&&a.b.i,0,a.u)} +function UXc(a){NUe(a.b);X1c(a.a);!!a.b.r&&(a.c=null)} +function G2d(a){var b;b=a.b;b.Z=a.a.A;b.$=a.a.B;b._=0} +function JWd(a,b){var c;c=b;return c.A!=a.p||c.B!=a.q} +function K$b(a,b){this.e=a;this.a=0;this.c=0;this.d=b} +function Tsd(){this.b=NaN;this.c=NaN;new amf(0,0,1,0)} +function nJb(){nJb=xqb;mJb=new xLb((tRb(),iRb),0,1,0)} +function vjd(a,b,c,d){ojd(a,new gKg(b),true,c,true,d)} +function KKd(a,b,c,d,e){LKd.call(this,a,b,c,d,e,true)} +function U1d(a,b,c,d,e){V1d.call(this,a,b,c,d,e,null)} +function ude(a,b){bde.call(this,a);qde(this);this.a=b} +function U5d(a,b){return new u8d(a.k,a,(_8f(),T6f),b)} +function v6d(a,b){return new u8d(a.k,a,(_8f(),y7f),b)} +function E7d(a,b){return new u8d(a.k,a,(_8f(),s8f),b)} +function rre(a,b){return ff(Hpd(a.g,b.b,false,0),133)} +function kie(a){return ff(a,109)||ff(a,42)||ff(a,118)} +function XJe(a,b,c){return hgc(Y9b(a.a),new $Je(b,c))} +function ise(a,b,c){!a[b]?(a[b]=c):(a[b]=G7d(c,a[b]))} +function VRe(a,b){j1c(a.k,b[0],b[1]);oQe(a,b[0],b[1])} +function Tae(a){if(!a.q){return false}return Fde(a.q)} +function fre(a){!a.p&&(a.p=new zJe(a.g,a));return a.p} +function DMe(a){var b;b=new _lf(a.Z,a.$,a._);return b} +function fce(a){a.Mw((Heg(),Xsc(a.k)));a.i=0;return a} +function ice(a){a.Mw((Heg(),Ysc(a.k)));a.i=0;return a} +function Zce(a){a.Mw((Heg(),Q3b(a.k)));a.i=0;return a} +function Nce(a){a.Mw((nfg(),Ppc(a.k)));a.i=0;return a} +function rZe(a){a.B>=a.k.i.length&&(a.B=0);return a.B} +function vWe(a){NHc();pWe.call(this,a.Kc);WVe(this,a)} +function Qdf(a){Xcf();Odf.call(this,a.Kc);tdf(this,a)} +function ITe(a){NHc();oTe.call(this,a,null);jRd(this)} +function l9e(){W8e.call(this,'GEOIMPLICITSURFACE',19)} +function G9e(){W8e.call(this,'GEOREGULARPENTAGON',38)} +function tge(a){this.c=a;this.b=me(sf,g9g,5,a+1,15,1)} +function qkf(a){this.c=a;this.a=k9g;this.b=new bmf(2)} +function nof(a){if(sqf(a,52))return true;return false} +function oof(a){if(sqf(a,53))return true;return false} +function qof(a){if(sqf(a,77))return true;return false} +function sof(a){if(sqf(a,36))return true;return false} +function vof(a){if(sqf(a,38))return true;return false} +function Rof(a){if(sqf(a,83))return true;return false} +function epf(a){if(sqf(a,50))return true;return false} +function gpf(a){if(sqf(a,40))return true;return false} +function fpf(a){if(sqf(a,46))return true;return false} +function hpf(a){if(sqf(a,41))return true;return false} +function ipf(a){if(sqf(a,42))return true;return false} +function jpf(a){if(sqf(a,43))return true;return false} +function kpf(a){if(sqf(a,49))return true;return false} +function lpf(a){if(sqf(a,37))return true;return false} +function npf(a){if(sqf(a,57))return true;return false} +function opf(a){if(sqf(a,58))return true;return false} +function ppf(a){if(sqf(a,59))return true;return false} +function wpf(a){if(sqf(a,72))return true;return false} +function Kif(a){if(a==h9g){return a}return Zsc(a,k9g)} +function Lif(a){if(a==k9g){return a}return Zsc(a,h9g)} +function L_e(a){var b;return b=new _lf(a.Z,a.$,a._),b} +function SOf(a){var b;b=a.cb;!b&&(b=a.cb);return b.Pb} +function iPf(a){!a.sb&&(a.sb=YKg(a.pb.o));return a.sb} +function gXe(a,b){!!a.d&&!!b&&a.d.p&&(b.p=true);a.d=b} +function fYf(a,b){!b&&AYf();a.bb>0?(a.cb=true):xQf(a)} +function b6e(a,b){a.Z=b.Z;a.$=b.$;a._=b._;wKc(a,null)} +function DIg(a,b){a.a.value=b==null?T4g:''+(nhc(b),b)} +function qcg(a,b){ocg.call(this,a,b);this.a=Jod(a.pb)} +function LKg(a,b){this.b=b;this.a=new OKg(a.cb.u,a.B)} +function mMg(a,b,c){var d;d=XPg(a.B,b);nMg(a,d+wjh+c)} +function XHg(a,b,c){var d;d=a;d.addEventListener(b,c)} +function cVg(a,b){var c;c=a;return c.toExponential(b)} +function n1g(a,b){m1g();if(!a){throw Qpb(new l3b(b))}} +function yVf(a,b){!!jlg&&klg(jlg,(Clg(),Blg),a+':'+b)} +function TTh(a,b){a.C=false;F0e(a);wLc(a,false,false)} +function B4g(a){this.b=a;this.a=me(Lpb,Z4g,129,4,0,1)} +function JQh(){return lOd(this.j,me(JY,Roh,33,0,0,1))} +function PWe(a){return !a.d?me(_Q,Voh,42,0,0,1):a.d.o} +function Wef(a){return !(a.c>a.a)&&a.c==h9g||a.a==k9g} +function lBc(a){return a==_Ac||a==$Ac||a==YAc||a==ZAc} +function e9f(a){return a==T7f||a==W7f||a==U7f||a==V7f} +function g9f(a){return a==e8f||a==f8f||a==Q7f||a==R7f} +function gWh(a){return URg(this.a,this.b,this.c),null} +function ERb(a,b){FRb.call(this,a,b,(EOb(),EOb(),DOb))} +function o_b(a){U$b();n_b.call(this,a.getContext(a9g))} +function RKb(a,b){var c;c=b+1;c>a.length&&(a.length=c)} +function y4b(a,b){uhc(b,a.length+1);return a.substr(b)} +function M1b(a,b){K1b(a,b,b+1,String.fromCharCode(41))} +function L4b(a,b){a.a+=String.fromCharCode(b);return a} +function S4b(a,b){a.a+=String.fromCharCode(b);return a} +function Ztb(a){var b;a.r=-1;b=iub(a);a.r=a.e;return b} +function _gc(a,b){var c;c=console[a];c.call(console,b)} +function zkc(a,b){xkc();Akc.call(this,(qmc(),olc),a,b)} +function Vkc(a,b){xkc();Wkc.call(this,(qmc(),Tlc),a,b)} +function Bnc(a,b){xkc();Akc.call(this,(qmc(),Nlc),a,b)} +function tAc(a,b){a.Qb+=a.xb.Zb;a.Rb+=a.xb.$b;xAc(a,b)} +function XHc(a){return a.yb&&(!a.nb||a.nb.i.length<=1)} +function MNb(a,b,c,d){return NNb(a,b,(MQb(),LQb[c]),d)} +function Lmc(a,b,c){vnc(a,b);tnc(a,c);return a.b[b][c]} +function wIc(a){if(!a.lb){return a.Lc}return a.lb.ti()} +function FIc(a){if(!a.lb){return null}return a.lb.Ri()} +function nIc(a){if(!a.sb){return null}return a.sb.lp()} +function oLc(a,b){if(a.Em()){return a.qp(b)}return '?'} +function wKc(a,b){if(!!a.Gb&&!b&&!!a.lb){return}a.Gb=b} +function GPc(a,b){if(a.Gb!=b){a.Gb=b;a.uc=true;ozg(a)}} +function RYc(a,b){$ug(b,BAc(a));bvg(b,a.Ib);Bug(b,a.s)} +function q_c(a,b){$ug(b,BAc(a));bvg(b,a.Ib);Bug(b,a.f)} +function E_c(a,b,c){b.Yh(eJc(a.xb));b.Zh(a.Kb);b.th(c)} +function Dwc(a,b){var c;c=N6d(a.Ap(),b,false);return c} +function DSc(a,b){var c;c=new CSc;c.a=a;c.c=b;return c} +function occ(){this.a=new wcc;this.c=new wcc;ncc(this)} +function xic(){pic.call(this,hmh);this.a=new Bic(this)} +function YWc(a,b){LWc.call(this,a,b,false);this.b=null} +function ecc(a){this.d=a;this.c=a.a.c.a;this.b=a.a.d.f} +function zYc(a){return $wnd.Math.max(a.a.v.b,gYc(a.a))} +function Bvd(a,b){return !a.w||a.a&&b.c>a.w.gB()?b:a.w} +function s0c(a,b,c,d,e){return !!a.a&&pqg(a.a,b,c,d,e)} +function b0c(a,b,c,d){Lpg(d,b,c);Epg(d,a);Lpg(d,-b,-c)} +function h2c(a,b,c){if(G2c(a.a,b,c)){return}l2c(a,b,c)} +function gLd(a,b){if(!a.c||a.a.M.fb){return}Z8b(a.b,b)} +function wrd(a){if(!$1b('',a.p)){return a.p}return a.a} +function bWd(a){if(a.an()){return qdf(a)}return a.Em()} +function l5d(a){k5d.call(this,w3b(Y2b(a,10)),a.length)} +function t_d(a,b,c,d){Txd.call(this,a,b,!a.$,c,d,null)} +function u_d(a,b,c,d){Txd.call(this,a,b,!a.$,c,null,d)} +function S1d(a,b,c,d){V1d.call(this,a,b,c,null,d,null)} +function T1d(a,b,c,d){V1d.call(this,a,b,c,d,null,null)} +function T5d(a){return new u8d(a.k,a,(_8f(),Q6f),null)} +function a6d(a){return new u8d(a.k,a,(_8f(),k7f),null)} +function m6d(a){return new u8d(a.k,a,(_8f(),o7f),null)} +function D6d(a){return new u8d(a.k,a,(_8f(),G7f),null)} +function F6d(a){return new u8d(a.k,a,(_8f(),H7f),null)} +function u7d(a){return new u8d(a.k,a,(_8f(),g8f),null)} +function b8d(a){return new u8d(a.k,a,(_8f(),M8f),null)} +function d8d(a){return new u8d(a.k,a,(_8f(),O8f),null)} +function r6c(a){a.e=2*a.e-1;++a.b;a.i=a.j+a.e*a.d[a.b]} +function jce(a,b){a.Mw(ofg(a.k,b.Fp()));a.i=0;return a} +function Ece(a,b){a.Mw(xfg(b.Fp(),a.k));a.i=0;return a} +function Fce(a,b){a.Mw(yfg(b.Fp(),a.k));a.i=0;return a} +function Gee(a){if(ff(a.c,167)){return a.c}return null} +function bge(a){Yfe.call(this,a,new bde(a),new bde(a))} +function Yfe(a,b,c){Xfe.call(this,a);this.e=b;this.f=c} +function Jhe(a){this.c=new Oec;this.a=new Oec;this.b=a} +function mje(a){this.d=new n9b;this.b=new n9b;this.a=a} +function yMe(a){if(!uLg(a.ub)){return}VRg(uLg(a.ub),a)} +function zMe(a){if(!uLg(a.ub)){return}XRg(uLg(a.ub),a)} +function rOe(a){if(!a.c){return '?'}return a.e?Knh:mrh} +function Wqe(a,b){return Xqe(a,b,new hJe(!a.d.$,true))} +function Wre(a,b){return Xre(a,b,new hJe(!a.d.$,true))} +function SJe(a,b){return $1b(b.j!=null?b.j:''+b.k,a.i)} +function rYe(a){return ff(a.d,50)&&a.d.qm()&&!wZe(a.d)} +function tYe(a){return a.c>=8&&!(ff(a.d,94)&&a.d.xn())} +function Erd(a,b){b==null||$1b(T4g,b)?(a.o=''):(a.o=b)} +function iie(a,b){var c;c=b.jj((Sud(),oud));Gec(a.a,c)} +function uUe(a){var b;b=new FUe(a.Kc);b.a=a.a;return b} +function $Se(a){ZSe.call(this,a.Kc,NSe(a));USe(this,a)} +function z5e(a,b,c){y5e.call(this,a);this.d=b;this.e=c} +function Rcf(a,b,c){kwc.call(this,a);this.d=b;this.e=c} +function Gsf(a,b,c){do{a.j[a.f++]=ysf[b]}while(b++!=c)} +function LRe(a,b){KRe(a,b[0],b[1],b[2],b[3],b[4],b[5])} +function y0e(a,b){ff(b,33)?Dxd(a,b):v0e(a,b.iz(),true)} +function HXe(a,b){if(!a.c[b]){return 0}return a.c[b].A} +function IXe(a,b){if(!a.c[b]){return 0}return a.c[b].B} +function MYf(a){if(a==2){return new DXf}return new AXf} +function Ctf(a){var b;a.r=-1;b=Ntf(a);a.r=a.e;return b} +function E0f(a){this.b=new n9b;this.a=a;iod(a.pb,this)} +function nWf(a){AQf.call(this,a);Zxe(this);this.b=true} +function D9f(){l9f.call(this,'DOLLAR_VAR_ROW_COL',109)} +function T9f(){l9f.call(this,'IS_SUBSET_OF_STRICT',17)} +function VZg(){RZg.call(this,'TABLE_HEADER_GROUP',10)} +function WZg(){RZg.call(this,'TABLE_FOOTER_GROUP',11)} +function q9e(){W8e.call(this,'GEOCURVECARTESIAN3D',24)} +function r9e(){W8e.call(this,'GEOCURVECARTESIANND',25)} +function m9e(){W8e.call(this,'GEOQUADRIC3DLIMITED',20)} +function m3f(a,b,c,d,e,f){l3f.call(this,a,b,c,d,e,e,f)} +function Vog(a,b,c){Dog();Wog.call(this,a,b,c,10,null)} +function erg(a,b,c,d,e){return frg(a,new Xrg(b,c,d,e))} +function h4f(a){return mhg(),'#'+iig(BCc(a.b.cb.lb).v)} +function PTh(){return new EYe(this.Kc,this.Zb,this.$b)} +function vSh(a,b){return a?ewf(this.d,b):gwf(this.d,b)} +function VDb(a,b){return mf(b)?WDb(a,b):RDb(wbc(a.e,b))} +function yKb(a,b){return b0;)a.i[b]=V4g} +function pQb(a,b){a.n=b;a.i=b.length;a.j=1;a.o=0;a.e=-1} +function Adc(a,b){Idc(b,a.a.i.length);return b9b(a.a,b)} +function Cdc(a,b){Idc(b,a.a.i.length);return f9b(a.a,b)} +function tdc(a,b){nhc(b);while(a.c=a){return new $fc}return Tfc(a-1)} +function x8b(a){if(!a){throw Qpb(new Gcc)}return a.ef()} +function nhc(a){if(a==null){throw Qpb(new S3b)}return a} +function Ymc(a){if(a==null){throw Qpb(new Tkc)}this.a=a} +function vyg(a,b){if(b<0||b>a.t.c){throw Qpb(new S1b)}} +function jAc(){var a;if(!gAc){a=kAc();gAc=new oOb(a.a)}} +function dDb(){this.a=me(ph,Z4g,1008,i5g,0,1);$Cb(this)} +function _vc(a,b){a.Y=me(fY,qnh,13,1,0,1);a.Y[0]=b.lp()} +function oic(a,b,c,d,e){a.Eg(100,b,c,d,e);return a.Dg()} +function iGc(a,b,c,d){return mLd(Kod(a.a.K),null,b,c,d)} +function mGc(a,b,c,d){return xLd(Kod(a.a.K),null,b,c,d)} +function nGc(a,b,c,d){return yLd(Kod(a.a.K),null,b,c,d)} +function pGc(a,b,c,d){return iLd(Kod(a.a.K),null,b,c,d)} +function j5c(a,b){return new qZd(a.k.Jb.o,b,null,false)} +function OQc(a,b){return new off(MQc(a,b.c),MQc(a,b.a))} +function $_c(a,b,c){FAc(a.a)&&E_c(a.a,b,c);I_c(a.a,b,c)} +function fWc(a){a.b=BIc(a.xb);a.a=a.b.Cv();a.c=a.b.Dv()} +function UBc(a){cUf(a.Jb);WBc(a,true,true);a.kc.ac=null} +function eJc(a){if(!a.Ab){return a.qc}return $Ic(a,100)} +function _od(a){if(!a.O){return 0}return a.O.a.i.length} +function ixd(a){if(!a.b.d){E0e(a.a);return}q1e(a.b,a.a)} +function Tud(a,b){if(a.d&&b.g==2){return wwh}return Rnh} +function _ud(a,b){if(a.d&&b.g==2){return xwh}return Qnh} +function avd(a,b){if(a.d&&b.g==2){return ywh}return Snh} +function TKd(a,b){if(a.b){a.a=null}else{a.a=b;a.b=true}} +function yFd(a,b){rFd.call(this,a.Kc);this.b=a;this.c=b} +function JFd(a,b,c){EFd.call(this,a.Kc);BFd(this,a,b,c)} +function Sxd(a,b,c){Txd.call(this,a,b,!a.$,c,null,null)} +function R1d(a,b,c){V1d.call(this,a,b,c,null,null,null)} +function rKd(a,b){sKd.call(this,a,A6d(b,(Sud(),oud)),b)} +function mtd(a,b,c,d){var e;e=new Htd(b,c,d);MYb(a.d,e)} +function oLd(a,b,c){var d;d=new hGd(a.a,b,c);return d.a} +function YMd(a,b,c){var d;d=new fVd(a.a,b,c);return d.a} +function LNd(a,b,c){var d;d=new qQd(a.a,b,c);return d.a} +function uNd(a,b,c){var d;d=new nZd(a.a,b,c);return d.Y} +function PNd(a){var b;b=ONd(a,0,0);JKc(b,null);return b} +function sce(a){a.Mw((Heg(),1/Q3b(a.k)));a.i=0;return a} +function Vce(a){a.Mw((nfg(),sfg(a.k).a));a.i=0;return a} +function Ice(a){a.Mw($wnd.Math.log(a.k));a.i=0;return a} +function yce(a){a.Mw($wnd.Math.exp(a.k));a.i=0;return a} +function dre(a){!a.b&&(a.b=new lge(a.g,')'));return a.b} +function $ue(a,b,c){var d;d=new jVd(a.e,b,c);return d.b} +function Uve(a,b,c){var d;d=new a$d(a.e,b,c);return d.a} +function Pqe(a,b,c){var d;d=new sKd(a.d,b,c);return d.a} +function xXe(a){var b;b=new bYe(a.Kc);QXe(b,a);return b} +function N$e(a){var b;b=new Z$e(a.Kc);w$e(b,a);return b} +function NLb(){NLb=xqb;MLb=new xLb((tRb(),iRb),0,0.5,0)} +function GUh(){wLc(this,false,false);eqd(this.Mc,this)} +function Yme(a,b,c){Xme.call(this,a,b,null,null,true,c)} +function j_e(a,b,c){a.f=b;b?Z8b(b.a,a):(a.g=true);a.e=c} +function s_e(a,b){return !!b&&$wnd.Math.abs(a.k-b.k)==2} +function Mee(a,b){return a.Sw(a.f,a.c.si().K,'k',b,0,1)} +function Jee(a,b){return a.Sw(a.d,a.c.si().q,'c',b,0,0)} +function Kee(a,b){return a.Sw(a.e,a.c.si().s,'c',b,0,0)} +function Lee(a,b){return a.Sw(a.e,a.c.si().s,'c',b,1,0)} +function Zef(a){return Pcg(a.c,-1,a.d)&&Pcg(a.a,-1,a.d)} +function wff(a,b,c){return new off(b+c*a.d,b+(c+1)*a.d)} +function Ykf(a,b){var c;for(c=0;c9&&(c=9);b>a.rb&&(a.rb=c)} +function Zcf(a){var b;b=new Odf(a.Kc);tdf(b,a);return b} +function x2e(a){var b;b=new A2e(a.Kc);z2e(b,a);return b} +function g3e(a){var b;b=new N3e(a.Kc);D3e(b,a);return b} +function iUf(a){var b;b=a.mc;if(!b){return a}return b.b} +function llf(a){if(a.f.length>2){return a.f[2]}return 0} +function i4f(a){if(a.b.Yb){return $jd(a.b.Yb)}return ''} +function Qzg(a){if(!a.p.kc){return}vzg(a.p.kc,qLg(a.o))} +function Jzg(a){ff(a.a,337)&&ILg(new Izg(a.b));ozg(a.b)} +function s3f(a,b){sZf(a.b.U.a)||$Wf(GYf(YOf(a.b),-1),b)} +function JEg(a,b){VDb(a.c,b)!=null&&VDb(a.c,b).FC(true)} +function dGg(a,b){a.o=b;!!a.f&&aIg(a,'noKeyboard',!a.o)} +function lKg(a){!a.b&&(a.b=fLg(a.a,a.c,0,0));return a.b} +function rsg(a,b){this.b=a;this.d=a;this.c=b;this.a=a.b} +function LGg(a){this.a=a;this.d=false;this.e=new WVf(a)} +function HQe(a){if(!a.S){a.S=new bmf(3);a.T=new bmf(3)}} +function KOe(a){if(!a.Q){if(!a.j){return}LOe(a,a.b!=2)}} +function V3e(a){if(KJc(a,1)){a.Hc=(Xcg(),Vcg);a.Ic=Vcg}} +function VRg(a,b){var c;c=VDb(a.b,b);c!=null&&c.pause()} +function SQg(a,b,c){var d;d=WDb(a.a,c);!!d&&cRg(d,b.cb)} +function rOg(a,b,c){var d;DOg((d=new xPg,jOg(a,b,d)),c)} +function lTg(a,b){kTg($wnd.goog.global.JSON.parse(a),b)} +function a4b(a,b){uhc(b,a.length);return a.charCodeAt(b)} +function vCb(a,b){this.a=a;this.b=b;this.c=true;this.j=3} +function S3g(a,b,c){this.c=b;this.d=a;this.b=c;this.a=0} +function lDb(a,b,c){this.a=b;!!b&&VLb(this.a,a);this.b=c} +function YDb(a,b,c){return mf(b)?ZDb(a,b,c):xbc(a.e,b,c)} +function IHb(a,b,c){JHb.call(this,a,b,c,(oNb(),iNb),iNb)} +function OHb(a,b,c,d,e){PHb.call(this,a,b,c,d,e,NaN,NaN)} +function UYb(){bIb.call(this,1,pe(ie(Zg,1),Z4g,41,0,[]))} +function WYb(){bIb.call(this,0,pe(ie(Zg,1),Z4g,41,0,[]))} +function yNh(a,b){uKb(this.b,pe(ie(Zg,1),Z4g,41,0,[b]))} +function _Ug(a,b){if(b<3){throw Qpb(new l3b($Gh))}a.a=b} +function XZb(a,b){var c;if(b){c=b;j_b(c,a.a);_$b(c,a.c)}} +function cQb(a){if(!I8b(a.q)){return Yc(a.q)}return null} +function Ctb(a){if(a.i[1]!=a.g){a.j[a.f++]=1;a.i[1]=a.g}} +function W8b(a){this.d=a;this.a=this.d.b;this.b=this.d.c} +function m$b(){this.a=qd();this.c=new n9b;this.b=new cEb} +function mcg(){kcg.call(this,'GGBSCRIPT',0,'ggbscript')} +function aag(){l9f.call(this,'MULTIPLY_OR_FUNCTION',25)} +function Mkc(a){vkc.call(this,a,pe(ie(gu,1),Z4g,1,5,[]))} +function abc(a){EYb(a.a);a.b=me(gu,Z4g,1,a.b.length,5,1)} +function Lvc(a){if(a.Y==null){return 0}return a.Y.length} +function $Hc(a,b){if(ff(b,33)){return a.Hk(b)}return k9g} +function qfc(a){var b;if(!hfc){return}nfc((b=a,Xec(),b))} +function uPc(a,b){if(b==null){return}a.vb=b;cPc(a,false)} +function UHc(a,b){tQf(b)?(a.Hc=(Xcg(),Vcg)):a.ep(b,true)} +function Icc(a,b){return nf(a)===nf(b)||a!=null&&Vb(a,b)} +function eNc(a){return DWf(a.bc)>V4g?DWf(a.bc):CWf(a.bc)} +function FJc(a){return !a.Nb&&!a.lb&&(!a.Db||!cPe(a.Db))} +function vQc(a){return a.ic[1]&&a.Cca.V[1]} +function QNb(a){return qih*(a<2?1:a<4?1:a<6?0.7:0.5)*iOb} +function KNb(a){return Fbh*(a<2?1:a<4?1:a<6?0.7:0.5)*iOb} +function e6c(a){return isNaN(a)||!isNaN(a)&&!isFinite(a)} +function F4b(a){return String.fromCharCode.apply(null,a)} +function rRc(a,b,c,d){return Nqg(pRc(a),b-d,c-d,2*d,2*d)} +function ovc(a,b,c,d){var e,f;e=c-a;f=d-b;return e*e+f*f} +function Nvc(a){var b;b=new h5b;Ovc(a,b,true);return b.a} +function Kld(a){!a.hb&&(a.hb=new fKg(a.M,a));return a.hb} +function wwd(a,b){var c;c=a.cu(b).iu();lLc(c,b);return c} +function d5c(a,b){var c;c=b-Xoh;a.e=Yod(a.c,c);a.f=a.e.d} +function C6c(a,b){l7c(a.b,a.a,b.c,a.a.a.Lc,b.c,a.a.a.Jc)} +function kYc(a){fVc(a,a.Pb.f,a.b,a.Bb);return new BYc(a)} +function mrd(a,b){if(ff(b,167)&&wIc(b)<0){return}a.cj(b)} +function Lqd(a,b){if(b>=0){a.mb=false;a.P=new QUg('',b)}} +function QWc(a,b){a.c=b;a.xb=b;a.k=b.$;a.b=NSe(b)==2?2:0} +function _Sc(a,b){ZSc();VSc.call(this);this.b=a;this.a=b} +function Skd(a,b,c){hvb.call(this,a,b);this.b=c;this.a=0} +function N1d(a,b,c,d){M1d.call(this,a,c,d);H6e(b,this.Y)} +function rxd(a,b,c,d){sxd.call(this,a,c,d);JKc(this.c,b)} +function vYd(a,b,c,d){uYd.call(this,a,c,d);JKc(this.e,b)} +function K_d(a,b,c,d){L_d.call(this,a,c,d);JKc(this.g,b)} +function u0d(a,b,c,d){v0d.call(this,a,d,c);JKc(this.b,b)} +function cTd(a,b,c){Txd.call(this,a,null,false,b,null,c)} +function kTd(a,b,c){Txd.call(this,a,null,false,b,c,null)} +function m9d(a,b,c){if(b.tw()){return c}return c.bm(a.a)} +function vae(a,b){if(!a.j){return null}return Tbc(a.j,b)} +function B5d(a,b){return b.ik(a)||e7d(a.o,b)||e7d(a.q,b)} +function t3d(a,b){var c;c=b.a;while(c){v3d(a,c.a);c=c.b}} +function u3d(a,b){var c;c=a.a;while(c){Gec(b,c.a);c=c.b}} +function A3d(a,b){var c;c=a.a;while(c){Mec(b,c.a);c=c.b}} +function jbe(a){var b;b=new pWe(a.t.o);$Ve(b,a);return b} +function ese(a,b){var c;c=new N4e(a.d);C4e(c,b);return c} +function mre(a){!a.u&&(a.u=new lge(a.g,'x('));return a.u} +function nre(a){!a.v&&(a.v=new lge(a.g,'y('));return a.v} +function Jde(a){!a.q&&!!a.d&&(a.q=Ode(a,a.d));return a.q} +function Xce(a){a.Mw($wnd.Math.sqrt(a.k));a.i=0;return a} +function hye(a){Yxe();if(!a){return T4g}return a.jj(Xxe)} +function oYe(a){if(a.k!=null){return a.k}return u6e(a.b)} +function $se(a,b,c,d,e){return wLd(Kod(a.f),b,c,d,e,a.a)} +function Lte(a,b,c,d,e){return QLd(Kod(a.f),b,c,d,e,a.a)} +function Cee(){Aee();return pe(ie(mR,1),I7g,ach,0,[zee])} +function uee(){see();return pe(ie(kR,1),I7g,_bh,0,[ree])} +function yee(){wee();return pe(ie(lR,1),I7g,$bh,0,[vee])} +function zhe(a,b){Bhe.call(this,new cde(a,1),new j5b(b))} +function rve(a,b){_Cd.call(this,a);this.a=b==(EIe(),iDe)} +function HOe(a,b,c){GOe.call(this,a);this.Zb=b;this.$b=c} +function eqe(a,b,c,d){fqe.call(this,a,c,d);JKc(this.o,b)} +function zkf(a,b,c,d){Mlf(d,a.f,Ckf(a,b,c,a.i));return d} +function $kf(a,b){var c;c=new bmf(3);Olf(c,a,b);return c} +function l5e(a){var b;b=Xeg(a.d,a.e);a.d=a.d/b;a.e=a.e/b} +function __e(a){return !a.lb&&(!a.Db||!cPe(a.Db))&&!a._b} +function COf(a,b){w0f((!a.db&&(a.db=new E0f(a)),a.db),b)} +function xPf(a,b){hVf((!a.Zb&&(a.Zb=new nVf(a)),a.Zb),b)} +function Vef(a){if(a.c>a.a){return 0}return Kif(a.a-a.c)} +function A1e(a){if(a.p==null){return 0}return a.p.length} +function rfg(a){nfg();if(a<0){return NaN}return sfg(a).d} +function feg(a){eeg();if(a1?1:b} +function DWg(a){var b;b=BWg(a);b!=null&&b.removeChild(a)} +function ZAg(a,b){WAg(a);!!a.a.B&&Dyg(a.a.B,a.a,b.c,b.d)} +function mIg(a,b,c,d){!a.a&&(a.a=new qIg);pIg(a.a,b,c,d)} +function $pg(a,b,c,d,e,f,g){bqg(a,b-d,c-d,d*2,d*2,e,f,g)} +function b3g(a,b){Ahc(a,yqb(d3g.prototype.Ag,d3g,[b,a]))} +function z1g(a,b){y1g();a.appendChild(iIh in b?b[iIh]:b)} +function _Db(a,b){return b==null?ybc(a.e,null):Mbc(a.g,b)} +function SUh(){return this.Cc==5?(Hje(),vje):(Hje(),zje)} +function pbf(){mbf.call(this,'NO_DEFAULT',1,false,false)} +function obf(){mbf.call(this,'YES_DEFAULT',0,true,false)} +function N9e(){W8e.call(this,'GEOCOORDSYS2DNOTPLANE',44)} +function HHb(a,b){JHb.call(this,a,b,null,(oNb(),iNb),iNb)} +function pZf(){zQf.call(this);this.c=0;this.b=0;this.d=0} +function GCb(a,b,c,d){this.b=b;this.c=c;this.a=a;this.d=d} +function lZb(a,b,c,d){this.d=a;this.b=b;this.a=c;this.c=d} +function iHb(a,b,c,d){this.d=a;this.b=b;this.c=c;this.a=d} +function wdc(a,b){this.c=0;this.d=b;this.b=17488;this.a=a} +function Jfc(a){if(!a){this.b=null;new n9b}else{this.b=a}} +function gPb(a){if(I8b(a.q)){return new XGb}return fPb(a)} +function dQb(a){if(!I8b(a.q)){return O8b(a.q)}return null} +function kLb(a){if(ff(a.a,65)){return BKb(a.a)}return a.a} +function e_b(a){F_b(a.d);j_b(a,a.f);h_b(a,a.c);k_b(a,a.a)} +function CUg(a){QJc(a.c[0]);QJc(a.c[1]);QJc(a);Zpd(a.Mc)} +function Owc(a,b){return iWf(YOf(a.a).b)?Uwc(a).tj(b):'?'} +function $Nb(a){return 0.05*(a<2?1:a<4?1:a<6?0.7:0.5)*iOb} +function tIb(a){var b;b=new AIb(a.p,a.n);b.s=a.s;return b} +function Xzc(a){var b;b=a.d.v;b||(b=eig(Wzc(a)));return b} +function ZHc(a,b){var c;c=a.Bk();c.Kc=b;c.Mc=b.M;return c} +function mJc(a){var b;b=new h5b;nJc(a,false,b);return b.a} +function fOh(a){this.a=new rBb;this.a.f=true;return true} +function mDc(a,b){if(a.V==77){return}qOe(b,!b.e);a.g=true} +function UNc(a){if(!a.rb){return new sug(pbh)}return a.rb} +function Lfc(a,b){Ifc(a);return new wgc(a,new Qfc(b,a.a))} +function kgc(a,b){Ifc(a);return new wgc(a,new Cgc(b,a.a))} +function ngc(a,b){Ifc(a);return new wgc(a,new Igc(b,a.a))} +function ogc(a,b){Ifc(a);return new Zfc(a,new Fgc(b,a.a))} +function gVc(a,b,c,d,e){return nVc(a.Pb.C,c,d,oVc(d,b,e))} +function BSc(a,b){return mqb(Xpb($wnd.Math.round(b*a.c)))} +function MIc(a,b){return a.Al()==61?tvd(b):df(a.Al())+' '} +function VJc(a,b){tQf(b)?(a.Hc=(Xcg(),Ucg)):a.ep(b,false)} +function jLc(a,b){b?(a.Ic=(Xcg(),Vcg)):(a.Ic=(Xcg(),Ucg))} +function xSc(a,b){lvc(a.a,a.a.c,pf(Peg(a.a.d,0,b-a.a.a)))} +function DOc(a,b){COf(a.C,new r0f((_1f(),$1f),null,''+b))} +function J$c(a,b){if(b==a.b.Sy()){return}a.b.Vy(b);K$c(a)} +function dXc(a){if(!a.f.Hb||!a.f.Hb){return}eXc(a);cXc(a)} +function k2c(a){if(!a.a.o){return}M2c(a.a);P2c(a.a,false)} +function W5c(a){if(X5c(a)){return Y5c(a,a.t.f)}return a.j} +function a7c(a){if(0!=a.i){a.i=0;return true}return false} +function d1c(a){a.b[0]=a.a[0]+a.c[0];a.b[1]=a.a[1]+a.c[1]} +function _Ec(a){a.$b=true;a.vb=a.V;a.sb=a.j;BPc(a.kc,0,0)} +function r7c(a){a.c=false;!!a.f&&S6c(a.f);!!a.a&&o7c(a.a)} +function b8c(a){a.a.i.length=0;_8b(a.a,a.d);c8c(a);d8c(a)} +function pmd(a,b){var c;if(a.P){c=_Db(a.P,b);!!c&&rLc(c)}} +function Wvc(a){var b;for(b=0;b0;)a.i[b]=V4g} +function Eae(a,b){a.n=b.n;a.o=b.o;a.r=b.r;a.s=b.s;a.q=b.q} +function MFd(a){a.V=me(fY,qnh,13,1,0,1);a.V[0]=a.d;Xvc(a)} +function nPf(a){if(a.Xb==null){HOf(a);aEb(a.H);ard(a.pb)}} +function XOf(a){!a.Ib&&(a.Ib=new KUf(a.pb,a));return a.Ib} +function mXf(a,b,c){var d;d=nXf(a,b,c);d&&a.UA();return d} +function yOf(a,b,c){var d;d=a.cb;return fQc(d,c)-fQc(d,b)} +function KPf(a,b,c){b!=0&&GFc(a.bb);!!a.cb&&BPc(a.cb,b,c)} +function s0f(a,b,c,d){this.f=a;this.d=b;this.b=c;this.e=d} +function Rrg(a,b,c,d){this.c=a;this.d=b;this.b=c;this.a=d} +function Dxg(a,b,c,d){this.a=a;this.b=b;this.d=c;this.c=d} +function Pzg(a,b,c,d){this.a=a;this.b=b;this.c=c;this.d=d} +function tAg(a,b,c){lIg(a.d.a.j);Rxg(a.d,b.b,b.c,c.b,c.c)} +function hFg(a,b,c,d){this.a=a;this.d=b;this.c=c;this.b=d} +function Fug(a,b,c,d,e,f){Rug(a,b,c,d,e,f/2);a.j.stroke()} +function v0f(a,b){w0f(a,new s0f((_1f(),Q0f),null,null,b))} +function z0f(a,b){w0f(a,new s0f((_1f(),g1f),null,null,b))} +function C0f(a,b){w0f(a,new s0f((_1f(),o1f),null,null,b))} +function QFg(a,b){hyg(a.s.b,new ABg(b),(f0g(),f0g(),e0g))} +function WGg(a,b){b>=0&&b0){return pf(lLg(a))}return 600} +function BLg(a){if(zLg(a)>0){return pf(zLg(a))}return 800} +function Qtg(a){return a!=null&&'onfullscreenchange' in a} +function HTh(){return !this.lb&&(!this.Db||!cPe(this.Db))} +function W0g(a,b,c,d){this.a=a;this.d=b;this.c=c;this.b=d} +function fNg(a,b,c,d){this.a=a;this.d=b;this.b=c;this.c=d} +function eNg(a,b,c,d){this.a=a;this.b=b;this.d=c;this.c=d} +function qRg(a,b,c,d){this.a=a;this.c=b;this.b=c;this.d=d} +function sAb(a,b,c,d){hvb.call(this,a,b);this.b=c;this.a=d} +function tyb(a,b,c,d){hvb.call(this,a,b);this.a=c;this.b=d} +function NHb(a,b,c,d,e){PHb.call(this,a,b,c,null,null,d,e)} +function MHb(a,b,c){PHb.call(this,a,b,c,null,null,NaN,NaN)} +function HRb(a,b,c){GRb.call(this,a,b,(EOb(),EOb(),DOb),c)} +function xIb(a){mCb.call(this);qIb(this);this.b=new o9b(a)} +function Pwb(a){Awb.call(this,a.a.length);new n9b;this.a=a} +function E9e(){W8e.call(this,'GEOEQUILATERALTRIANGLE',36)} +function ncg(){kcg.call(this,'JAVASCRIPT',1,'javascript')} +function ncc(a){a.a.a=a.c;a.c.b=a.a;a.a.b=a.c.a=null;a.b=0} +function EJg(a){PPc(a.c);x8b(aLg(a.a).d.a.$f()).bt(false)} +function EYb(a){var b;for(b=a.rd();b.xf();){b.yf();b.zf()}} +function dbc(a,b){return lbc(a.a,b)?Xgc(a.b,b.k,null):null} +function r4b(a,b){return (new RegExp('^('+b+')$')).test(a)} +function CVf(){BVf();new UJe;KVf();new FVf;this.a=new EVf} +function Nac(){Nac=xqb;Kac=new Qac;Lac=new Qac;Mac=new Rac} +function Acc(){Acc=xqb;xcc=new Bcc;ycc=new Ccc;zcc=new Dcc} +function joc(a){ioc();eoc.call(this,hoc,foc,goc,new voc,a)} +function Xkc(a,b,c){xkc();Ykc.call(this,(qmc(),Ylc),a,b,c)} +function vyc(a,b,c,d){hvb.call(this,a,b);this.b=c;this.a=d} +function mBc(a,b,c,d){hvb.call(this,a,b);this.a=c;this.b=d} +function ygc(a,b,c,d){this.b=a;this.c=d;sdc.call(this,b,c)} +function vBc(a,b,c,d,e){return XCc(a,b,c,false,a.Jb.I,d,e)} +function sJc(a,b){if(!a.lb){return false}return a.lb.Zi(b)} +function lJc(a){if(!a.Gc){return null}return new p9b(a.Gc)} +function tIc(a,b){if(a.zb==null){return ''}return sIc(a,b)} +function gIc(a,b){return a.Xb==null||!a.hb?a.qp(b):a.jj(b)} +function yDc(a,b){return $1b(Knh,a.f.d.a._B(Goh))||!b.Cn()} +function C2c(a,b,c){return a.o&&vSc(a.k,b,c)||X3c(a.i,b,c)} +function SLc(a,b,c){!a.f&&(a.f=new X2e(a.Kc));VLc(a.f,b,c)} +function _kd(a,b){!a.U&&(a.U=new Oec);Gec(a.U,b);b.Wb=true} +function H7c(a,b){return b>=a.b.a.i.length||Xff(a.b,b).b.b} +function l_c(a){var b;b=a.g.i.length;a.e=b>0;a.e&&e_c(a,b)} +function anc(a){_mc.call(this,a.length,a[0].length,cnc(a))} +function Fyc(a){Byc();_dc(Ayc,'SolveODE.1',t4b(a,'_',Unh))} +function g7c(a,b,c,d){l7c(a,b,c.c,d.a,c.c+Uef(c)/2,b.a.Lc)} +function h7c(a,b,c,d){l7c(a,b,c.c,d.c,c.c+Uef(c)/2,b.a.Jc)} +function SDc(a,b,c){uBc(a,eSc(b,a.kc,a.Gb),c);return false} +function Gsd(a){Esd();if($1b(mrh,a)){return Csd}return Dsd} +function C8d(a,b){if(a.Di()){return a.yl(b)}return a.jj(b)} +function Kpd(a){if(!a.eb){return false}return !!a.i&&a.i.f} +function AMe(a,b){if(!uLg(a.ub)){return}_Rg(uLg(a.ub),a,b)} +function Npd(a,b){var c;if(!a.o){return}c=a.o.Z;Opd(a,b,c)} +function Qqd(a,b){a.gb=b;b||!!a.o&&!a.o.A&&!a.gb&&nwc(a.V)} +function RHd(a,b){b>0&&!(!isNaN(b)&&!isFinite(b))&&(a.w=b)} +function VHd(a,b){b>0&&!(!isNaN(b)&&!isFinite(b))&&b;a.C=b} +function i4c(a){this.f=(h3c(),f3c);this.b=new E4c;this.d=a} +function mbf(a,b,c,d){hvb.call(this,a,b);this.a=c;this.b=d} +function A$d(a,b,c,d){rxd.call(this,a,b,c,d);_kd(a,this.c)} +function Z$e(a){NHc();F$e.call(this,a);this.Hc=(Xcg(),Ucg)} +function ngf(a,b,c){this.a=a;this.b=b;this.c=c;this.d=null} +function $jf(a,b){this.f=me(S0,Jqh,52,b,0,1);Pjf(this,a,b)} +function dPf(a,b){return bVf((!a.Zb&&(a.Zb=new nVf(a)),b))} +function sif(a){return a.c>a.a||fff(a,Nif(a.c),Mif(a.a)),a} +function GFd(a){return new JFd(a.i.ez(),a.k.ez(),a.j.ez())} +function TPe(a){a.q=true;a.n&&!a.O?MOe(a):KPe(a);a.q=false} +function RWf(a,b,c){a.q[b]=c;a.d[b]&&(a.d[b]=false);a.UA()} +function Tfe(a,b,c){a.e=b;a.f=c;a.c=4;dwf(a.d,(owf(),mwf))} +function zXe(a){if(!a.d){a.d=new Wrg;E$b(a.d,0,0,a.p,a.o)}} +function hVf(a,b){if(!SDb(a.d,b)){return}VDb(a.d,b).f=true} +function DPf(a,b){if(b==null){a.dc=null;return}a.dc=sQf(b)} +function f$f(a){if(!a.a.pb.ib){return false}return a.d.a>1} +function psg(a){if(a.a==1){return Msg(a.d)}return Msg(a.b)} +function Xhg(a,b){mhg();var c;c=new ggg(b);return cgg(c,a)} +function whg(a,b){mhg();return a==null?null:Yhg(a)+'.'+b.b} +function b1e(a,b){NHc();return (a.Z*b.$-b.Z*a.$)/(a._*b._)} +function Hsf(a,b){if(a.i[b]!=a.g){a.j[a.f++]=b;a.i[b]=a.g}} +function Yjg(a){var b;b=a.f;do{b.a=a.a;b=b.c}while(b!=a.f)} +function fvg(a){vug(this);this.e=null;this.j=a;D_b(this.j)} +function ATf(a,b,c,d){hvb.call(this,a,b);this.b=c;this.a=d} +function Wig(a,b,c,d){a.e=b;a.n=c;hkg(a,new Ukg(d));a.j=-1} +function INg(a,b,c,d){var e;e=a.Tk();return GNg(a,b,c,d,e)} +function IVg(a,b){var c;c=KVg(b,a.b);return new JVg(a.a,c)} +function tOg(a,b){var c;return mOg((c=new xPg,jOg(a,b,c)))} +function LUg(a){!a.Gb&&(a.Gb=new zQg(a,new yNg));yQg(a.Gb)} +function rd(a){kd();$wnd.setTimeout(function(){throw a},0)} +function pUg(a){if(a.d){a.d=false;return true}return false} +function yFg(a){if(a.d>=0){wFg(a);return true}return false} +function VPg(a){if(a.b==(ing(),Xlg)){return KDh}return a.c} +function dc(a,b){var c;c=E2b(a.mD);return b==null?c:c+X4g+b} +function XDb(a,b){return b==null?!!wbc(a.e,null):Jbc(a.g,b)} +function JNb(a){return new fOb(a.g,a.a,a.b,a.d,a.e,a.f,a.c)} +function LVh(){return new Rrg(this.c,this.d,this.b,this.a)} +function cYb(a,b){NAb.call(this);this.a=a;this.b=b;this.j=3} +function U0g(a,b,c){this.a=a;this.d=b;this.c=null;this.b=c} +function V0g(a,b,c){this.a=a;this.d=b;this.c=null;this.b=c} +function YGb(a,b,c){this.b=new cJb(a,c);this.a=new cJb(b,c)} +function Qub(a,b,c){ZDb(a.f,b,c);Gec(a.i,g5b(new j5b(b)).a)} +function xTh(a,b,c){cKc(this,a,b,c);ff(a,405)&&Qbf(a,this)} +function $ub(a,b,c,d){var e;e=new Pub(a,b,d);e.b=c;return e} +function BCc(a){!a.wb&&(a.wb=new JHc(a.f,a.kc));return a.wb} +function _zc(a,b){a.r=b.c;a.s=b.d;XOc(a.d,b.b);hVc(a.d,b.a)} +function Qic(a){if(a.c){return Hic}return new fjc(a.d,-a.a)} +function h8b(a){lhc(a.b>0);return a.a.getAtIndex(a.c=--a.b)} +function igc(a,b){var c;return rgc(a,new n9b,(c=new Ogc,c))} +function GGc(a,b,c){var d;d=new wXd(a.a.K.o,b,c);return d.d} +function lGc(a,b,c,d,e){return wLd(Kod(a.a.K),null,b,c,d,e)} +function AGc(a,b,c,d,e){return QLd(Kod(a.a.K),null,b,c,d,e)} +function iXe(a,b,c,d,e){e[0]=b;e[1]=c;e[2]=d;e[3]=NWe(a,e)} +function u7c(a,b,c){this.b=a;this.d=b;this.e=c;this.c=false} +function dLc(a,b){b||(a.Ec=null);a.xc=b;a.xc&&(a.Kc.Y=true)} +function L3c(a,b){a.c=new xqg($wnd.Math.max(b,a.c.b),a.c.a)} +function wPc(a,b){a.xb=b;a.yb=(OMc(),UMc(a.wb?2:1,b,NMc.q))} +function GHd(a,b){a.r=b;a.r&&Cpd(a.Mc)&&a.Mc.f&&IHd(a,true)} +function pcd(a){this.b=(!a.Ib&&(a.Ib=new KUf(a.pb,a)),a.Ib)} +function Vzc(a){return new Rrg(a.r,a.s,pf(a.d.A),pf(a.d.u))} +function cwc(a){var b;for(b=0;b=Xad(a)){return null}return b9b(a.w,0)} +function Ttg(a,b){a?b.stopPropagation():b.preventDefault()} +function GId(a,b){if(a.g==0){a.d=b;a.e=b;a.V[1]=a.e;hwc(a)}} +function ILd(a,b,c,d){var e;e=new aLd(a.a,b,d,c);return e.b} +function HLd(a,b,c,d){var e;e=new $Kd(a.a,b,d,c);return e.c} +function ALd(a,b,c,d){var e;e=new WId(a.a,b,c,d);return e.Y} +function iMd(a,b,c,d){var e;e=new nRd(a.a,b,c,d);return e.Y} +function CMd(a,b,c,d){var e;e=new iRd(a.a,b,c,d);return e.Y} +function DMd(a,b,c,d){var e;e=new jSd(a.a,b,c,d);return e.Y} +function INd(a,b,c,d){var e;e=new J1d(a.a,b,c,d);return e.Y} +function KNd(a,b,c,d){var e;e=new N1d(a.a,b,c,d);return e.Y} +function mNd(a,b,c,d){var e;e=new vYd(a.a,b,c,d);return e.e} +function wNd(a,b,c,d){var e;e=new IUd(a.a,b,c,d);return e.d} +function ENd(a,b,c,d){var e;e=new K_d(a.a,b,c,d);return e.g} +function Rrd(a){var b;b=a.b;while(ff(b,707)){b=b.b}return b} +function J0d(a){var b,c;b=1;for(c=2;c<=a;c++){b*=c}return b} +function Tke(a){var b;Ske(a);b=null.pD();null.pD();return b} +function COd(a){var b;for(b=1;b1?b9b(a.d,1):null} +function f_b(a,b,c,d){N_b(a.d,c,d);G_b(a.d,b);N_b(a.d,-c,-d)} +function b_b(a,b,c,d){var e;e=a.f.Re();e.Te(b,c,d,a.f.d,a.d)} +function QGc(a,b){var c;c=b.oz();a.a.mc=c.f[0];a.a.oc=c.f[1]} +function KDc(a){var b;b=a.cb;LEc(a,b);vLc(b,false);Zpd(b.Mc)} +function wCc(a){!a.k&&!!a.kc&&(a.k=new _4c(a.kc));return a.k} +function lYc(a){if(!(!!fOc(a.Pb)&&fOc(a.Pb).f==a.b)){return}} +function oYc(a,b){zJc(a.xb)&&AOc(a.Pb,a.xb)&&b?pYc(a):lYc(a)} +function FHc(a,b){a.u!=b&&(a.D=true);a.u=b;DHc(a,Juc(a.v,b))} +function Wrd(a,b){return WDb(a.b,(mhg(),B4b(b,(Acc(),ycc))))} +function TYc(a,b,c,d){return !!a.s&&erg(a.s,b-d,c-d,2*d,2*d)} +function Dcd(){Bcd();return pe(ie(aF,1),I7g,965,0,[Acd,zcd])} +function uOd(a){if(a.g==5){return EIe(),CBe}return EIe(),yAe} +function o3b(a){nc.call(this,'ProcessIntersections error',a)} +function GVc(a,b,c){NAc.call(this,a,b);this.s=new Y1c(a,b,c)} +function LRd(a,b,c,d,e){MRd.call(this,a,c,d,e);JKc(this.d,b)} +function pWd(a,b,c,d){C$e(a.e,b,c,d?(dud(),bud):(dud(),cud))} +function Q$b(a,b,c,d){this.a=plh+a+L7g+b+L7g+c+L7g+d/255+')'} +function YPd(a,b){var c,d;c=b.hv().n;d=a.f==c;a.f=c;return d} +function Vae(a,b){abd.call(this);X9d(this);this.t=a;this.n=b} +function cde(a,b){abd.call(this);_be(this);this.j=a;this.k=b} +function Che(a,b){this.b=new j5b(a.b.a);Oqb(this,z8d(a.a,b))} +function Vmd(a){var b;b=a.M.j.V;yPf(a.M.j,true);yPf(a.M.j,b)} +function rhd(a){Ged(a.g,a.N,a.a);jMg(a.a,a.g.a);$Pf(a.a,a.N)} +function ide(a){return !isNaN(a)&&!(!isNaN(a)&&!isFinite(a))} +function Ane(){hne=0;if(!jne){jne=new cic(3);kne=new cic(5)}} +function OMc(){OMc=xqb;NMc=new Vog(1,1,1);MMc=new Vog(3,1,1)} +function YXc(){YXc=xqb;WXc=new Vog(1,0,0);XXc=new Vog(3,0,0)} +function N3d(){K3d();return pe(ie(iQ,1),I7g,871,0,[J3d,I3d])} +function A1d(){y1d();return pe(ie(yP,1),I7g,947,0,[x1d,w1d])} +function rJe(a,b){if(!b){return new s8d(a.b,0)}return b.Ap()} +function v1e(a){if(a.d){return $wnd.Math.abs(a.a)}return NaN} +function PNe(a,b){if(a.p==b){return}a.p=b;!!b&&B_e(b,a,true)} +function TNe(a,b){if(a.v==b){return}a.v=b;!!b&&B_e(b,a,true)} +function oWe(a,b){if(!a.d||!a.r){return NaN}return a.d.Cg(b)} +function G_e(a,b){var c,d;c=b.A-a.A;d=b.B-a.B;return c*c+d*d} +function G5e(a,b){var c;c=new fjc(a.d,a.e);c=Wic(c);L5e(b,c)} +function flf(a,b){var c;for(c=0;c=0){return a[b]}return 0} +function $he(a,b,c){Yhe();Xhe.c=a;Xhe.b=b;Xhe.a=c;return Xhe} +function B2e(a,b,c){NHc();A2e.call(this,a);this.a=b;this.b=c} +function URe(a,b,c){j1c(a.k,b,c);Jlf(a.cb,1,b);Jlf(a.cb,2,c)} +function Alf(a,b,c){Blf(a,b.f[0],b.f[1],b.f[2],Njf(b,b.a),c)} +function Clf(a,b,c){Dlf(a,b.f[0],b.f[1],b.f[2],Njf(b,b.a),c)} +function wUe(a,b){$1b(Nvh,b)||$1b('cas',b)?(a.a=eCh):(a.a=b)} +function hPf(a){return qjd((!a.sb&&(a.sb=YKg(a.pb.o)),a.sb))} +function D7e(a){return B4b(a.j!=null?a.j:''+a.k,(Acc(),ycc))} +function naf(){laf();return pe(ie(F$,1),I7g,623,0,[kaf,jaf])} +function WWf(a){Huc();Vuc(a.b>>16&255,a.b>>8&255,a.b&255,60)} +function PZf(a){ncc(a.f);a.d=kcc(a.f,0);g$f(a,zjd(a.b,true))} +function d$f(a){var b;if(f$f(a)){b=tcc(a.d);n$f(b,a);OZf(a)}} +function YOf(a){!a.Jb&&(a.Jb=(new OQg(a),NYf()));return a.Jb} +function VOf(a){!a.Gb&&(a.Gb=new zQg(a,new yNg));return a.Gb} +function kPf(a){if(!a.cb.Gb){return false}XLg(a);return true} +function v_f(a){if(a==null){throw Qpb(new r_f(KEh))}return a} +function nXf(a,b,c){var d;d=c!=a.M[b];d&&(a.M[b]=c);return d} +function Z4f(a,b,c){var d;d=Hpd(a.d,b,false,0);!!d&&fKc(d,c)} +function Utg(a,b){var c;c=b;c.length>0&&SKg(a.a);return null} +function trg(a,b){prg();rrg.call(this,a);this.b=a.a;this.a=b} +function Gxg(a){this.v=a;this.c=a.cb;this.a=new NRg(this,10)} +function rkg(){rkg=xqb;pkg=new skg(X8g,0);qkg=new skg(Y8g,1)} +function _og(){_og=xqb;$og=pe(ie(uf,1),v5g,5,15,[2,2,4,6,0])} +function prg(){prg=xqb;org=pe(ie(uf,1),v5g,5,15,[2,2,4,6,0])} +function $hg(a){mhg();return uhc(22,a.length+1),a.substr(22)} +function qug(a){return ($1b(a.e,iah)?1:0)+($1b(a.c,llh)?2:0)} +function pug(a){return a.c+' '+a.d+' '+a.e+' '+a.b+'px '+a.a} +function JGg(a){!a.c&&(a.c=a.d?LOf(a.a):KOf(a.a));return a.c} +function CGg(a,b){a.d=b.b;a.MC(a.d);wCg(a.e.d,true);B0g(a,b)} +function tyg(a,b,c){oyg(b);v4g(a.t,b);z1g(c,b.aC());qyg(b,a)} +function MIg(a,b,c){OIg(a,!a.b);QJg(b.a);c.stopPropagation()} +function ayg(a,b){eyg(a.C,'pointerEventsNoneWhenDragging',b)} +function ZHg(a,b){var c;c=a;c.setProperty('font-size',b,OFh)} +function kGg(a,b){var c;c=Y2b(b.b,10)+fGh;ZHg(a.s.C.style,c)} +function tIg(a,b){!!a.a&&(a.C[YGh]='',undefined);a.C.src=b.a} +function sAg(a,b){a.d.V==0&&mIg(a.d.a.j,a.d,pf(b.b),pf(b.c))} +function tRg(a,b){return !(sRg(a,b.c)||h4b(qHh,b.c)||!b.b.c)} +function USh(){return !(!this.lb&&(!this.Db||!cPe(this.Db)))} +function EBb(a){return !(a.c.i.length==1&&ff(b9b(a.c,0),475))} +function pf(a){return Math.max(Math.min(a,R4g),-2147483648)|0} +function kCg(a){if(!a.a){return a.b.width}return a.a.C.width} +function K9d(a,b){if(a.indexOf('?')==-1){b.a+=',';b.a+=''+a}} +function Caf(a,b){a.a+='\tc||b=0){return a/(1+a)}return a/(1-a)} +function z6c(a){if(Ocg(a,k9g)){return Fih}if(Ocg(a,h9g)){return Gih}return a} +function Jsd(a,b){var c;c=a.a;while(c){if(c.c==b){return c.b}c=c.f}return -1} +function Ksd(a,b){var c;c=a.a;while(c){if(c.b==b){return c.b}c=c.f}return -1} +function F3d(a){var b;if(!a.a){throw Qpb(new Gcc)}b=a.a.a;a.a=a.a.b;return b} +function wLd(a,b,c,d,e,f){var g;g=new oJd(a.a,c,d,e,f);JKc(g.i,b);return g.i} +function iLd(a,b,c,d,e){var f,g;f=new IFd(a.a,c,d,e);g=f.g;JKc(g,b);return g} +function mLd(a,b,c,d,e){var f,g;f=new ZFd(a.a,c,d,e);g=f.d;JKc(g,b);return g} +function Wwe(a,b,c,d,e){var f,g;f=new D1d(a.e,c,d,e);g=f.d;JKc(g,b);return g} +function bue(a,b,c,d,e){var f,g;f=new $Pd(a.e,c,d,e);g=f.i;JKc(g,b);return g} +function NRe(a,b,c,d,e,f,g){j1c(a.q[0],b/d,c/d);j1c(a.q[1],e/g,f/g);a.t=true} +function OCd(a,b,c){var d;d=c.qp((Sud(),oud));!!Hpd(a.f,d,false,0)&&C4e(b,d)} +function LTe(a){var b;b=Fpd(a.Mc,a.a);!b&&(b=Hpd(a.Mc,a.a,false,0));return b} +function RLe(a){if(!!a&&!i6d(a.Ap(),null)){return a.Kk((Sud(),oud))}return a} +function jZe(a){if(a.k.i.length>0&&a.j!=JYe){return b9b(a.k,0).vl()}return a} +function p1d(a,b){if(b<0||b>=a.p.length){return a4b(a.p,0)}return a4b(a.p,b)} +function cqe(a,b,c){if(b!=a.e){return null}if(c!=a.o){return null}return a.b} +function W5e(a){var b;b=new bmf(4);Vlf(b,a.Z);Wlf(b,a.$);Xlf(b,a._);return b} +function HZe(a){var b;a.Gb=null;for(b=0;b'+ILc(b,false)+gwh} +function Pbf(){Pbf=xqb;Obf=ivb((Ibf(),pe(ie(T$,1),I7g,713,0,[Gbf,Fbf,Hbf])))} +function $bf(){$bf=xqb;Zbf=ivb((Ubf(),pe(ie(U$,1),I7g,698,0,[Tbf,Sbf,Rbf])))} +function qwf(){owf();return pe(ie(p1,1),I7g,551,0,[mwf,iwf,lwf,kwf,jwf,nwf])} +function fud(){dud();return pe(ie(FG,1),I7g,566,0,[bud,cud,Ztd,aud,_td,$td])} +function aUe(){$Te();return pe(ie(cY,1),I7g,536,0,[XTe,WTe,VTe,ZTe,YTe,UTe])} +function WXf(){TXf();return pe(ie(B9,1),I7g,543,0,[QXf,PXf,OXf,NXf,RXf,SXf])} +function d5f(a,b,c){var d;d=Hpd(a.d,b,false,0);if(!d){return}oKc(d,c);d.yp()} +function v5f(a,b,c){var d;d=Hpd(a.d,b,false,0);if(!d){return}KKc(d,c);d.yp()} +function Jqf(a,b,c){var d;Aqf(a,b,false);a.e=true;d=Wmf(a,c);Sqf(a);return d} +function pSf(a,b,c){var d;d=YPg(a,b);if(d==null||$1b(d,b)){return c}return d} +function uyg(a,b,c){var d;vyg(a,c);if(b.B==a){d=x4g(a.t,b);d>16&255,b.b>>8&255,b.b&255,b.b>>24&255))} +function mpg(){_og();this.d=me(qf,Rlh,5,10,15,1);this.b=me(sf,g9g,5,20,15,1)} +function Dbe(a){abd.call(this);this.t=a;$ae(this);this.o=me(_Q,Voh,42,1,0,1)} +function hRg(a,b){this.c=new _Qg(a,b);this.b=new n9b;this.d=new cEb;this.a=b} +function Nub(a,b){var c;c=new Oub(a.f+(''+b),a.c,a.b);c.d=a.d+(''+b);return c} +function x4g(a,b){var c;for(c=0;c0?1:-1} +function FCd(a,b,c){var d;d=XVf(a.d,b,c);return gye(a.g,d,b,null,(yTf(),YSf))} +function vNd(a,b,c){var d;kod(a.a.M);d=new oZd(a.a,b,c);jod(a.a.M);return d.Y} +function gye(a,b,c,d,e){Yxe();var f;f=new bye(b,d);f.c=a;f.a=c;f.b=e;return f} +function $ae(a){a.e=new o9b(2);a.f=new o9b(2);a.g=new t8d(a.t,new cde(a.t,0))} +function wSe(a,b){var c;c=new bmf(4);Klf(c,(new cmf(j5e(a.q[b]))).f);return c} +function Vvc(a,b){var c;for(c=0;c=a.F.length&&(a.b=0);a.F[a.b]=b;jWd(a.J[a.b],c)} +function CWd(a,b,c){++a.b;a.b>=a.D.length&&(a.b=0);a.D[a.b]=b;jWd(a.G[a.b],c)} +function Qbe(a,b,c){return ff(a,62)&&a.d.i.length==c?b9b(a.d,b):Rje(a.Ap(),b)} +function wkf(a,b,c){return Okf(Ojf(a.e),Okf(plf(a.e.f[0],b),plf(a.e.f[1],c)))} +function i5e(a){return new z5e(a.a,$wnd.Math.floor(a.d),$wnd.Math.floor(a.e))} +function P8d(a){return a==(_8f(),M8f)||a==o7f||a==S8f||a==q7f||a==G8f||a==s7f} +function vqd(a){aqd(a.j.pb);!!a.U&&Jnd(a.U);VBc(a.j.cb.lb);$pd(a);aqd(a.j.pb)} +function RFd(a,b){qFd.call(this,a);this.c=b;this.b=pFd(a);QFd(this);this.Ii()} +function DXf(){AXf.call(this);tXf(this);wXf(this);BXf(this);this.U=0;this.Y=0} +function VSc(){Ryc.call(this);this.c=me(sA,Z4g,84,9,0,1);this.d=new dTc(this)} +function Tvf(a,b){var c;c=new Oec;Evf(a.c,b,c);Evf(a.b,b,c);return new p9b(c)} +function R5f(a,b,c){var d;d=Hpd(a.d,b,false,0);if(!d){return}d.Go(c);zLc(d,9)} +function j5f(a,b,c,d,e){var f;f=Hpd(a.d,b,false,0);if(!f){return}xBf(f,c,d,e)} +function k3f(a,b,c,d,e){l3f.call(this,a,b,c,(mhg(),B4b(c,(Acc(),ycc))),d,d,e)} +function HQf(a,b){Yxe();fye.call(this,a,(yTf(),vTf),pe(ie(mu,1),h5g,2,6,[b]))} +function $_f(){Y_f();return pe(ie(hab,1),I7g,571,0,[T_f,V_f,U_f,S_f,W_f,X_f])} +function sig(){sig=xqb;rig=pe(ie(uf,1),v5g,5,15,[12,14,16,18,20,24,28,32,48])} +function npg(a){_og();this.d=me(qf,Rlh,5,a,15,1);this.b=me(sf,g9g,5,a*2,15,1)} +function mog(a){var b;b=new QUg('',13);return PUg(b,a[0])+'+'+PUg(b,a[1])+'i'} +function Kqg(a,b){var c;c=new Zqg(a);!!b&&Kpg(b,c.a,0,c.a,0,c.b/2|0);return c} +function bsg(a,b,c){var d;d=new Gdc;dsg(d,b,0);dsg(d,c,1);d=csg(a,d);return d} +function Skf(a,b,c){var d;for(d=0;d=K7g&&a<=55215){b=a-K7g;return b%28==0}return false} +function mwb(a,b){var c;if(b>=0&&b=a.d.i.length){return false}return b9b(a.d,b).nd()} +function dPg(a,b){!!jlg&&klg(jlg,(Clg(),vlg),'Loading failed for id'+a+X4g+b)} +function $Hb(a,b,c){this.b=u_b(_Yb(XYb),c,a,b);this.c=this.b.c;this.a=this.b.a} +function wLb(a,b){NAb.call(this);qLb(this);this.e=a;this.f=b;this.d=0;this.c=0} +function XLb(a,b,c){ICb.call(this);this.a=a;this.j=b;b==1&&(this.k=0);this.b=c} +function hJb(a,b,c,d,e,f){this.e=a*e;this.b=b*e;this.a=c*e;this.c=d*e;this.d=f} +function uKb(a,b){var c,d,e,f;for(d=b,e=0,f=d.length;e=c){return a>c?2:1}return 0} +function yod(a,b,c){var d;d=Eod(a,b,c);zSf(a.j.B)!=48&&(d=zpd(a,d,c));return d} +function Hxd(a,b,c){var d;d=Vxd(b,c,a.p,a.d);a.p.a>1&&k4d(a.p);c>0&&h4d(a.p,d)} +function Hge(a,b,c){var d;for(d=0;d=0;return}a.f=SQe(a.c)<0} +function adf(a,b,c){if(a.b!=null){return Udf(b,c,a.b)}return $cf(a,a.i[1],b,c)} +function _cf(a,b,c){if(a.b!=null){return Tdf(b,c,a.b)}return $cf(a,a.i[0],b,c)} +function mJd(a){switch(a.n){case 1:return EIe(),fze;default:return EIe(),gze;}} +function rJd(a){switch(a.n){case 1:return EIe(),jze;default:return EIe(),kze;}} +function yPd(a){switch(a.D.k){case 5:case 6:return true;default:return false;}} +function CQf(a){switch(a){case 3:case 2:case 7:return 45;default:return 8211;}} +function rof(a){var b;if(yof(a))return true;b=a.D;sof(a)&&(a.D=b);return false} +function Gof(a){var b;if(Jof(a))return true;b=a.D;Hof(a)&&(a.D=b);return false} +function iqf(a){var b;if(Gof(a))return true;b=a.D;aof(a)&&(a.D=b);return false} +function FSf(a,b){var c;c=z4b(a.d,0,2);if(!$1b('hu',c)){return b}return HSf(b)} +function _3f(a,b){var c;c=Hpd(a.d,b,false,0);if(!c){return false}return c.zn()} +function B4f(a,b){var c;c=Hpd(a.d,b,false,0);if(!c){return false}return c.Em()} +function P5f(a,b,c){var d;d=Hpd(a.d,b,false,0);if(!!d&&d.bo()){d.Zp(c);d.yp()}} +function t5f(a,b,c){var d;d=b<0?3:b;if(d<1||d>3){return}xXf(GYf(YOf(a.b),d),c)} +function cjg(a,b,c,d){var e;e=new vkg;e.b=b;e.c=c;Oqb(e,new Ukg(d));Z8b(a.f,e)} +function WAg(a){if(!a.a){a.a=new GAg;Uxg(a.a,'gbox');FAg(a.a,a.d);NTg(a.a.C)}} +function Mkd(a){this.d=a;this.a=new n9b;this.b=new n9b;this.i=new NRg(this,33)} +function vIg(a){uIg.call(this,new o1g(a));this.C.setAttribute('draggable',mrh)} +function _lf(a,b,c){Nkf();bmf.call(this,3);this.f[0]=a;this.f[1]=b;this.f[2]=c} +function SNg(a,b){mhg();!(b==null||b.length==0)&&!$1b(mlh,b)&&a(b);return null} +function L_f(a,b){if(b==null){throw Qpb(new r_f(KEh))}I_f(a);P_f(a,b);return a} +function f4g(a){if(!a.a||!a.c.u){throw Qpb(new Gcc)}a.a=false;return a.b=a.c.u} +function xGg(a){if(!a.k){throw Qpb(new n3b('initWidget() is not called yet'))}} +function m$f(a,b){if(a.b){YZf(b);rKg(b,a.b);ZZf(b)}else{o$f(a,b,new r$f(a,b))}} +function Daf(a,b){a.a+=''} +function DPg(a,b){return cSf(a,tAb(b[e9g]|0),a.d.k,!!b[SGh],!!b[zGh],!!b[AGh])} +function AHb(a,b){var c;for(c=0;c1&&(d=1);d<0&&(d=0);c=pf(d*255);return $Ic(a,c)} +function xEc(a){var b,c;for(c=new t9b(a.Nb);c.a-1}return a.lb.Lc>-1} +function d0e(a,b){if(!b){return false}if(b.Wm()){return b.Dz(a)}return c0e(a,b)} +function Vnf(a){var b;b=a.D;if(Wnf(a)){a.D=b;if(Xnf(a))return true}return false} +function uof(a){var b;b=a.D;if(vof(a)){a.D=b;if(wof(a))return true}return false} +function yof(a){var b;b=a.D;if(zof(a)){a.D=b;if(Aof(a))return true}return false} +function U3f(a,b,c,d){var e;e=Hpd(a.d,b,false,0);if(!e){return d}return c.We(e)} +function p4f(a,b){var c;c=$qe(Jod(a.d),b,new AVf);if(!c){return 0}return c.Fp()} +function x5f(a,b,c){var d;d=Hpd(a.d,b,false,0);if(!d){return}OKc(d,c);zLc(d,10)} +function Sgg(a,b,c){if(c!=null){a.a+=' ';a.a+=''+b;a.a+='="';Chg(a,c);a.a+='"'}} +function yyg(a,b,c,d){d=uyg(a,b,d);oyg(b);y4g(a.t,b,d);B1g(c,b.aC(),d);qyg(b,a)} +function FGg(a,b,c,d){this.a=a;EGg.call(this,b,new rHg(false,d.o),new jJg(c,d))} +function Ibf(){Ibf=xqb;Gbf=new Kbf(X8g,0);Fbf=new Kbf(Pih,1);Hbf=new Kbf(Y8g,2)} +function fkf(){fkf=xqb;mkf();gkf(mkf());hkf(mkf());ikf(mkf());nkf(Hih);nkf(Qph)} +function F_f(a){var b;b=c0f(a);if(ff(b,557)){this.a=b.a}else{throw Qpb(k_f(b))}} +function dse(a){var b,c,d,e;for(c=a,d=0,e=c.length;d57){return}++a.o}} +function CQg(a,b,c){var d;d=a[c];$1b(O4g,typeof(d))&&(b[c]=d.bind(a),undefined)} +function yIb(a){mCb.call(this);qIb(this);if(!a){return}uIb(this,a);Z8b(this.b,a)} +function vLb(a){NAb.call(this);qLb(this);this.e=a.b;this.f=a.a;this.d=0;this.c=0} +function nXb(){GHb.call(this,0,'fonts/latin/optional/jlm_cmtt10',431,525,qch,0)} +function hXb(){GHb.call(this,0,'fonts/latin/optional/jlm_cmss10',444,333,pih,0)} +function jXb(){GHb.call(this,0,'fonts/latin/optional/jlm_cmssi10',444,333,pih,0)} +function _Wb(){GHb.call(this,0,'fonts/latin/optional/jlm_cmbx10',444,383,xjh,0)} +function oXb(){GHb.call(this,0,'fonts/maths/optional/jlm_dsrom10',463,300,pih,0)} +function pic(a){this.c=a;this.g=lmh;this.f=imh;this.d=(gtc(),new ktc(0,0,1,ftc))} +function Kkc(a,b,c,d){Lkc.call(this,(qmc(),amc),a,b,c,d,pe(ie(gu,1),Z4g,1,5,[]))} +function Zkc(a){Hkc.call(this,a);alc(this.b,(qmc(),slc),pe(ie(gu,1),Z4g,1,5,[]))} +function evc(a,b){return $wnd.Math.sqrt((a.a-b.a)*(a.a-b.a)+(a.b-b.b)*(a.b-b.b))} +function cjc(a,b){ttc(b);if(a.c||b.c){return Hic}return new fjc(a.d-b.d,a.a-b.a)} +function Nic(a,b){ttc(b);if(a.c||b.c){return Hic}return new fjc(a.d+b.d,a.a+b.a)} +function Nfc(a,b){var c;if(Zpb(a.c,a.a)){return false}c=a.b.og(b);++a.c;return c} +function g9b(a,b){var c;c=c9b(a,b,0);if(c==-1){return false}f9b(a,c);return true} +function rgc(a,b,c){var d;Hfc(a);d=new Lgc;d.a=b;a.a.wf(new Pgc(d,c));return d.a} +function c9b(a,b,c){for(;c=0;c--){d=d*b+a.b[c]}return d} +function Lrd(a,b,c){var d;d=a.lb;d.Lc>-1?Krd(d,b,c):b.a.put(a,(Y1b(),W1b))==null} +function DSe(a,b){vQe();CSe.call(this,a);KRe(this,b[0],b[1],b[2],b[3],b[4],b[5])} +function t_e(a,b,c,d,e,f){hvb.call(this,a,b);this.a=c;this.c=d;this.b=e;this.d=f} +function E5e(a,b,c){var d;d=new fjc(a.Fp(),0);d=Tic(d,new fjc(b.d,b.e));L5e(c,d)} +function Elf(a,b,c,d,e,f,g){var h;Flf(a,b,c,d,e,g);h=-g[2];rlf(d,h,f);Qkf(a,f,f)} +function ARd(a,b){if(a.e==0){return me(sf,g9g,5,b.length,15,1)}return AOd(a.c,b)} +function Y6d(a){if(a.Jn((_8f(),m8f))&&G8d(a.Ap().o,-1)){return a.Ap().s}return a} +function Xkf(a){var b,c;c=new bmf(a.d);for(b=0;b0&&--a.j;return b9b(a.i,a.j)} +function iOc(a){switch(a.mb){case 1:return 1;case 2:return 16;default:return 0;}} +function yLg(a){!a.O&&(h4b(Zoh,SSg(a.d))?(a.O=new OGg):(a.O=new MGg));return a.O} +function BOg(a){var b;b=COg(a,true);!b&&(b=COg(a,false));!b&&(b=a.b.cb);return b} +function Lxg(a,b){a.u&&Jyg(a.kc.d,false);Wzg(a.a,b,(m5b(),Xpb(Date.now())),true)} +function TWf(a,b,c){a.n[b]=c;a.G[b]=a.n[b]!=null&&$1b(a.n[b],(DAb(),BAb));a.UA()} +function BWg(a){var b;b=a.parentNode;(b==null||b.nodeType!=1)&&(b=null);return b} +function YWg(a){var b;b=a[qph];if(b==1){return 4}else if(b==2){return 2}return 1} +function TNh(a){var b;b=this.b;this.b=new HKb(pe(ie(Zg,1),Z4g,41,0,[]));return b} +function x_e(){x_e=xqb;w_e=ivb((r_e(),pe(ie(DY,1),I7g,549,0,[n_e,p_e,q_e,o_e])))} +function Tjd(){Tjd=xqb;Sjd=ivb((Pjd(),pe(ie(MF,1),I7g,599,0,[Ljd,Ojd,Njd,Mjd])))} +function YMe(){YMe=xqb;NHc();XMe=pe(ie(mu,1),h5g,2,6,['x','y']);WMe=new j5b(s8g)} +function qNb(){oNb();return pe(ie(Gl,1),I7g,511,0,[kNb,mNb,iNb,nNb,hNb,lNb,jNb])} +function zSg(a){return B4b(t4b(a.a.bC(IGh)?a.a._B(IGh):Xuh,JGh,zEh),(Acc(),ycc))} +function qLg(a){return (t1b(),$wnd.goog.global.window).devicePixelRatio*TTg(a.t)} +function LPg(a,b){$1b(O4g,typeof(a))&&a.apply((t1b(),$wnd.goog.global.window),b)} +function Mvc(a,b){var c,d;for(d=0;d-1){return s4b(b,101,69)}return b} +function JLe(a){var b;b=new PLe(a.c,a.b);b.d=a.d;b.f=a.f;b.e=a.e;b.g=a.g;return b} +function Jwe(a,b,c,d,e){var f,g;f=new jPd(a.e,b,c,d,(_8f(),w8f),e);g=f.d;return g} +function oNd(a,b,c,d){var e,f;e=d?5:3;f=new Q0e(a.a,e);s0e(f,b,c,1,true);return f} +function qaf(a,b,c,d){var e;e=!c?null:q8d(c);return ff(e,297)?raf(b,e):saf(a,b,d)} +function Paf(a,b){if(a.a.length>0){return false}return Ahg(a.b)||!b&&$1b('?',a.b)} +function Q$e(a){a.i.length>0&&ide(b9b(a,a.i.length-1).c)&&a.add(new Nad(NaN,NaN))} +function wYe(a,b){!b?(a.d=new O4e(a.Kc,'')):(a.d=b);Jub(a.b,b);a.a=new cbf(a,a.d)} +function DOf(a,b){jWf((!a.Jb&&(a.Jb=(new OQg(a),NYf())),a.Jb).b,b);Zre(Jod(a.pb))} +function TUf(a,b){b.Ib&&b.Em()&&(b.Ib=false);VUf(a,b);!a.j&&b.xc&&kVf(cPf(a.d),b)} +function IUf(a,b){var c,d;for(d=new t9b(a.e);d.a=0&&Dhc(a.C.style,sih,b+fGh);c>=0&&Dhc(a.C.style,tih,c+fGh)} +function xd(b,c){function d(a){c.fd(a)} +return __gwtStartLoadingFragment(b,K4g(d))} +function iXb(){GHb.call(this,0,'fonts/latin/optional/jlm_cmssbx10',458,367,fdh,0)} +function vug(a){a.n=new sug(pbh);a.i=Vuc(255,255,255,255);a.k=me(sf,g9g,5,6,15,1)} +function rNg(){nNg();return pe(ie(Ijb,1),mHh,412,0,[mNg,gNg,hNg,lNg,jNg,kNg,iNg])} +function W1g(){if(!T1g){b3g(($1g(),Z1g),yqb(t2g.prototype.jD,t2g,[]));T1g=true}} +function yBg(a){!!jlg&&klg(jlg,(Clg(),vlg),'possible missing release()');this.a=a} +function uNg(a){if(!a.a){throw Qpb(new n3b('app was already removed'))}return a.a} +function C4g(a){if(a.b>=a.c.c){throw Qpb(new Gcc)}a.a=a.c.a[a.b];++a.b;return a.a} +function CZc(a,b){if(!(a==(r_e(),q_e)||a==n_e)){return b==1?64:b==2?32:16}return 0} +function J_c(a){if(!a.a){a.a=new jTc;xNb(a.a,sLg(a.Pb.C))}Qyc(a.a,a.xb);return a.a} +function cf(a){var b;a==null||Array.isArray(a)&&(b=je(a),!(b>=14&&b<=16));return a} +function lwb(a){var b;!a.d&&(a.d=new n9b);for(b=a.d.i.length-1;b>-1;b--){vwb(a,b)}} +function zld(a,b){var c,d;for(d=new t9b(a.I);d.a=0){if(uld(a.o,c).Ci()){return c}--c}return -1} +function QNd(a,b,c,d){var e,f;e=new F2d(a.a,c,d);f=e.f;f.Jb=true;JKc(f,b);return f} +function xJb(a,b,c){uJb();var d,e;e=WDb(tJb,b);d=aJb(e.a,a,c);_Ob(a,d,true);a.te()} +function UWd(a,b,c){a.a+='(';O4b(a,bCg(b,c.c));a.a+=',';O4b(a,bCg(b,c.d));a.a+=Tyh} +function xLb(a,b,c,d){NAb.call(this);qLb(this);this.e=a;this.f=b;this.d=c;this.c=d} +function _0d(a,b,c,d,e,f){HPd.call(this,a,b,c,(QPd(),MPd),d,e,f);hmd(this.Kc,this)} +function u0c(a,b){this.c=pe(ie(sA,1),Z4g,84,0,[new mvc,new mvc]);this.d=b;this.e=a} +function use(a,b,c,d){var e;e=pe(ie(fY,1),qnh,13,0,[hLd(Kod(a.f),b,c,d)]);return e} +function wse(a,b,c,d){var e;e=pe(ie(fY,1),qnh,13,0,[jLd(Kod(a.f),b,c,d)]);return e} +function pve(a,b,c,d){var e;e=pe(ie(fY,1),qnh,13,0,[fNd(Kod(a.f),b,c,d)]);return e} +function Mje(a,b,c,d){Hje();var e;e=Kje(a,b,c);e==yje&&!!b&&Oqb(d,b.Jl());return e} +function PMe(a,b,c,d){NHc();var e,f,g;e=0-a._*c;f=a._*b;g=a.Z*c-a.$*b;NNe(d,e,f,g)} +function eMe(a,b,c,d){NHc();cMe.call(this,a);this.d=d;$Le(this,c);bMe(this,b,true)} +function QUe(a){NHc();BLc.call(this,a);this.q=false;this.k=(Huc(),Ztc);this.v=true} +function q3e(a){if(!!a.c&&Iee(a.c)>0){return o3e(a)}return Kqf(cpd(a.Mc),a.b).Ap()} +function s3e(a){if(!!a.c&&Iee(a.c)>0){return Kqf(cpd(a.Mc),a.b).Ap()}return o3e(a)} +function opd(a){if(a.Bt()==a.At()){return -10}return 2*a.Bt()-a.At()+a.Et()-a.Dt()} +function kke(a){if(!a.b||!a.b.o){return mac(),mac(),lac}return new iac(Hld(a.b.o))} +function y3e(a){if(!a.j){return}(a.i!=gpd(a.Mc)||a.g!=gpd(a.Mc))&&(a.j=x3e(a,a.s))} +function v4e(a,b,c){var d;d=a.lb;if(!!d&&c){a.o=b;a.n=-1;a.G=true;L4e(a);M4e(a,d)}} +function zOf(a,b,c){var d;d=c;b==(jcg(),gcg)&&false&&(d=scg(a,d));return b.bB(a,d)} +function HUf(a,b){var c,d;for(d=new t9b(b.a);d.a>16&255;c=a>>8&255;b=a&255;return new Q$b(d,c,b,255)} +function nlf(a){var b;for(b=0;b0?(a.cb=true):xQf(a)} +function Axg(a,b,c,d){OYb(a.a,b);a.b=t4b(a.b,b,c.result);bEb(a.a.a)==0&&oPg(d,a.b)} +function c$f(a,b,c){cQf(a.a);_Zf(a,b,AEh+uPg,c);w0f(OOf(a.a),new p0f((_1f(),O1f)))} +function mFg(a,b,c){c.preventDefault();ZTf((!a.Ib&&(a.Ib=new KUf(a.pb,a)),a.Ib),b)} +function aRb(){aRb=xqb;_Qb=new JOb((tRb(),hRb),0.6);$Qb=new vLb(new JOb(hRb,0.06))} +function uXg(){uXg=xqb;sXg=new xXg;qXg=new yXg;pXg=new zXg;rXg=new AXg;tXg=new BXg} +function Ze(){Ze=xqb;Ve=ue(B5g,B5g,524287);We=ue(0,0,D5g);Xe=se(1);se(2);Ye=se(0)} +function LYf(){this.e=me(x9,Z4g,747,3,0,1);this.f=new cEb;this.p=new PYb;HYf(this)} +function Idg(){this.a=false;this.b=ke(sf,[nih,g9g],[17,5],15,[3,3],2);this.a=false} +function HQh(){var a;return a=new O0e(this.a.Kc),s0e(a,0,0,1,true),A0e(a,this.a),a} +function Mcg(a,b){var c;return c=$wnd.Math.abs(a),!(c>koh||c>$wnd.Math.abs(b)*koh)} +function fJd(a){return !(Iqhpih} +function lzg(a){return !!a.f&&!!a.f.e&&a.f.e.v&&!$1b(a.f.e.C.style[yYg(),Hrh],r9g)} +function OSg(a){return !$1b(mrh,a.a._B('randomize'))||$1b(Knh,a.a._B('randomize'))} +function B4b(a,b){return b==(Acc(),Acc(),zcc)?a.toLocaleLowerCase():a.toLowerCase()} +function D4b(a,b){return b==(Acc(),Acc(),zcc)?a.toLocaleUpperCase():a.toUpperCase()} +function bPb(a){var b;if(!I8b(a.q)){b=Yc(a.q);while(b.Hd(a)&&!I8b(a.q)){b=Yc(a.q)}}} +function Gd(a){var b,c;if(a.c){c=null;do{b=a.c;a.c=null;c=Pd(b,c)}while(a.c);a.c=c}} +function Fd(a){var b,c;if(a.b){c=null;do{b=a.b;a.b=null;c=Pd(b,c)}while(a.b);a.b=c}} +function DQb(a){var b,c;c=16;b=a%10;while(a>10){a=a/10|0;b+=c*(a%10);c<<=4}return b} +function obc(a){var b;++a.a;for(b=a.c.a.length;a.a=0&&Tpb(a,11)<0){return r5b[mqb(a)]}return new W5b(a,0)} +function OAc(a,b,c){if(a==null||a.length==0){return null}return new rvg(a,b,c.Kh())} +function MTb(a,b,c,d,e,f){var g;g=new IHb(b,c,e);return new BLb(f*2,new mHb(g,a,d))} +function pZb(a,b,c){if($1b('|',a)&&$1b('|',c)){return 'Determinant('+b+')'}return b} +function uDc(a,b){if(!b.cn()){return false}return a.$b&&a.f.Eb||!b.Nb||SOf(a.f)==61} +function eTc(a,b){if(a.b.Gb){return}a.b.Gb=new P0e(a.a,cQc(a.c,b.c),dQc(a.c,b.d),1)} +function O7c(a,b){if(!a.b){return}b?i8c(a.f):R7c(a);P7c(a);Q7c(a);b8c(a.f);ozg(a.i)} +function j_c(a){if(a.Lb){return a.Lb}a.xb.Tb?f_c(a):GAc(a,new tqg(a.d));return a.Lb} +function yIg(a,b){if(!a.b){a.b=true;hyg(a,new KIg(a),(N_g(),N_g(),M_g))}Z8b(a.c,b)} +function kod(a){if(a.S){a.n=true;a.w=null;!!a.j.db&&x0f(OOf(a.j),(_1f(),L0f),null)}} +function DQc(a,b){return a.pn()&&a.k||a.cn()||a.Yl()&&!b||a.Dn()||ff(a,359)||a.Gn()} +function lVc(a){return a!=null&&a.length>1&&$1b(a.substr(0,1),'$')&&f4b(E4b(a),'$')} +function QBc(a,b){g9b(a.B,b);g9b(a.D,b);g9b(a.Sb,b);g9b(a.Zb,b);!!a.wb&&AHc(a.wb,b)} +function eDb(a){WCb();this.a=me(ph,Z4g,1008,i5g,0,1);n5b(a.a,0,this.a,0,a.a.length)} +function cKb(a){mCb.call(this);this.a=a;this.u=a.u;this.q=a.q;this.o=a.o;this.s=a.s} +function aXb(){GHb.call(this,0,'fonts/latin/optional/jlm_cmbxti10',444,414,1182,0)} +function pgd(a){var b;if(!a.n.hn()||!CJc(a.n)){return false}b=a.n;return isNaN(b.H)} +function mjd(a){phd();if($1b(xvh,a)||$1b(mlh,a)||$1b(T4g,a)){return 0}return Vhg(a)} +function LVe(a,b,c){if($1b(xVe(a,(Sud(),oud)),'y')){return eVe(a,c)}return eVe(a,b)} +function ode(a){var b;b=S5b(a);if(m4b(b,G4b(101))>-1){return s4b(b,101,69)}return b} +function I0d(a,b){var c;for(c=b.length-1;c>-1;c--){if(a>b[c]){return b[c]}}return 0} +function Pee(a,b){var c;c=new See(a.c.si(),b,a.c);lmd(a.c.si(),c);b.q=true;return b} +function uLd(a,b,c,d,e){var f,g;f=new KId(a.a,c,d,e);g=f.t;g.Cc=2;JKc(g,b);return g} +function hWe(a,b){N1b(a.u,0);a._b&&AWe(a.u,b,a.Xb,a);O4b(a.u,jWe(a,b));return a.u.a} +function kXe(a,b){N1b(a.k,0);a._b&&AWe(a.k,b,a.Xb,a);O4b(a.k,lXe(a,b));return a.k.a} +function u4e(a,b,c){var d;d=a.lb;if(!!d&&c){a.n=b;a.o=-1;a.G=false;L4e(a);M4e(a,d)}} +function yQd(a){var b;for(b=0;b<4;b++){B_e(a.d[b],a.a,false);B_e(a.d[b],a.b,false)}} +function def(a){var b,c;b=0;for(c=0;c<4;c++){b=b<<1|gef(a.b[c])}return b>=8?~b&15:b} +function Aef(a){var b;for(b=a.length-1;b>=0;b--){if(!Scg(a[b])){return b}}return -1} +function i4e(a){var b,c;for(c=new t9b(a.F);c.a=a.n){return 1}return Xsg(b,a.o,a.p,a.q)} +function w4f(a,b){var c;c=Hpd(a.d,b,false,0);if(!c){return 0}return w9d(Sod(a.d),c)} +function Ytg(a,b){var c;c=a.style;if(c==null){return}c['transform']=r9g;c[PFh]=b+''} +function J4e(a,b){tLc(a,b);!a.Kc.A&&a.Xb!=null&&x4b(a.Xb,GCh)&&dMg(a.Mc.j,a);i4e(a)} +function xNe(a){return !isNaN(a.Z)&&!isNaN(a.$)&&!isNaN(a._)&&!(Scg(a.Z)&&Scg(a.$))} +function eJg(a){a.d.s&&(SGg(a.c)==-1?WGg(a.c,a.c.a.i.length-1):WGg(a.c,SGg(a.c)-1))} +function i7d(a){(!a.r||!a.r.Lm())&&(a.r=S9d(a,a.k,true));return a.r.Jn((_8f(),y7f))} +function tjd(a,b,c,d){try{vid(a.d,!c&&!d);ujd(a,b,c,d,true)}finally{vid(a.d,false)}} +function Ajf(a,b){if(a.a){return Xvd(b,a.Xb)+Hvd(b)+Cjf(a,b)+Zvd(b)}return LIc(a,b)} +function gYb(a){if(!a.b){a.b=new eDb((WCb(),WCb(),VCb));a.b.a[46]=new mDb}return a.b} +function Ukf(a){var b;a.e=0;for(b=0;b1?xhc(a.a[0],a.a[1]):xhc(a.a[0],0);return a.e>0?b:dqb(b)} +function Rzc(a){var b;b=Kzc(a.c,a.f,a.g,a.d);!!b&&(a.e=b.a);Dzc(a.c,a.a,a.b,a.e,a.i)} +function RBc(a){var b;b=false;if(a.D.i.length>0){QEc(a);b=true}Ygc(a.D.i,0);return b} +function QEc(a){var b,c;for(c=new t9b(a.D);c.a2){throw Qpb(new l3b('invalid type for Arc: '+b))}a.g=b} +function A5c(a,b,c){if($wnd.Math.abs(a-b)<$wnd.Math.min(20,0.1*c)){return b}return a} +function qVc(a,b){var c;rVc(a,b);c=b9b(a.b,b);if(!c){c=new KRc;j9b(a.b,b,c)}return c} +function N6c(a,b,c){var d;MJb(a.d,new Vff(b,c));d=Yff(a.d).a.c;d>=a.a.a.Ac&&$ff(a.d)} +function x0d(a,b,c,d,e){var f;for(f=c;fa.f){return b-(a.f-a.o)}return b} +function a0e(a,b){if(!b.jn()){return false}if(b.Wm()){return b.Im(a)}return c0e(a,b)} +function eEc(a){switch(a){case 62:case 73:case 74:case 111:return true;}return false} +function plf(a,b){var c,d;d=new bmf(a.d);for(c=0;c>>b%31&1)==1} +function tgc(a,b){var c;Ifc(a);c=new ygc(a,a.a.kg(),a.a.jg()|4,b);return new wgc(a,c)} +function PBc(a,b){if(!!a.v&&a.V==34){HFc(a,a.Rb,b)||KFc(a,b);return true}return false} +function kJc(a){if(!a.Ec){a.Ec=new Tgg;a.Zl()==($Te(),XTe)&&(a.Ec.c=true)}return a.Ec} +function lTc(a,b){var c;c=$wnd.Math.atan2(b.b-a.b,b.a-a.a)*Toh;c<0&&(c+=360);return c} +function ucc(a){var b;rhc(!!a.c);b=a.c.a;mcc(a.d,a.c);a.b==a.c?(a.b=b):--a.a;a.c=null} +function moc(a){var b,c;if(a.j){b=a.o-a.A;c=a.q==0?0:(a.q-b)/a.q;a.bh(c,b);a.j=false}} +function __c(a){var b,c,d;c=a.c.b-a.c.a;d=a.c.d-a.c.c;b=$wnd.Math.atan2(d,c);return b} +function vDc(a){return (a.V==78||a.V==40&&a.$b&&a.vb==78)&&a.Jb.k.i.length>0&&!UCc(a)} +function qXc(a){return Pcg(a.a,1,bqh)&&Pcg(a.e,1,bqh)&&Pcg(a.b,0,bqh)&&Pcg(a.d,0,bqh)} +function Myc(a,b,c,d){var e;e=new Rrg(b-d,c-d,2*d,2*d);return Erg(a.n,e)&&!Qpg(a.n,e)} +function ied(a,b,c,d){var e;e=new n9b;Z8b(e,new red(a.a,b.a,b.b));ged(a,e,c,d);hed(a)} +function rrd(a,b,c,d){var e,f;e=new Ype(a,b,c,d);f=e.n;RNe(f,1);tLc(f,false);return f} +function srd(a,b,c,d){var e,f;e=new eqe(a,b,c,d);f=e.o;RNe(f,1);tLc(f,false);return f} +function ugd(a,b,c,d){var e;e=$qe(b,d,a.B.t);c.hn()&&!!e&&$2c(c,isNaN(e.Fp()));c.rb=e} +function vld(a,b,c){var d,e,f;f=a.n.i.length;for(e=0;e=0){$Zf(a.ab);return true}return false} +function A8d(a,b){var c;for(c=0;cb&&b9b(a.a,b).i.length!=0?b9b(b9b(a.a,b),0):null} +function jCc(a,b){if(!b){return}a.D.i.length>0&&QEc(a);TRc(a.D,b);HKc(b,true);Zpd(a.K)} +function V$b(a,b){a.d.beginPath();a.d.moveTo(b.a,b.c);a.d.lineTo(b.b,b.d);a.d.stroke()} +function mNc(a,b){var c;c=ZQc(a.bb,b);if(c){YDb(a.jb,b,c);b.jn()&&Z8b(a.nc,b)}return c} +function BJc(a){var b;if(a.xk()){b=a.lb;return !b||Vb(b.Mi(),(K3d(),J3d))}return false} +function lLg(a){var b;if(a.a.C==null){return 0}return (b=a.a.C.offsetHeight,!b?0:b)|0} +function OKb(a){var b;jhc(a);b=((a-1)/31|0)+1;this.a=me(uf,v5g,5,0,15,1);Ygc(this.a,b)} +function CKd(a,b){kwc.call(this,a);this.a=new j$e(a);wKc(this.a,b);BKd(this);AKd(this)} +function uId(a,b,c,d){kwc.call(this,a);b.Iw(d.e);this.g=b;this.f=c;this.i=b.lp().Dk(a)} +function $Dc(a,b,c,d){Iub(a.kc.cb,true);a.X=new jvc(b,c);QFc(a,d,d<1.1?1:2,b,c);a.qb=2} +function s4c(a,b,c){var d;d=c+2*b;d>a.d.n?(d=a.d.n-10):c3c(a.d,(a.d.n-d)/2|0);return d} +function RNd(a,b,c){var d,e;e=(d=new I2d(a.a,b,c),d.b);e.Jb=true;tLc(e,false);return e} +function yxe(a,b,c){var d,e;for(e=new t9b(a.d);e.aa||a>b){throw Qpb(new V1b('fromIndex: 0, toIndex: '+a+q5g+b))}} +function d$e(a,b){if(a.q&&b.e&&wZe(a)){return c$e(a,false,b)}return a.q?VYe(a,b).a:'?'} +function qVe(a){if(a.o){return $wnd.Math.min(ipd(a.Mc,a)[1],a.p)}return ipd(a.Mc,a)[1]} +function sVe(a){if(a.o){return $wnd.Math.max(ipd(a.Mc,a)[0],a.q)}return ipd(a.Mc,a)[0]} +function ZQe(a){return $wnd.Math.abs($wnd.Math.asin(a.q[1].d))*-O3b(a.q[1].d*a.q[1].e)} +function WQd(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.a;a.V[1]=a.b;bwc(a,a.d);xxd(a);Xvc(a)} +function aSd(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.g;a.V[1]=a.n;bwc(a,a.b);xxd(a);Xvc(a)} +function i7e(a,b){a.c.a.length>0&&F1b(a.c,a.c.a.length-1)==46&&O4b(a.c,' ');O4b(a.c,b)} +function bdf(a,b){if(b==null){sdf(a);return}a.b=b;a.e=a.b.length-1;a.f=a.b[0].length-1} +function cwd(a){switch(a.B.k){case 3:return gbh;case 4:return Ogh;default:return rxh;}} +function aPf(a){if(!a.Vb){a.Vb=new QUf(a.pb);NJb(a.Vb,a.pb);NJb(a.Vb,a.bb)}return a.Vb} +function $eg(a){Heg();var b,c;c=a[0];for(b=0;bc&&(c=a[b])}return c} +function _eg(a){Heg();var b,c;c=a[0];for(b=0;b=9999||b>=9999||a<0||b<0){return null}return mUe(a)+(b+1)} +function okg(a,b){if(b==he(a.r.b)){return he(a.r.a)}return he(a.a.a)+a.d*(b-he(a.a.b))} +function Hqg(a,b,c){var d;if(a.c<2){return false}d=a.e==1?-1:1;return (a.pB(b,c)&d)!=0} +function B4e(a,b,c){var d;if(b!=a.w){a.w=b;L4e(a);c&&(d=a.lb,!!d&&!ff(d,607)&&d.Hi())}} +function ODg(a,b,c){kDg();var d,e;e=new WSg(a);d=WTg(a.aC());xDg(new MDg(d,e,c),d,a,b)} +function JJg(a,b){var c,d,e;c=b?bnh:1.5;d=fzg(a.c)/2;e=bzg(a.c)/2;QFc(a.c.lb,c,15,d,e)} +function qKg(a,b){var c;c=new wPg;lTg((bLg(a.a),b),c);return new i$f(c.g.a.get(gHh).d)} +function Wyg(a,b){a.YB();a.Oh();a.$h(b.s.g);a.sh(0,0,pf(b.Lq().p),pf(b.Lq().n));a.Nh()} +function VBg(a,b){a.a=false;++a.b;$wnd.goog.global.requestAnimationFrame(b.cb.s);--a.b} +function wWg(a,b){t1b();$wnd.goog.global.setTimeout(yqb(xWg.prototype.Bf,xWg,[a,b]),b)} +function lDg(a,b){_Tg(a.b.o,b,'focusin',new PDg(a));_Tg(a.b.o,b,'focusout',new QDg(a))} +function p1g(a){m1g();l1g&&n1g(true,'String is not a valid URI: '+a);return new o1g(a)} +function Xcg(){Xcg=xqb;Vcg=new _cg('TRUE',0);Ucg=new _cg('FALSE',1);Wcg=new _cg(Z8g,2)} +function Ubf(){Ubf=xqb;Tbf=new Vbf('TOP',0);Sbf=new Vbf('MIDDLE',1);Rbf=new Vbf(Qih,2)} +function asg(){asg=xqb;_rg=new hsg;$rg=me(lfb,Z4g,959,2,0,1);Zrg=me(ifb,Z4g,719,2,0,1)} +function xub(){vub();this.a=new Pub((Lvb(),mvb),null,uub);this.b=new Pub(nvb,null,uub)} +function F$e(a){NHc();BLc.call(this,a);sKc(this,true);this.j=new o9b(500);this.d=false} +function PNg(a,b){b.preventDefault();b.stopPropagation();a.style.borderColor='#ff0000'} +function QNg(a,b){b.preventDefault();b.stopPropagation();a.style.borderColor='#000000'} +function yqb(a,b,c){var d=function(){return a.apply(d,arguments)};b.apply(d,c);return d} +function sNb(a){var b;b=new BNb(a.i,a.f,a.k,a.a,a.b,a.j,a.g,a.c,a.e);b.i=a.i|1;return b} +function QPc(a){var b;b=gNc(a);if(!b){return}$Oc(a,b.a.a,b.a.a+b.b.b,b.a.b,b.a.b+b.b.a)} +function WVc(a){a.a=BIc(a.xb);a.e=a.a.Vu();if(a.a._u()){a.j=new n9b;a.d=new n9b;YVc(a)}} +function iBb(a,b){var c;Z8b(a.d,BKb(a.g));a.g=new DKb;for(c=0;c=d&&c>=e&&b0){return $wnd.Math.pow(a,V9g)}return -$wnd.Math.pow(-a,V9g)} +function R2b(a,b){var c;if(!a){return}b.n=a;var d=O2b(b);if(!d){uqb[a]=[b];return}d.mD=b} +function d2g(a){var b;b=a.currentTarget;while(b!=null&&!X1g(b)){b=b.parentNode}return b} +function CSg(a,b){return b&&!$1b(mrh,a.a._B('enableCAS'))||$1b(Knh,a.a._B('enableCAS'))} +function sLg(a){return (!a.O&&(h4b(Zoh,SSg(a.d))?(a.O=new OGg):(a.O=new MGg)),a.O).PC()} +function W2c(a){return (a.b==1?a.i.d:0)>0&&(a.b==1?a.i.a:a.e.k.i.length)=0){a.c=a.d?a.d.i.length:0;Dwb(a);a.a=c;a.b=b.e}} +function KKb(a){var b,c;b=QKb(a.a);if(b==-1){return 0}c=a.a[b]|0;return b*31+(32-u3b(c))} +function IDb(a){zDb();var b;b=WDb(yDb,a);if(!b){return WDb(yDb,a.toLowerCase())}return b} +function qqb(){rqb();var a=pqb;for(var b=0;b=0);if(N8b(a.d,a.c)<0){a.a=a.a-1&a.d.a.length-1;a.b=a.d.c}a.c=-1} +function svc(a){var b;this.Jc=(b=a.M.j.Y,a.M.j.Y=Rpb(a.M.j.Y,1),b);this.Kc=a;this.Mc=a.M} +function XJb(a,b,c,d){!a?(this.b=new DKb):(this.b=new FKb(a));this.d=b;this.c=c;this.a=d} +function CPh(){if(!this.xb.Em()||!zJc(this.xb)||!this.e){return null}return nRc(this.e)} +function GPh(){if(!this.xb.Em()||!zJc(this.xb)||!this.c){return null}return nRc(this.c)} +function xMc(a){var b,c;b=yMc(a);c=AMc(a);if(b+c<=0){return 0}return $wnd.Math.sqrt(b+c)} +function o2b(a){e2b==null&&(e2b=new RegExp(k6g));return e2b.test(String.fromCharCode(a))} +function rVc(a,b){var c;!a.b&&(a.b=new n9b);for(c=a.b.i.length-1;c9){return new Uog(a/2)}!y$c[a]&&(y$c[a]=new Uog(a/2));return y$c[a]} +function Hmc(a,b){if(a<1){throw Qpb(new Rkc(w3b(a)))}if(b<1){throw Qpb(new Rkc(w3b(b)))}} +function OKc(a,b){if(b==a.cc){return}b>9?(a.cc=9):b<0?(a.cc=0):(a.cc=b);Qpd(a.Mc,a,a.cc)} +function TFd(a,b,c){qFd.call(this,a);this.b=b;this.c=c;this.a=pFd(a);uFd(this);this.Ii()} +function sKd(a,b,c){kwc.call(this,a);this.b=b;this.c=c;this.a=b.Bk();jxd(this);pKd(this)} +function Spd(a){var b,c;if(a.S){for(c=new t9b(a.rb);c.a=8304&&a<=8313||a==185||a==178||a==179)} +function oMg(a){return a.Sb&&!($1b(Knh,a.d.a._B(Goh))||ISg(a.d)||$1b(Knh,a.d.a._B(vvh)))} +function $cc(a){return adc(a,26)*1.4901161193847656E-8+adc(a,27)*1.1102230246251565E-16} +function ndf(a,b){jJc(a,b);PIc(a,b);b.a+='\t'} +function Hd(a){var b;if(a.a){b=a.a;a.a=null;!a.f&&(a.f=[]);Pd(b,a.f)}!!a.f&&(a.f=Kd(a.f))} +function Hjg(a){var b;Vig(a);a.j=null;a.a=null;a.k=null;b=a.t;while(b){yjg(a,b.d);b=b.b}} +function RPf(a){var b;a.ob=true;for(b=new t9b(a.Fb);b.a0?(a.cb=true):xQf(a)} +function PYf(a,b,c){!a.f&&(a.f=new cEb);YDb(a.f,w3b(b),w3b(c));a.bb>0?(a.cb=true):xQf(a)} +function xAg(a,b){this.a=b.pointerId;this.b=b.offsetX/Uzg(a.b);this.c=b.offsetY/Uzg(a.b)} +function nHb(a,b,c,d){this.a=a;this.b=b==(dNb(),FMb)?null:b;this.d=d==FMb?null:d;this.c=c} +function Tnc(a,b,c){if(c.length!=a.a){throw Qpb(new zkc(c.length,a.a))}n5b(b,a.b,c,0,a.a)} +function Unc(a,b,c){if(b.length!=a.a){throw Qpb(new zkc(b.length,a.a))}n5b(b,0,c,a.b,a.a)} +function MXc(a,b,c){MAc.call(this);DXc(this);this.Pb=b;this.xb=c;this.vb=true;JXc(this,a)} +function $Xc(a,b){YXc();NAc.call(this,a,b);this.c=new Y1c(a,b,false);this.d=b;this.e=null} +function tQc(a,b){var c;if(SDb(a.jb,b)){c=VDb(a.jb,b);c.Qj(true);return true}return false} +function cFc(a){m5b();if(_pb(Xpb(Date.now()),Rpb(a.t,a.N))){return !CQc(a.V)}return false} +function c2c(a){if(!$1b('',_Ic(a.xb))){return sIc(a.xb,(Sud(),oud))}return '\xA0\xA0\xA0'} +function F3c(a,b,c){return Occ(lgc(kgc(new wgc(null,new gdc(a.b,16)),new U3c(b,c))),null)} +function r5c(a,b,c){var d;d=new P0e(a.k.Jb.o,cQc(a.k,b),dQc(a.k,c),1);d.Jb=false;return d} +function K6c(a,b){var c,d;d=b.b;if(d.ca.a&&(a.a=a._);a.b>a.a&&(a.a=a.b)} +function qvg(a){if(a.b){return Y2b(a.c.b,10)*Fbh}return Y2b(a.c.b,10)*0.20000000298023224} +function e_f(){c_f();return pe(ie(aab,1),I7g,440,0,[Y$f,_$f,Z$f,a_f,V$f,b_f,W$f,X$f,$$f])} +function Flg(){Clg();return pe(ie(keb,1),I7g,410,0,[wlg,tlg,ulg,xlg,Blg,zlg,ylg,vlg,Alg])} +function Bfe(a,b,c){return b.B==(c9d(),X8d)&&sfe(a)&&false&&a.a?Afe(a,b):yfe(a,b,c,false)} +function ctf(a,b,c){switch(a){case 255:return eqb(Spb(vrf[b],c),0);default:return false;}} +function Cyg(a,b){if(b.B!=a){throw Qpb(new l3b('Widget must be a child of this panel.'))}} +function YJg(a,b,c){if(a){a.aC().setAttribute('data-title',b);a.aC().setAttribute(d9g,c)}} +function LLg(a,b,c){var d,e;if(b.readyState==(w1b(),v1b)){e=b.result;d=c.name;FLg(a,d,e)}} +function JOg(a,b,c){var d,e;if(c!=null){d=new jPg;vPf(a.b,d)}ZLg(a.b);e=bLg(a.b);jTg(e,b)} +function rhg(a,b,c){var d;if((d=WDb(lhg,c))!=null){Vgc(a.i,b+'_'+d);Vgc(a.i,b+Q7g+d+'}')}} +function fRg(a,b){var c;c=b.jc;if(c9b(a.b,c,0)!=-1){g9b(a.b,c);Z8b(a.b,b.Xb);Zpd(b.vi())}} +function SJg(a,b,c){pJg(new tJg(Zbd(!a.e?-1:iOc(a.e)),c,pe(ie(Lpb,1),Z4g,129,0,[b])),a.a)} +function v$g(){t$g();return pe(ie(wnb,1),I7g,284,0,[p$g,k$g,l$g,m$g,n$g,o$g,q$g,r$g,s$g])} +function v_g(){t_g();return pe(ie(Vnb,1),I7g,283,0,[s_g,q_g,l_g,m_g,r_g,p_g,n_g,k_g,o_g])} +function fTh(a,b){return $wnd.Math.max($wnd.Math.abs(a[0]-b[0]),$wnd.Math.abs(a[1]-b[1]))} +function tqb(a,b){typeof window===L4g&&typeof window['$gwt']===L4g&&(window['$gwt'][a]=b)} +function IBg(a){$wnd.window.canvas2pdf!=null?HOg(a.a,a.e,a.d,a.c,a.b):HBg(a,'canvas2pdf')} +function JBg(a){$wnd.window.C2S!=null?mzg(a.a,a.e,a.c,a.d,a.b):HBg(a,'canvas-to-svg.umd')} +function iwb(a){var b;if(!a.f){return null}b=hwb(a);return b>=ywb(a.f)-1?null:owb(a.f,b+1)} +function syb(a){if(a==hyb){return 'var'+(a.j!=null?a.j:''+a.k)}return a.j!=null?a.j:''+a.k} +function s6b(a){var b;b=me(uf,v5g,5,a.d,15,1);n5b(a.a,0,b,0,a.d);return new O6b(a.e,a.d,b)} +function Hc(a){var b;while($c(a.j)>0&&a.d[Yc(a.j)]){b=Zc(a.j);ba){return new $fc}b=a+1;c=new Vfc(b,a);return new Zfc(null,c)} +function P4c(){P4c=xqb;M4c=new Q4c('MOUSE',0);O4c=new Q4c('TOUCH',1);N4c=new Q4c('PEN',2)} +function MVc(){MVc=xqb;HVc=(Huc(),zuc);IVc=Duc;LVc=Duc;KVc=Duc;JVc=(OMc(),UMc(4,0,NMc.q))} +function NFg(){NFg=xqb;MFg=new utg('[,\\[\\(] *(<.*?>|"<.*?>"|\\.\\.\\.) *(?=[,\\]\\)])')} +function h3c(){h3c=xqb;f3c=new i3c(Rih,0,0);g3c=new i3c('UP',1,-1);e3c=new i3c('DOWN',2,1)} +function G3g(){G3g=xqb;(t1b(),$wnd.goog.global.window)['GwtPotentialElementShim']=new A3g} +function ktg(){var a;a=(t1b(),p1b).cookie;if(a==itg){return false}else{itg=a;return true}} +function q4c(a,b){var c;c=b;c3c(a.d,a.d.n-b-5);if(a.d.k<5){c3c(a.d,5);a.c||(c-=5)}return c} +function ODb(a,b){var c,d;nhc(b);for(d=b.Zd().rd();d.xf();){c=d.yf();a.put(c.ef(),c.ff())}} +function m$c(a,b){var c;if(b){a.Ab=true;c=JNc(a.Pb);!!c&&d$c(a,c)}else{a.Ab&&(a.Ab=false)}} +function yHc(a,b){if(!!b&&b.g&&!a.lk()){W4c(wCc(a.G.lb),b,true);Zpd(a.p.pb)}else{wHc(a,b)}} +function $ec(a,b){((ifc(),ffc)?null:b.c).length==0&&kfc(b,new ufc);ZDb(a.a,ffc?null:b.c,b)} +function Zwb(a,b){var c;a.d=null;a.e=0;a.b=null;a.c=null;c=new h5b;nxb(a,b.a,c);return c.a} +function UVd(a,b){var c;for(c=0;c0?a.k-$wnd.Math.floor(a.k):a.k-$wnd.Math.ceil(a.k))} +function h6e(a){!a.d&&Y5e(a);s0e(a.c,a.e.A+a.Z,a.e.B+a.$,1,true);UMe(a.e,a.c,a.d);C2e(a.d)} +function CYe(a,b){var c,d;c=oYe(a);$1b((d=b.s.b.C[Yph],d==null?null:''+d),c)||pHg(b.s.b,c)} +function Vge(a,b){var c,d;c=b.k;d=q8d(b);a[0]=new cde(c,_ge(d.a));a[1]=new cde(c,Zge(d.a))} +function Fmf(a,b){a.c.o.V.a.size()==0&&b.fu()!=null&&imd(a.c.o,sde(b.fu()[0],(Sud(),oud)))} +function BHd(a,b){a.Bv(b.Lk(),true);b.Ei()||!b.kl()||h7d(b.kl())?(a.Gb=b.kl()):(a.Gb=null)} +function $9d(a,b,c){a._h(-c.f[0],-c.f[1]);wae(a,1/b.Fp(),0,0,1/b.Fp());a._h(c.f[0],c.f[1])} +function rjf(a,b,c){var d;xRe(a.d,b,c);c.b<0&&(c.b+=zmh);d=c.b-a.k;d<0&&(d+=zmh);c.b=d/a.j} +function P3f(a,b){var c;c=Hpd(a.d,b,false,0);if(!c){return ''}return mhg(),'#'+iig(YIc(c))} +function zeg(a,b,c,d,e,f,g){var h;h=ueg(a,ueg(ueg(b^c^d,e),g));return ueg(h<>>32-f,b)} +function ose(a,b,c,d,e,f,g){this.a=a;this.g=b;this.d=c;this.f=d;this.c=e;this.e=f;this.b=g} +function qef(a){this.f=a;this.q=new occ;this.t=me(mG,Z4g,83,2,0,1);this.j=a;this.g=new aef} +function N_f(a){if(a.b.i.length==0){throw Qpb(new r_f(LEh))}return b9b(a.b,a.b.i.length-1)} +function s7e(a,b){if(b.length==1){return r7e(a,(uhc(0,b.length),b.charCodeAt(0)))}return b} +function nhg(a,b){if(!b){return 0}return m4b(a,G4b(95))>-1?Y2b(b.b,10)*1.8:Y2b(b.b,10)*1.4} +function aif(a){return a.c>a.a||fff(a,Lif($wnd.Math.atan(a.c)),Kif($wnd.Math.atan(a.a))),a} +function SZf(a){var b;if(a.f.b>1){for(b=new t9b(a.g);b.a=0&&!b.DC().contains(xyg(a.b,c))){--c}return c} +function QSg(a,b){var c;c=a.a.bC(DHh)?a.a._B(DHh):'';return h4b('ascii',c)||!h4b(Xah,c)&&b} +function fec(a,b){var c,d;c=1-b;d=a.a[c];a.a[c]=d.a[b];d.a[b]=a;a.b=true;d.b=false;return d} +function dvc(a,b){var c;c=0;$1b(a.e,iah)&&(c=c|2);$1b(a.c,llh)&&(c=c|4);b||(c=c|1);return c} +function Jvc(a){var b,c,d;d=0;for(b=0;bd&&(d=c)}return d+1} +function tQb(a){var b;while(a.o-1){return VIc(a,false,true)}return UIc(a)} +function awd(a){switch(a.B.k){case 3:return '^{2}';case 2:return '^2';default:return v8g;}} +function SZb(a){switch(a.e){default:case 0:return pbh;case 2:return llh;case 1:return iah;}} +function QWg(a){if(EWg(a)){return a!=null&&a.nodeType==$wnd.Node.ELEMENT_NODE}return false} +function D0c(a,b){if(a.xb.el()){return true}return (a.k.k||d4e(a.k))&&(b||a.k.Mc.A||!a.k.b)} +function OEc(a,b){b.b?szg(a.kc,(pHc(),kHc)):b.c?szg(a.kc,(pHc(),lHc)):szg(a.kc,(pHc(),dHc))} +function fKc(a,b){var c;tJc(a);c=a.sb.lp();c.hn()&&!c.lb&&(!c.Db||!cPe(c.Db))&&c.Bv(b,true)} +function fqd(a,b){var c,d;if(a.S){for(d=new t9b(a.rb);d.a0||a.indexOf('_')==-1){return a}return t4b(a,'_',Q7g)+'}'} +function hXd(a,b,c){if(VDb(a.g,b)==null){YDb(a.g,b,c);if(!gXd(a,b)){Z8b(a.f,b);Z8b(a.a,c)}}} +function iye(a,b){Yxe();dye.call(this,a,XPg(a,hBh)+' : '+UPg(a,b.i),(yTf(),xTf));this.a=b.i} +function Prd(a){_md.call(this,a,a.b.o);this.a=false;this.b=a.b.o;this.c=new PYb;this.A=true} +function jWc(a,b){MAc.call(this);this.Pb=a;this.a=b;this.xb=b;this.c=new eAc(b,a);iWc(this)} +function u6c(a,b,c){this.j=a;this.d=b;this.k=c;this.e=1;this.b=0;this.i=a;this.f=a;this.a=0} +function fdf(a,b,c){if(a.b!=null){return Vdf(b,c,a.b)}a.k[0]=b;a.k[1]=c;return gae(a.o,a.k)} +function fgf(a){if((Rgf(),Ggf)==a.c&&!!a.b&&a.b.An()){return a.b}return a.c.pA(a.a,a.b,a.d)} +function fRe(a){switch(a.gb){case 4:case 3:case 5:case 9:return false;default:return true;}} +function lcf(a,b){var c;c=n8d(a.Gb,b);if(c.indexOf('=')!=-1){return a.yl(b)+':='+c}return c} +function ove(a,b,c){var d,e;d=gNd(Kod(a.f),c);JKc(d,b);e=pe(ie(fY,1),qnh,13,0,[d]);return e} +function Fjf(a,b,c){var d;a.g=b;a.b=c;a.d=true;for(d=0;d2||b==0){return false}c=GYf(YOf(a.b),b<0?3:b);return c.O} +function y_f(a){var b;b=w_f(a,Prh);if(ff(b,686)){return b}throw Qpb(j_f(Prh,b,'JSONArray'))} +function fCb(a,b){if(!!a&&$wnd.Math.abs(b-a.u)>t9g){return new zIb(a,b,(oNb(),iNb))}return a} +function Zcg(a){switch(a.k){case 2:default:return Wcg;case 0:return Ucg;case 1:return Vcg;}} +function zNb(a){var b;b=new BNb(a.i,a.f,a.k,a.a,a.b,a.j,a.g,a.c,a.e);b.i=a.i<=3?5:7;return b} +function OPb(a){var b,c;c=1;while(++a.o=a.r?K4b(a.c,a.r,a.e-a.r+1):K4b(a.c,a.r,a.f-a.r)+K4b(a.c,0,a.e+1)} +function fWh(){return new Q$b((_Yb(XYb),this.a.b>>16&255),this.a.b>>8&255,this.a.b&255,255)} +function Xbc(){aEb(this);this.c=new $bc(this);this.d=new cEb;this.c.b=this.c;this.c.a=this.c} +function _Hb(a,b,c,d){mCb.call(this);this.a=a;this.u=b;this.q=c;this.b=1/d;this.o=0;this.s=0} +function l3f(a,b,c,d,e,f,g){hvb.call(this,a,b);this.c=c;this.d=e;this.a=f;this.e=d;this.b=g} +function AXf(){zQf.call(this);zWf(this);this.U=215;this.Y=315;this.J=new xqg(0,0);this.XA()} +function SKb(){OKb.call(this,16);NKb(this,2);NKb(this,1);NKb(this,3);NKb(this,4);NKb(this,6)} +function zEc(a,b,c){a.cb==b&&(a.cb=c);if(!!a.fc&&c9b(a.fc,b,0)!=-1){g9b(a.fc,b);Z8b(a.fc,c)}} +function O6c(a,b,c){var d;NJb(a.d,new Vff(b,c));d=b9b(a.d.a,0);d.a.a<=a.a.a.Cc&&f9b(a.d.a,0)} +function bLc(a,b){if(a==b){throw Qpb(new Zkd)}!!a.Cb&&zNd(a.Cb,a);a.Cb=b;!!a.Cb&&TIb(a.Cb,a)} +function CJg(a,b){a.b.d=true;!!b&&!b.b&&(b.b=true,!b.c?FWg(b.C,QBh):NIg(b,b.c));b.C.focus()} +function ucd(a,b,c){a.sc=c;c||sUf((!b.Ib&&(b.Ib=new KUf(b.pb,b)),b.Ib),a,true,true);zLc(a,4)} +function gMd(a,b,c,d){var e,f;e=TLd(a,c,d);e.W=true;cld(e.Kc,e,true);f=e.d;H6e(b,f);return f} +function AMd(a,b,c,d){var e,f;e=XLd(a,c,d);e.W=true;cld(e.Kc,e,true);f=e.b;H6e(b,f);return f} +function JMd(a,b,c,d){var e,f;e=YLd(a,c,d);e.W=true;cld(e.Kc,e,true);f=e.Y;H6e(b,f);return f} +function MMd(a,b,c,d){var e,f;e=ZLd(a,c,d);e.W=true;cld(e.Kc,e,true);f=e.Y;H6e(b,f);return f} +function eVc(a,b,c){var d,e,f,g;e=a.Qb;g=a.q;f=e+a.v.a+a.r;d=g+a.o;return b>e&&bg&&c=a.length-1||x4b(a[b+1],'[')){return false}return !!Hpd(c.pb,a[b],false,0)} +function oJc(a,b){if(!!a.Hb&&a.Hb.Xb!=null){b.a+='\t\n',b)} +function RZf(a,b){var c,d;d=false;if(rcc(a.d)){c=tcc(a.d);scc(a.d);d=j$f(c,b)}d||pcc(a.d,b);return d} +function Vzg(a,b,c){var d;d=new CBg(b,c,(P4c(),O4c),(EBg(),DBg));sZf(a.o.U.a)||(d.g=true);MFc(a.p,d)} +function rQd(a,b,c){a.k?Z8b(a.a,new Oad(c[0],c[1],(dud(),bud))):Z8b(a.a,new Oad(b,c[0],(dud(),bud)))} +function Xfe(a){abd.call(this);this.b=a;this.d=new hwf(this,Qke(YOf(a.j).i));dwf(this.d,(owf(),iwf))} +function CKg(a){this.f=a.o;this.i=a;this.a=a.j;this.e=new n9b;this.d=new n9b;xxe(this,qZf(this.a.U))} +function Opg(a,b,c,d,e,f,g){this.a=a;this.d=b;this.b=c;this.e=d;this.c=e;this.f=f;this.g=g;this.i=-1} +function mvg(a){var b;gvg.call(this,a);this.a=0;b=a.C.style;hXg(b,(U$g(),S$g));this.b=a.B.aC().style} +function jYe(a){NHc();QUe.call(this,a.Kc);fYe(this);qQb(this,new nvc(a.u.qz(),a.u.rz()));hYe(this,a)} +function Dug(a,b,c,d,e){a.j.beginPath();a.j.moveTo(b,c);a.j.lineTo(d,e);a.j.closePath();a.j.stroke()} +function Fe(a,b){var c,d,e;c=a.l+b.l;d=a.m+b.m+(c>>22);e=a.h+b.h+(d>>22);return ue(c&B5g,d&B5g,e&C5g)} +function Qe(a,b){var c,d,e;c=a.l-b.l;d=a.m-b.m+(c>>22);e=a.h-b.h+(d>>22);return ue(c&B5g,d&B5g,e&C5g)} +function BKb(a){var b;b=a.a.i.length;if(b==0){return new XGb}else if(b==1){return b9b(a.a,0)}return a} +function Ppb(a){var b;if(ff(a,48)){return a}b=a&&a.__java$exception;if(!b){b=new vc(a);_d(b)}return b} +function $7b(a){if(a.a.xf()){return true}if(a.a!=a.e){return false}a.a=new Abc(a.f.e);return a.a.xf()} +function i6b(a){if(a==pf(a)){return h6b(0,pf(a))}if(a>=0){return new W5b(0,R4g)}return new W5b(0,V4g)} +function F8b(a,b){if(b==null){return false}while(a.a!=a.b){if(Vb(b,U8b(a))){return true}}return false} +function c2b(a,b){Y1b();return mf(a)?b4b(a,b):jf(a)?a3b(a,b):hf(a)?b2b((nhc(a),a),(nhc(b),b)):a.kd(b)} +function J3b(a,b){return !isNaN(a)&&!isFinite(a)||!isNaN(b)&&!isFinite(b)?k9g:$wnd.Math.sqrt(a*a+b*b)} +function etc(a){this.b=a;ctc.call(this,0,new dtc);this.a=this.b;xAb(this,this.a.e);atc(this,this.a.a)} +function Szc(a,b,c,d,e,f,g,h){this.c=a;this.b=c;this.e=d;this.i=e;this.f=f;this.g=g;this.d=h;this.a=b} +function SPc(a,b){!!a.Bc&&zHd(a.Bc,a);if(!b&&!!a.Jb.o){a.Bc=new cId(a.Jb.o);oQc(a)}else{a.Bc=b}OPc(a)} +function TPc(a,b){!!a.Dc&&zHd(a.Dc,a);if(!b&&!!a.Jb.o){a.Dc=new cId(a.Jb.o);oQc(a)}else{a.Dc=b}OPc(a)} +function VPc(a,b){!!a.Kc&&zHd(a.Kc,a);if(!b&&!!a.Jb.o){a.Kc=new cId(a.Jb.o);oQc(a)}else{a.Kc=b}OPc(a)} +function WPc(a,b){!!a.Mc&&zHd(a.Mc,a);if(!b&&!!a.Jb.o){a.Mc=new cId(a.Jb.o);oQc(a)}else{a.Mc=b}OPc(a)} +function D1g(a){y1g();var b;b=S1g(G1g,a);if(!b&&!!a){a.stopPropagation();a.preventDefault()}return b} +function pjd(a,b){var c;c=new h5b;c.a+=zvh;yjd(c,true,null,a.b);O4b(c,apd(a.e,b));c.a+=Avh;return c.a} +function G3c(a,b){var c,d;a.b.i.length=0;for(c=0;c=0?d:b.Xk();f=Vuc(c.b>>16&255,c.b>>8&255,c.b&255,pf(255*e));a.Yh(f)} +function _qd(a,b,c){var d;for(d=0;da.o.a?b:a.o).a;return c<=16?Iud[c]:$wnd.Math.pow(10,-c)*0.5} +function n5e(a,b){var c,d,e;c=$wnd.Math.cos(b);d=$wnd.Math.sin(b);e=a.d*c+a.e*d;a.e=a.d*d-a.e*c;a.d=e} +function s5e(a,b){var c,d,e;c=$wnd.Math.cos(b);d=$wnd.Math.sin(b);e=a.d*c-a.e*d;a.e=a.d*d+a.e*c;a.d=e} +function IMe(a,b){var c,d,e;c=$wnd.Math.cos(b);d=$wnd.Math.sin(b);e=a.Z*c+a.$*d;a.$=a.Z*d-a.$*c;a.Z=e} +function Glf(a,b){var c;for(c=0;c0.9?(a.b=0.9):(a.b=b):(a.b=0.2)} +function HEg(a,b){var c,d,e;e=VDb(a.c,b);if(e){for(d=e.DC().rd();d.xf();){c=d.yf();oyg(c)}}$Db(a.c,b)} +function QRg(a,b){var c;c=VDb(a.b,b);if(c!=null){return pf($wnd.Math.floor(c.duration*pih))}return -1} +function vVg(a){var b,c,d;d={};for(c=new a8b((new Z7b(a)).a);c.b;){b=_7b(c);d[b.ef()]=b.ff()}return d} +function zIg(a){var b,c;for(c=new t9b(a.c);c.a=0&&(mhc(c,a.i.length),nf(a.i[c])!==nf(b));c--){f9b(a,c)}} +function UFc(a){var b,c;for(c=a.i.length-1;c>=0;c--){b=(mhc(c,a.i.length),a.i[c]);ff(b,337)&&f9b(a,c)}} +function $4c(a,b){var c,d;for(d=new t9b(b);d.aa.k.i.length-1)&&(a.B=0);if(c){vLc(a,false);Zpd(a.Mc);Wqd(a.Mc)}} +function NOe(a){if(a.c!=null){jmd(a.Kc,a.c);a.c=null}aIc(a);mmd(a.Kc,a);GPe(a,null);a.Lc>-1&&Smd(a.Kc)} +function V6c(a){Oif(a.e,HQc(a.a));Ypb(jgc(kgc(new wgc(null,new gdc(a.b.d.a,16)),new agf)),1)&&c7c(a.c)} +function g_e(a,b){var c;if(!a.f){nJc(a,false,b);return}c=a.f.Xb;MKc(a.f,'_');nJc(a,false,b);MKc(a.f,c)} +function UXe(a,b,c,d){var e;if(b==null){return}if($1b(b,a.Pb.c)){return}e=fLg(a.Mc.j,b,c,d);VXe(a,b,e)} +function Iod(a,b,c,d){if(b>=0){c.a+='\xB1 ';O4b(c,yod(a,b,d));return}c.a+='\u2213 ';O4b(c,yod(a,-b,d))} +function Evd(a,b,c,d,e,f,g,h){Wud(a,b,f,c,e);a.f||(b.a+=' ',b);b.a+=h;a.f||(b.a+=' ',b);Wud(a,b,g,d,e)} +function S3f(a,b,c){var d;d=Hpd(a.d,b,false,0);if(!d){return ''}return d.ll(c?(Sud(),oud):(Sud(),Dud))} +function e5f(a,b,c,d,e){var f;f=Hpd(a.d,b,false,0);if(!f){return}f.$o((Huc(),Vuc(c,d,e,255)));zLc(f,1)} +function x_f(a,b){var c,d;c=w_f(a,b);d=h_f(c);if(d==null){throw Qpb(j_f(b,c,'double'))}return nhc(d),d} +function dlf(a,b){var c,d;d=a.d;for(c=0;c36){return 0}if(a<0||a>=b){return 0}return c=a-10,(c<0?48+a:97+c)&Q4g} +function m3e(a){var b,c;c=r3e(a);if(ff(c,272)){return c.hv()}b=new s8d(a.Mc,NaN);return new Ebe(a.Mc,b)} +function wte(a,b,c,d,e){var f;f=e;if(d){O7d(d,'x',e);f=d}return new u8d(a,f,(_8f(),u7f),new cge(a,b,c))} +function SZe(a,b,c){var d;j9b(a.k,b,c);UYe(a,c);a.r=true;for(d=0;d=0;b--){z4g(a.t,b)}CWg(a.C);XGg(a,null)} +function AVg(a){if($1b(Knh,a.a._B(FHh))||ptg('GeoGebraDebug')!=null){qlg(new zVg);plg(ptg('logLevel'))}} +function d2b(a){if($1b(typeof(a),P4g)){return true}return a!=null&&a.$implements__java_lang_CharSequence} +function Anc(a){if(a[0]==null){throw Qpb(new Tkc)}return a.length*a[0].length<=g7g?new Rmc(a):new anc(a)} +function sIc(a,b){if(a.zb==null){return a.yl(b)}if(m4b(a.zb,G4b(37))<0){return a.zb}return SLe(a.zb,a,b)} +function TNb(a,b,c){var d;if(a.c==b.c){d=a.c;return d.ie(a.b,b.b,(c<2?1:c<4?1:c<6?0.7:0.5)*iOb)}return 0} +function t3b(a){var b;if(a<0){return V4g}else if(a==0){return 0}else{for(b=d7g;(b&a)==0;b>>=1);return b}} +function d2c(a){var b,c;if(!a.k){return 0}c=a.k.b+(lVc(a.n)?0:10)+a.k.a;b=x2c(a.a);return a.a.o&&b>c?b:c} +function Rhc(a,b,c,d){ttc(b);Eic(c,d);a.i=c;a.g=d;a.f=b;a.e=jtc(itc(a.e,500));a.d=jtc(a.d);return _hc(a)} +function n0d(a){a.V=me(fY,qnh,13,1,0,1);a.V[0]=!a.a?a.b:a.a;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.c);Xvc(a)} +function oGc(a,b){var c,d;d=me(JY,Roh,33,5,0,1);for(c=0;c<5;c++){d[c]=b[c]}return BLd(Kod(a.a.K),null,d)} +function Ke(a){var b,c,d;b=~a.l+1&B5g;c=~a.m+(b==0?1:0)&B5g;d=~a.h+(b==0&&c==0?1:0)&C5g;return ue(b,c,d)} +function qjd(a){var b;b=new h5b;b.a+=zvh;wjd(b,a.b);O4b(b,MOf(a.b));wld(a.c,b,false);b.a+=Avh;return b.a} +function LCc(a){var b;b=m9b(a.Jb.q,me(z0,{3:1,4:1,7:1,10:1,9:1,273:1},503,0,0,1));TBc(a,a.Jb.q);return b} +function Pwd(a,b){if(ff(b,350)||b.Bn()){return Owd(a.Kc,b)}if(b.en()){return new j$e(a.Kc)}return b.Bk()} +function PHd(a,b,c){if(a.n){!!a.F&&g9b(a.F.tz(),a);a.F=null}!a.F&&(a.F=new T0e(a.Kc,true));a.F.Ps(b,c,1)} +function eQd(a,b){var c;kwc.call(this,a);this.a=b;c=b.hv();this.b=new qWe(this.Kc,c);dQd(this);cQd(this)} +function xFd(a,b,c,d){qFd.call(this,a);this.b=c;this.c=d;this.a=pFd(a);uFd(this);wFd(this);JKc(this.a,b)} +function UKd(a,b,c){kwc.call(this,a);this.d=new N4e(a);wKc(this.d,b);SKd(this);c&&(this.d.r=0);PKd(this)} +function DSd(a){var b;for(b=0;bb.ti()?-1:1}return c<0?-1:1} +function f6b(a){C5b();if(!isNaN(a)&&!isFinite(a)||isNaN(a)){throw Qpb(new _3b(Ilh))}return new X5b(''+a)} +function JZd(){JZd=xqb;GZd=new KZd(bzh,0);HZd=new KZd('UNION',1);FZd=new KZd(czh,2);IZd=new KZd('XOR',3)} +function ncd(){lcd();return pe(ie(YE,1),I7g,362,0,[$bd,bcd,ccd,dcd,hcd,gcd,fcd,ecd,acd,icd,kcd,jcd,_bd])} +function XRb(){VRb();return pe(ie(hm,1),I7g,361,0,[JRb,ORb,IRb,KRb,PRb,MRb,LRb,RRb,QRb,NRb,SRb,TRb,URb])} +function Nje(){Hje();return pe(ie(oS,1),I7g,358,0,[Gje,Eje,uje,Aje,zje,vje,Fje,wje,Dje,yje,xje,Bje,Cje])} +function XQe(a){var b;b=pe(ie(sf,1),g9g,5,15,[a.ab[0],a.ab[1],a.ab[2],a.ab[3],a.ab[4],a.ab[5]]);return b} +function K3e(a,b){var c,d,e,f,g;g=new j$e(a.Kc);for(d=b,e=0,f=d.length;e=Xoh){c=Yod(a.pb,b-Xoh);return !c?'':c.p}else{d=oBc(b);return YPg(a.B,d)}} +function Oug(a){var b;if(!a.e){return a.f}b=$wnd.goog.global.parseInt(a.e.C[TFh],10)|0;return b==0?a.f:b} +function Pug(a){var b;if(!a.e){return a.g}b=$wnd.goog.global.parseInt(a.e.C[SFh],10)|0;return b==0?a.g:b} +function PRg(a,b){var c;c=VDb(a.b,b);if(c!=null){return pf($wnd.Math.floor(c.currentTime*pih))}return -1} +function n0e(a,b){var c,d,e;d=b.Fp();c=Qeg(d);e=$wnd.Math.sin(d);s0e(a,a.Z*c-a.$*e,a.Z*e+a.$*c,a._,true)} +function PXe(a,b){if(!a.c[b]||rJc(a.c[b])){return}TXe(a,null,b);QJc(a.c[b]);Vpd(a.Mc,a.c[b]);a.c[b]=null} +function sOf(a,b){if(!mPf(a.pb.j,(WQf(),IQf))){return}!a.R&&(a.R=new S7c(a.cb));b||j8c(a.R.f);O7c(a.R,b)} +function DSf(a,b,c){if(a.u==b){return}a.u=b;GSf(a,z4b(a.d,0,2));$qd(c.pb,false);cQf(c);!!c.cb&&mQc(c.cb)} +function eTg(a,b,c){b.readyState==4&&(b.status==200?bTg(a,new $wnd.Uint8Array(b.response)):dTg(c.a,c.b))} +function e4b(a,b,c){var d,e;e=me(rf,b5g,5,c*2,15,1);d=0;while(c-->0){d+=y2b(a[b++],e,d)}return K4b(e,0,d)} +function Bub(a,b){var c,d;for(d=new t9b(a.a);d.axlh){return k9g}else if(b<-3.4028234663852886E38){return h9g}return b} +function aMc(a){var b;if(!!(b=rMc(a))||!!(b=nMc(a))){return b}a.r&&!!a.s&&QJc(a.s);a.s=null;return jMc(a)} +function _dc(a,b,c){var d,e;d=new qec(b,c);e=new rec;a.b=Zdc(a,a.b,d,e);e.b||++a.c;a.b.b=false;return e.d} +function J6c(a,b){var c,d;c=E7c(a.b,b);K6c(a,c);d=c.b;d.a>a.a.a.Lc&&l7c(a.c,a.a,c.a.c,a.a.a.Lc,c.a.a,d.c)} +function v7c(a,b){var c;if(!b.b||_ef(b.b.b)){return -1}c=$wnd.Math.abs(b.a.b.c-b.b.b.c);return NQc(a.a,c)} +function w7c(a,b){var c;if(!b.c||_ef(b.c.b)){return -1}c=$wnd.Math.abs(b.a.b.c-b.c.b.c);return NQc(a.a,c)} +function Znc(a){if(a.a.i.length==0){return a.c.a}else{b9b(a.a,a.a.i.length-1);return null.pD()+null.pD()}} +function $ld(a,b,c){var d,e;d=b.lb;e=!d?c9b(a.n,b,0):c9b(a.n,d,0);if(e>=0){return Zld(a,e,c)}return false} +function zOc(a){var b,c;for(c=new t9b(a.w);c.ag||d+e>f){throw Qpb(new S1b)}} +function Kyc(a,b,c,d){if(Lyc(a,b,c,d)>=0){return true}return !!a.n&&Drg(a.n,b-d,c-d,2*d,2*d)&&a.Fj(b,c,d)} +function YCc(a,b,c,d){if(d){return wBc(a,c,fSc(b,a.B),1)}return xBc(a,c,fSc(b,a.B),1,false,b.i.length==1)} +function vOc(a,b){return b[0]>=0&&b[0]<=pf(a.f.e.C.width/a.f.p)&&b[1]>=0&&b[1]<=pf(a.f.e.C.height/a.f.p)} +function LQh(a){return vSf(this.Kc.M.j.B,Axh,Kyh,pe(ie(mu,1),h5g,2,6,[this.V[0].yl(a),this.V[1].yl(a)]))} +function Ae(a){var b,c,d;b=~a.l+1&B5g;c=~a.m+(b==0?1:0)&B5g;d=~a.h+(b==0&&c==0?1:0)&C5g;a.l=b;a.m=c;a.h=d} +function nxd(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.d;a.V[1]=a.e;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.a);Xvc(a)} +function uFd(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.b;a.V[1]=a.c;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.a);Xvc(a)} +function LId(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.b;a.V[1]=a.c;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.d);Xvc(a)} +function UBd(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.c;a.V[1]=a.b;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.d);Xvc(a)} +function UNd(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.c;a.V[1]=a.b;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.a);Xvc(a)} +function FId(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.c;a.V[1]=a.e;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.f);Xvc(a)} +function _Kd(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.c;a.V[1]=a.a;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.b);Xvc(a)} +function ZKd(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.d;a.V[1]=a.b;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.c);Xvc(a)} +function CJd(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.a;a.V[1]=a.b;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.c);Xvc(a)} +function aOd(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.a;a.V[1]=a.b;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.d);Xvc(a)} +function nVd(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.a;a.V[1]=a.b;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.e);Xvc(a)} +function uVd(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.a;a.V[1]=a.c;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.b);Xvc(a)} +function J_d(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.a;a.V[1]=a.b;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.g);Xvc(a)} +function E2d(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.a;a.V[1]=a.b;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.f);Xvc(a)} +function tQd(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.e;a.V[1]=a.j;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.f);Xvc(a)} +function tYd(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.c;a.V[1]=a.d;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.e);Xvc(a)} +function q3d(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.e;a.V[1]=a.d;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.a);Xvc(a)} +function FXd(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.i;a.V[1]=a.a;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.j);Xvc(a)} +function e2d(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.i;a.V[1]=a.e;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.j);Xvc(a)} +function g2d(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.b;a.V[1]=a.a;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.c);Xvc(a)} +function Xpe(a){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.a;a.V[1]=a.f;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.n);Xvc(a)} +function kkf(a,b,c,d,e){fkf();lkf(b,c,d);Wjf(e,a,e.a);switch(2){case 2:Wjf(e,c,1);Wjf(e,d,2);Wjf(e,b,3);}} +function Hcf(a,b,c,d){Exd.call(this,a);this.c=b;this.g=c;this.j=d;Ecf(this);Fcf(this);Xvc(this);Ccf(this)} +function uge(a,b){var c;this.b=me(sf,g9g,5,b,15,1);for(c=0;ca.Ac?pf(a.f.e.C.width/a.f.p)+1:b0&&hqg(a.a,new tqg(d.Eq()))} +function sgd(a,b,c,d){var e;e=Sqe(b,d,new AVf);e?c.bp(e):Z8b(a.B.o,'Invalid condition to show object: '+d)} +function WBg(a,b,c,d,e){d.b==null||d.b.complete?c.Dh(b):a.b==0&&iCg(d).addEventListener(VFh,new ZBg(a,e))} +function _nc(a,b){if(b.length!=a.d.length){throw Qpb(new zkc(b.length,a.d.length))}n5b(b,0,a.d,0,b.length)} +function zKg(a){if(!uxe){Uc(8,new IKg(a));throw Qpb(new jye('Prover commands not loaded yet'))}return uxe} +function YUg(a,b){if($wnd.window.canvas2pdf!=null){return new $wnd.canvas2pdf.PdfContext(a,b)}return null} +function Xkd(a){if(a.Jn((_8f(),v7f))){return true}if(a.Jn(E7f)||a.Jn(p8f)){return ff(a.o,234)}return false} +function QSe(a,b){var c;if(!b.Um()){return Xcg(),Ucg}c=b;if(ojf(a.a,c.a)){return gRe(a,b)}return Xcg(),Ucg} +function dge(a,b){var c;if(a.k==Aph){return !b.t&&(b.t=new hge(b,Aph,Zvh)),b.t}c=new ige(a);c.j=b;return c} +function PSe(a,b){var c;c=new O0e(a.Kc);uRe(a,c);ysd((!c.H&&(c.H=new Asd),c.H),b);uRe(a,c);L0e(c);return c} +function zge(a,b){var c;c=new t9b(a.b);while(c.a>16&255)+','+(a.b>>8&255)+','+(a.b&255)+','+(a.b>>24&255)/255+')',b} +function Yyg(a){var b;b=$wnd.Math.min(a.f.e.C.width,a.f.e.C.height);return Ezg($yg(a,512/b,false,false),6)} +function jNc(a){var b,c,d;for(c=new t9b(a.w);c.aa.Jc?-1:b0.1;a.Mw($wnd.Math.sin(a.k));a.i=0;b&&Scg(a.k)&&a.Mw(0);return a} +function C6e(a,b){var c,d;c=0;do{++c;d=b+(''+zpd(a.b.M,c+'',(Sud(),oud)))}while(!Rld(a.b,d,false));return d} +function _0c(a){var b;b=a.j.Bs();if(!Scg(llf(b))){a.c=false;return false}i1c(a.e,b.f[0],b.f[1]);return true} +function pre(a){var b,c;b=a.Xb;c=b!=null?b:Vad(a.Gb);return c!=null&&Nhg((uhc(0,c.length),c.charCodeAt(0)))} +function $qf(a){Pmf();var b;b=m4b(a,G4b(125));if(b>0){return n4b(a,G4b(95),b)>=0}return a.indexOf('.')!=-1} +function Zof(a){var b;b=a.D;if(sqf(a,32)){a.D=b;if(sqf(a,33))return true}if(kof(a))return true;return false} +function zif(a,b,c){var d;if(!(ide(c.c)&&Pcg(c.a,c.c,t9g))){return new off(k9g,h9g)}d=c.c;return yif(a,b,d)} +function Imf(a,b,c,d,e){var f,g;f=new u8d(a,b,(_8f(),v7f),new cde(a,c));g=d?V8f:L7f;return new u8d(a,f,g,e)} +function q5f(a,b){var c;c=new RPg(b);N6f(c,ovh,new SPg(new s6f(a.b)));N6f(c,'fontSize',new SPg(new M6f(a)))} +function KWe(a){a.g=true;a.j=0;a.k=new i5b;a.e=false;a.a=new _lf(1,0,0);a.b=new _lf(0,1,0);new bmf(3);gmf()} +function J6d(a,b){if(a.o.Lm()&&a.o.q==b&&!a.o.a){a.s=a.o.s;a.o=new u8d(a.k,a.o.o,(_8f(),O8f),null);a.q=m8f}} +function jff(a,b){if(a.c>a.a||b.c>b.a){a.c=k9g;a.a=h9g;a.b=false}else{a.c-=b.a;a.a-=b.c;lff(a,b.b)}return a} +function cgg(a,b){a.e=new h5b;a.f=0;a.c=true;egg(a,b,agg);fgg(a,g5b(a.e).a);a.d.b||dgg(a);return g5b(a.e).a} +function lpg(a,b,c,d,e){cpg(a,1,4);a.d[a.c++]=2;a.b[a.a++]=b;a.b[a.a++]=c;a.b[a.a++]=a.e=d;a.b[a.a++]=a.g=e} +function lke(a){if(a.a.length<2){return false}return h4b(Q8g,z4b(a.a,0,2))&&(a.a.length<=2||a4b(a.a,2)!=95)} +function Nxg(a){if(QKg(a.f)&&!hgc(new wgc(null,new gdc(a.Jb.k,16)),new Txg)){PNc(a.kc).pD();PNc(a.kc).pD()}} +function wKg(a){if(!rxe){Uc(5,new FKg(a));throw Qpb(new jye('Advanced commands not loaded yet'))}return rxe} +function yKg(a){if(!txe){Uc(3,new DKg(a));throw Qpb(new jye('Discrete commands not loaded yet'))}return txe} +function C1g(b){y1g();try{return b!=null&&iIh in b}catch(a){a=Ppb(a);if(!ff(a,38))throw Qpb(a)}return false} +function tAb(a){rAb();var b,c,d,e;for(c=uAb(),d=0,e=c.length;d=0&&a[d]==b[d];d--);return d<0?0:_pb(Spb(a[d],Llh),Spb(b[d],Llh))?-1:1} +function jFg(a,b,c){var d;(c.a[e9g]|0)==13&&BYe(b,(d=a.d.C[Yph],d==null?null:''+d),pe(ie(mu,1),h5g,2,6,[]))} +function Cmc(a,b){var c,d,e;tnc(a,b);d=a.Xg();e=me(sf,g9g,5,d,15,1);for(c=0;ckoh||d>$wnd.Math.abs(b)*koh||d>$wnd.Math.abs(c)*koh)} +function qig(a){var b;b=$1b(fvb((EIe(),wDe)),W6d(a.Gb).i)?IGe:wDe;xNb(W6d(a.Gb),b.j!=null?b.j:''+b.k);f3e(a)} +function NKg(a,b){if(c9b(a.c,b,0)==-1&&!$1b(b.gv(),VDb(a.a,b))){Z8b(a.c,b);$Db(a.a,b);a.g!=null||PAg(a,700)}} +function FAg(a,b){if(b==a.u){return}!!b&&oyg(b);!!a.u&&EAg(a,a.u);a.u=b;if(b){z1g(a.xC(),a.u.aC());qyg(b,a)}} +function rwb(a,b){if(b<0||b>=a.d.i.length){return false}return !!a.f&&!!a.f.ld()&&a.f.ld().e&&b9b(a.d,b).nd()} +function FOg(a,b){var c;c=(mhg(),b==null||b.length==0?null:Hpd(a.d,b,false,0));return !!c&&pUf((XOf(a.b),c))} +function EDb(a,b,c){zDb();var d;d=JDb(a-$wnd.Math.floor(a/360)*360+360)/360;return jZb((_Yb(XYb),ADb(d,b,c)))} +function L_b(a,b,c,d,e,f,g){a.m00_=b;a.m10_=c;a.m01_=d;a.m11_=e;a.m02_=f;a.m12_=g;a.setTransform(b,c,d,e,f,g)} +function BOb(a,b,c){a.c=b;if(!c){a.c.d+=pf(Sih*a.d);a.c.a+=pf(Sih*a.d);a.c.b+=pf(Sih*a.d);a.c.c+=pf(Sih*a.d)}} +function G4f(a,b){var c,d;for(c=120;c<=122;c++){d=c-120;N6f(b,String.fromCharCode(c),new O6f(new B6f(d,a)))}} +function bEc(a,b,c){var d;if(c.en()){d=NNc(a.kc,c);if(ff(d,448)){j2c(d,b.f.a,b.f.b);return true}}return false} +function RNc(a){var b,c,d;b=QNc(a);if(b!=null){c=b[1];d=b[3];return pf(d-c+2)}return pf(a.f.e.C.height/a.f.p)} +function Ync(a){var b,c;c=me(Ky,W4g,812,a.a.i.length,0,1);for(b=0;b=0&&c.b>=0){return c}return null} +function Z8e(a){U8e();var b,c,d,e;for(c=$8e(),d=0,e=c.length;d=0;c--){b=Adc(a.kb,c);UXe(b,b.Pb.c,0,0);vLc(b,false)}} +function DUf(a){var b,c;for(c=0;ckoh&&a=a.a&&WUf(a,d+1);c>=a.c&&XUf(a,c+1);(!!b||b9b(a.b,c*a.a+d)!=null)&&j9b(a.b,c*a.a+d,b)} +function BPg(a,b){var c,d;d=tAb(b.a[e9g]|0);c=aSf(a,d,!!b.a[SGh],GPg(b.a),!!b.a[AGh]);c&&b.a.preventDefault()} +function bTg(a,b){var c;c=(m5b(),Xpb(Date.now()));$wnd.window.fflate.unzip(b,yqb(qTg.prototype.dD,qTg,[a,c]))} +function _Rb(a,b){var c;c=Yc(b.q).Pd(b);a.d=c?BKb(c):new XGb;a.c=new HKb(pe(ie(Zg,1),Z4g,41,0,[]));return true} +function ebc(a){var b;this.a=(b=a.e&&a.e(),new nbc(b,Sgc(b,b.length)));this.b=me(gu,Z4g,1,this.a.a.length,5,1)} +function Fqg(a,b){Eqg();this.e=a.c;this.f=a.d;this.d=a.b;this.b=a.a;this.a=b;(this.d<0||this.b<0)&&(this.c=6)} +function _Ue(a,b){UUe();QUe.call(this,a);this.a=true;this.c='';this.r=b;this.o=250;this.n=48;LUe(this,250,48)} +function U$f(a){this.k=a;this.j='';this.i=-1;this.a=new f_f;this.n='';this.d='';this.b='';this.g='';this.e=-1} +function Q0g(a){var b,c;if(a.a){try{for(c=new t9b(a.a);c.a=0){return c}for(b=0;bc&&(c=d)}return c} +function mTc(a){var b,c;b=a.a.a-a.b.a;c=a.a.b-a.b.b;a.c==(vTc(),tTc)?(c=0):a.c==uTc&&(b=0);return new jvc(b,c)} +function oCc(a,b){var c;for(c=1;c=0&&b0){return true}}return false} +function Ovd(a){switch(a.B.k){case 3:return '\\neq';case 4:return '<>';case 2:return '!=';default:return D8g;}} +function pNd(a,b,c,d,e,f,g,h){var i,j;i=new OYd(a.a,c,d,e,f);j=i.a;g?(j.Cc=5):h||(j.Cc=6);f&&JKc(j,b);return j} +function eqd(a,b){var c,d;if(a.S){for(d=new t9b(a.rb);d.a=2&&(b.a+='\t9){return}d=Hpd(a.d,b,false,0);if(!d){return}if(ff(d,303)){d.Uy(c);d.yp()}} +function o5f(a,b,c,d){var e;e=Hpd(a.d,b,false,0);if(e){e.Nm()&&(c?e.Nm()&&(e.Nb=c):(e.Nb=false));ucd(e,a.b,d)}} +function lCc(a,b,c,d,e){b!=null?BDc(a,b):e||SBc(a);!!d&&$Fc(d,(Y1b(),c||b!=null?true:false));return c||b!=null} +function hQg(a,b){var c;c=new $wnd.Object;c.xml=a;c.objects=b;c.thumbnail=null;c.title=null;c.order=0;return c} +function C3g(a,b){var c,d;c=(d=b.C[YGh],d==null?null:''+d);$1b(VFh,c)&&(a.a=new D3g(a,b),qWg((kWg(),jWg),a.a))} +function RKg(a,b){!!jlg&&klg(jlg,(Clg(),vlg),'calling function: '+a+'('+b+')');MPg(a,pe(ie(gu,1),Z4g,1,5,[b]))} +function lCb(a,b,c,d){a.r=b.c;if(a.n){h_b(b,a.n);a_b(b,new F$b(c,d-a.q,a.u,a.q+a.o))}!a.p?h_b(b,a.r):h_b(b,a.p)} +function Ssg(a,b){if(a.a==a.b||b<=a.e){return a.a}if(b>=a.f){return a.b}return a.a+(b-a.e)*(a.b-a.a)/(a.f-a.e)} +function Tpb(a,b){var c;if(jf(a)&&jf(b)){c=a-b;if(!isNaN(c)){return c}}return He(jf(a)?kqb(a):a,jf(b)?kqb(b):b)} +function Uif(a,b){a.d=P6c(a.b);xff(a.f,b,a.a?fzg(a.a.a):a.e);a.b.d.a.i.length=0;vff(a.f,new Zif(a));Oqb(a.c,b)} +function E_b(a,b){a.ggbDevicePixelRatio=b;a.setTransform(b*a.m00_,b*a.m10_,b*a.m01_,b*a.m11_,b*a.m02_,b*a.m12_)} +function Kdc(a){var b;b=a.a.i.length;if(b>0){return Idc(b-1,a.a.i.length),b9b(a.a,b-1)}else{throw Qpb(new _ac)}} +function Ldc(a){var b;b=a.a.i.length;if(b>0){return Idc(b-1,a.a.i.length),f9b(a.a,b-1)}else{throw Qpb(new _ac)}} +function EWg(b){try{return !!b&&!!b['nodeType']}catch(a){a=Ppb(a);if(ff(a,38)){return false}else throw Qpb(a)}} +function wQb(a){var b;while(a.o32){return}else{++a.o}}} +function rCc(a,b){var c,d;yUf(a.Jb,b);d=NNc(a.kc,b);if(d){c=d.Vj();a.kc.Cb=(kBc(),jBc);pPc(a.kc,c);jQc(a.kc,b)}} +function nWc(a,b,c,d){var e;e=new _lf(a.s.cb.f[0],a.s.cb.f[1],0);iSe(a.s,e);k0d(a.s,b,c,d);slf(e,-1);iSe(a.s,e)} +function RCc(a){var b;b=m9b(a.Jb.I,me(F0,{3:1,4:1,7:1,10:1,246:1,9:1,1611:1},504,0,0,1));TBc(a,a.Jb.I);return b} +function fJc(a,b){if(a.rc&&SOf(a.ub)==27){return Vuc(b.b>>16&255,b.b>>8&255,b.b&255,(b.b>>24&255)/2|0)}return b} +function dKc(a,b){if(!a.Kb||b<0||b>1){return}a.ob=b;a.Kb=Vuc(a.Kb.b>>16&255,a.Kb.b>>8&255,a.Kb.b&255,pf(255*b))} +function ned(a,b){if(!!b&&b.a<9999&&b.b<9999){oed(a);return b.b>=a.f&&b.b<=a.d&&b.a>=a.e&&b.a<=a.c}return false} +function vXc(a){if(!a.xb.Em()||!u$e(a.j)&&a.xb.ul()!=(i3f(),I2f)||!zJc(a.xb)||!a.e){return null}return nRc(a.e)} +function oQc(a){if(BOc(a)&&!!a.Dc){a.Dc.Bv(a.Cc,true);a.Bc.Bv(a.Ac,true);a.Mc.Bv(a.Lc,true);a.Kc.Bv(a.Jc,true)}} +function tZc(){tZc=xqb;YXc();qZc=new Vog(2,0,0);sZc=Fac(new NZc,(Nac(),Nac(),Lac));rZc=Fac(new OZc,(null,Lac))} +function zfc(){zfc=xqb;wfc=new Afc('CONCURRENT',0);xfc=new Afc('IDENTITY_FINISH',1);yfc=new Afc('UNORDERED',2)} +function mwd(a,b,c){Sud();var d;d=new gwd(sxh+a+txh+b+','+c);d.g=true;d.a=c;_vd(d,a);d.o=new QUg('',b);return d} +function ijd(a,b){var c,d;d=Y2b(Tbc(b,xph),10);VWf(a,fUc(d));(c=a,Y1b(),h4b(Knh,Tbc(b,iah)),c).UA();return true} +function lqd(a){var b,c,d,e,f;b=a.L;c=!b?50:b.Ec;d=!b?50:b.Nc;f=cb){d=b/a;c=a*$wnd.Math.sqrt(1+d*d)}else{d=a/b;c=b*$wnd.Math.sqrt(1+d*d)}return c} +function Pef(a,b){if(a.c>a.a||b.c>b.a){a.c=k9g;a.a=h9g;a.b=false;return a}a.c+=b.c;a.a+=b.a;lff(a,b.b);return a} +function jUf(a){var b,c,d;d=new PYb;for(c=new t9b(a.k);c.a=R4g){return R4g}return pf(b?$wnd.Math.ceil(a):$wnd.Math.floor(a))} +function ptg(a){if($1b('',(t1b(),q1b).search)){return null}return (new $wnd.URLSearchParams(q1b.search)).get(a)} +function nJe(a,b){if(!A6d(b,(Sud(),Bud)).In()){throw Qpb(new fye(a.b.j.B,(yTf(),hTf),pe(ie(mu,1),h5g,2,6,[])))}} +function ihc(a,b,c){if(a>b){throw Qpb(new l3b(n5g+a+o5g+b))}if(a<0||b>c){throw Qpb(new V1b(n5g+a+p5g+b+q5g+c))}} +function k$e(a,b){BLc.call(this,a);LYe(this);sKc(this,true);this.k=new o9b(b);this.c=new o9b(b);PZe(this,false)} +function $mc(a,b){Hmc.call(this,a,b);this.e=a;this.d=b;this.b=(a+52-1)/52|0;this.a=(b+52-1)/52|0;this.c=bnc(a,b)} +function BNb(a,b,c,d,e,f,g,h,i){this.i=a;this.f=b;this.k=c;this.a=d;this.b=e;this.j=f;this.g=g;this.c=h;this.e=i} +function ASh(){return this.r||BIc(this)!=this.lb||!this.lb&&(!this.Db||!cPe(this.Db))&&this._b||ff(this.lb,244)} +function jug(){jug=xqb;iug=pe(ie(mu,1),h5g,2,6,['miter',nlh,'bevel']);hug=pe(ie(mu,1),h5g,2,6,['butt',nlh,nhh])} +function xRb(){tRb();return pe(ie(am,1),I7g,321,0,[hRb,iRb,oRb,pRb,nRb,lRb,fRb,kRb,jRb,rRb,qRb,gRb,eRb,sRb,mRb])} +function yVc(a){a.j=pe(ie(sf,1),g9g,5,15,[1,0]);a.o=pe(ie(sf,1),g9g,5,15,[0,0]);ff(BIc(a.b),244)&&(a.a=BIc(a.b))} +function UTg(a){a.a.setAttribute(HHh,''+PTg(a.a,'x',true));a.a.setAttribute('data-scaley',''+PTg(a.a,'y',true))} +function Xvd(a,b){switch(a.B.k){case 2:return hwd(t4b(b,'$',''));case 3:return t4b(b,'$',g5g);default:return b;}} +function bod(a){var b,c;b=a.si();if(a.xn()||!a.Ei()){return (new eQd(b,a)).b}c=new pWe(b);$Ve(c,a.hv());return c} +function z5d(a,b){var c,d;c=$6d(a.o,b);d=$6d(a.q,b);if(!c){return d}else if(!d){return c}else{CYb(c,d);return c}} +function TLb(a,b){var c,d,e,f;f=b.k;e=b.i;c=ONb(f,a.a,e);a.j==1&&e<2&&(d=c.c,!!d.le(c.a))&&(c=WNb(c,e));return c} +function MBc(a,b,c){var d,e,f;e=a.K.o;f=new z$d(e,c);lmd(e,f);d=kGc(e,b,f.b);d.Cc=2;qRe(d);tLc(d,false);return d} +function Eie(a,b,c){Aie();zie.a.i.length=0;zie.c.i.length=0;Z8b(zie.a,a);Z8b(zie.c,b);zie.d=0;zie.b=c;return zie} +function N9b(a){var b,c,d,e,f;f=1;for(c=a,d=0,e=c.length;d=a.k.i.length-1&&a.qb>0){a.qb=-a.qb;return}if(a.B==0&&a.qb<0){a.qb=-a.qb;return}a.B+=a.qb} +function Ssb(a,b,c){var d;d=a.e[b];while(d.c>a.k){if(!d.d){d=d.d=new jtb;break}d=d.d}d.c=a.k+c-a.p;d.b=a.C;d.a=c} +function rqf(a,b,c){var d;d=a.i[b];while(d.c>a.p){if(!d.d){d=d.d=new frf;break}d=d.d}d.c=a.p+c-a.s;d.b=a.I;d.a=c} +function JMe(a,b){var c,d,e,f;d=b.Fp();c=$wnd.Math.cos(d);e=$wnd.Math.sin(d);f=a.Z*c-a.$*e;a.$=a.Z*e+a.$*c;a.Z=f} +function ZLe(a,b){var c;c=b;bMe(a,c.Om()?c.e:c.Fp(),true);b.Ei()||!b.kl()||h7d(b.kl())?(a.Gb=b.kl()):(a.Gb=null)} +function K4e(a){var b;!a.vc?(a.vc=new n9b):(a.vc.i.length=0,undefined);b=vIc(a,a.s);t4e(b,a.g,false);Z8b(a.vc,b)} +function I_f(a){var b;b=N_f(a);if(b==(Y_f(),W_f)){L4b(a.a,44)}else if(b!=U_f){throw Qpb(new r_f(LEh))}O_f(a,S_f)} +function s4f(a,b){var c;c=Hpd(a.d,b,false,0);if(!c){return false}if(c.Sm()){return !!c.O&&zJc(c.O)}return zJc(c)} +function ljg(a,b){var c,d;d=b.o;c=b.f;if(!d&&!c&&b!=a.a){return}d?(d.f=c):(a.a=c);!!c&&(c.o=d);b.f=null;b.o=null} +function rff(a,b,c,d){var e;if(c>=d){return new Agc}return e=new Gfc(c),Lfc(Kfc(new Mfc(null,e),d),new Aff(a,b))} +function T6c(a){Uif(a.e,HQc(a.a));Ypb(jgc(kgc(new wgc(null,new gdc(a.b.d.a,16)),new agf)),1)&&c7c(a.c);a.d=false} +function JCc(a){var b;b=m9b(a.Jb.p,me(i_,{3:1,4:1,7:1,10:1,121:1,9:1,4259:1},4260,0,0,1));TBc(a,a.Jb.p);return b} +function Adg(a){xdg();var b,c,d,e;for(c=Bdg(),d=0,e=c.length;d0&&(this.C.style[tih]=c+fGh,undefined)} +function AQb(a,b,c,d){ZOb(this);this.q=new S8b;this.s=new S8b;this.n=a;this.i=a.length;this.j=c;this.o=b;this.e=d} +function QVg(){var a,b;if(MVg.i.length==0){for(b=new t9b(LVg);b.a=d||b0?$wnd.Math.max(bqh,c):$wnd.Math.min(Yqh,-c)} +function XPf(a,b,c,d,e,f){var g;g=(!a.Jb&&(a.Jb=(new OQg(a),NYf())),a.Jb).c;uWf(g,d);kWf(g,e);tWf(g,f);WPf(a,b,c)} +function wzg(a,b){if(!!a.r&&wqg(a.r,b)){return}Lyg(a.d);a.r=b;avg(a.f,b);a.Ib?uQc(a):(Bzg(a),lQc(a));EPc(a,false)} +function EAg(a,b){if(a.u!=b){return false}try{qyg(b,null)}finally{a.xC().removeChild(b.aC());a.u=null}return true} +function eHg(a,b){if(!a.f){a.f=true;hyg(a,new u4g(a),(N_g(),N_g(),M_g))}return iyg(a,b,(!GIg&&(GIg=new V_g),GIg))} +function ETe(a,b,c){nTe(a,b,c);a.a=Pcg(dTe(a,0).Cg(b),dTe(a,0).Cg(c),Amh)&&Pcg(dTe(a,1).Cg(b),dTe(a,1).Cg(c),Amh)} +function djg(a,b,c,d){fjg(a,b,d);c.u==0&&fjg(a,c,d);if(b.j==c.j){b.j=-1;c.j=-1}else b.j0&&(b.a+=Awh,b);T4b(b,c[d])}return b.a} +function yub(a){var b;for(b=0;b=a.c){throw Qpb(new S1b)}--a.c;for(c=b;c=0;c--){b=(mhc(c,a.i.length),a.i[c]);b.ln()&&(b.vi(),true)&&f9b(a,c)}} +function tYc(a){var b;if(a.xb.zn()){b=sIc(a.xb,(Sud(),oud));if(!$1b(b,a.f)){a.f=b;a.Bb=b}}hVc(a,pf(a.Pb.sb*a.b.s))} +function YUc(a,b){if(!a.v){return}a.p=a.Qb+a.v.a+a.Hq();a.q=b?a.Rb+((a.v.b-a.Iq())/2|0):a.Rb;a.r=a.Jq();a.o=a.Iq()} +function dUg(a,b){a.a.readyState==4&&(a.a.status==200?b._A(a.a.responseText):b.$A(a.a.status+':'+a.a.statusText))} +function fKg(a,b){this.e=a;this.c=b;this.b=a.j;this.a=new Bjd;this.d=(!this.d&&(this.d=this.e.Ot(this.c)),this.d)} +function xif(){this.a=new Dhf(this);this.c=new Bif(this);this.b=new Thf(this);this.d=new Hff(this);this.e=new Gif} +function uvg(a){this.b=new cEb;if(a!=null){this.a=a[_8g];delete a[_8g];Ahc(a,yqb(vvg.prototype.Ag,vvg,[this,a]))}} +function fed(){fed=xqb;eed=new cEb;ZDb(eed,'a',w3b(0));ZDb(eed,'b',w3b(1));ZDb(eed,'f',w3b(3));ZDb(eed,'c',w3b(2))} +function yZe(a){return a.k.i.length!=0&&!ugc(kgc(new wgc(null,new gdc(a.k,16)),new Vec(new q$e))).lg((ggc(),fgc))} +function TLd(a,b,c){var d,e;e=RLd(a,b,c);if(e){return e}d=new $Qd(a.a,b,c);d.W=false;lmd(d.Kc,d);gLd(a,d);return d} +function VLd(a,b,c){var d,e;e=RLd(a,b,c);if(e){return e}d=new kTd(a.a,b,c);d.W=false;lmd(d.Kc,d);gLd(a,d);return d} +function WLd(a,b,c){var d,e;e=RLd(a,b,c);if(e){return e}d=new cTd(a.a,b,c);d.W=false;lmd(d.Kc,d);gLd(a,d);return d} +function XLd(a,b,c){var d,e;e=RLd(a,b,c);if(e){return e}d=new cSd(a.a,b,c);d.W=false;lmd(d.Kc,d);gLd(a,d);return d} +function $Ld(a,b,c){var d,e;e=RLd(a,b,c);if(e){return e}d=new Ncf(a.a,b,c);d.W=false;lmd(d.Kc,d);gLd(a,d);return d} +function _Ld(a,b,c){var d,e;e=RLd(a,b,c);if(e){return e}d=new Acf(a.a,b,c);d.W=false;lmd(d.Kc,d);gLd(a,d);return d} +function aMd(a,b,c){var d,e;e=RLd(a,b,c);if(e){return e}d=new Bcf(a.a,b,c);d.W=false;lmd(d.Kc,d);gLd(a,d);return d} +function dMd(a,b,c){var d,e;e=RLd(a,b,c);if(e){return e}d=new Ocf(a.a,b,c);d.W=false;lmd(d.Kc,d);gLd(a,d);return d} +function d6d(a,b){var c,d,e;e=new n9b;e6d(a,e);for(d=new t9b(e);d.a0){b=String.fromCharCode(65+(c-1)%26&Q4g)+b;c=(c-1)/26|0}return b} +function E2e(a,b){var c;c=F2e(a,b.A,b.B);if(c<0){return E_e(b,a.v)}if(c>1){return E_e(b,a.p)}return D2e(a,b.A,b.B)} +function wEg(a,b){var c;c=a.et()-b.et();if(c!=0){return c}if(!!a.ft()&&!!b.ft()){return a.ft().k-b.ft().k}return 0} +function n$f(a,b){var c;if(a.a){o$f(a,b,new s$f(a,b))}else{YZf(b);c=MZf(b,a.d);c?QZf(b,c,a.d,a):VZf(b,a.d);ZZf(b)}} +function O5c(a,b,c,d,e,f){a.c=xOc(a.e,b,c);a.d=$wnd.Math.abs(d[0])=0){a.a+='\t=0&&d.u!=0){e=!e;!c.c&&(c.c=b9b(a.g,d.j))}d=d.o}e&&(c.d=true)} +function _Eg(a,b,c){var d,e;e=NNc(c.cb,a);if(ff(e,484)){d=e.oi();mXg(b.C.style,d.d,(t_g(),s_g));dXg(b.C.style,d.c,s_g)}} +function J6b(a){var b,c,d,e;return a.e==0?a:(b=a.d,c=b+1,d=me(uf,v5g,5,c,15,1),$6b(d,a.a,b),e=new O6b(a.e,c,d),t6b(e),e)} +function Gnc(a){var b,c,d,e;for(c=a.b,d=0,e=c.length;db){return 1}if(a==b){return a==0?f3b(1/a,1/b):0}return isNaN(a)?isNaN(b)?0:1:-1} +function Dpd(a,b,c){var d;return !a.mb&&$wnd.Math.abs(b)<=(d=xvd(c,a.P).a,d<=16?(Sud(),Iud)[d]:$wnd.Math.pow(10,-d)*0.5)} +function YLd(a,b,c){var d,e;e=RLd(a,b,c);if(e){return e}d=new HSd(a.a,c,b,false);d.W=false;lmd(d.Kc,d);gLd(a,d);return d} +function bMd(a,b,c){var d,e;e=RLd(a,b,c);if(e){return e}d=new Hcf(a.a,b,c,false);d.W=false;lmd(d.Kc,d);gLd(a,d);return d} +function iwd(a){Sud();var b;b=new gwd('FullFiguresFor:'+a);b.i=true;b.a=true;_vd(b,a);b.w=new bVg(16,350,false);return b} +function I1g(a){y1g();W1g();x0g();!N1g&&(N1g=new y0g);if(!G1g){G1g=new G0g(null,true);O1g=new R1g}return C0g(G1g,N1g,a)} +function PUd(a){fPc(a.c,a.b.L);a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.a;a.V[1]=a.b;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.c);Xvc(a)} +function c_d(a){fPc(a.d,a.b.L);a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.b;a.V[1]=a.c;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.d);Xvc(a)} +function e2c(a,b,c){a.xb.zn()&&_Hc(!a.yb?a.xb:a.yb)&&c&&!a.xb.Hb?b.Eh(a.Qb,a.q+((a.o-a.v.b)/2|0),a.v.a,a.v.b):bVc(a,b,c)} +function QMe(a,b){NHc();var c;c=new bmf(3);Vlf(c,a.$*b._-a._*b.$);Wlf(c,a._*b.Z-a.Z*b._);Xlf(c,a.Z*b.$-a.$*b.Z);return c} +function Pbe(a,b){if(ff(b,142)){return p8d(P6d(b.jv(),b.vi()),a)}if(ff(b,167)){return b.G.ks(b.vi()).sp(a).tp()}return b} +function Xie(a,b){var c;if(a.a==null){return false}for(c=0;c0){--a.i;++a.e==a.f&&(a.e=0);return a.c[a.e]}++a.e>=a.n&&_tb(a);b=a.c[a.e];cub(a,b);return b} +function w6b(a,b){var c;if(nf(a)===nf(b)){return true}if(ff(b,87)){c=b;return a.e==c.e&&a.d==c.d&&x6b(a,c.a)}return false} +function L9b(a){var b,c,d,e,f;if(a==null){return 0}f=1;for(c=a,d=0,e=c.length;de&&(e=b)}for(c=0;c\n',a)} +function F$d(a){a.V=me(fY,qnh,13,4,0,1);a.V[0]=a.b.lp();a.V[1]=a.c.lp();a.V[2]=a.d.lp();a.V[3]=a.e.lp();_vc(a,a.a);Xvc(a)} +function ZPd(a){a.V=me(fY,qnh,13,3,0,1);a.V[0]=a.g.lp();a.V[1]=a.b;a.V[2]=a.d;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.i);Xvc(a)} +function oSd(a){a.V=me(fY,qnh,13,3,0,1);a.V[0]=a.c.lp();a.V[1]=a.d;a.V[2]=a.k;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.i);Xvc(a)} +function uRd(a){a.V=me(fY,qnh,13,3,0,1);a.V[0]=a.b.lp();a.V[1]=a.d;a.V[2]=a.f;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.e);Xvc(a)} +function B_d(a){a.V=me(fY,qnh,13,3,0,1);a.V[0]=a.i;a.V[1]=a.b.lp();a.V[2]=a.a;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.j);Xvc(a)} +function h6d(a){if(ff(a.o,234)||ff(a.s,234)){return true}if(ff(a.o,18)&&h6d(a.o)){return true}return ff(a.s,18)&&h6d(a.s)} +function k6d(a){if(ff(a.o,124)||ff(a.s,124)){return true}if(ff(a.o,18)&&k6d(a.o)){return true}return ff(a.s,18)&&k6d(a.s)} +function fUf(a){var b,c;for(c=new t9b(a.k);c.a=-c} +function VVf(a,b){var c,d,e;if(!b){return null}e=new n9b;for(d=new t9b(b);d.a0){--a.i;++a.e==a.f&&(a.e=0);return a.c[a.e]}++a.e>=a.n&&Etf(a);b=a.c[a.e];cub(a,b);return b} +function rpg(a){if(!a.a){a.f-=a.e.i;return true}if(a.f>=a.e.i){if(a.g){a.f-=a.e.i;return true}a.a=a.f==a.e.i}return false} +function Ifc(a){if(a.b){Ifc(a.b)}else if(a.c){throw Qpb(new n3b("Stream already terminated, can't be modified or used"))}} +function wSg(a,b,c,d){switch(c){default:case 6:return new pSg(a,b);case 11:return new sVg(a,b);case 3:return new XUg(d);}} +function GNg(a,b,c,d,e){var f,g;if(!a){return !c?fWg():c}f=a.vi().j;g=false;ff(a,281)&&(g=a.ly());return HNg(f,b,c,d,e,g)} +function Fff(a,b,c,d){var e;e=Gff(a,b,Tpb(c,0)<0?dqb(c):c,Tpb(d,0)<0?dqb(d):d);Iub(e,b.b);return _pb(cqb(c,d),0)?hif(e):e} +function Qgg(a,b,c){var d;if(WDb(a.a,lFh)==null){return null}d=w4b(E4b(WDb(a.a,lFh)),' ',0);return X2b(d[c])-X2b(d[b])+''} +function D0g(b,c){var d;try{K0g(b.a,c,b.b)}catch(a){a=Ppb(a);if(ff(a,655)){d=a;throw Qpb(new Z0g(d.a))}else throw Qpb(a)}} +function e6b(a){if(aR4g){throw Qpb(new R1b('Underflow'))}else{return pf(a)}} +function KSg(a){if(!JSg(a,false)&&!$1b(Knh,a.a._B(Goh))){return false}return !$1b(mrh,a.a._B(AHh))||$1b(Knh,a.a._B(AHh))} +function eCc(a,b,c){if(a.V==1||a.V==72){lSc(b);mSc(b);cCc(a,b,true,false,true,true,c)}else{cCc(a,b,true,true,true,true,c)}} +function sUf(a,b,c,d){if(!b){return}x0f(OOf(a.c.j),(_1f(),R0f),b);if(g9b(a.k,b)){_Kc(b,false);d&&IUf(a,true);c&&Zpd(a.c)}} +function dTg(a,b){nlg(b.statusText+':'+b.statusText);PMg(a.a);BHg(xLg(a.a),YPg(a.a.B,'FileLoadingError'),a.a);return null} +function UCc(a){var b,c;c=a.Jb.k;if(c.i.length==1){b=NNc(a.kc,(mhc(0,c.i.length),c.i[0]));if(b){return b.Sj()}}return null} +function TJc(a,b){var c,d,e;e=!!a.mb&&z3d(a.mb,b);if(e){if(a.lb){d=a.lb.Ti();for(c=0;c0;if(a.d){c=me(A0,Joh,120,d,0,1);for(b=0;b0&&a.d[a.c-1]==0){a.a[a.b-2]=b;a.a[a.b-1]=c}else{Vqg(a,false,2);a.d[a.c++]=0;a.a[a.b++]=b;a.a[a.b++]=c}} +function HPf(a,b){if(b==a.Qb){return}a.Qb=b;!a.lb&&!!jlg&&klg(jlg,(Clg(),vlg),'updateApplicationLayout: Implementation needed...')} +function tzg(a,b){var c;c=!a.d?null:a.d.C;if(c!=null&&!KWg(c,b)){Vxg((Z3g(),a4g(null)),Fnh);c.className='EuclidianPanel';FWg(c,b)}} +function gOb(a,b){var c,d;c=a.c;d=c.ke(a.b);if(d==null){return new hJb(1,1,0,0,b*iOb,b)}return new hJb(d[0],d[1],d[2],d[3],b*iOb,b)} +function YIb(a){var b,c,d,e;NAb.call(this);SIb(this);this.b=new o9b(a.length);for(c=a,d=0,e=c.length;d6&&$1b(a.substr(0,6),Cqh));!d&&ff(b,281)&&(d=ff(b,213)&&c?b.g:b.ly());return d} +function jOd(a,b,c){var d,e,f;f=b+a.d.i.length;for(d=a.d.i.length;dAmh){c=a[b];++d;a[d]=c}}} +function SUd(a){fPc(a.c,a.b.L);a.V=me(fY,qnh,13,3,0,1);a.V[0]=a.a;a.V[1]=a.e;a.V[2]=a.b;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.c);Xvc(a)} +function m_d(a){a.V=me(fY,qnh,13,3,0,1);a.V[0]=a.c.lp();a.V[1]=a.a.lp();a.V[2]=a.b.lp();a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.e);Xvc(a)} +function iYd(a){var b;a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.a;a.V[1]=a.e;a.Y=me(fY,qnh,13,4,0,1);for(b=0;b<4;b++){awc(a,b,a.d[b])}Xvc(a)} +function JYd(a){var b;if(a.b){b=W_e(a.a);ysd(b,usd(a.b.Fp(),a.c.Hp(),a.c.Gp()))}if(a.V[0].Em()){a.c.Vp(a.a);L0e(a.a)}else{E0e(a.a)}} +function lVe(a,b,c){!a.b&&(a.b=new pWe(a.Kc));YVe(a.b,a,b,c);iWf(YOf(a.Mc.j).b)||aWe(a.b,new Yme(a.Kc,a,new fJe(false)));return a.b} +function Y5e(a){if(!!a.j&&!a.j.Wm()){a.e=a.j}else{a.e=new O0e(a.Kc);s0e(a.e,0,0,1,true)}a.c=new O0e(a.Kc);a.d=new Y2e(a.Kc,a.e,a.c)} +function Tsf(b,c,d,e){b.d=d;b.e=c;try{b.a=Ntf(b.c)}catch(a){a=Ppb(a);if(ff(a,165)){return c+1}else throw Qpb(a)}return Ksf(b,e,c+1)} +function pfg(b,c,d){nfg();try{return Apc(),Fpc(d,b,c,lmh,R4g)*ofg(b,c)}catch(a){a=Ppb(a);if(ff(a,43)){return NaN}else throw Qpb(a)}} +function S6b(a){p6b();var b,c;c=mqb(a);b=mqb(iqb(a,32));if(b!=0){return new N6b(c,b)}if(c>10||c<0){return new M6b(1,c)}return l6b[c]} +function sJb(a,b){qJb();var c,d,e,f;e=WDb(pJb,b);if(!e){return false}f=e.c;c=sPb(a,f);d=aJb(e,a,c);_Ob(a,d,false);a.p=-1;return true} +function LEc(a,b){var c,d,e,f,g,h;f=NNc(a.kc,b);if(!f){return}g=wMe(b);e=f;d=pf(FVc(e,a.X.a,a.X.b).c-e.q);c=g/e.r*d;h=pf(c);AMe(b,h)} +function gTc(a,b){var c,d;for(d=new t9b(a.b.Jb.k);d.a0?b9b(a.d,0):null,240)){return (!!a.d&&a.d.i.length>0?b9b(a.d,0):null).a.f.length}return 2} +function H6c(a,b){G7c(a.b,b)&&!H7c(a.b,b+1)?x7c(a.d,K7c(a.b,b)):J6c(a,b);a.b.b.a.i.length>b&&H7c(a.b,b+1)||gff(a.e,new off(k9g,h9g))} +function B6c(a,b,c,d){Yef(d,b)?(a.c?D6c(a,c.c,d.c):E6c(a,c.c,d.c),D6c(a,c.a,d.a)):(a.c?D6c(a,c.c,d.a):E6c(a,c.c,d.a),D6c(a,c.a,d.c))} +function SIg(){Ayg.call(this);Yxg(this,(XWg==null&&($1b(mlh,typeof($doc))?(XWg=$wnd.document):(XWg=$doc)),XWg).createElement('ul'))} +function qOg(a){var b,c,d;d=(b=new xPg,jOg(a,false,b));return c=KOg(d),$wnd.base64Util.bytesToBase64($wnd.window.fflate.zipSync(c))} +function $Qg(a,b,c){var d;LWg(a.C,vHh);d=a.C.style;dXg(d,b+8,(t_g(),s_g));mXg(d,c-($wnd.goog.global.parseInt(a.C[TFh],10)|0)/2,s_g)} +function yfd(b,c){try{b.n.Po((phd(),$1b(Knh,Tbc(c,xph))));return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function Fhd(b,c){try{$1b(Knh,Tbc(c,Jrh));bWf(YOf(b.a).a);return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function u5d(a,b,c){var d;d=oke(b,(Sud(),oud));if($qf(d)){a.o=rke(b,0,true,true).Ap();return a}if(!c){return a}Yad(a.q,d);return a.q} +function _5d(a,b){if(j7d(a,(_8f(),y7f))){return H9d(b,a)}else if(a.q==m8f&&ff(a.o,357)&&a.s.Jn(y7f)){return 1/H9d(b,a.s)}return null} +function asd(a){var b,c,d;if(!a){return ''}d=new h5b;for(b=0;b$wnd.Math.abs(a.$)?s0e(b,-a._/a.Z,0,1,true):s0e(b,0,-a._/a.$,1,true)} +function Baf(a,b){a.a+=' r="';T4b(a,b.b>>16&255);a.a+='"';a.a+=' g="';T4b(a,b.b>>8&255);a.a+='"';a.a+=' b="';T4b(a,b.b&255);a.a+='"'} +function Qqg(a,b,c,d,e,f,g){Vqg(a,true,6);a.d[a.c++]=3;a.a[a.b++]=b;a.a[a.b++]=c;a.a[a.b++]=d;a.a[a.b++]=e;a.a[a.b++]=f;a.a[a.b++]=g} +function spf(a){var b;if(sqf(a,69))return true;if(Gof(a))return true;b=a.D;if(sqf(a,80)){a.D=b;if(sqf(a,81))return true}return false} +function tpf(a){var b;if(sqf(a,70))return true;if(Gof(a))return true;b=a.D;if(sqf(a,80)){a.D=b;if(sqf(a,81))return true}return false} +function upf(a){var b;if(sqf(a,71))return true;if(Gof(a))return true;b=a.D;if(sqf(a,80)){a.D=b;if(sqf(a,81))return true}return false} +function vpf(a){var b;if(sqf(a,76))return true;if(Gof(a))return true;b=a.D;if(sqf(a,80)){a.D=b;if(sqf(a,81))return true}return false} +function VGg(a){var b;b=c9b(a.a,a.d,0)-1;b<0&&(b=a.a.i.length-1);if(b>=0&&b>5;b&=31;e=a.d+c+(b==0?0:1);d=me(uf,v5g,5,e,15,1);Z6b(d,a.a,c,b);f=new O6b(a.e,e,d);t6b(f);return f} +function tog(a,b){var c,d;++a.b;if(aqb(a.g,jqb(b,pih))){d=lqb(jqb(b,a.g))/pih;c=pf(a.b/d);a.e>c&&(a.e=c);a.d0){$wnd.Error.stackTraceLimit=Error.stackTraceLimit=64;return true}return 'stack' in new Error} +function vKb(a,b){var c;if(!b){return}if(ff(b,65)){_8b(a.a,b.a)}else{Z8b(a.a,b);ff(b,262)&&(c=b.zd(),(c==2||c==3)&&Z8b(a.a,new uCb))}} +function y2c(a,b){var c,d,e;e=b?(_1f(),V0f):(_1f(),T0f);d=new q0f(e,a.d);if(!b){c=new cEb;ZDb(c,'index',w3b(rZe(a.d)));d.c=c}return d} +function GSc(a){var b,c,d;d=new h5b;for(c=new t9b(a.a);c.a=$wnd.Math.min(a,e)-g&&d<=$wnd.Math.max(b,f)+g&&d>=$wnd.Math.min(b,f)-g} +function N3b(a){var b;if($wnd.Math.abs(a)0} +function Olf(a,b,c){a.f[0]=b.f[1]*c.f[2]-b.f[2]*c.f[1];a.f[1]=b.f[2]*c.f[0]-b.f[0]*c.f[2];a.f[2]=b.f[0]*c.f[1]-b.f[1]*c.f[0];a.a=true} +function w$e(a,b){var c,d,e;if(ff(b,668)){c=b;a.i=c.i;a.j.i.length=0;for(e=new t9b(c.j);e.ag){b.Ps((a+9*g)/10,b.rz(),1);b.Hi()}} +function W4f(a,b,c,d){var e,f,g;e=Hpd(a.d,b,false,0);if(!e||!F6e(c,a.d,e)){return false}f=d?qcd(a.d,c):c;g=WJc(e,f);Zpd(a.d);return g} +function Zsg(a,b,c,d){var e,f;if(a<=b&&b<=c){return 0}a-=b;c-=b;e=a+c;if(e==0){return 0}f=a/e;if(f<=0||f>=1){return 0}d[0]=f;return 1} +function yrg(a,b,c,d,e){var f,g;if(a.lB()||d<=0||e<=0){return false}f=a.ki();g=a.li();return b>=f&&c>=g&&b+d<=f+a.ji()&&c+e<=g+a.ii()} +function Ihg(a){mhg();var b;if(a==null){return false}b=E4b(a);return b.length==1&&m4b(wzh,G4b((uhc(0,b.length),b.charCodeAt(0))))!=-1} +function yhg(a){mhg();if(a==null||a.indexOf('/')!=-1){return false}return a.indexOf(l5g)!=-1||a.indexOf('^{')!=-1||a.indexOf('_')!=-1} +function p7e(a,b,c){a.a+=' ';if(b==2){O4b(a,YPg(c,'double'));a.a+=' '}else if(b==3){O4b(a,YPg(c,'triple'));a.a+=' '}O4b(a,YPg(c,Xhh))} +function bif(a,b){var c,d;d=b.rA(a.b?new off(h9g,a.c):new off(k9g,h9g));c=b.rA(a.b?new off(a.a,k9g):new off(k9g,h9g));return wif(d,c)} +function g$f(a,b){var c,d;c=new i$f(b.a);d=new p$f(c,AEh+uPg);RZf(a,d);TZf(a);w0f(OOf(a.a),new p0f((_1f(),O1f)));OZf(a);SZf(a);OZf(a)} +function BUg(a,b){var c,d,e;e=weg(b);c=a;d=p4b(a,G4b(47));d!=-1&&(c=(uhc(d+1,c.length+1),c.substr(d+1)));c=tig(wig(c));return e+'/'+c} +function zyg(a,b){var c;if(b.B!=a){return false}try{qyg(b,null)}finally{c=b.aC();(y1g(),BWg(c)).removeChild(c);A4g(a.t,b)}return true} +function ufg(b,c,d){nfg();try{return Jpc((d-b)/c)}catch(a){a=Ppb(a);if(ff(a,38)){return db+20*c?1:NaN}else throw Qpb(a)}} +function Mrb(b){b.p=1;b.r=b.w=b.C;try{return !Isb(b)}catch(a){a=Ppb(a);if(ff(a,481)){return true}else throw Qpb(a)}finally{Ssb(b,0,1)}} +function Nrb(b){b.p=1;b.r=b.w=b.C;try{return !Jsb(b)}catch(a){a=Ppb(a);if(ff(a,481)){return true}else throw Qpb(a)}finally{Ssb(b,1,1)}} +function Qrb(b){b.p=1;b.r=b.w=b.C;try{return !Jsb(b)}catch(a){a=Ppb(a);if(ff(a,481)){return true}else throw Qpb(a)}finally{Ssb(b,4,1)}} +function Rrb(b){b.p=1;b.r=b.w=b.C;try{return !Jsb(b)}catch(a){a=Ppb(a);if(ff(a,481)){return true}else throw Qpb(a)}finally{Ssb(b,5,1)}} +function Prb(b){b.p=1;b.r=b.w=b.C;try{return !Lsb(b)}catch(a){a=Ppb(a);if(ff(a,481)){return true}else throw Qpb(a)}finally{Ssb(b,3,1)}} +function kQg(a){UXe(a.i,a.k.c,a.j.width,a.j.height);a.c?null.pD():mQg(a);pUg(a.n)&&lKc(a.i,false);Vxg((Z3g(),a4g(null)),Fnh);pMg(a.b)} +function Q2b(a,b){var c=0;while(!b[c]||b[c]==''){c++}var d=b[c++];for(;c=0){f=f.a[1]}else{e=f;f=f.a[0]}}return e} +function Vdc(a,b,c){var d,e,f;e=null;f=a.b;while(f){d=a.a.bf(b,f.d);if(c&&d==0){return f}if(d<=0){f=f.a[0]}else{e=f;f=f.a[1]}}return e} +function RGb(a,b){var c,d,e;c=a.a.ud(b);d=QOb(b.e,fih,b);e=QOb(b.e,gih,b);if(!a.b){return new MHb(c,d,e)}return new OHb(c,d,e,a.c,a.b)} +function Gmc(a){var b,c,d;c=a.b==null?0:a.b.length;b=a.b==null||a.b[0]==null?0:a.b[0].length;d=new Qmc(b,c);Omc(a,new Jmc(d));return d} +function Rc(a){if(a.b>=0){return}Ic(a);Hc(a);if(Lc(a.g)){return}if($c(a.i)>0){Qc(a,Yc(a.i));return}if($c(a.j)>0){Qc(a,Zc(a.j));return}} +function G2c(a,b,c){if(!a.o){return false}if(A2c(a,b,c)||z2c(a,b,c)){return true}a.i.a&&!Z3c(a.i)&&Ncd(a.c.c,b,c);a.b=true;return true} +function VMd(a,b,c,d,e){var f,g,h,i;if(!b.rv(false)||!c.rv(false)){return null}f=VLd(a,b,c);g=Bxd(f,d,e);i=new zTd(f,g);h=i.g;return h} +function iYb(a){var b;while(kYb(a)&&a.oc&&($wnd.Math.ceil(a.H)<0?(c=0):a.Yk()==1?(c=bfg(a.H,Iih)):(c=cfg(a.H,0)));KHd(a,new cde(a.Mc,c))} +function VZe(a,b){var c,d;a.t=b;if(!a.k||a.k.i.length==0){return}for(d=0;d0){return b9b((!a.Ib&&(a.Ib=new KUf(a.pb,a)),a.Ib).k,0)}return null} +function rgd(a,b,c){var d;d=Hpd(a.B.v,c,false,0);!!d&&d.pn()?yKc(b,d):!!jlg&&klg(jlg,(Clg(),Blg),'dynamicCaption is not a GeoText:'+c)} +function xVd(a,b){if(b.ul()==a.a.ul()||X8e(a.a,b)){a.a.ro(b);a.b=b.yl((Sud(),Lud));ff(BIc(b),197)&&xKc(a.a,BIc(b).Tu())}else{a.a.cp()}} +function e6d(a,b){if(a.q!=(_8f(),m8f)){b.add(a);return}ff(a.o,18)?e6d(a.o,b):!!a.o&&b.add(a.o);ff(a.s,18)?e6d(a.s,b):!!a.s&&b.add(a.s)} +function Are(b,c){var d;try{return Cre(b,c,false,new AVf)}catch(a){a=Ppb(a);if(ff(a,38)){d=a;lQf(b.a,d);return null}else throw Qpb(a)}} +function qBg(b,c){var d;try{b.a.a=jBg(c);nBg(b.a)}catch(a){a=Ppb(a);if(ff(a,185)){d=a;!!jlg&&klg(jlg,(Clg(),vlg),d)}else throw Qpb(a)}} +function xnf(b){b.s=3;b.u=b.D=b.I;try{return !bqf(b)}catch(a){a=Ppb(a);if(ff(a,249)){return true}else throw Qpb(a)}finally{rqf(b,1,3)}} +function Gnf(b){b.s=1;b.u=b.D=b.I;try{return !nqf(b)}catch(a){a=Ppb(a);if(ff(a,249)){return true}else throw Qpb(a)}finally{rqf(b,8,1)}} +function LUf(a,b){var c;c=!!lJc(a)&&lJc(a).i.length>0?b9b(lJc(a),0).a:-1;if(c==16){return null}else if(c==512){return null}return b.cb} +function Uwe(a,b,c){var d;if(c==1&&b[0].en()){d=b[0];if(d.k.i.length==0||b9b(d.k,0).en()){return d}}return $Cd(a,b,c,(i3f(),r2f),null)} +function oqg(a,b,c,d,e){var f;if(d<0||e<0){return false}if(!Crg(mqg(a),b,c,d,e)){return false}f=ssg(a.b,b,c,b+d,c+e);return !f||f.a!=0} +function TLe(a,b,c,d,e){var f;f=a.a;if(!f){return false}if(!c){f.Bv(f.H+b.f[0]+b.f[1]+llf(b),true);CLc(f,d,e);return true}return false} +function iqg(a,b,c){var d,e,f;if(!xrg(mqg(a),b,c)){return false}f=zdc(a.b);e=0;while(q9b(f.a)){d=r9b(f.a);e+=d.DB(b,c)}return (e&1)==1} +function ysg(a,b,c){var d,e,f;d=1;while(true){e=(b+d)/2;if(e==b||e==d){return d}f=a.VB(e);if(fc){d=e}else{return d}}} +function jic(a,b){var c,d,e;ttc(a);d=a.length;if(d==0){throw Qpb(new Mkc((qmc(),qlc)))}e=a[d-1];for(c=d-2;c>=0;c--){e=b*e+a[c]}return e} +function Flf(a,b,c,d,e,f){var g;g=a.d;a.b==null&&(a.b=ke(sf,[nih,g9g],[17,5],15,[g,g],2));bkf(a.b,f,a,pe(ie(S0,1),Jqh,52,0,[b,c,d,e]))} +function HGb(a,b,c,d,e,f){var g,h;g=new UCb(c&Q4g,d);h=new XLb(g,b,e);ZDb(BGb,a,g);ZDb(DGb,a,h);_Cb((WCb(),WCb(),VCb),e,new lDb(e,h,f))} +function gTb(a){eTb();var b,c;c=E4b(TPb(a));if(c.length==0){return iPb(a)}b=WDb(dTb,c);if(b){return b.Ae(a)}throw Qpb(new VWb(a,rjh+c))} +function r6b(a,b){if(a.e>b.e){return 1}if(a.eb.d){return a.e}if(a.d=0;c--){d[1]=d[1]*b+d[0];d[0]=d[0]*b+a.b[c]}return d} +function wlf(a){var b,c,d,e,f;e=new bmf(a.d);Ukf(a);a.c=$wnd.Math.sqrt(a.e);d=1/a.c;c=a.d;for(b=0;b0&&Tpb(a,128)<0){return F3b(),b=mqb(a)+128,c=E3b[b],!c&&(c=E3b[b]=new z3b(a)),c}return new z3b(a)} +function gWd(a,b,c,d){var e;++a.I;C$e(a.r,b,c,d?(dud(),bud):(dud(),cud));a.p=b;a.q=c;for(e=0;ed&&(b[d]=null);return b} +function m9b(a,b){var c,d;d=a.i.length;b.lengthd&&(b[d]=null);return b} +function PBf(a){var b,c;!a.mb&&(a.mb=new E3d);if(a.mb){for(c=(!a.mb&&(a.mb=new E3d),new G3d(a.mb));c.a;){b=F3d(c);ff(b,875)&&lYe(b.a)}}} +function Tyc(a){var b,c,d;if(a.d){a.f=a.d.b/a.d.a;for(d=new t9b(a.a);d.a0){for(c=a.i.length-1;c>=0;c--){b=(mhc(c,a.i.length),a.i[c]);b.ln()&&(b.vi(),true)&&f9b(a,c)}}} +function ESc(a,b,c){var d,e,f;e=0;f=0;while(ed.a){return new off(k9g,h9g)}else{E6c(a,c.a,d.c);D6c(a,c.a,d.a);return d}} +function PCc(a){var b;b=m9b(a.Jb.B,me(TY,{3:1,4:1,8:1,7:1,10:1,121:1,367:1,11:1,9:1,64:1,12:1,4257:1},208,0,0,1));TBc(a,a.Jb.B);return b} +function y$f(){y$f=xqb;w$f=new z$f(Rih,0);t$f=new z$f('BASE_MISMATCH',1);u$f=new z$f('DOC',2);v$f=new z$f('ID',3);x$f=new z$f('TYPE',4)} +function T2b(a){var b;b=typeof(a);if($1b(b,M4g)||$1b(b,N4g)||$1b(b,P4g)){return true}return a!=null&&a.$implements__java_lang_Comparable} +function uwb(a){var b;for(b=0;b<(a.d?a.d.i.length:0);b++){if(ff(a.pd(b),478)){return b}}throw Qpb(new V1b('Index out of array bounds.'))} +function Fxe(a,b,c){var d;d=Axe(a,b);if(!d){if($1b(b.i,oSf(a.a.B,qAh,true))){return null}throw Qpb(new iye(a.a.B,b))}return Exe(a,d,b,c)} +function XYd(a,b,c,d){var e,f;TYd(a,d);for(f=0;fAmh){d=a.b[b];++c;a.b[c]=d}}a.a=c+1} +function EJc(a,b){var c,d,e;if(a.mb){e=new G3d(a.mb);while(e.a){c=F3d(e);for(d=0;d=b;e--){Z8b(f,!!a.d&&a.d.i.length>e&&e>=0?b9b(a.d,e):null);vwb(a,e)}Rwb(a,b,d);return f} +function kub(a,b,c,d){var e,f,g;g=a.b-a.a;if(g==0){return -1}e=b.length;f=e-c;f=f>d?d:f;f>g&&(f=g);i4b(a.c,a.a,a.a+f,b,c);a.a+=f;return f} +function N8b(a,b){var c,d,e,f;d=a.a.length-1;c=b-a.b&d;f=a.c-b&d;e=a.c-a.b&d;T8b(c=f){P8b(a,b);return -1}else{Q8b(a,b);return 1}} +function K3c(a,b){var c,d;b.c=oug(b.a,0,b.d);a9b(a.b,new T3c(b));c=J3c(a,new P3c,new Q3c);d=J3c(a,new R3c,new S3c);a.c=new xqg(c+20,d+20)} +function PRc(a,b,c){var d;if(KNc(a.a,b,c)){RRc(a,a.a.lb.Db)}else{d=JOf(a.a.C,c);ORc(a,b,d);c==(P4c(),O4c)&&a.e.i.length==0&&ORc(a,b,d*3)}} +function WEc(a,b){var c;a.ib=b;c=a.ib.Nl();ff(c,1613)&&(a.ib=c.Cu());NPc(a.kc,$1b(Knh,a.f.d.a._B(Goh))&&!a.ib.Pn());szg(a.kc,(pHc(),aHc))} +function jSe(a,b,c,d){wKc(a,null);b[2]=b[2]+c*(b[0]*c-2*b[4])+d*(b[1]*d-2*b[5]+2*b[3]*c);b[4]=b[4]-b[0]*c-b[3]*d;b[5]=b[5]-b[3]*c-b[1]*d} +function izc(a,b,c,d){a.u=d;a.t=15;if(c==1&&b!=1){a.k=a.v.Ec;a.j=a.v.Nc/b;a.i=(tzc(),ozc)}else{a.k=a.v.Nc;a.j=a.v.Ec*b/c;a.i=(tzc(),pzc)}} +function dJc(a,b){if(a.pc==null){return}cJc(a,(_1f(),O0f),xph,b);cJc(a,W1f,'onUpdate',b);cJc(a,S0f,'onDragEnd',b);cJc(a,W0f,'onChange',b)} +function JYc(a,b,c){mXc.call(this);this.Pb=a;this.i=b;this.xb=b;this.e=c;b.r=true;b.r&&Cpd(b.Mc)&&b.Mc.f&&IHd(b,true);HYc(this);IYc(this)} +function MYc(a,b,c){mXc.call(this);this.Pb=a;this.j=b;this.xb=b;this.f=c;b.r=true;b.r&&Cpd(b.Mc)&&b.Mc.f&&IHd(b,true);KYc(this);LYc(this)} +function vBd(a,b,c){kwc.call(this,a);this.c=new h5b;this.b=b;this.a=c;this.d=new N4e(a);this.d.i=true;jCb(this.d,b.q);uBd(this);tBd(this)} +function Ymd(a){var b;_Db(a.H,a.gb);_Db(a.H,a.jb);b=a.M.j.B;a.gb=YPg(b,'xAxis');a.jb=YPg(b,'yAxis');ZDb(a.H,a.gb,a.fb);ZDb(a.H,a.jb,a.ib)} +function vTd(a){if(ff(a.a,521)){B_e(a.g,a.a.a,false);B_e(a.g,a.a.b,false)}else if(ff(a.a,488)){B_e(a.g,a.a.n,false);B_e(a.g,a.a.g,false)}} +function uvd(a){switch(a.B.k){case 2:return 'euler\\_gamma';case 3:return '\\mathit{e_{\\gamma}}';case 9:return 'euler gamme';}return Bwh} +function CNd(a,b,c,d){var e,f;e=null;f=null;if(b!=null){switch(b.length){case 2:f=b[0];e=b[1];break;case 1:f=b[0];}}return DNd(a,e,f,c,d)} +function eOd(a){var b;hmd(a.Kc,a);b=a.c.Fp();if(Ocg((nhc(b),b),11)||Ocg((nhc(b),b),12)){fmd(a.Kc,a);return}Ocg((nhc(b),b),5)&&gmd(a.Kc,a)} +function DQd(a,b){var c,d;for(c=0;c1&&(c-=1);d=c*6;if(d<1){return a+(b-a)*d}if(c*2<1){return b}if(c*3<2){return a+(b-a)*(4-d)}return a} +function Vkf(a){var b,c;c=true;b=0;while(b=97&&b<=122){++a.o;return new eJb(b,true)}else if(b>=65&&b<=90){++a.o;return new OCb(b,false)}return lYb(a,b,false)} +function THc(a,b){var c,d,e;c=s3d((!a.mb&&(a.mb=new E3d),a.mb),b);if(c){if(a.lb){e=a.lb.Ti();for(d=0;d0)}else if(d.Di()&&!d.Em()){return new cde(a.a,NaN)}return new cde(a.a,fae(b,c))} +function tae(a){var b,c,d,e;if(a.s){return true}for(c=a.o,d=0,e=c.length;db&&(b=d)}return b} +function $Jc(b,c){if(c.gl()){b.Bo(_Ye(c.gl()));b.Co(c.hl())}if(c.Tl()){try{b.bp(eOe(c.Tl()))}catch(a){a=Ppb(a);if(!ff(a,38))throw Qpb(a)}}} +function oqd(a,b){if(b>a.tb.length){a.tb=lrd(a.tb,b);a.sb=lrd(a.tb,b);a.wb=lrd(a.wb,b);a.vb=lrd(a.vb,b);a.ub=lrd(a.ub,b);a.xb=lrd(a.xb,b)}} +function WSd(a,b,c,d){var e,f,g;g=Psc(b.a);f=0;g.length>1&&(f=_Sd(g,a.g));for(e=0;ed+koh||c>g[e]+koh)&&(g[e]=NaN)}XSd(a,g,f)} +function Sde(a,b,c){var d;c3c(a.e[0],b);a.e.length>1&&c3c(a.e[1],c);d=B6d(a.j);return Iqh0?(Xcg(),Vcg):(Xcg(),Ucg)} +function mVd(a){var b,c,d,e;b=a.a.A;c=a.a.B;d=a.b.A;e=a.b.B;a.e.Z=b-d;a.e.$=c-e;s0e(a.f,b+d,c+e,2,true);a.e._=-(a.f.Z*a.e.Z+a.f.$*a.e.$)/2} +function TXd(a){var b,c;if(ff(a.a.lb,763)){b=a.a.lb;c=b.b}else{c=a.a.yl((Sud(),Lud))}c!=null?C4e(a.b,c):C4e(a.b,a.a.rl((Sud(),Lud),false))} +function uRe(a,b){var c,d;if(!crd(a.Mc,b)){wRe(a,b);return}c=b.jz(a.wy());d=b.vz();a.By(c,d);b.Lz(c.f[0],c.f[1],llf(c));b.Uz(false,a.wy())} +function fae(a,b){if(a.o.length==1&&$1b('y',sde(a.o[0],(Sud(),oud)))){return gae(a,pe(ie(sf,1),g9g,5,15,[b.ts()[1]]))}return gae(a,b.ts())} +function $Me(a,b,c){b[0]=a.Z;b[1]=a.$;b[2]=a._;if(Scg(a.Z)||Scg(a.$)){return nod(a.Mc,b,XMe,c,true).a}return ood(a.Mc,b,XMe,true,c,true).a} +function ZSe(a,b){vQe();CSe.call(this,a);this.b=new i5b;this.d=new bmf(3);this.e=me(sf,g9g,5,2,15,1);this.a=new yjf(this,b);sKc(this,true)} +function hcf(a){if(a.V==null){$vc(a,a.e.Gb);a.b=new PYb;dcf(a,a,a.b,new Oec)}Lvc(a)==0&&(a.Y=me(fY,qnh,13,1,0,1));awc(a,0,a.e.lp());Xvc(a)} +function mnf(b){b.s=R4g;b.u=b.D=b.I;try{return !Vpf(b)}catch(a){a=Ppb(a);if(ff(a,249)){return true}else throw Qpb(a)}finally{rqf(b,0,R4g)}} +function nnf(b){b.s=R4g;b.u=b.D=b.I;try{return !sof(b)}catch(a){a=Ppb(a);if(ff(a,249)){return true}else throw Qpb(a)}finally{rqf(b,9,R4g)}} +function Fnf(b){b.s=R4g;b.u=b.D=b.I;try{return !gof(b)}catch(a){a=Ppb(a);if(ff(a,249)){return true}else throw Qpb(a)}finally{rqf(b,7,R4g)}} +function Anf(b){b.s=R4g;b.u=b.D=b.I;try{return !hqf(b)}catch(a){a=Ppb(a);if(ff(a,249)){return true}else throw Qpb(a)}finally{rqf(b,2,R4g)}} +function Bnf(b){b.s=R4g;b.u=b.D=b.I;try{return !iqf(b)}catch(a){a=Ppb(a);if(ff(a,249)){return true}else throw Qpb(a)}finally{rqf(b,3,R4g)}} +function Cnf(b){b.s=R4g;b.u=b.D=b.I;try{return !jqf(b)}catch(a){a=Ppb(a);if(ff(a,249)){return true}else throw Qpb(a)}finally{rqf(b,4,R4g)}} +function Dnf(b){b.s=R4g;b.u=b.D=b.I;try{return !kqf(b)}catch(a){a=Ppb(a);if(ff(a,249)){return true}else throw Qpb(a)}finally{rqf(b,5,R4g)}} +function Enf(b){b.s=R4g;b.u=b.D=b.I;try{return !lqf(b)}catch(a){a=Ppb(a);if(ff(a,249)){return true}else throw Qpb(a)}finally{rqf(b,6,R4g)}} +function Dhg(a){mhg();var b;b=p4b(a,G4b(46));if(b<=0||b==a.length-1){return ''}return B4b((uhc(b+1,a.length+1),a.substr(b+1)),(Acc(),ycc))} +function apg(a,b){cpg(a,b.c,b.a);n5b(b.b,0,a.b,a.a,b.a);n5b(b.d,0,a.d,a.c,b.c);a.a+=b.a;a.c+=b.c;if(a.a>=2){a.e=a.b[a.a-2];a.g=a.b[a.a-1]}} +function ipg(a,b){cpg(a,b.c-1,b.a-2);n5b(b.b,2,a.b,a.a,b.a-2);n5b(b.d,1,a.d,a.c,b.c-1);a.a+=b.a-2;a.c+=b.c-1;a.e=a.b[a.a-2];a.g=a.b[a.a-1]} +function yqg(a,b,c){var d,e,f,g;e=a.b;if(e<=0){return false}f=(b-a.c)/e-0.5;d=a.a;if(d<=0){return false}g=(c-a.d)/d-0.5;return f*f+g*g2000){hd=a;jd=$wnd.setTimeout(td,10)}}if(gd++==0){Fd((Ed(),Dd));return true}return false} +function Dtb(a){var b,c,d,e,f;e=vtb[a.d];d=e==null?aub(a.c):e;c=fub(a.c);b=eub(a.c);hub(a.c);gub(a.c);f=new nub(a.d,d);f.b=c;f.a=b;return f} +function s1c(a,b){var c,d,e;e=new n9b;Z8b(e,a.f);for(d=b.rd();d.xf();){c=d.yf();x1c(c,e)}Z8b(e,a.e);mac();V9b(e.i,e.i.length,null);return e} +function gSc(a){var b,c,d;d=new uSc;for(c=0;c7?0:a;g=b>7?0:b;e=THb[f|g<<3|c.i>>1<<6];return !e?null:(d=XNb(c.i,(HNb(),ENb))/18,new XHb(e.a*d))} +function boc(a){var b;b=a.ah();this.b=a;this.c=new Vnc(0,b);this.f=NaN;this.d=me(sf,g9g,5,b,15,1);this.e=me(sf,g9g,5,b,15,1);this.a=new n9b} +function tzc(){tzc=xqb;rzc=new uzc('ZOOM',0);szc=new uzc('ZOOM_RW',1);ozc=new uzc('AXES_X',2);pzc=new uzc('AXES_Y',3);qzc=new uzc('MOVE',4)} +function RTc(a,b){var c;if(!a.d){!!jlg&&klg(jlg,(Clg(),vlg),'[TF] textField is null');return}c=b.xb;c!=a.d.f&&QTc(a);gGg(a.d,mYe(c));aYc(b)} +function fYc(a,b){return b!=null&&b.length>1&&$1b(b.substr(0,1),'$')&&f4b(E4b(b),'$')&&!!a.e?a.e.a:!!a.tb&&!!a.tb.f.Hb?a.tb.b:pf(a.u*1.2+2)} +function m_c(a,b){MAc.call(this);d_c(this);this.Pb=a;this.g=b;this.xb=znd(a.Jb.o.r,70);this.d=new xRc(a);vRc(this.d,this.xb.Hl());l_c(this)} +function w3c(a,b){var c,d;if(!b||A3c(b,a.i)){return}COf(a.a,(c=new q0f((_1f(),U0f),a.g),d=new cEb,ZDb(d,'index',B2c(a.j,b)),c.c=d,c));a.i=b} +function cOe(a,b,c){var d;if(!b){if(!c){return null}return c.Dk(a)}if(c){d=b.Gb;p0e(b,c,true);!b.lb&&(!b.Db||!cPe(b.Db))||wKc(b,d)}return b} +function xfd(b,c){try{t4e(b.n,(phd(),$1b(Knh,Tbc(c,xph))),false);return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function onf(b){b.s=R4g;b.u=b.D=b.I;try{return !Xpf(b)}catch(a){a=Ppb(a);if(ff(a,249)){return true}else throw Qpb(a)}finally{rqf(b,10,R4g)}} +function pnf(b){b.s=R4g;b.u=b.D=b.I;try{return !Ypf(b)}catch(a){a=Ppb(a);if(ff(a,249)){return true}else throw Qpb(a)}finally{rqf(b,11,R4g)}} +function qnf(b){b.s=R4g;b.u=b.D=b.I;try{return !Zpf(b)}catch(a){a=Ppb(a);if(ff(a,249)){return true}else throw Qpb(a)}finally{rqf(b,12,R4g)}} +function rnf(b){b.s=R4g;b.u=b.D=b.I;try{return !$pf(b)}catch(a){a=Ppb(a);if(ff(a,249)){return true}else throw Qpb(a)}finally{rqf(b,13,R4g)}} +function snf(b){b.s=R4g;b.u=b.D=b.I;try{return !_pf(b)}catch(a){a=Ppb(a);if(ff(a,249)){return true}else throw Qpb(a)}finally{rqf(b,14,R4g)}} +function tnf(b){b.s=R4g;b.u=b.D=b.I;try{return !aqf(b)}catch(a){a=Ppb(a);if(ff(a,249)){return true}else throw Qpb(a)}finally{rqf(b,15,R4g)}} +function dhd(a){while(a4b(a.i,a.f)!=60){++a.f}N1b(a.k,0);while(a4b(a.i,a.f)!=62){L4b(a.k,a4b(a.i,a.f));++a.f}++a.f;L4b(a.k,62);return a.k.a} +function TKg(a){dUf((!a.Ib&&(a.Ib=new KUf(a.pb,a)),a.Ib),false,false);sod(a.pb,true);ypd(a.pb);Cnd(a.pb.o.r);a.rb=0;gMg(a,null);return true} +function jae(a,b,c){var d,e,f;d=a.n;for(e=0;e=97&&a<=122){return VDb(rxb,z2b(a+65-97&Q4g))}return VDb(rxb,z2b(a&Q4g))} +function iPb(a){var b;tQb(a);if(a.owIc(b)?-1:1}return c<0?-1:1} +function x8d(a){switch(a.k){case 9:case 8:case 16:case 17:case 10:case 12:case 11:case 13:case 15:case 14:return true;default:return false;}} +function rug(a,b){switch(b){case 1:a.e=iah;a.c=pbh;break;case 2:a.e=pbh;a.c=llh;break;case 3:a.e=iah;a.c=llh;break;default:a.c=pbh;a.e=pbh;}} +function lSe(a){switch(a.gb){case 1:eSe(a);break;case 2:dRe(a,a.db);break;case 7:NQe(a);break;case 8:tRe(a,a.db);break;case 10:dSe(a,a.db);}} +function Bxe(a){var b,c,d,e;a.j=new lJe(a.i);a.c=new dEb(500);for(c=KIe(),d=0,e=c.length;d0&&F1b(c.c,c.c.a.length-1)!=32&&O4b(c.c,' '));return c.c.a} +function cxb(a){bxb();var b,c;c=new h5b;for(b=0;b=a.b>>1){d=a.c;for(c=a.b;c>b;--c){d=d.b}}else{d=a.a.a;for(c=0;c=0;d--){c=b9b(a.e,d);if(ff(c,319)){b=NNc(a.a,c);if(ff(b,U5g)){return b.c}}}return null} +function Omd(a){var b,c,d,e;d=a.d.i.length;e=null;for(c=0;c0){Lkd(a);MRg(a.i);w0f(OOf(a.d.j),new p0f((_1f(),M1f)))}} +function C$d(a){a.V=me(fY,qnh,13,3,0,1);a.V[0]=a.a.lp();a.V[1]=a.c.lp();a.V[2]=new vOe(a.Kc,true);a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.e);Xvc(a)} +function bhe(a,b){var c;c=new h5b;T4b(c,a.a);c.a+='.';g5d(a.b,c);if(b.B==(c9d(),X8d)){c.a+=V7g;g5d(a.c,c);c.a+='}'}else{f5d(a.c,c)}return c.a} +function uke(a,b,c){var d,e;e=b.length-c;d=Ake(a,(thc(0,e,b.length),b.substr(0,e)));return C7d(d.Ap(),Bke(a,(uhc(e,b.length+1),b.substr(e))))} +function WLe(a,b){var c;a.a!=(jMe(),iMe)?(c=Lcg(b)):(c=b);a.e=c;switch(a.a.k){case 1:c>Iih&&(c=zmh-c);break;case 2:c=0;b--){if(null.pD()||null.pD()){a.length>=b+1&&a.splice(0,b+1);break}}return a} +function t2b(a){return a4b(String.fromCharCode(a).toLowerCase(),0)==a&&(g2b==null&&(g2b=new RegExp(Xjh,'i')),g2b.test(String.fromCharCode(a)))} +function PGc(a,b){var c;c=pNd(Kod(a.a.K),null,b,a.a.mc,a.a.oc,false,false,true);tLc(c,false);!!c.F&&LLc(c.F,c.Kc);a.a.mc=c.A;a.a.oc=c.B;QJc(c)} +function qJc(a,b){if(a.Nb&&a.Nm()){b.a+='\t=f&&b<=g&&c>=d&&c<=h} +function V4c(a,b){var c,d,e,f,g;f=cQc(a.e,a.d.c);g=dQc(a.e,a.d.d+a.d.a);e=a.d.b*a.e.Db;c=a.d.a*a.e.Eb;d=new Wrg;E$b(d,f,g,e,c);return O$e(b,d)} +function kXc(a,b){var c;c=q8d(b9b(a.c,b));if(ff(c,167)){return new cde(a.e,c.O.Lk())}return new cde(a.e,B6d(p8d(b9b(a.c,b),(Fhe(),Ehe)).Ap()))} +function fKd(a){var b,c;if(!!a&&a.Lm()){b=a;c=b.q;if(c==(_8f(),V8f)){return true}if(c==D7f){return true}return fKd(b.o)||fKd(b.s)}return false} +function Aed(a,b,c){ued();var d;d=(!a.K&&(a.K=new ZUf(a)),a.K);if(c<0||c>=d.c){return null}if(b<0||b>=d.a){return null}return b9b(d.b,c*d.a+b)} +function t$c(a){a.e=a.xb.zn();if(a.e){a.Qb=pf(a.a+$wnd.Math.sqrt(0.5)*a.g);a.Rb=pf(a.b+$wnd.Math.sqrt(0.5)*a.i)+a.Pb.sb;a.Bb=a.xb.Bl();sAc(a)}} +function g6c(a,b,c,d){var e,f;e=new amf(b.c,b.d,b.gi(),1);if(d!=(tkf(),skf)){Akf(d,e,a.b);Klf(e,a.b.f)}f=e;c[0]=f.f[0];c[1]=f.f[1];return true} +function sod(a,b){b&&Hqd(a,Yvh);!!a.G&&Nwc(a.G);!!a.O&&$rd(a.O);if(a.i){Kkd(a.i);Fkd(a.i)}b&&aEb(a.o.g);lld(a.o);dYf(YOf(a.j).o);Rpd(a);Zpd(a)} +function zvd(a,b,c){if(a.B==(c9d(),a9d)){O4b(b,' '+(pSf(c,'ScreenReader.plus','plus')+' '))}else{a.f||(b.a+=' ',b);b.a+='+';a.f||(b.a+=' ',b)}} +function CXd(a){if(a.a==a.d){!a.d.v&&SNe(a.d);a.f.Tp(a.d)}else a.a==a.e?ff(a.j,56)?PVe(a.j,a.e.mz()):a.f.Up(a.e.mz()):ff(a.f,842)&&a.f.Fx(a.c)} +function T4d(a,b,c,d){abd.call(this);this.c=new n9b;this.e=a;this.b=a.j;this.a=d;if(c&&!a.kb){this.i=b;this.i==null&&(this.i=b)}else{this.i=b}} +function Y9d(a,b,c){var d;for(d=0;d=120&&b<=122;return d||e||c} +function dSe(a,b){a.gb=10;WQe(a);a.H=-a.q[0].e;a.I=a.q[0].d;a.Q=a.k.d*a.H+a.k.e*a.I;a.G[0].Z=a.H;a.G[0].$=a.I;a.R=b[0]-a.Q;a.G[0]._=a.R;bSe(a)} +function fef(a){var b;b=jef(a.b[0],a.b[1])<<3|jef(a.b[1],a.b[2])<<2|jef(a.b[2],a.b[3])<<1|jef(a.b[3],a.b[0]);if(b==15||b==0){return 0}return b} +function jjf(a,b,c){if(c.b>0.5+Iih/a.j){a.n?(c.b=0):(c.b=1);SSe(a.d,b,c)}else if(c.b>1){a.n?(c.b=1):(c.b=0);SSe(a.d,b,c)}else a.n||(c.b=1-c.b)} +function _Rf(a){var b,c;c=a.d.k;if(c.i.length==1&&(mhc(0,c.i.length),c.i[0]).en()){b=q2c(a.b,(mhc(0,c.i.length),c.i[0]));!!b&&b.a.o&&R2c(b.a)}} +function B5f(a,b,c,d){var e,f;f=Hpd(a.d,b,false,0);if(!f||!f.en()||!(!f.lb&&(!f.Db||!cPe(f.Db)))){return}e=a.d.o;SBf(a.d,f,pf(c),new dId(e,d))} +function grg(a,b,c,d,e,f){var g;c-=a;d-=b;e-=a;f-=b;g=e*d-f*c;if(g==0){g=e*c+f*d;if(g>0){e-=c;f-=d;g=e*c+f*d;g<0&&(g=0)}}return g<0?-1:g>0?1:0} +function Yrg(a){var b;b=$wnd.Math.abs(a%360);if(isNaN(b)||b==360||b<=$wnd.Math.abs(360)/2){return b}return (a==0||isNaN(a)?a:a<0?-1:1)*(b-360)} +function SCg(a){if(!a.q){return}a.v=a.r;a.p=null;a.q=false;a.r=false;if(a.s){$wnd.goog.global.cancelAnimationFrame(a.s.a);a.s=null}a.v&&WCg(a)} +function eGg(a){BGg(a.s,true);!!a.f&&aIg(a,'errorStyle',!Bhg(a.f.k));if(!!a.f&&!a.f.rc){dUf(XOf(a.a),false,false);YTf(XOf(a.a),a.f,true,true)}} +function $Lg(a){if($1b(Knh,a.d.a._B(Goh))){(t1b(),$wnd.goog.global.window).parent.postMessage('{"action": "resetUrl"}','*');Mtg('/'+RSg(a.d))}} +function AQg(a,b){var c,d,e;for(d=new a8b((new Z7b(b)).a);d.b;){c=_7b(d);e=c.ff();ff(e,285)?(a[c.ef()]=e.a,undefined):(a[c.ef()]=e,undefined)}} +function Hyc(a,b){var c,d;for(d=new t9b(a.k);d.a=pih?K5g:d>=900?'warn':d>=800?'info':H7g);_gc(c,a.a)} +function PEc(a,b,c){if(mPf(a.f,(WQf(),TQf))){b==(P4c(),N4c)&&b!=a.j&&SOf(a.f)==0&&KPf(a.f,62,0);c&&SOf(a.f)==62&&b!=N4c&&N4c==a.j&&_Ec(a)}a.j=b} +function yFc(a,b,c,d,e){var f,g,h;f=pf(b+d)/2|0;g=pf(c+e)/2|0;if(a.rb>0){h=Xeg(b-d,c-e);if($wnd.Math.abs(h-a.rb)>10){$Dc(a,f,g,h/a.rb);a.rb=h}}} +function ZKc(a,b,c){if(c==(_1f(),W1f)&&false||c==O0f&&!a.yk()){return}a.pc==null&&(a.pc=me(sdb,Z4g,591,b2f().length,0,1));mQf(a.ub);a.pc[c.k]=b} +function oZc(a,b,c){var d;d=NNc(a.a,b);if(!d){d=FOc(c.Pb,b);!!d&&(d.Sb=true,d.Tb=true,c.Tb?(d.Ub=c.Ub):(d.Ub=c),undefined)}else{d.Hi()}return d} +function w5c(a){this.b=new ivc;this.j=new Qrg(0,0);this.d=new Cqg(0,0,0,0);this.e=new lrg;this.i=new crg(0);this.g=new n9b;this.c=a.lb;this.k=a} +function kHd(a){var b,c,d,e;d=jHd(a);c=iHd(a);b=cHd(a);e=1+mqb(Xpb($wnd.Math.round((c-d)/b)));return Fcg($wnd.Math.floor($cc(a.Mc.j.Bb)*e)*b+d)} +function HRd(a,b,c,d,e,f){JOd.call(this,a,b,!a.$);this.e=0,undefined;this.c=c;this.d=d;this.j=e;this.n=f;this.e=1;zRd(this);xRd(this);FOd(this)} +function n3d(a,b,c){kwc.call(this,a);this.d=c;this.c=new rOd(this,new o3d(this));iOd(this.c,1,true);k3d(this);j3d(this);pOd(this.c,b);hwc(this)} +function gYd(a){var b;a.a=a.e.v;a.d=Hpd(a.Mc,a.a,false,0);a.c[1]=a.d;if(a.d){a.d.wk(a);if(a.b){b=new G3d(iIc(a.b));while(b.a){a.d.wk(F3d(b))}}}} +function a3d(a,b,c){var d,e,f,g;g=(!c.q&&!!c.d&&(c.q=Ode(c,c.d)),c.q);d=b.d;for(f=new t9b(g);f.a3){return}f=GYf(YOf(a.b),g);++f.bb;QWf(f,0,c);QWf(f,1,d);f.WA()&&QWf(f,2,e);wQf(f);Zpd(a.d)} +function klg(a,b,c){a.a.k>=b.k&&(ff(c,6)?yVg(b,Z9b(c)):ff(c,17)?yVg(b,Z9b(c)):gf(c)?yVg(b,A9b(cf(c),new PYb)):ff(c,274)?yVg(b,c.ls()):yVg(b,c))} +function Csg(a,b,c,d){var e;e=d[3];if(c>e){$sg(a,d,d[2],e,d[0],d[1],b,c,-1)}else if(c==e&&c==d[1]){return}else{$sg(a,d,b,c,d[0],d[1],d[2],e,1)}} +function fyg(a,b){var c;b?Dhc(a.style,(yYg(),Hrh),''):jXg((c=a.style,QZg(),c),(yYg(),LXg),r9g);b?a.removeAttribute(gGh):a.setAttribute(gGh,Knh)} +function lBg(a){var b,c,d,e;e=null;for(c=new t9b(a.a);c.a0){return ''}return '-'}d=yod(a,b,c);switch(c.B.k){case 2:return d+'*';default:return d;}} +function Fod(a,b,c,d){var e;e=Dvd(d,(c9d(),a9d));if(b>=0){c.a+=e?' plus ':'+ ';O4b(c,yod(a,b,d));return}c.a+=e?' minus ':'- ';O4b(c,yod(a,-b,d))} +function Cxd(a,b){var c,d,e,f,g,h,i;c=a.vu();g=k9g;f=0;for(d=0;de+koh){g=e;f=d}}return f} +function QCd(a,b,c){var d;d=Mre(a.b,b,VIe(c));if(d!=null){return d}throw Qpb(new fye(a.g,(yTf(),YSf),pe(ie(mu,1),h5g,2,6,[n8d(b,(Sud(),oud))])))} +function gOd(a,b,c,d){kwc.call(this,a);this.c=c;this.b=d;this.a=new O0e(a);fOd(this);dOd(this);this.a.Jb=false,undefined;JKc(this.a,b);eOd(this)} +function EOd(a,b,c,d){var e,f;a.Pv(d);for(f=0;f=0&&!a[c].C){d=true;--c}if(d){++c;Dxd(a[c],a[b]);E0e(a[b])}}}} +function _7d(a,b){if(b.w!=0){return}a.o.Lm()?_7d(a.o,b):ff(a.o,111)&&(a.o=P4d(a.o,b));!!a.s&&(a.s.Lm()?_7d(a.s,b):ff(a.s,111)&&(a.s=P4d(a.s,b)))} +function Nae(a,b,c){Iqh1&&(d-=1);if(da.TB()){throw Qpb(new mc(CFh+this.e+'=>'+this.d+'] for '+a))}} +function JCb(a,b){var c,d,e;a.b==-1&&(a.b=b.j);e=b.g;d=KCb(a,b.k,b.i,e);e&&t2b(a.a)?(c=new YKb(d)):(c=new TCb(d));a.i&&a.c&&RCb(c,d.d.c);return c} +function FKb(a){sKb();if(!a){this.a=new n9b}else{if(ff(a,65)){this.a=new o9b(a.a.i.length);_8b(this.a,a.a)}else{this.a=new o9b(1);Z8b(this.a,a)}}} +function $Lb(a,b){var c;c=(EGb(),!DGb&&JGb(),WDb(DGb,b));if(!c){return false}if(!a.f){c=SLb(c);c.i=false;c.j=0}Yc(a.q).Gd(a,c);a.p=-1;return true} +function y2b(a,b,c){ghc(a>=0&&a<=1114111);if(a>=i5g){b[c++]=j5g+(a-i5g>>10&k5g)&Q4g;b[c]=56320+(a-i5g&k5g)&Q4g;return 2}else{b[c]=a&Q4g;return 1}} +function eKc(a,b){var c,d;d=a.pb;a.pb=b&&a.vm();if(d!=a.pb){c=Mod(a.Mc);a.pb?Ekd(c,a):(g9b(c.a,a)&&c.a.i.length==0&&Kkd(c),Lkd(c));gqd(a.Mc,a,4)}} +function ZRc(a,b){var c,d;for(d=0;d80){d=80/e;f=mqb(Xpb($wnd.Math.round(d*f)));g=mqb(Xpb($wnd.Math.round(d*g)))}a.Zb=f;a.$b=g} +function Kqf(a,b){var c;Aqf(a,b.length>0&&(uhc(0,b.length),b.charCodeAt(0)==61)?(uhc(1,b.length+1),b.substr(1)):b,false);c=Ymf(a);Sqf(a);return c} +function EQb(a,b,c){YOb();var d,e;for(e=0;ehe(a.a)==he(b.a)he(a.b)==he(b.b)>1);h=a[g];d=f3b(h,c);if(d<0){f=g+1}else if(d>0){e=g-1}else{return g}}return -f-1} +function Gyc(a){var b,c,d,e,f;f=new j5b('[');for(c=a,d=0,e=c.length;d\n'} +function nOc(a){var b,c,d,e;for(d=(e=(new l8b(a.jb)).a.Zd().rd(),new m8b(e));d.a.xf();){c=(b=d.a.yf(),b.ef());if(zJc(c)){return true}}return false} +function dJd(a,b){var c,d;for(c=0;c<3;c++){for(d=0;d<3;d++){if(!Tcg(b[c][d],Amh)&&$wnd.Math.abs(a)>10000000000*b[c][d]){return true}}}return false} +function MSc(a,b,c){var d,e,f,g,h,i;a.a.i.length=0;d=0;for(g=w4b(b,',',0),h=0,i=g.length;h0){return false}}return true} +function f5d(a,b){var c,d;if(!a.b){return}e5d(a,b,'0\u0305');d=I4b(a.b);for(c=0;c-1?(a.C=nwd(b,a.o)):!a.G&&a.n>-1?(a.C=mwd(b,a.n,false)):(a.C=jwd(b));a.C=hvd(a.C,a.w)} +function Pvf(a){var b,c,d,e;for(c=Kvf,d=0,e=c.length;db)&&(dc)} +function Nug(a){var b,c;c=$wnd.goog.global.parseInt(a.e.C[SFh],10)|0;b=$wnd.goog.global.parseInt(a.e.C[TFh],10)|0;if(c>0){Wug(a,c-1,b);Wug(a,c,b)}} +function uKg(a){this.e=new n9b;this.c=new n9b;this.b=a;this.a=a.M.j;this.f=new occ;this.d=kcc(this.f,0);this.g=new n9b;Z8b(this.c,new KZf(this.a))} +function WIb(a){SIb(this);if(!a){this.b=new n9b}else{if(ff(a,329)){this.b=new o9b(a.b.i.length);_8b(this.b,a.b)}else{this.b=new n9b;Z8b(this.b,a)}}} +function TQg(a,b,c){var d,e,f,g;bvg(c,new Vog(6,1,1));for(g=(e=(new n8b(a.a)).a.Zd().rd(),new o8b(e));g.a.xf();){f=(d=g.a.yf(),d.ff());dRg(f,b,c)}} +function BQc(a){var b,c,d,e;for(c=(e=(new A8b(a.a)).a.Zd().b.Xf(),new B8b(e));c.a.xf();){b=(d=c.a.yf(),d.ef());if(zJc(b)){return true}}return false} +function iSc(a){var b,c,d,e,f,g;g=new uSc;for(c=new t9b(a);c.a0){for(d=b.Gx(),e=0,f=d.length;e>>0,e.toString(16));f=c5g+y4b(d5g,d.length)+d;g=String.fromCharCode(c);return a.replace(new RegExp(f,'g'),g)} +function jub(a){this.j=a;this.k=1;this.g=0;this.a=this.f=g7g;this.c=me(rf,b5g,5,g7g,15,1);this.d=me(uf,v5g,5,g7g,15,1);this.b=me(uf,v5g,5,g7g,15,1)} +function F7b(a,b,c,d){B7b();var e,f;e=0;for(f=0;f0);if((b&-b)==b){return pf(b*adc(a,31)*4.6566128730773926E-10)}do{c=adc(a,31);d=c%b}while(c-d+(b-1)<0);return pf(d)} +function yCc(a,b,c){var d,e;d=b.f.a-a.Rb.a;e=b.f.b-a.Rb.b;switch(c.k){case 3:case 1:e=d/a.Ob.f;break;case 0:case 2:e=-d/a.Ob.f;}return new nvc(d,e)} +function HFc(a,b,c){var d;if(!b||!c){return true}d=$wnd.Math.sqrt((b.a-c.f.a)*(b.a-c.f.a)+(b.b-c.f.b)*(b.b-c.f.b));return d<(A$c(),JOf(a.f,c.j)+12)} +function _Xc(a){fVc(a,a.Pb.f,a.b,a.Bb);wYc(a);zSc(a.c,a.Pb,a.Rb+(a.o-(!!a.tb&&!!a.tb.f.Hb?a.tb.b:pf(a.u*1.2+2)))/2,a.j,a.Bb);qYc(a,false);ozg(a.Pb)} +function Nxd(a,b){var c,d;H_e(a.n[b]);d=me(JY,Roh,33,a.n.length-1,0,1);for(c=0;c1){return D_e(a.p,b,c)}return $wnd.Math.abs((a.Z*b+a.$*c+a._)/Xeg(a.Z,a.$))} +function peg(a,b){var c,d;d=teg(Jec(a.a,b),b);c=teg(Hec(a.a,b),b);if(d==null){return c}if(c==null){return d}if(d.length>c.length){return d}return c} +function uOg(a,b){var c,d;c=(mhg(),b==null||b.length==0?null:Hpd(a.d,b,false,0));if(ff(c,213)){return d=pYe(c,(Sud(),uud)),s4b(d,943,105)}return ''} +function i3e(a,b,c){var d;return Qwc(a.Mc.yt(),new t8d(b.e,b),c,(d=b.i,$1b(fvb((EIe(),FDe)),d)&&b.c.i.length==2?(Sud(),Gud):(Sud(),Jud)),null,a.Mc)} +function zlf(a,b,c,d,e){var f,g,h,i;Zlf(a,b,d);g=Ylf(c,b);i=tlf(g);f=(vlf(g),g);h=alf(d,f);qlf(f,h,d);Pkf(b,d,d);if(e==null){return}e[0]=h/i;e[1]=h} +function Uhg(a,b){mhg();var c,d;c=a;if(c<0){b.a+=M6g;c=-c}d=b.a.length;do{e5b(b,d,String.fromCharCode((DAb(),gac(CAb,c%10).a)));c=c/10|0}while(c>0)} +function zrg(a,b){var c;if(b===a){return true}if(ff(b,1622)){c=b;return a.ki()==c.ki()&&a.li()==c.li()&&a.ji()==c.ji()&&a.ii()==c.ii()}return false} +function Vrb(a){var b;if(Tsb(a,15))return true;if(wsb(a))return true;while(true){b=a.w;if(Osb(a)){a.w=b;break}}if(Tsb(a,16))return true;return false} +function Vtg(b){mhg();if(b.length!=0){try{(t1b(),$wnd.goog.global.history).pushState({},'GeoGebra',b)}catch(a){a=Ppb(a);if(!ff(a,38))throw Qpb(a)}}} +function KHg(b){var c;c=(t1b(),$wnd.goog.global.window);try{b.a=b==FHg?c.localStorage:c.sessionStorage}catch(a){a=Ppb(a);if(!ff(a,38))throw Qpb(a)}} +function XCg(a){VCg(a);if(a.b){Dhc(a.c.C.style,Uuh,Grh);a.c.t!=-1&&CCg(a.c,a.c.j,a.c.t);eDg(a.a,a.c)}else{a.e||zyg(a.a,a.c)}Dhc(a.c.C.style,lGh,'')} +function YLg(a){Uxg((Z3g(),a4g(null)),Fnh);TKg(a);a._b=pVg();Utd(a.pb.cb);!sZf(a.U.a)&&JLg(a)&&tOf(a);$Lg(a);!!a.eb&&DVf(a.eb.a);Vxg(a4g(null),Fnh)} +function _1g(a,b,c){var d,e,f;f=0;e=a.firstChild;d=null;while(e!=null){if(e.nodeType==1){if(f==c){d=e;break}++f}e=e.nextSibling}a.insertBefore(b,d)} +function orb(a,b){var c,d,e;if(!ff(b,478)){return b}d=b;for(e=0;e<(d.d?d.d.i.length:0);e++){c=d.pd(e);ff(c,240)&&c.a.c==63?vwb(d,e):c.od(a)}return b} +function NNb(a,b,c,d){var e,f;if(b0?a.f.Fc:a.f.Gc)+10;if(bfzg(a.f)){return w3b(pf(fzg(a.f)-d+c))}return null} +function QUc(a,b){switch(a.e.f?pf(a.e.f.H):1){case -1:return a.a.Qb-b+1;case 0:return a.a.Qb+3-$wnd.Math.floor(b/2);case 1:default:return a.a.Qb+6;}} +function FZc(a){switch(a.k){case 9:return r_e(),q_e;case 10:return r_e(),p_e;case 11:return r_e(),n_e;case 12:return r_e(),o_e;default:return null;}} +function lwd(a,b){switch(a.q.k){case 10:return b?'>':'<';case 12:return b?'>=':'<=';case 13:return b?'<=':'>=';case 11:return b?'<':'>';}return null} +function lXc(a,b,c){var d;d=q8d(b9b(b.c,c));if(ff(d,167)){return d.O}return new qWe(a.Pb.C.pb.o,new Ebe(a.xb.vi(),p8d(b9b(b.c,c),(Fhe(),Ehe)).Ap()))} +function J5c(a,b,c){var d;if(c!=null){l6c(a,c,(dud(),bud));d=c}else{d=me(sf,g9g,5,b.length,15,1)}l6c(a,b,(dud(),cud));n5b(b,0,d,0,b.length);return d} +function afd(b,c){var d;try{d=Tbc(c,'showObject');d!=null&&Tgd(b.t,b.n,d);return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function Bfd(b,c){try{b.n.Zb=Y2b(Tbc(c,'x'),10);b.n.$b=Y2b(Tbc(c,'y'),10);return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function Dgd(a){ncc(a.v);ncc(a.t.a);ncc(a.g.a);ncc(a.p.a);ncc(a.a);ncc(a.q);ncc(a.c.a);ncc(a.b.a);ncc(a.A.a);a.u=false;a.k=false;a.o=false;a.w=false} +function ljd(a){if(a!=null&&(new RegExp('^(graphing|geometry|classic|3d|3D|scientific|suite|cas|notes|probability)$')).test(a)){return a}return null} +function VBd(a,b,c,d){kwc.call(this,a);this.a=null;this.c=c;this.a=d;this.b=d.lp();this.d=new N4e(a);this.d.i=true;UBd(this);TBd(this);JKc(this.d,b)} +function wOd(a,b,c,d,e){kwc.call(this,a);this.g=e;this.c=b;this.d=c;this.e=d;this.f=new CSe(a);vOd(this);tOd(this);!!this.e&&this.e.az(this.f,false)} +function Yke(a,b,c,d){abd.call(this);this.b=a;fld(a.o,(i3f(),M2f));this.d=new hwf(this,gle(YOf(this.b.j).i));dwf(this.d,(owf(),iwf));Uke(this,b,c,d)} +function p2d(a){var b,c,d,e;e=a.a.k.i.length;if(e==0){C4e(a.b,'');return}d=new h5b;for(c=0;c=e.k.i.length+1){return NaN}f=b9b(e.k,c-1);return f.Lk()} +function BEg(a,b,c){var d,e,f;f=-1;!!c&&(f=DEg(a,c));for(e=b.DC().rd();e.xf();){d=e.yf();eyg(d.eC(),'accessibilityControl',true);gDg(a.b,d,f+1);++f}} +function SHg(a,b){var c,d;c=hyg(a,new VHg(b),(l0g(),l0g(),k0g));d=gyg(a,new WHg(b),(u0g(),u0g(),t0g));return new Y0g(pe(ie(Bob,1),Z4g,1003,0,[c,d]))} +function cNg(a){var b,c,d,e,f,g;g=new n9b;for(d=a,e=0,f=d.length;e1&&a4b(c,c.length-1)==10){c=z4b(c,0,c.length-1)}a.g?(a.v=kig(c,false)):(a.v=t4b(c,'\\\\n',y6g))} +function dcf(a,b,c,d){var e,f,g;f=b.V;for(e=0;ee&&(e=c.$l().o)}return e} +function p5f(a,b,c,d,e,f){var g,h;g=Hpd(a.d,b,false,0);if(ff(g,281)){h=g;h.my(c/$wnd.Math.max(YOf(a.b).g.a,12));h.ny((d?1:0)|(e?2:0));h.ry(f);g.yp()}} +function pjg(a,b,c,d,e){var f;if(a.s){return false}c.i.length=0;a.o=d;a.b=e;a.c=b;a.p=false;try{f=qjg(a);f&&ijg(a,c);return f}finally{a.g.i.length=0}} +function hrg(a){var b,c,d,e;if(a.a=j5g&&d<=56319&&b0?e:c.i.length)-1);d=(mhc(e,c.i.length),c.i[e]);Yyc(a,b,g,d,f)}return f} +function UEc(a,b,c,d){a.X=new jvc(c,d);a.d=b;a.X.a<0?(a.X.a=0):a.X.a>fzg(a.kc)&&(a.X.a=fzg(a.kc));a.X.b<0?(a.X.b=0):a.X.b>bzg(a.kc)&&(a.X.b=bzg(a.kc))} +function zLc(a,b){var c,d,e;a.zp(b);Zpd(a.Mc);if(a.mb){e=new n9b;for(d=new G3d(a.mb);d.a;){c=F3d(d);ff(c,946)&&(b==1||b==4)&&(Vgc(e.i,c),true)}nwc(e)}} +function Qpd(a,b,c){var d,e;pQf(a.j,c);if(a.S){for(e=new t9b(a.rb);e.a=a.d.n){b=q4c(a,b);a.c&&(b=s4c(a,a.a,b))}return b} +function bhd(a,b){if(a4b(b,a.k.a.length-2)!=47){if(m4b(b,G4b(32))>-1){return '<\/'+z4b(b,1,m4b(b,G4b(32)))+'>'}return '<\/'+z4b(b,1,b.length)}return b} +function cJd(a,b){return a[0][0]*b.Z*b.Z+a[1][1]*b.$*b.$+a[2][2]*b._*b._+(a[0][1]+a[1][0])*b.Z*b.$+(a[0][2]+a[2][0])*b.Z*b._+(a[1][2]+a[2][1])*b.$*b._} +function tKd(b){try{b.c.Z=b.b[0].Lk();b.c.$=b.b[1].Lk();b.c._=b.b[2].Lk();!!b.c.v&&SNe(b.c)}catch(a){a=Ppb(a);if(ff(a,48)){LMe(b.c)}else throw Qpb(a)}} +function ATd(a,b,c){Exd.call(this,b.Kc);this.a=b;++b.D;this.e=c;this.i=null;this.g=new O0e(b.Kc);yTd(this);xTd(this);wTd(this);JKc(this.g,a);vTd(this)} +function eye(a,b,c,d,e){Yxe();Fqb.call(this,b.b);this.a=null;this.c=a;this.d=b;this.e=me(mu,h5g,2,3,6,1);this.e[0]=hye(c);this.e[1]=d;this.e[2]=hye(e)} +function O2d(a,b){var c;kwc.call(this,a);this.b=b;L2d(this,a);for(c=1;cb.a){return new off(k9g,h9g)}if(b.b){return bif(b,new Uhf(a))}return new off(Lif($wnd.Math.exp(b.c)),Kif($wnd.Math.exp(b.a)))} +function Sjf(a,b,c){var d,e,f,g;for(d=1;d<=c.e;d++){for(e=1;e<=c.a;e++){g=0;for(f=1;f<=a.a;f++){g+=Njf(a.f[f-1],d)*Njf(b.f[e-1],f)}Jlf(c.f[e-1],d,g)}}} +function xDg(a,b,c,d){var e;NWg(b.a,'');STg(b,0,c);!jlg&&AVg(a.c);a.g=d;oDg(a);e=a4g(b.a.id);e?tyg(e,a,e.C):nlg('Cannot find article with ID '+b.a.id)} +function bMg(a,b,c){var d,e,f,g;f=b/zLg(a);g=c/lLg(a);e=$1b(Knh,a.d.a._B('allowUpscale'));d=eIg(f,g,e);e||(d=$wnd.Math.min(d,LSg(a.d,uih,1)));cMg(a,d)} +function TTg(a){var b,c;if($1b('',(c=a.a.getAttribute(HHh),c!=null?c:''))){return PTg(a.a,'x',true)}return X2b((b=a.a.getAttribute(HHh),b!=null?b:''))} +function pub(a,b,c,d,e,f){oub.call(this,k7g+c+v6g+d+l7g+(a?z6g:"'"+wrb(''+f)+"' ("+f+m7g)+(e==null||e.length==0?'':n7g+wrb(e)+'"')+(b==0?'':o7g+b+')'))} +function XAb(){XAb=xqb;SAb=new xLb((tRb(),hRb),1,0,0);TAb=new xLb(hRb,0.5,0,0);WAb=new xLb(iRb,0,1,0);VAb=new xLb(iRb,0,0.4,0);UAb=new xLb(iRb,0,0.4,0)} +function KPb(a){var b,c,d;for(c=new W8b(a.q);c.a!=c.b;){b=U8b(c);if(ff(b,231)){d=b;if(d.a==2){return d}return null}if(!b.Ld()){return null}}return null} +function IYb(a,b){var c,d,e,f;f=a.size();b.lengthf&&(b[f]=null);return b} +function $nc(a,b){var c;if(b.length!=Znc(a)){throw Qpb(new zkc(b.length,Znc(a)))}Tnc(a.c,b,a.d);for(c=new t9b(a.a);c.ag+koh?-1:1}d=b.ev();e=c.ev();if(d==e){return 0}return d>e+koh?-1:1} +function Ald(a,b,c){var d,e;d=m4b(b,G4b(95));d==-1?(e=b):(e=(thc(0,d,b.length),b.substr(0,d)));!F6e(e,a.M,null)&&!$1b(e,Cph)&&(e='a');return ild(a,e,c)} +function HQd(a,b,c,d,e,f,g,h,i,j){a[4]=b*b*g;a[3]=4*g*b*d;a[2]=2*g*b*c+4*g*d*d-4*b*e*j+4*e*e*f;a[1]=4*g*c*d-8*e*d*j+8*e*e*i;a[0]=-4*e*c*j+g*c*c+4*e*e*h} +function TRd(a){var b,c;$Rd(a,a.g,a.c);for(c=0;cb){for(c=a.c*a.a-1;c>=b*a.a;c--){f9b(a.b,c)}}else{for(c=a.c*a.a;c0?(a.cb=true):xQf(a)} +function w0f(a,b){var c,d,e;if(a.c){c=!!a.a.pb.o&&!!b.d;c&&zmd(a.a.pb.o,b.d);for(e=new t9b(a.b);e.athis.c+this.b&&(c|=4);this.a<=0?(c|=10):bthis.d+this.a&&(c|=8);return c} +function ze(a,b){var c,d,e;if(b<=22){c=a.l&(1<>16&255,a.b>>8&255,a.b&255);b[2]>0.4?(b[2]-=0.3):(b[2]-=0.2);b[2]=$wnd.Math.max(b[2],0);return Xuc(b[0],b[1],b[2])} +function SCc(a,b){var c,d;if(b.i.length==0||b.i.length<2){return null}c=(mhc(0,b.i.length),b.i[0]);d=(mhc(1,b.i.length),b.i[1]);return BGc(a.i,c,d,true)} +function qIc(a,b){if(a.xm()){a.wb.a||(b.a+=kph,b)}else{if(a.wb.b){b.a+='\t=1){return a.d[0]}q3f(Dzh+a.i);throw Qpb(new cye(a.b.B,sSf(a.b.B)+wjh+a))} +function uae(a,b){var c,d,e,f;if(a.o==null){return false}for(d=a.o,e=0,f=d.length;e5?10*d:c>2?5*d:2*d} +function aqg(a){if(a>180){if(a<=540){a=a-360}else{a=Yrg(a);a==-180&&(a=180)}}else if(a<=-180){if(a>-540){a=a+360}else{a=Yrg(a);a==-180&&(a=180)}}return a} +function Btg(){Btg=xqb;var a;rxc();Atg=(a=$wnd.window.evalGeoGebraCASExternal,$1b(O4g,typeof(a))&&$1b('2',a.call((t1b(),$wnd.goog.global.window),'1+1')))} +function MHg(b,c){KHg(b);try{b.a!=null&&b.a.setItem(bFh,c)}catch(a){a=Ppb(a);if(ff(a,38)){!!jlg&&klg(jlg,(Clg(),Blg),'Quota exceeded')}else throw Qpb(a)}} +function ne(a,b){var c=new Array(b);var d;switch(a){case 14:case 15:d=0;break;case 16:d=false;break;default:return c;}for(var e=0;e102)){return false}}return true} +function Krd(a,b,c){var d,e,f;d=D3b(a.Jc);u8b(c.a,d)||b.a.put(a,(Y1b(),W1b))==null;c.a.put(d,(Y1b(),W1b))==null;e=a.Y;for(f=0;ft9g){return new zIb(a,b,(oNb(),iNb))}else{jCb(a,$wnd.Math.max(a.q,0));iCb(a,$wnd.Math.max(a.o,0))}}return a} +function lQb(a){var b;while(!I8b(a.s)){b=O8b(a.s);a.n=b.e;a.i=b.b;a.o=b.d;if(b.f){bPb(a);return false}if(a.o$wnd.Math.abs(a.$)){b[0]=-a._/a.Z;b[1]=0}else{b[0]=0;b[1]=-a._/a.$}}} +function Lqf(a,b){var c;Aqf(a,b.length>0&&(uhc(0,b.length),b.charCodeAt(0)==61)?(uhc(1,b.length+1),b.substr(1)):b,false);a.g=false;c=Ymf(a);Sqf(a);return c} +function Nqf(a,b){var c;Aqf(a,b.length>0&&(uhc(0,b.length),b.charCodeAt(0)==61)?(uhc(1,b.length+1),b.substr(1)):b,true);a.d.b=true;c=Ymf(a);Sqf(a);return c} +function B3f(b,c){var d;try{zre(Jod(b.d),c,false,null,false,null)}catch(a){a=Ppb(a);if(ff(a,43)){d=a;nlg(d._c());return false}else throw Qpb(a)}return true} +function evg(a){var b;if(!a.i||a.j==null){return}b=plh+(a.i.b>>16&255)+','+(a.i.b>>8&255)+','+(a.i.b&255)+','+(a.i.b>>24&255)/255+')';K_b(a.j,b);J_b(a.j,b)} +function NDg(a,b){kDg();var c,d,e,f;for(d=new t9b(a);d.a0&&(c.a+=L7g,c);c.a+='<';O4b(c,a.g[b].rp());c.a+='>'}c.a+=' ]';return c.a} +function aye(a){var b,c,d,e,f;f=new h5b;O4b(f,$xe(a));if(!a.d&&a.e!=null){f.a+=' \n';for(c=a.e,d=0,e=c.length;d1&&Pvc(b)){return true}}}return false} +function fke(a,b){var c,d,e;for(d=b;d<=a.a.length;d=jke(a,d+1)){e=z4b(a.a,0,d);if(a.d.contains(e)){return e}c=Hpd(a.b,e,false,0);if(c){return e}}return null} +function BZe(a,b){var c,d;c=0;for(d=0;d=0?(a.C=v4b(a.C,b,c)):(a.C=null);a.D=v4b(a.D,b,c)}a.c=c} +function pVe(a){var b,c;if(!(a.r&&!!a.d&&(b=q8d(a.d.n),!(ff(b,31)&&b.Dm()&&isNaN(b.Lk()))))||!a.d){return NaN}c=me(sf,g9g,5,2,15,1);GYe(a.d.n,c);return c[1]} +function rVe(a){var b,c;if(!(a.r&&!!a.d&&(b=q8d(a.d.n),!(ff(b,31)&&b.Dm()&&isNaN(b.Lk()))))||!a.d){return NaN}c=me(sf,g9g,5,2,15,1);GYe(a.d.n,c);return c[0]} +function l6e(a,b,c,d,e,f,g,h){var i;if(h&&!!g.kl()){O4b(f,n6e(g.kl(),b))}else{i=me(mu,h5g,2,3,6,1);i[0]=yod(a,c,b);i[1]=yod(a,d,b);i[2]=yod(a,e,b);m6e(i,f)}} +function Tgf(){Rgf();return pe(ie(b0,1),I7g,126,0,[Qgf,Ggf,rgf,sgf,tgf,ugf,vgf,wgf,xgf,ygf,zgf,Agf,Bgf,Dgf,Cgf,Egf,Fgf,Hgf,Igf,Jgf,Kgf,Lgf,Mgf,Ngf,Ogf,Pgf])} +function P$f(a,b){if($1b(DEh,b)){if(Jbc(a.g,wrh)){return a.g.a.get(wrh)}}else if($1b(EEh,b)||$1b(FEh,b)){if(Jbc(a.g,GEh)){return a.g.a.get(GEh)}}return null} +function Q3f(a,b,c){var d;d=Hpd(a.d,b,false,0);if(!d){return ''}if(ff(d,167)){return d.ll(c?(Sud(),oud):(Sud(),Dud))}return yIc(d,c?(Sud(),oud):(Sud(),Dud))} +function mhg(){mhg=xqb;ihg=pe(ie(rf,1),b5g,5,15,[48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70]);khg=new i5b;lhg=new cEb;ZDb(lhg,'o','0');ZDb(lhg,'O','0')} +function KCg(a,b){var c,d,e;c=a;while(c){d=(e=c.getAttribute('data-scale'+b),e!=null?e:'');mhg();if(!(d==null||d.length==0)){return X2b(d)}c=BWg(c)}return 1} +function WWg(a){var b;b=a.scrollingElement;if(b!=null){return b}b=$1b(a.compatMode,'CSS1Compat')?a.documentElement:a.body;return b!=null?b:a.documentElement} +function g3b(a){var b,c;if(isNaN(a)){return {l:0,m:0,h:524160}}return b=new ArrayBuffer(8),(new Float64Array(b))[0]=a,c=new Uint32Array(b),xhc(c[0]|0,c[1]|0)} +function Sc(a,b,c){var d;this.f=a;this.c=b;this.e=c;d=a+1;this.a=me(gu,W4g,7,d,3,2);this.j=new _c(d);this.d=me(Npb,y5g,5,d,16,1);this.g=me(Hf,Z4g,1245,d,0,1)} +function Ee(a,b){var c,d,e;e=a.h-b.h;if(e<0){return false}c=a.l-b.l;d=a.m-b.m+(c>>22);e+=d>>22;if(e<0){return false}a.l=c&B5g;a.m=d&B5g;a.h=e&C5g;return true} +function rub(a,b){var c,d;if(b==null||b.length!=1){return null}c=WDb(a.a,b);if(!c){d=(uhc(0,b.length),b.charCodeAt(0));c=new Oub(b,d,1);ZDb(a.a,b,c)}return c} +function rPb(a){var b;tQb(a);if(a.o0||!g&&h==0)){return false}return true} +function jxc(a,b){var c,d;for(c=0;c<2;c++){q8d((mhc(c,a.i.length),a.i[c]))}d=b.a.length;0d&&(b.a+=J4b(me(rf,b5g,5,-d,15,1)));b.a+=Inh} +function bzc(a,b,c){var d,e;e=b;mgc(kgc(new wgc(null,new gdc(e,16)),new ezc),new fzc);for(d=0;d<4;d++){e=Zyc(a,new dzc($yc(c[(d+3)%4]),$yc(c[d])),e)}return e} +function Sed(b,c){try{kKc(b.n,(phd(),$1b(Knh,Tbc(c,xph))?(lbf(),kbf):(lbf(),ibf)));return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function Xaf(b){var c,d;try{if(!b.d.Ei()){d=b.d.Ck().lp();rmd(b.c.o,b.d.lp(),d,null);b.d=d}}catch(a){a=Ppb(a);if(ff(a,48)){c=a;slg(c._c())}else throw Qpb(a)}} +function h9d(a,b,c,d){if(c!=null){if(b.r){return new Zee(a.a,hae(b,c))}else if(d.Di()&&!d.Em()){return new cde(a.a,NaN)}return new cde(a.a,gae(b,c))}return d} +function zae(a,b){var c,d;if($wnd.Math.abs(b.Z)>$wnd.Math.abs(b.$)){c=b._/b.Z;d=0}else{c=0;d=b._/b.$}a._h(c,d);yae(a,2*$wnd.Math.atan2(-b.Z,b.$));a._h(-c,-d)} +function GOe(a){NHc();BLc.call(this,a);this.q=true;this.A=40;this.u=30;this.s=1;this.t=0;this.v=false;this.r=false;sKc(this,true);this.Jb=true;lKc(this,true)} +function IZf(a,b,c){if(b==(_1f(),u1f)){r3f(hLg(a.a),c[0])}else if(b==F0f){C3f(hLg(a.a),c[1])}else if(b==W1f){C3f(hLg(a.a),c[2])}else{return false}return true} +function M_f(a,b,c){if(a.b.i.length==0&&a.a.a.length>0){throw Qpb(new r_f('Nesting problem: multiple top-level roots'))}J_f(a);Z8b(a.b,b);O4b(a.a,c);return a} +function jcg(){jcg=xqb;var a,b,c,d;gcg=new mcg;hcg=new ncg;icg=new cEb;for(b=pe(ie(odb,1),I7g,618,0,[gcg,hcg]),c=0,d=b.length;c0&&BDg(a,mqb(Xpb($wnd.Math.round(LSg(a.b.d,sih,0)))),mqb(Xpb($wnd.Math.round(LSg(a.b.d,tih,0)))))} +function Xqb(a,b,c){var d,e,f,g;d=(e=new frb,f=b.b,g=owb(b.a,f-1),e.b=ff(g,241)&&(g.md((Lvb(),Jvb))||g.md(Hvb))?g:null,!!e.b&&--f,e.a=Mqb(b,f),e);Yqb(a,b,d,c)} +function Xrb(a){var b;b=a.w;if(Tsb(a,11)){a.w=b;if(Tsb(a,13))return true}if(usb(a))return true;b=a.w;if(Tsb(a,12)){a.w=b;if(Tsb(a,14))return true}return false} +function fQb(a){var b,c;if(a.o=a.b.length){g=me(sf,g9g,5,2*f,15,1);for(e=0;e0.1;if(Ocg($wnd.Math.abs(a.k)%Iih,Hih)){a.Mw(NaN)}else{a.Mw($wnd.Math.tan(a.k));b&&Scg(a.k)&&a.Mw(0)}a.i=0;return a} +function JJe(a){var b,c,d;if(a.q==(_8f(),M7f)&&ff(a.s,62)){c=a.s;for(d=0;d0){d=c.fB(b)}else{a.a+='-';d=c.fB(-b)}uhc(0,d.length);d.charCodeAt(0)==46&&(a.a+='0',a);a.a+=''+d} +function akg(a){var b;b=null;Kkg(a.e.r,a.r)&&!a.e.g?(b=a.e):Kkg(a.n.r,a.r)&&!a.n.g&&(b=a.n);if(!!b&&(b.j==-2||b.f==b.o&&!(he(b.c.b)==0))){return null}return b} +function yGg(a,b){var c;if(a.k){throw Qpb(new n3b('Composite.initWidget() may only be called once.'))}oyg(b);c=b.C;a.C=c;G3g();C1g(c)&&H3g(c,a);a.k=b;qyg(b,a)} +function ZMg(b){var c,d;try{c=Jod(b.a.pb).c;AKg(c);wKg(c);BKg(c);zKg(c);xKg(c)}catch(a){a=Ppb(a);if(ff(a,237)){d=a;WMg(b,null);throw Qpb(d)}else throw Qpb(a)}} +function AXc(b){var c;if(!b.Mb){try{b.Mb=Tog(b.Ib,b.e,2500)}catch(a){a=Ppb(a);if(ff(a,38)){c=a;nlg('problem creating Locus shape: '+c._c())}else throw Qpb(a)}}} +function xwc(b,c){var d;try{return Mqf(b.b,c)}catch(a){a=Ppb(a);if(ff(a,48)){d=a;q3f((d.j==null&&(d.j=$b(d)),d.j));return new cde(b.b.G,NaN)}else throw Qpb(a)}} +function HOg(a,b,c,d,e){var f,g,h;f=a.b.cb;if(f){g=f;b==null?(h=_yg(g,c)):(h=uSg(a.d.j,0,Hpd(a.d,b,false,0),d,c,3))}else{return}d!=null&&Otg(h,d);!!e&&e.sg(h)} +function FQg(a){var b;if(a.c){return}if(a.e.g!=null){b=(m5b(),Xpb(Date.now()));Ypb(a.b,0)&&Ypb(jqb(b,a.b),50)?HQg(a.e.a):Wpb(a.b,0)&&(a.b=b)}else{QAg(a.e,16)}} +function yc(a,b){wc();if(a.querySelector&&a.querySelector(t5g)){var c=a.querySelector(t5g);var d=c['nonce']||c.getAttribute('nonce');b.setAttribute('nonce',d)}} +function hrb(a,b){var c,d,e;orb(a.a,b);if(ff(b,356)){c=b;if(c.a>=1){for(d=0;d<(c.d?c.d.i.length:0);d++){e=!!c.d&&c.d.i.length>d&&d>=0?b9b(c.d,d):null;irb(e)}}}} +function Ytb(a,b,c){switch(a){case 0:return eqb(Spb(rtb[b],c),0);case 33:return eqb(Spb(stb[b],c),0);case 34:return eqb(Spb(ttb[b],c),0);default:return false;}} +function wBc(a,b,c,d){var e,f,g;g=0;for(f=new t9b(c);f.a0&&F1b(b.c,b.c.a.length-1)!=32&&O4b(b.c,' ');i7e(b,pSf(c,'DropdownClosed','Dropdown closed'))} +function m$e(a){KYe();var b,c;c=(mhc(0,a.i.length),a.i[0]);b=1;while(b=c+e} +function hzg(a,b,c){var d,e,f;e=(f=a.$b,new Rrg(f.b,pf(a.f.e.C.height/a.f.p)-f.a-24,24,24));d=new Rrg(e.c-12,e.d-12,e.b+24,e.a+24);return Kpd(a.Jb)&&Jrg(d,b,c)} +function AGg(a){var b,c;b=(c=a.b.C[Yph],c==null?null:''+c);if($1b(b,a.d)){return}a.d=b;b.length==0?TIg(a.g,(new h4g(null,a.f),a.c)):VIg(a.g,new h4g(b,a.f),a.c)} +function dOg(a){aOg();var b,c;if(!VDb(_Ng,w3b(a))){b=new cOg(a);YDb(_Ng,w3b(a),b);c=qd()+'deferredjs/'+(kd(),$strongName)+'/'+b.c+'.cache.js';fUg(new gUg,c,b)}} +function XUg(a){var b,c;this.b=a;b=pf($wnd.Math.floor(SNc(this.b)));c=pf($wnd.Math.floor(RNc(this.b)));this.a=YUg(b,c);this.d=new fvg(this.a);CPf(this.b.C,3,1)} +function Pc(a,b,c){var d;if(a.d[b]){Ld((Ed(),Dd),new Cd(c));return}d=a.a[b];d==null&&(d=a.a[b]=me(Af,Z4g,468,0,0,1));d[d.length]=c;!!a.g[b]||Jc(a,b,new Vc(a,b))} +function Pvb(){Lvb();return pe(ie(zg,1),I7g,209,0,[rvb,vvb,Gvb,Evb,tvb,lvb,zvb,svb,Jvb,Hvb,wvb,Fvb,qvb,Bvb,yvb,uvb,xvb,Cvb,Ivb,Kvb,pvb,ovb,Avb,Dvb,mvb,kvb,nvb])} +function GEc(a,b){if(!a.Ib&&!b.cn()){a.kc.f.e.C.focus();a.Ib=true;ILg(new KMg(b))}else a.kc.Bb.e.i.length>0&&ff(b9b(a.kc.Bb.e,0),213)&&(a.kc.f.e.C.focus(),true)} +function ELc(a,b){NHc();var c,d,e,f,g;d=JLc(a);e=JLc(b);c=b4b(d,e);if(c!=0){return c}f=a.length-d.length;g=b.length-e.length;if(f!=g){return f-g}return b4b(a,b)} +function H0c(a,b){z0c();MAc.call(this);this.Pb=a;this.k=b;this.xb=b;this.n=oug(new sug(pbh),0,a.sb);this.a=new VUc(b,this,ezg(a,this.n));KAc(this,b,0);E0c(this)} +function pSd(a,b,c,d,e,f){rRd.call(this,a);this.k=c;this.c=d;this.d=e;this.e=f;nSd(this);oSd(this);Xvc(this);mSd(this);b!=null?JKc(this.i,b[0]):JKc(this.i,null)} +function x1c(a,b){var c,d;c=a.Ap();d=c.q;if(d==(_8f(),e8f)||d==f8f||d==Q7f||d==R7f||d==E7f){y1c(c.o,c.s,b);y1c(c.s,c.o,b)}else if(U6f==d){x1c(c.o,b);x1c(c.s,b)}} +function h8c(a,b){if(!AOc(a.e,b)||!zJc(b)){return false}return b.Rm()||b.Qm()&&b.jp()||b.pn()&&(zJc(b)||b.ib&&b.ip())&&b.pv()||b.en()&&b.i||b._m()&&b.pv()&&!b.j} +function vod(a,b){var c,d;d=me(vf,G6g,5,2,14,1);d[1]=lqd(a);d[0]=Xpb($wnd.Math.round(b*lqb(lqd(a))));c=jrd(d[0],d[1]);d[0]=Vpb(d[0],c);d[1]=Vpb(d[1],c);return d} +function Gvd(a){switch(a.q.k){case 32:case 31:case 33:case 62:case 61:case 63:case 56:case 55:case 57:case 65:case 64:case 66:return true;default:return false;}} +function j9f(a){switch(a.k){case 11:return f8f;case 13:return e8f;case 10:return R7f;case 12:return Q7f;case 9:return p8f;case 8:return E7f;default:return o8f;}} +function VXf(a){TXf();switch(a){case -1:return QXf;case 0:return PXf;case 1:return OXf;case 2:return NXf;case 3:return RXf;case 4:return SXf;}throw Qpb(new S1b)} +function eTe(a,b){var c;if(!a.c[b]){return dTe(a,b)}if(!a.i[b]){a.i[b]=new Gbe(dTe(a,b),a.Mc);c=gKd(P6d(dTe(a,b).n,a.Mc),false).Ap();jkd(a.i[b],c)}return a.i[b]} +function rQf(a){this.kb=new Gdc;this.$b=(rVf(),qVf);this.dc=sQf(Dvh);this.Fb=new n9b;this.Bb=new cdc;this.U=new rZf;this._=new GQf(this);this._b=pVg();this.zb=a} +function O3f(a,b){var c,d;d=(Sud(),Eud);mhg();b==null||b.length==0||(d=mwd((c9d(),U8d),Y2b(b,10),a.s));c=a.G;return !c?YOe(a,d):c.tp().Di()?c.tp().qp(d):c.jj(d)} +function aeg(a,b,c){var d,e;for(e=new a8b((new Z7b(b)).a);e.b;){d=_7b(e);a.a+=c;a.a+=' ';O4b(a,$wnd.goog.global.escape(d.ef()));a.a+=' ';O4b(a,d.ff());a.a+=y6g}} +function Yug(b,c){b.q=false;if(c){b.n=c;try{b.j.font=pug(b.n)}catch(a){a=Ppb(a);if(ff(a,48)){b.q=true;nlg('problem setting font: '+pug(b.n))}else throw Qpb(a)}}} +function brd(b,c,d,e){var f,g;try{f=new lXd(b.o,c,d,e);return f.Y}catch(a){a=Ppb(a);if(ff(a,38)){g=a;!!jlg&&klg(jlg,(Clg(),vlg),g);return null}else throw Qpb(a)}} +function nSg(a,b,c,d,e){var f;f={};f['images']=Qgc(a.i);f['gifWidth']=c;f['gifHeight']=d;f[svh]=e;$wnd.window.gifshot.createGIF(f,yqb(tSg.prototype.BC,tSg,[b]))} +function iTg(a,b){var c,d;d=E4b(y4b(b,m4b(b,G4b(44))+1));c=$wnd.base64Util.base64ToBytes(d);t1b();$wnd.goog.global.setTimeout(yqb(pTg.prototype.Bf,pTg,[a,c]),0)} +function XTg(){var a,b,c,d,e;e=(t1b(),p1b).getElementsByClassName(IHh);b=new n9b;for(d=0;d=d){return -1}e=(a.a[c]|0)&R4g<=d){return -1}e=a.a[c]|0}return c*31+v3b(e)} +function cfc(){this.a="GwtEvent is deprecated; please migrate to Event. revive only resets the event's source, and doesn't exist in Event.";m5b();Xpb(Date.now())} +function vvc(a,b,c){var d,e;for(d=0;d0&&(e=true);return e&&(c.i.length!=a.D.i.length||!FYb(c,a.D))} +function $0c(a){var b;if(!!a.j.Fs()&&!a.j.Fs().un()){b=a.j.Fs().pz();if(!Scg(llf(b))){a.c=false;return false}h1c(a.e,b.f[0],b.f[1])}else{h1c(a.e,0,0)}return true} +function Ond(a,b,c){var d;d=-1;switch(b.length-1){case 0:d=0;break;case 1:b[0]=-b[0]/b[1];c[0]=0;d=1;break;case 2:d=Ynd(b,c);break;default:d=Nnd(a,b,c);}return d} +function P4d(a,b){var c;c=cse(Jod(a.e),a,VIe(b));ff(c,13)&&(a.d=pe(ie(fY,1),qnh,13,0,[c]));if(c){return c}q3f(Dzh+a.i);throw Qpb(new cye(a.b.B,sSf(a.b.B)+wjh+a))} +function bPe(a,b){var c,d,e,f;a.L=new n9b;e=w4b(b,',',0);for(d=0;dhe(a.r.b)){return he(b.r.a)okg(b,he(a.r.b))}return he(b.b.a)2){--g;e=b%g;if(e==0){f=g;d=0;c=true}else if(e>d){d=e;f=g}}a.j=f==0?1:f;a.b=(b/a.j|0)+(d==0?0:1)} +function Yjd(a,b){b.a+='\t=c.i.length){return}e=(mhc(b,c.i.length),c.i[b]);d=m4b(e,G4b(91));d==-1&&(d=m4b(e,G4b(40)));iGg(a,a.d+d);bGg(a,false,true)} +function jUg(a,b,c){var d,e;if(b!=null&&!!c){!!jlg&&klg(jlg,(Clg(),vlg),'addExternalImage: '+b);d=Zhg(b);e=(t1b(),p1b).createElement(rlh);ZDb(a.a,d,c);ZDb(a.b,d,e)}} +function ixb(a,b){var c,d;d=b.f;if(!d||ff(d,356)&&(d.d?d.d.i.length:0)==1){return M7g}if(ff(d,241)){c=d.a.e;if(c==(Lvb(),mvb)||c==yvb){return M7g}}return a.a?exb:M7g} +function pOb(b){var c,d;c=new nOb;if(b==null){c.b=new XGb;return c}d=new CQb(true,b);try{aQb(d)}catch(a){a=Ppb(a);if(!ff(a,38))throw Qpb(a)}c.a=d;c.b=gPb(d);return c} +function Axc(a,b,c){var d,e,f,g;e=b.tp();if(ff(e,80)){f=q8d(e.o);if(ff(f,109)||ff(f,118)){g=q8d(e.q);d=a.Ek(c);d.sp(nje(f.jj((Sud(),oud)),g,c));return d}}return null} +function DCc(a){var b,c,d,e;d=me($X,Ooh,117,a.Jb.g.i.length,0,1);e=0;for(c=new t9b(a.Jb.g);c.a=a.Nc){b.a+='1 : ';O4b(b,PUg(a.Yb,a.Ec/a.Nc))}else{O4b(b,PUg(a.Yb,a.Nc/a.Ec));b.a+=' : 1'}b.a+=' ';return b.a} +function d$c(b,c){var d;$ug(c,BAc(b));bvg(c,b.Ib);Bug(c,b.f);if(b.e){try{yAc(b,c,b.xb.Tb?b.Lb:b.f)}catch(a){a=Ppb(a);if(ff(a,38)){d=a;nlg(d._c())}else throw Qpb(a)}}} +function sjd(b,c){var d,e;try{e=(!b.d&&(b.d=b.e.Ot(b.c)),b.d);dKg(b,e,new gKg(c))}catch(a){a=Ppb(a);if(ff(a,38)){d=a;!!jlg&&klg(jlg,(Clg(),vlg),d)}else throw Qpb(a)}} +function c5c(a,b){var c;if(a.a.Jb.n.i.length==a.f.length){c=brd(a.c,null,a.e,ICc(a.a));!!b&&YFc(b,(Y1b(),true));return c!=null}!!b&&YFc(b,(Y1b(),false));return false} +function $Rf(a){var b,c;if(a.d.k.i.length==1){c=b9b(a.d.k,0);if(c.en()){b=q2c(a.b,c);if(b){k2c(b);RTf(c);return true}}else c.cn()&&zJc(c)&&GNc(a.b.cb,c)}return false} +function g5c(a,b,c){var d,e;d=me(sf,g9g,5,2,15,1);e=c?a.j.b:Rpg(a.d).b;a.b.a>=b.f.a?(d[0]=a.b.a-e):(d[0]=a.b.a+e);a.b.b>=b.f.b?(d[1]=a.b.b-e):(d[1]=a.b.b+e);return d} +function Eqd(a,b,c,d,e,f,g,h){var i;i=b-1;if(i<0||b<0){return}oqd(a,b);a.tb[i]=c;a.sb[i]=d;a.wb[i]=e;a.vb[i]=f;a.ub[i]=g;a.xb[i]=h;a.I=false;!!a.O&&Yrd(a.O);_ld(a.o)} +function ztd(a,b,c){var d,e;if(Z5e(b,c)==(Xcg(),Vcg)){e=ctd(b,c,true,a.c);d=(Y1b(),true)}else{e=htd(a,b,c,HMe(b,c));d=(Y1b(),false)}mtd(a,d,(Rtd(),Mtd),e);return a.d} +function bQd(a,b,c,d,e,f){kwc.call(this,a);this.b=null;this.c=c;this.e=d;this.f=e;this.d=f;this.a=new O0e(a);s0e(this.a,0,0,1,true);aQd(this);_Pd(this);JKc(this.a,b)} +function Ype(a,b,c,d){kwc.call(this,a);this.g=me(sf,g9g,5,2,15,1);this.e=me(sf,g9g,5,2,15,1);this.n=new YNe(a);this.a=c;Wpe(this,d);Xpe(this);Upe(this);JKc(this.n,b)} +function y6d(a,b){var c;c=a.o;if(a.q==(_8f(),q8f)&&ff(c,46)){return ff(c,31)&&c.Lw()||b&&c.Di()&&!c.xn()&&!ff(c,109)}if(a.q==m8f){return y6d(a.s.Ap(),b)}return false} +function OLe(a,b){var c,d;if(b.q==(_8f(),L7f)&&ff(b.o,56)){c=b.o;d=p8d(P6d(V6d(b),a.c),cje(kVe(c)[0],a.b));return p8d(P6d(jVe(c),a.c),cje(kVe(c)[0],d)).Ap()}return b} +function jOe(a,b){Gaf(a,b,!a.lb&&(!a.Db||!cPe(a.Db)));qJc(a,b);qIc(a,b);rIc(a,b);a.a&&(b.a+='\t\n',b);dJc(a,b);uIc(a,b);!!a.d&&a.d.cz(b,true)} +function l3e(a,b){var c,d,e;if(a.d.i.length==0){return}c='';b.a+='\t>16&255,b.b>>8&255,b.b&255,c)}} +function iNc(a,b){if($1b(Knh,a.C.d.a._B(Tph))){yug(b,_Nc(a),aOc(a),YNc(a)-_Nc(a),ZNc(a)-aOc(a))}else{Uug(b,a.b);evg(b);Lug(b,_Nc(a),aOc(a),YNc(a)-_Nc(a),ZNc(a)-aOc(a))}} +function $Sc(a,b,c,d,e){c?Uug(b,a.f):Uug(b,(Huc(),ruc));Tpg(YSc,d,e,d-12,e-12);Kug(b,YSc);Uug(b,(Huc(),Euc));N_b(b.j,d,e);Dug(b,-6,0,6,0);Dug(b,0,-6,0,6);N_b(b.j,-d,-e)} +function k5c(a){var b,c,d,e;f9b(a.g,a.g.i.length-1);e=me(JY,Roh,33,a.g.i.length,0,1);d=0;for(c=new t9b(a.g);c.ac){a.i.r=false}else{d=_Ve(a.i,b,c);qQb(a.i,d)}} +function $Ud(a){fPc(a.c,a.a.L);if(a.b){a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.a;a.V[1]=a.b}else{a.V=me(fY,qnh,13,1,0,1);a.V[0]=a.a}a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.c);Xvc(a)} +function C1d(a){fPc(a.d,a.a.L);if(a.c){a.V=me(fY,qnh,13,3,0,1);a.V[2]=a.c}else{a.V=me(fY,qnh,13,2,0,1)}a.V[0]=a.a;a.V[1]=a.b;a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.d);Xvc(a)} +function G0d(a){if(a.p){a.V=pe(ie(fY,1),qnh,13,0,[a.g,a.b.lp(),a.p])}else{a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.g;a.V[1]=a.b.lp()}a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.o);Xvc(a)} +function M$d(a){var b,c;if(a.a.j!=(i3f(),L2f)&&a.a.j!=M2f){a.b=me(A0,Joh,120,0,0,1);return}c=a.a.k.i.length;a.b=me(A0,Joh,120,c,0,1);for(b=0;b1&&(a.g=1);return c.gs(a.g,d)} +function Kjf(a,b,c){var d,e;e=pe(ie(sf,1),g9g,5,15,[b,c]);if(a.c==null){return new z5e(a.Mc,NaN,NaN)}d=new z5e(a.Mc,gae(a.c[0],e),gae(a.c[1],e));!!a.a&&(d.b=5);return d} +function $Of(a){var b,c,d,e;if(!a.Pb){return false}for(e=(c=(new n8b(a.Pb)).a.Zd().rd(),new o8b(c));e.a.xf();){d=he((b=e.a.yf(),b.ff()));if(d){return true}}return false} +function gQf(a){var b,c,d,e;if(!a.Ob){return false}for(e=(c=(new n8b(a.Ob)).a.Zd().rd(),new o8b(c));e.a.xf();){d=he((b=e.a.yf(),b.ff()));if(d){return true}}return false} +function c5f(a,b,c,d,e){var f,g,h,i;h=b<0?3:b;if(h<1||h>3){return}f=GYf(YOf(a.b),h);++f.bb;i=pe(ie(mu,1),h5g,2,6,[c,d,e]);for(g=0;g<3;g++){TWf(f,g,i[g])}wQf(f);Zpd(a.d)} +function ypg(a){this.b=a;this.d=0;this.f=0;this.g=true;while(this.f>=a[this.d]){this.g=!this.g;this.f-=a[this.d];this.d=(this.d+1)%a.length}this.f=-this.f;this.c=this.g} +function kKg(a){var b,c,d,e;if($1b('',a.c)){return}e=a.c;c=(mhg(),b=Dhg(a.c),Adg(b));if(c.a){return}d=whg(a.c,(xdg(),qdg));a.c=weg(d)+'/'+d;q3f('Converted:'+e+'->'+a.c)} +function mQg(a){if(a.e){TXe(a.i,a.e,0);if(!a.f){a.f=new P0e(a.d,0,0,1);wXe(a.i,a.f,2)}TXe(a.i,a.f,1);Ldg(a.e.qz(),a.f,a.b);!!a.g&&TXe(a.i,a.g,2);JKc(a.i,null);cYe(a.b)}} +function gRg(a,b,c){var d,e,f,g;e=NNc(b.cb,c);if(e){d=e.Jj();if(d){f=d.c+d.b+(GWg(b.cb.f.e.C)-GWg(b.a.C));g=d.d+(HWg(b.cb.f.e.C)-HWg(b.a.C));eDg(b.a,a.c);$Qg(a.c,f,g)}}} +function fWg(){var a;a=(XWg==null&&($1b(mlh,typeof($doc))?(XWg=$wnd.document):(XWg=$doc)),XWg).createElement(C9g);if(!('getContext' in a)){return null}return new eWg(a)} +function kOb(a,b){var c;c=new eOb(a);b==0&&(c.e=false);(b&8)!=0&&(c.d=true);(b&16)!=0&&(c.f=true);(b&1)!=0&&(c.e=true);(b&4)!=0&&(c.c=true);(b&2)!=0&&(c.b=true);return c} +function qZb(a,b){var c,d,e;if(!ff(b,65)){return 0}d=b;if(!ff(AKb(d),289)){return 0}e=AKb(d);c=$1b(ekh,tZb(a,e.d));if(c&&$1b('1',tZb(a,d))&&sZb(d)){return 1}return c?2:0} +function Omc(a,b){var c,d,e,f,g;g=a.b==null?0:a.b.length;c=a.b==null||a.b[0]==null?0:a.b[0].length;for(d=0;d=0&&o<=1){i.c=e+o*l;i.d=f+o*n;return i}}return null} +function uWc(a){var b,c;b=a.Lb?a.Lb:!a.B?new sqg:new tqg(a.B);if(a.s.Tb){c=new tqg(LNc(a.Pb));!!a.p&&(c=new tqg(a.p));c.b=bsg(new msg,c.b,b.b);c.a=null;return c}return b} +function Vfd(a,b){var c;if(!ff(a.n,213)){nlg('wrong element type for : '+a.n.mD);return false}c=Tbc(b,xph);c!=null&&$2c(a.n,(phd(),$1b(Knh,c)));return true} +function dmd(a,b){var c,d;if(a.$||b.Xb==null){return}ZDb(a.H,b.Xb,b);Gec(a.C,b);Gec(a.F,b);Gec(a.D,b);c=b.ul();d=VDb(a.G,c);!d&&(d=nld(a,c));d.a.put(b,(Y1b(),W1b))==null} +function wBd(a,b,c){var d,e;d=b.g;a.a+='\\rotatebox{';a.a+=c;a.a+='}{ ';e=b.v;if(!d){a.a+='\\text{ ';e=(mhg(),u4b(e,y6g,'\\\\cr '))}a.a+=''+e;d||(a.a+=' } ',a);a.a+=' }'} +function UHd(a,b,c,d){if(!d&&a.A){return}if(!a.n&&!!a.F){g9b(a.F.tz(),a);a.F=null}if(!a.F){a.F=new O0e(a.Kc);a.F.Ps(b,c,1)}else{a.F.Ps(b,c,1);a.F.Hi()}a.t==null&&(a.t=b)} +function fOd(a){if(!a.b){a.V=me(fY,qnh,13,1,0,1);a.V[0]=a.c.lp()}else{a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.b.lp();a.V[1]=a.c.lp()}a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.a);Xvc(a)} +function LYd(a){if(!a.b){a.V=me(fY,qnh,13,1,0,1);a.V[0]=a.c.lp()}else{a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.c.lp();a.V[1]=a.b.lp()}a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.a);Xvc(a)} +function kPd(a){var b,c;c=_3e(a.e);if(a.V[0].Em()){a.a=pPd(a.b.Fp());N1b(a.c,0);b=!a.d||a.d.e;nPd(a.c,a.a,c,b,a.Mc);C4e(a.e,a.c.a);t4e(a.e,true,false)}else{C4e(a.e,'?')}} +function KUd(a,b,c){var d;if(a.a==b&&a.b==c||a.b==b&&a.a==c){return}for(d=0;d0){A0f(OOf(a.a),d[0]);COf(a.a,new q0f((_1f(),r1f),d[0].lp()))}b&&pMg(a.a);!!c&&Saf(c,d.length>0?d[0]:null)}} +function sSe(a,b){var c;WQe(a);a.G[0].ro(b);a.G[1].ro(b);a.W=true;a.gb=10;a.q[0]=new z5e(a.Mc,-b.$,b.Z);c=b.v;!c&&(c=SNe(b));a.k=new z5e(a.Mc,c.A,c.B);URe(a,a.k.d,a.k.e)} +function pUe(b){hUe();var c,d;if(!b){return -1}c=-1;try{d=b.a[4];c=Y2b(d,10)-1}catch(a){a=Ppb(a);if(ff(a,38)){return -1}else throw Qpb(a)}if(c+1>9999){return -1}return c} +function Qcg(a){if(!isNaN(a)&&!isFinite(a)||isNaN(a)){return false}if(a>100000000000000000||a<-100000000000000000){return true}return Ocg(a,lqb(Xpb($wnd.Math.round(a))))} +function Ieg(a){Heg();if(a>1&&(a==1||a-imh<1&&10&&(uhc(b,a.length),a.charCodeAt(b)>=48)&&(uhc(b,a.length),a.charCodeAt(b)<=57)){--b}return thc(0,b+1,a.length),a.substr(0,b+1)} +function qUc(a,b,c){var d,e;if(a.d.a.i.length>0){e=Kdc(a.d);if($wnd.Math.abs(e[0]-b)=0;d--){g=0;if(c[d]==null){return NaN}for(e=c[d].length-1;e>=0;e--){g=b*g+c[d][e]}f=f*a+g}}return f} +function Xag(a,b,c){var d,e,f,g;if(ff(b,198)&&ff(c,198)){d=b;e=c;g=d.Em()&&e.Em();f=d.uw();Jub(f,d.tw()&&e.tw());f.a=g;return f}throw Qpb(x9d(a,b,c,(yTf(),_Sf),'\u2227'))} +function Mtg(a){var b;b=(t1b(),q1b).host;(b!=null&&(b.indexOf('geogebra.org')!=-1||$1b(b,'localhost'))&&q1b.pathname.indexOf('.html')==-1||$1b(a.substr(0,1),'?'))&&Vtg(a)} +function IDg(a){iDg.call(this,a?'main':Mbh);this.e=0;this.d=0;this.g=null;Z8b(jDg,this);eyg(this.C,'GeoGebraFrame',true);F1g(this.C,92);a&&this.C.setAttribute(nGh,'main')} +function bIg(a,b){var c;c=b.C;Ahg(c.id)&&(c.id=(y1g(),VWg((XWg==null&&($1b(mlh,typeof($doc))?(XWg=$wnd.document):(XWg=$doc)),XWg))));a.C.setAttribute('for',c.id);return a} +function l2b(a,b){if(b<2||b>36){return -1}if(a>=48&&a<48+$wnd.Math.min(b,10)){return a-48}if(a>=97&&a=65&&a')}else throw Qpb(a)}} +function ftd(a,b,c,d){if(d){return vSf(a.c,'AliesOnB',null,pe(ie(mu,1),h5g,2,6,[dtd(b),dtd(c)]))}return vSf(a.c,'AdoesNotLieOnB',null,pe(ie(mu,1),h5g,2,6,[dtd(b),dtd(c)]))} +function hHd(a){var b,c;b=new Fbe(new t8d(a.Mc,a),new tde(a.Mc));if(a._b||!(!a.lb&&(!a.Db||!cPe(a.Db)))){c=(new cKd(a.Kc,b,false)).d}else{c=new pWe(a.Kc);$Ve(c,b)}return c} +function PKd(a){var b,c;c=_3e(a.d);if(a.c!=c){a.c=c;for(b=0;bd+koh){return false}}return true} +function Q5e(a,b,c,d){var e,f,g;g=b.Pw();if(g.d.i.length!=2){c.d=NaN;c.e=NaN;return}e=b9b(g.d,0).Lk();f=b9b(g.d,1).Lk();if(d){c.d=a.d-e;c.e=a.e-f}else{c.d=e-a.d;c.e=f-a.e}} +function QUf(a){var b;this.a=new n9b;new n9b;znd(a.o.r,16);b=a.j;XTf((!b.Ib&&(b.Ib=new KUf(b.pb,b)),b.Ib),this);TIb((!b.db&&(b.db=new E0f(b)),b.db),this);zBc(b.cb.lb,this)} +function Hdg(a,b){Mmc(a,0,0,b[0]);Mmc(a,0,1,b[3]);Mmc(a,1,0,b[3]);Mmc(a,1,1,b[1]);Mmc(a,2,0,b[4]);Mmc(a,0,2,b[4]);Mmc(a,2,1,b[5]);Mmc(a,1,2,b[5]);Mmc(a,2,2,b[2]);a.a=false} +function iKg(){if(hKg){return}hKg=true;ltg((Iwg(),Fvg),false);ltg((Pwg(),Mvg),true);ltg((Fwg(),Cvg),false);ltg((Mwg(),Jvg),false);OVg(new PVg(qd()));ltg((qxg(),owg),false)} +function iMg(a,b){if(a==null||$1b('',a)){!!jlg&&klg(jlg,(Clg(),Blg),'error calling setLanguage(), setting to English (US): '+a+'_'+b);return}if(b==null||$1b('',b)){return}} +function sqb(b,c,d,e){rqb();var f=pqb;$moduleName=c;$moduleBase=d;Opb=e;function g(){for(var a=0;a0){d=w4b(b,'E',0);return Epd(a,d[1],true)+'E'+Epd(a,d[0],true)}return Epd(a,b,e)} +function Kqd(a,b){var c,d;if(b!=a.S){a.S=b;if(b){a.qb=true;for(d=new t9b(a.rb);d.ae){ftg(a,d,d[4],e,d[2],d[3],d[0],d[1],b,c,-1)}else if(c==e&&c==d[1]&&c==d[3]){return}else{ftg(a,d,b,c,d[0],d[1],d[2],d[3],d[4],e,1)}} +function _zg(a,b){this.o=a;this.p=b;new occ;this.n=new occ;this.o=a;$Tg(a.o,(t1b(),$wnd.goog.global.window),qGh,new bAg(this));PKg(a,new aAg(this));this.j=(kIg(),kIg(),jIg)} +function PIg(a,b){Yxg(this,YHg());eyg(this.C,qph,true);this.d=a;eyg(this.C,'MyToggleButton',true);this.b=false;!this.c?LWg(this.C,QBh):NIg(this,this.d);NIg(this,a);this.c=b} +function cTg(a,b,c){var d;d=new wPg;Ahc(c,yqb(rTg.prototype.Ag,rTg,[c,d]));q3f((m5b(),'GGB file unzipped and post-processed in '+nqb(jqb(Xpb(Date.now()),b))+'ms'));gTg(a,d)} +function Trb(a){var b;b=a.w;if(Tsb(a,27)){a.w=b;if(Tsb(a,32)){a.w=b;if(Tsb(a,31)){a.w=b;if(Tsb(a,23)){a.w=b;if(Tsb(a,24))return true}}}}if(Tsb(a,12))return true;return false} +function k_b(a,b){var c;a.a=b;a.d.lineCap=I$b(a.a);a.d.lineJoin=J$b(a.a);a.d.lineWidth=a.a.e;a.d.miterLimit=a.a.d;c=a.a.b;c!=null?o1b(a.d,c):a.d.setLineDash($wnd.Array.of())} +function Gbc(){function b(){try{return (new Map).entries().next().done}catch(a){return false}} +if(typeof Map===O4g&&Map.prototype.entries&&b()){return Map}else{return Hbc()}} +function OBc(a,b,c){if(b.i.length==0){return false}XCc(a,b,1,false,a.Jb.w,(U8e(),s8e),c);if(a.Jb.w.i.length==1){null.pD(YPg(a.U,oBc(a.V)),NCc(a)[0]);return true}return false} +function uCc(a){var b,c,d,e;e=a.kc.Bb.e;if(!!e&&e.i.length>0){for(d=new t9b(hSc(e));d.a0.5?(b=2*(1-b)):(b=2*b);return b}return a.ob} +function zSc(a,b,c,d,e){var f;f=b.f;a.a=a.c.yr(f,a.b,d,e);wSc(c,pf(b.f.e.C.height/b.f.p))&&xSc(a,pf(b.f.e.C.height/b.f.p));Nrg(a.a,pf(a.a.b-2*a.d.qq()),pf(a.a.a-2*a.d.qq()))} +function OSc(a,b){if(a.Xb!=null&&x4b(a.Xb,qqh)&&!(b.Xb!=null&&x4b(b.Xb,qqh))){return 1}if(b.Xb!=null&&x4b(b.Xb,qqh)&&!(a.Xb!=null&&x4b(a.Xb,qqh))){return -1}return a.lc-b.lc} +function ZVc(a,b){MAc.call(this);this.c=me(sf,g9g,5,2,15,1);this.Pb=a;this.b=new uVc(a.C);this.k=b;this.xb=b;b.r=true;b.r&&Cpd(b.Mc)&&b.Mc.f&&IHd(b,true);WVc(this);XVc(this)} +function mYd(a,b,c,d){kwc.call(this,a);this.d=me(sf,g9g,5,3,15,1);this.a=c;this.c=d;this.b=new YNe(a);TNe(this.b,c);lYd(this);kYd(this);JKc(this.b,b);B_e(this.a,this.b,true)} +function bXc(a){var b;a.d.Rb=a.e.Uj(a.f.Hb.g,a.b);if(ff(a.e,484)){a.d.Qb=a.e.Qb-a.c}else if(ff(a.e,1137)){b=a.f.Hb.g?5:9;a.d.Qb=a.f.Zb+26+b+5}else{a.d.Qb=a.e.Qb}G0c(a.d,a.c)} +function C$c(a,b,c,d){var e,f,g;f=FOc(a.Pb,b);g=FOc(a.Pb,c);if(!!f||!!g){a.b.Px(a.f);iQc(a.Pb,a.f);e=new Cqg(a.f[0]-30,a.f[1]-30,60,60);d.Sh(e);E$c(d,b,f);E$c(d,c,g);d.Lh()}} +function j4c(a,b){var c,d;b.Yh(hZe(a.f.e));c=a.f.g-1;d=a.f.k-1;b.Fh(c,d,a.c.b+2,a.c.a+2,8,8);b.Yh((Huc(),auc));b.zh(c,d,a.c.b+2,a.c.a+2,8,8);r2c(a.d,b);W3c(a.g,b,hZe(a.f.e))} +function Qxd(a,b,c){var d,e;Mxd(a,c);for(e=0;ea.a-a.b*a.d-a.d){return}g=(f=a.a-a.b*a.d,new off(f,f+a.d));while(g.c>d){++a.b;--a.c;g=(e=a.a-a.b*a.d,new off(e,e+a.d));Sif(c.a,g)}} +function uff(a,b,c){var d,e,f,g;d=b.a;if(d0){g=(thc(d-1,d,a.length),a.substr(d-1,d-(d-1)));if(m4b('_{}',(nhc(g),g))==-1){e=g.toLowerCase()+e;++f}--d}return e} +function N$f(a){var b,c,d,e,f;f=new cEb;for(c=w4b(a,'&',0),d=0,e=c.length;d1){if(a==1||a-imh<1&&10?(a.className=e+' '+b):(a.className=b==null?'':b);return true}return false} +function Q_g(a){var b,c,d,e;c=a.b;if(c!=null){return b=a.a,(b.clientY|0)-HWg(c)+((e=c.scrollTop,!e?0:e)|0)+((d=WWg(c.ownerDocument).scrollTop,!d?0:d)|0)}return a.a.clientY|0} +function iTh(a){var b,c;c=new i5b;b=c.a.length;0b&&(c.a+=J4b(me(rf,b5g,5,-b,15,1)));if(this._b){O4b(c,this.Xb);c.a+=':'}O4b(c,GTe(this,a));return c.a} +function yVh(){return bkh+N3b(this.a*ckh)/ckh+L7g+N3b(this.b*ckh)/ckh+L7g+N3b(this.c*ckh)/ckh+'], ['+N3b(this.d*ckh)/ckh+L7g+N3b(this.e*ckh)/ckh+L7g+N3b(this.f*ckh)/ckh+']]'} +function Owb(a){if(a.a.e==(Lvb(),wvb)||a.a.e==Avb){return ywb(!!a.d&&a.d.i.length>0?b9b(a.d,0):null)==0?0:1}else if(a.a.e==yvb){return 1}else if(a.a.e==pvb){return 2}return 0} +function uyb(){ryb();var a,b,c,d,e;$xb==null&&($xb=me(rf,b5g,5,23,15,1));e=0;for(b=xyb(),c=0,d=b.length;c>16&255,d>>8&255,d&255,255)}catch(a){a=Ppb(a);if(ff(a,166)){return null}else throw Qpb(a)}} +function n0c(a,b){MAc.call(this);this.b=me(sf,g9g,5,2,15,1);this.Pb=a;this.f=a.Jb;this.i=b;this.xb=b;b.r=true;b.r&&Cpd(b.Mc)&&b.Mc.f&&IHd(b,true);this.a=BIc(this.i);m0c(this)} +function jVd(a,b,c){kwc.call(this,a);this.a=me(sf,g9g,5,2,15,1);this.c=c;this.b=new cId(a);QFd(this);this.c.Px(this.a);ZHd(this.b,Xeg(this.a[0],this.a[1]),true);JKc(this.b,b)} +function oYd(a,b,c,d){kwc.call(this,a);this.a=c;this.c=d;this.b=new YNe(a);TNe(this.b,c);uVd(this);PMe(this.a,-this.c.$,this.c.Z,this.b);JKc(this.b,b);B_e(this.a,this.b,true)} +function S1c(b,c,d){var e,f;f=new Npg;Ipg(f,b.g);Gpg(f,kvc(b.c,b.d)/c,kvc(b.c,b.f)/d);try{b.j=Cpg(f)}catch(a){a=Ppb(a);if(ff(a,38)){e=a;nlg(e._c())}else throw Qpb(a)}return f} +function g8c(a){var b,c,d,e;a.c.i.length=0;for(c=new t9b(a.a);c.ac.length?(a.d.v=null):C4e(a.d,(uhc(b-1,c.length),df(c.charCodeAt(b-1))+''))} +function eHd(a){if(!a.p||!a.o){return a.Yk()==1?Uvh:0.05}if(a.Yk()==1){return cfg((a.o.Fp()-a.p.Fp())*bHd(a)*Toh*0.0025,0)*Uvh}return cfg((a.o.Fp()-a.p.Fp())*bHd(a)*9.0E-4,0)} +function I4d(a,b){var c,d;if(b.ik(a)){return true}for(d=new t9b(a.c);d.a0){b=Adc(a.b,0);E$b(d,b.KB(),b.RB(),0,0);for(c=1;c=c.length&&!Scg(d[e])||e=0){switch(b){case 0:return 'x';case 1:return 'y';case 2:return 'z';}}!!jlg&&klg(jlg,(Clg(),vlg),'problem with variable number');return ''} +function H_e(a){var b,c;!!a.F&&trd(a.F);if(a.G){b=a.G.lp();b.Tm()&&DRe(b,a)}if(a.u){g9b(a.u,a);for(c=0;cc.a?new off(-1,1):c}return Dif(a,b)} +function EOf(a,b){var c,d,e,f,g,h;nPf(a);g=(mhg(),B4b(b,(Acc(),ycc)));for(d=KIe(),e=0,f=d.length;e=0){return $wnd.Math.exp(Tpc(a))}return Cmh/(a*$wnd.Math.exp(Tpc(-a))*$wnd.Math.sin(Iih*a))} +function hig(a,b,c){mhg();var d;d=new i5b;L4b(d,ihg[(a&240)>>>4]);L4b(d,ihg[a&15]);L4b(d,ihg[(b&240)>>>4]);L4b(d,ihg[b&15]);L4b(d,ihg[(c&240)>>>4]);L4b(d,ihg[c&15]);return d.a} +function aog(a){Wng();var b;if(a[0]>709){return fog(k9g,Ung)}b=pe(ie(sf,1),g9g,5,15,[$wnd.Math.exp(a[0])*$wnd.Math.cos(a[1]),$wnd.Math.exp(a[0])*$wnd.Math.sin(a[1])]);return b} +function Tog(a,b,c){a.F=a.G/2;a.d=Yog(a.F);a.c=Xog(a.F);a.H=Zog(a.F);a.j=new npg(c);a.r=new npg(c);a.v=new npg(c);a.g==null?Sog(a,b.ph(null)):Rog(a,b.ph(null));return gpg(a.j)} +function fpg(a,b){var c,d;cpg(a,b.c-1,b.a-2);for(d=b.a-4;d>=0;d-=2){a.b[a.a++]=b.b[d];a.b[a.a++]=b.b[d+1]}for(c=b.c-1;c>=1;c--){a.d[a.c++]=b.d[c]}a.e=a.b[a.a-2];a.g=a.b[a.a-1]} +function wyc(a){uyc();var b,c,d,e,f;c=new n9b;for(e=new t9b(Mxc);e.a0){for(b=0;b=0){return new off(a.c*b.c,a.a*b.a)}if(0>b.c&&0$wnd.Math.abs(a.$)?Vlf(c,-a._/a.Z):Wlf(c,-a._/a.$);c.f[b+1-1]=1;c.a=true}return c} +function O5e(a,b,c){var d,e,f,g,h,i;d=Hfe(a,0,0).Lk();e=Hfe(a,1,0).Lk();f=Hfe(a,0,1).Lk();g=Hfe(a,1,1).Lk();h=d*b.ki()+e*b.li();i=f*b.ki()+g*b.li();c.d=(nhc(h),h);c.e=(nhc(i),i)} +function i_f(b){if(ff(b,651)){return b}else if(ff(b,467)){return D3b(_2b(b))}else if(mf(b)){try{return D3b(Xpb(X2b(b)))}catch(a){a=Ppb(a);if(!ff(a,166))throw Qpb(a)}}return null} +function _4f(a,b,c,d,e){var f,g,h,i,j;j=b<0?3:b;if(j<1||j>3){return}i=GYf(YOf(a.b),j);++i.bb;g=nXf(i,0,c);g&&i.UA();h=nXf(i,1,d);h&&i.UA();f=nXf(i,2,e);f&&i.UA();wQf(i);Zpd(a.d)} +function u_b(a,b,c,d){var e,f,g;!a.a&&(a.a=new Xbc);f=Ecc(a.a,b,new w_b);bEb(a.a.d)>50&&Wbc(a.a,(e=(g=(new l8b(a.a)).a.Zd().rd(),new m8b(g)).a.yf(),e.ef()));return new y_b(f,c,d)} +function Zcc(){Zcc=xqb;var a,b,c,d;Wcc=me(sf,g9g,5,25,15,1);Xcc=me(sf,g9g,5,33,15,1);d=1.52587890625E-5;for(b=32;b>=0;b--){Xcc[b]=d;d*=0.5}c=1;for(a=24;a>=0;a--){Wcc[a]=c;c*=0.5}} +function vhd(a,b){switch(a.k){case 500:if($1b('defaults',b)){a.D=1;a.k=300;zgd(a.r)}break;case 501:$1b(_8g,b)&&(a.k=500);break;default:a.k=500;nlg('unknown defaults mode:'+a.k);}} +function Ctd(a,b,c,d){var e;e=new h5b;c?O4b(e,vSf(d,'ATouchesB',null,pe(ie(mu,1),h5g,2,6,[dtd(a),dtd(b)]))):O4b(e,vSf(d,hwh,null,pe(ie(mu,1),h5g,2,6,[dtd(a),dtd(b)])));return e.a} +function VRd(a){var b,c;c=b0e(a.b[0],a.b[1])!=(Xcg(),Vcg);for(b=0;ba.g&&(c[1]=a.g);return a.i}if(a==b.f&&c[0]b.g&&(c[1]=b.g);return -b.i}d=a.c.BB(b.c,c);a.f=b;a.g=c[1];a.i=d;return d} +function bJg(a,b){var c;c=new ICg(a,b);eyg(BWg((y1g(),IWg(c.C))),'suggestPopup',true);BWg(IWg(c.C)).className='gwt-SuggestBoxPopup';c.p=true;BCg(c,(PCg(),OCg));c.k=false;return c} +function AJg(a,b){var c;if(nf((t1b(),$wnd.goog.global.window))!==nf($wnd.goog.global.window.parent)&&a.b.c){c=yLg(a.a).OC();if(c){$wnd.window.toggleFullscreen();GJg(a,!a.b.d,b)}}} +function p3g(){var a;o3g.call(this,(a=(XWg==null&&($1b(mlh,typeof($doc))?(XWg=$wnd.document):(XWg=$doc)),XWg).createElement('BUTTON'),a.type=qph,a));this.C.className='gwt-Button'} +function TJb(a,b,c,d,e){mCb.call(this);this.a=a;this.b=b;this.e=c;this.c=d;this.d=e;this.u=a.u;this.q=a.q+(e?b.u:0)+(e&&!!c?c.q+c.o+d:0);this.o=a.o+(e?0:b.u)+(!e&&!!c?c.q+c.o+d:0)} +function q$b(a,b,c){var d,e;if(!$1b(c,a.c)){return}aZb('Font '+a.c+' error');aZb(Bqb(b));l$b(a.b,a);for(e=new t9b(a.a);e.a=0){c=Vpb(a,I5g);d=bqb(a,I5g)}else{b=iqb(a,1);c=Vpb(b,500000000);d=bqb(b,500000000);d=Rpb(gqb(d,1),Spb(a,1))}return fqb(gqb(d,32),Spb(c,Llh))} +function J7b(a,b){B7b();var c,d;d=(p6b(),k6b);c=a;for(;b>1;b>>=1){(b&1)!=0&&(d=E6b(d,c));c.d==1?(c=E6b(c,c)):(c=new P6b(L7b(c.a,c.d,me(uf,v5g,5,c.d<<1,15,1))))}d=E6b(d,c);return d} +function Fnc(a){var b,c;this.c=0;b=a.b==null?0:a.b.length;c=a.b==null||a.b[0]==null?0:a.b[0].length;this.a=Kmc(Gmc(a));this.b=me(sf,g9g,5,$wnd.Math.min(b,c),15,1);Cnc(this,this.a)} +function YBc(a,b,c){var d;if(b.i.length==0){return null}XCc(a,b,5,false,a.Jb.w,(U8e(),s8e),c);if(a.Jb.w.i.length==5){d=NCc(a);return pe(ie(fY,1),qnh,13,0,[oGc(a.i,d)])}return null} +function PHc(a,b,c){if(!!bJc(a,(_1f(),O0f))&&bJc(a,O0f).Ye().length>0&&!c.a){i7e(c,pSf(b,bph,'Press space to activate'));c.c.a.length>0&&F1b(c.c,c.c.a.length-1)!=32&&O4b(c.c,' ')}} +function LIc(a,b){if(!b.F||a.nc==null||$1b('',a.nc)){if(!a.xn()&&!a.hc){if(a.lb){return a.lb.Oi(b)}if(a.Gb){return n8d(a.Gb,b)}return a.op(b)}return Xvd(b,a.Xb)}return Xvd(b,a.nc)} +function i0c(a,b,c,d){var e,f;e=d+$wnd.Math.max(a.p,10);if(!erg(a.o,b-e,c-e,2*e,2*e)){return false}f=d*3+$wnd.Math.max(a.i,5);return ba.e[0]+f||ca.e[1]+f} +function mPd(a,b,c){kwc.call(this,a);this.a=pe(ie(sf,1),g9g,5,15,[0,0]);this.c=new h5b;this.b=b;this.d=c;this.e=new N4e(a);this.e.i=true;t4e(this.e,true,false);lPd(this);kPd(this)} +function oRd(a,b,c,d,e,f){hRd.call(this,a);jRd(this);this.f=new rOd(this,new pRd(this));this.g=c;this.a=d;this.c=e;this.d=f;this.b=true;lRd(this);mRd(this);pOd(this.f,b);hwc(this)} +function $Rd(a,b,c){var d,e,f,g;f=false;g=6;if(b.Em()&&a.n.Em()){d=imh;while(d<=Amh){g=dSd(a.n,b,c,d);f=eSd(a.n,b,c);if(f){break}d*=10}}if(!f){for(e=0;e<2;e++){E0e(c[e])}}return g} +function s3d(a,b){var c;if(x3d(a,b)){return false}if(w3d(a,b)){return true}c=b.cb;!c||c==a.d.a||!x3d(a,c)?(a.d.b=new H3d(b,null),a.d=a.d.b):y3d(a,b,c);MYb(a.b,b);++a.c;return true} +function w9d(a,b){if(ff(b,98)){return 0}else if(ff(b,382)){return b.ts()[2]}else if(ff(b,55)){return b._}throw Qpb(new fye(a.b,(yTf(),YSf),pe(ie(mu,1),h5g,2,6,['z(',hye(b),')'])))} +function Ybe(a,b){var c,d,e,f,g;e=me(_Q,Voh,42,a.a.a.size(),0,1);g=(d=(new A8b(a.a.a)).a.Zd().b.Xf(),new B8b(d));f=0;while(g.a.xf()){e[f++]=new ude(b,(c=g.a.yf(),c.ef()))}return e} +function nkf(a){var b,c,d;c=new jkf;b=$wnd.Math.cos(a);d=$wnd.Math.sin(a);Jlf(c.f[0],1,b);Jlf(c.f[1],2,b);Jlf(c.f[0],2,d);Jlf(c.f[1],1,-d);Jlf(c.f[2],3,1);Jlf(c.f[3],4,1);return c} +function UOf(a,b,c){var d,e,f,g,h;d=Hcg(b);e=Hcg(c);g=pf($wnd.Math.ceil($wnd.Math.min(d,e)));f=pf($wnd.Math.floor($wnd.Math.max(d,e)));if(g>f){h=f;f=g;g=h}return _cc(a.Bb,f-g+1)+g} +function JZf(a,b,c){if(b==(_1f(),F0f)){IZf(a,u1f,pe(ie(mu,1),h5g,2,6,[c[0]]));return true}else if(b==W1f){IZf(a,W1f,pe(ie(mu,1),h5g,2,6,[c[0],c[2],c[1]]));return true}return false} +function Vig(a){var b,c;a.q=a.t;if(!a.q){return}c=a.t;while(c){b=c.a;if(b){hkg(b,new Ukg(b.a));b.q=(rkg(),pkg);b.j=-1}b=c.c;if(b){hkg(b,new Ukg(b.a));b.q=(rkg(),qkg);b.j=-1}c=c.b}} +function OJg(a){a.c.a.length>0&&F1b(a.c,a.c.a.length-1)!=32&&O4b(a.c,' ');O4b(a.c,pSf(a.b,bph,'press space to activate'));a.c.a.length>0&&F1b(a.c,a.c.a.length-1)!=32&&O4b(a.c,' ')} +function H4g(b){var c,d,e;c=b;if(sIh in c&&rIh in c){try{d=w3b(Y2b(Bqb(c[sIh]),10)).a;e=w3b(Y2b(Bqb(c[rIh]),10)).a;return d-e}catch(a){a=Ppb(a);if(!ff(a,38))throw Qpb(a)}}return 0} +function dxb(a){bxb();var b,c,d,e,f;for(f=0;f: '+b.n.mD);return false}try{Ifd(b,c);return true}catch(a){a=Ppb(a);if(ff(a,38)){return false}else throw Qpb(a)}} +function wid(a,b){var c,d;c=YOf(a.a).s;d=Tbc(b,'xValues');if(d!=null){a.P=d}else{c.a=null;nZf(c,yhd(a,Tbc(b,Qah)).Fp());mZf(c,yhd(a,Tbc(b,Pah)).Fp());oZf(c,yhd(a,Tbc(b,urh)).Fp())}} +function Vpd(a,b){var c,d;if(a.S){b.xn()&&Z8b(a.q,b);for(d=new t9b(a.rb);d.a=b?eHd(a):b}return !a.rb&&(a.rb=new cde(a.Mc,0.1)),a.rb.Fp()} +function qOd(a){var b;for(b=0;bb.a)&&b.a>=0){c=b.c;return new off(c<=0?h9g:Lif($wnd.Math.log(c)),Kif($wnd.Math.log(b.a)))}return new off(k9g,h9g)} +function YVf(a,b,c){!a.a?(a.a=new h5b):N1b(a.a,0);ZVf(a,b);if(c>-1){O4b(a.a,wjh);O4b(a.a,zTf((yTf(),ZSf),a.b,pe(ie(mu,1),h5g,2,6,[])));O4b(a.a,X4g);T4b(a.a,c)}$Vf(a,b);return a.a.a} +function sCg(a,b,c,d){var e,f,g;g=pf((GWg(b.C)-GWg(a.r.C))/JCg(a.r.C,'x'));if(d>0){f=($wnd.goog.global.parseInt(a.r.C[SFh],10)|0)-g;e=GWg(b.C)-GWg(a.r.C);f=d&&(g-=d)}return g} +function HDg(a){var b,c,d;b=ASg(a.c);d=ySg(a.c)/2|0;b!=null&&($1b(r9g,b)?JDg(a.f,a.C,bBh,d):JDg(a.f,a.C,b,d));LWg(a.C,FGh);FWg(a.C,EGh);jXg((c=a.f.a.style,t$g(),c),(yYg(),_Xg),r9g)} +function ac(a,b,c){var d,e,f,g,h;String.fromCharCode(10);bc(a);for(e=(a.k==null&&(a.k=me(nu,W4g,48,0,0,1)),a.k),f=0,g=e.length;f=0?a.c:a.a.yd();if(e==2&&(!b||JKb(qKb,b.c>=0?b.c:b.a.zd())||!c)){a.c=0}else if(!!c&&(a.c>=0?a.c:a.a.zd())==2){d=c.yd();(d==3||d==5||d==6)&&(a.c=0)}} +function KOb(a){var b,c;b=$wnd.Math.abs(a-pf(a>=0?$wnd.Math.floor(a):-$wnd.Math.floor(-a)));c=mqb(Xpb($wnd.Math.round(b*$wnd.Math.pow(10,6))));while(c!=0&&c%10==0){c=c/10|0}return c} +function $Kc(a,b){var c;if(b.pc==null){a.pc=null;return}a.pc==null&&(a.pc=me(sdb,Z4g,591,b2f().length,0,1));for(c=0;ca.d){a.c.v=null;return}b==0?C4e(a.c,''):C4e(a.c,a.Rv(c,b))} +function lSd(a,b,c){var d,e,f;if(Scg(c.$)){e=-c._/c.Z}else{Jbe(b,c,a.a);e=qRd(a,a.a,a.k.A)}if(isNaN(e)){return null}f=b.Cg(e);d=new _lf(e,f,1);if(!K2e(c,d,Amh)){return null}return d} +function Swe(a,b,c){var d,e,f;f=new j$e(a.e);d=new j$e(a.e);for(e=0;ec){return}if(f==e){return}a.hb.pb&&Kkd(Mod(a.K));a.hb.Bv(e,true);xLc(a.hb)} +function DFc(a,b,c){var d;if(b.i.length==0){return null}XCc(a,b,2,false,a.Jb.w,(U8e(),s8e),c);if(a.Jb.w.i.length==2){d=NCc(a);return pe(ie(fY,1),qnh,13,0,[EFc(a,d[0],d[1])])}return null} +function NLc(a){var b;if(a.d==null||a.d.length==0){a.b=false;a.c=NaN;return}a.c=0;for(b=0;b=0&&a.e.d!=0){--d;f=-1;++g}for(c=0;c=0&&d0;e--){d=z4b(a.a,0,e);c=Vvf(a.c,d);if(c){return d}}return null} +function jTe(a,b,c){var d;if(b.k&&!!dTe(b,0)){a.k=true;for(d=0;d=a.a.length){return b}if(a4b(a.a,b)==95){if(a4b(a.a,b+1)==123){return jke(a,l4b(a.a,125,b)+1)}return jke(a,b+2)}else if(dke(a4b(a.a,b))){return jke(a,b+1)}return b} +function fse(b,c,d,e){var f,g,h,i;i=c.sp(new pse(b));g=null;try{g=Xre(b,i,e)}catch(a){a=Ppb(a);if(ff(a,54)){h=a;vVf(h,b.i,d)}else if(ff(a,38)){f=a;wVf(f,b.a,d)}else throw Qpb(a)}return g} +function nWe(a,b,c){if(!a.Kc.A&&!!a.d){if(j6d(a.d.n,kVe(a))){return false}}if(c||CVe(a)||!!a.d&&a.d.p){return true}return !($1b(xVe(a,(Sud(),oud)),'y')&&!a.Db)&&!(b&&$1b(xVe(a,oud),'z'))} +function RWe(a,b){jJc(a,b);(a.i!=null&&he(a.i)||!!a.d&&a.d.o.length==2)&&PIc(a,b);!!a.d&&a.d.o.length==2&&!(a.i!=null&&he(a.i))&&a.j==1&&(b.a+='\t\n',b)} +function i0e(a,b){var c,d,e;c=b;if($wnd.Math.abs(c.Z)>$wnd.Math.abs(c.$)){d=-a._*c._/c.Z;e=0}else{d=0;e=-a._*c._/c.$}a.Z-=d;a.$-=e;IMe(a,2*$wnd.Math.atan2(-c.Z,c.$));a.Z+=d;a.$+=e;L0e(a)} +function kgf(a){var b;!!a.b&&(a.b=a.b.nA());!!a.d&&(a.d=a.d.nA());if(ff(a.b,206)&&!ggf(a,(Rgf(),zgf))&&(!a.d||ff(a.d,206))){return new ogf((b=fgf(a),!b?new off(k9g,h9g):b.oA()))}return a} +function Dmf(a,b,c,d,e){var f,g;g=Gmf(a,d,e);f=new u8d(a.c,b,(_8f(),n8f),g);if(!Jod(a.c).s&&ff(g,297)){throw Qpb(new fye(a.c.j.B,(yTf(),jTf),pe(ie(mu,1),h5g,2,6,[])))}Vgc(c.i,f);return f} +function dnf(a){var b;b=fnf(a);if(nnf(a)){pqf(a,36);b.Lm()&&b.q==(_8f(),n8f)&&!b.a?(b=new u8d(a.G,b.o,(_8f(),m8f),new u8d(a.G,b.s,H7f,null))):(b=new u8d(a.G,b,(_8f(),H7f),null))}return b} +function BTf(a){if(a!=null&&$1b(a.substr(0,5),'null:')){return uhc(5,a.length+1),a.substr(5)}if(a!=null&&$1b(a.substr(0,10),'undefined:')){return uhc(10,a.length+1),a.substr(10)}return a} +function Yig(a){if(he(a.a)>kFh||he(a.b)>kFh||-he(a.a)>kFh||-he(a.b)>kFh){if(he(a.a)>WCh||he(a.b)>WCh||-he(a.a)>WCh||-he(a.b)>WCh){throw Qpb(new n3b('Coordinate outside allowed range'))}}} +function Fsg(a,b,c,d,e,f){var g;if(b=d&&b>=f){return 0}if(a>=c&&a>=e){return 0}if(a=g){return 0}return d0?1:0;while(f.a[e]!=c){f=f.a[e];e=a.a.bf(c.d,f.d)>0?1:0}f.a[e]=d;d.b=c.b;d.a[0]=c.a[0];d.a[1]=c.a[1];c.a[0]=null;c.a[1]=null} +function HEc(a,b,c){var d,e;if(b.i.length==0){return null}XCc(a,b,2,false,a.Jb.w,(U8e(),s8e),c);if(a.Jb.w.i.length==2){return d=NCc(a),e=RGc(a.K.o,d[0],d[1]).Y,e[0].Qo(null),e}return null} +function $Yc(a,b,c,d,e){kWc.call(this);NYc(this);e?(this.A=(hZc(),eZc)):(this.A=(hZc(),fZc));this.Pb=a;this.w=b;this.t=c;this.f=d;this.g=new YNe(a.Jb.o);this.xb=znd(a.Jb.o.r,20);ZYc(this)} +function _Oe(a){var b,c,d;b=false;if(!a.G){return VBh}d=a.G.tp();if(!d){return VBh}ff(d,297)&&(b=d.Sk());if(b){return 'ggbmpvarplot'}if(ff(d,18)){c=Vad(d);if(c!=null){return c}}return VBh} +function xTe(a,b,c){var d,e,f,g;d=b;if(d.G==a){return true}f=(!d.H&&(d.H=new Asd),d.H);g=bTe(a,d,f.b);e=$wnd.Math.abs(dTe(a,0).Cg(g)-d.A)<=c&&$wnd.Math.abs(dTe(a,1).Cg(g)-d.B)<=c;return e} +function ZUf(a){var b;this.j=true;this.d=a;this.e=new pOf;this.c=100;this.a=10;this.b=new o9b(pih);for(b=0;b-h&&i*i+j*j<=h*h){return e}}return -1} +function igd(b,c){var d;if(!ff(b.n,225)){nlg(Frh+b.n.mD);return false}try{d=b.n;d.Zp((phd(),$1b(Knh,Tbc(c,xph))));return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function djd(b,c){try{NWf(b,Y2b(Tbc(c,Juh),10));cXf(b,Y2b(Tbc(c,Kuh),10));XDb(c.d,wvh)&&kXf(b,Y2b(Tbc(c,wvh),10));return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function Wid(b){phd();var c,d,e;try{e=Y2b(Tbc(b,'r'),10);d=Y2b(Tbc(b,'g'),10);c=Y2b(Tbc(b,'b'),10);return Huc(),Vuc(e,d,c,255)}catch(a){a=Ppb(a);if(ff(a,43)){return null}else throw Qpb(a)}} +function Ugd(b,c){var d,e,f;for(f=kcc(b.a,0);f.b!=f.d.c;){e=scc(f);try{c.ht(e.b,e.a)}catch(a){a=Ppb(a);if(ff(a,43)||ff(a,160)){d=a;!!jlg&&klg(jlg,(Clg(),vlg),d)}else throw Qpb(a)}}ncc(b.a)} +function Rxd(a,b){var c,d,e;if(a.g){H6e(a.i,a.n);a.g=false}else{for(d=0;d>16&255)+','+(b.b>>8&255)+','+(b.b&255)+','+(b.b>>24&255)/255+')',c))} +function PHb(a,b,c,d,e,f,g){mCb.call(this);this.d=a;this.u=a.u+2*b+2*c;this.q=a.q+b+c;this.o=a.o+b+c;this.s=a.s;this.k=b;this.j=c;this.g=d;this.c=e;this.f=f;this.e=g;this.i=new F$b(0,0,0,0)} +function dPb(a,b,c){var d,e;if(!aDb(a.d,b,a)){if(c){d=String.fromCharCode(b)}else{e=a.o-1;while(a.o0}return false} +function vFd(a,b,c){var d,e;if(HMe(a.b,a.c)){e=a.c.v;!e&&(e=a.b.v);if(e){b[0]=e.A;b[1]=e.B}else{b[0]=k9g;b[1]=k9g}}else{d=QMe(a.b,a.c).f;b[0]=d[0]/d[2];b[1]=d[1]/d[2]}iNe(a.b,c);return true} +function ZFd(a,b,c,d){kwc.call(this,a);this.a=b;this.b=c;this.c=d;this.d=new YNe(a);TNe(this.d,c);YFd(this);this.g=new YNe(a);this.i=new YNe(a);this.j=new i6e(a);NNe(this.j,0,0,0);XFd(this)} +function rWd(a,b,c,d){kwc.call(this,a);mWd(this);this.g=d;this.f=c;this.i=d.G;this.e=new F$e(a);this.j=true;qWd(this);c9b(a.w,this,0)!=-1||Z8b(a.w,this);nWd(this);this.i.Wp(d);JKc(this.e,b)} +function i_d(a){var b,c;a.c=a.a.k.i.length;if(!a.a.q){NZe(a.b,false);return}NZe(a.b,true);WYe(a.b);if(a.c==0){return}for(c=0;c$wnd.Math.abs(b.$)){c=-b._/b.Z;d=0}else{c=0;d=-b._/b.$}return $wnd.Math.abs((a.Z*c+a.$*d+a._)/Xeg(a.Z,a.$))}return 0} +function _Qe(a){var b;b=new $jf(3,3);Ujf(b,1,1,a[0]);Ujf(b,2,2,a[1]);Ujf(b,3,3,a[2]);Ujf(b,1,2,a[3]);Ujf(b,2,1,a[3]);Ujf(b,1,3,a[4]);Ujf(b,3,1,a[4]);Ujf(b,2,3,a[5]);Ujf(b,3,2,a[5]);return b} +function hSe(a,b,c){var d;jSe(a,a.ab,b,c);VRe(a,Rkf(new cmf(pe(ie(sf,1),g9g,5,15,[b,c,0])),a.cb).f);d=(!a.U&&(a.U=new Npg),a.U);Hpg(d,a.q[0].d,a.q[0].e,a.q[1].d,a.q[1].e,a.k.d,a.k.e);lSe(a)} +function abf(a,b,c){var d;Qaf(b,a.c.j.B);lYe(a.b);d=new Uaf;bbf(a,c,d,b);if(d.a){Paf(b,rYe(a.b))?yYe(a.b,'',''):yYe(a.b,_af(b.a.length>0?Oaf(b):b.b),null);a.d.cp();Xaf(a);a.d.po();a.d.yp()}} +function uef(a,b){var c,d;c=kcc(b,0);while(c.b!=c.d.c){d=scc(c);if(d[0]>a[0]+$ph){tcc(c);break}if(Pcg(d[0],a[0],$ph)){if(d[1]>a[1]+$ph){tcc(c);break}if(Pcg(d[1],a[1],$ph)){return}}}pcc(c,a)} +function Mhf(a){if(Ocg(a.c,k9g)&&Ocg(a.a,a.c)||Ocg(a.c,h9g)&&Ocg(a.a,a.c)){return new nff(0)}if(a.c>0){return new off(k9g,k9g)}else if(a.a<0){return new off(h9g,h9g)}return new off(h9g,k9g)} +function gPf(a,b){switch(b){case 1:return a.cb;case 2:case 16:case 512:return null;case 8:case 32:case 64:case 70:case 4:if(a.bc);else{return null}{return null}return null.pD();}return null} +function tHg(a,b){var c,d,e,f,g,h,i;g=new hDg;eyg(g.C,'txtContainer',true);i=w4b(b,n6g,0);for(d=i,e=0,f=d.length;e=0;b--){for(d=0;d<=a.e;d++){e=b-d;if(e>=0&&ekoh){c=b;b=0;break}}}}return c} +function jPf(a){var b,c,d;if(!sOc(a.cb)){return false}b=Mod(a.pb);b.i.b.g!=null?Kkd(b):Jkd(b);ozg(a.cb);c=a.B;Mod(a.pb).i.b.g!=null?(d=pSf(c,Yxh,Zxh)):(d=pSf(c,$xh,_xh));VTf(d,a);return true} +function NTf(a,b){var c;oIc(a,b);if(!b.a){b.c.a.length>0&&F1b(b.c,b.c.a.length-1)!=32&&O4b(b.c,' ');c=a.vi().j.B;mUf(XOf(a.vi().j),a)?i7e(b,pSf(c,oEh,pEh)):i7e(b,pSf(c,qEh,rEh))}return b.c.a} +function qEg(a){var b,c,d,e;for(c=(e=(new A8b(a.d.a)).a.Zd().b.Xf(),new B8b(e));c.a.xf();){d=(b=c.a.yf(),b.ef());if(d.gt()){d.ct()||oEg(a,mEg(a,d));return true}}return oEg(a,x8b(a.d.a.$f()))} +function bub(a,b){a.j=b;a.k=1;a.g=0;if(a.c==null||g7g!=a.c.length){a.a=a.f=g7g;a.c=me(rf,b5g,5,g7g,15,1);a.d=me(uf,v5g,5,g7g,15,1);a.b=me(uf,v5g,5,g7g,15,1)}a.p=a.o=false;a.r=a.i=a.n=0;a.e=-1} +function tPb(a){var b,c;tQb(a);if(a.o0){b*=26;b+=(uhc(0,c.length),c.charCodeAt(0)-65+1);c=(uhc(1,c.length+1),c.substr(1))}if(b>9999){return -1}return b-1} +function NVe(a,b,c){var d,e;d=b;if(d.G==a){return true}if(!CVe(a)){return a.r&&!!a.d&&$wnd.Math.abs(a.d.Cg(d.A)-d.B)<=c}e=$1b(xVe(a,(Sud(),oud)),'y')?d.$:d.Z;d._!=1&&(e=e/d._);return eVe(a,e)} +function t2e(a,b){var c;MNe(a,b);if(!b.mn()){return}c=b;a.b=c.b;a.v=cOe(a.Kc,a.v,c.v);ff(a.lb,700)&&ff(b.Nl(),700)?p0e(a.lb.b,b.Nl().b,true):ff(a.lb,708)&&ff(b.Nl(),708)&&_5e(a.lb.c,b.Nl().c)} +function T4e(a,b){var c,d,e;oLg(a.Mc.j);d=$fg(a.v==null?'':a.v);e=$fg(b.v==null?'':b.v);c=b4b(d,e);c==0&&(c=b4b(a.v==null?'':a.v,b.v==null?'':b.v));if(c==0){return wIc(a)>wIc(b)?-1:1}return c} +function aXf(a,b){var c,d;c=false;if(a.A==null){c=true}else if(a.A.length!=b.length){c=true}else{for(d=0;d0;b--){d[b-1]=b*a[b]}return d} +function oDc(a,b,c){var d;d=wDc(a);a.V=b;NPc(a.kc,a.V==1||a.V==0);c&&!a.$b&&!(FQc(b)&&false)&&(cUf(a.Jb),WBc(a,true,true));a.$=101;DPc(a.kc,rFc(a,b));a.dc=false;if(!a.$b){d&&uqd(a.K);Vqd(a.K)}} +function rQc(a){sPc(a,$wnd.Math.max(a.C.Jb.g.a,12));XEc(a,oug(new sug(pbh),0,a.sb));!!a.bc&&!!a.bc&&qPc(a,new tug(a.bc.i?yih:xih,a.bc.p,mqb(L3b(Xpb($wnd.Math.round(a.sb*jih))))));qQc(a);mQc(a)} +function JWc(a,b,c,d,e){var f;kWc.call(this);lWc(this);this.Pb=a;this.eb=c;this.fb=d;this.cb=e;this.gb=b;f=a.Jb.o;this.jb=new cId(f);this.ib=me(JY,Roh,33,1,0,1);this.ib[0]=new O0e(f);xWc(this)} +function xXc(a,b,c,d){var e;e=a.xb.Tb?a.Wj():a.e;if(!e){return false}if(AJc(a.xb)){return e.qi(b-d,c-d,2*d,2*d)}if(!a.f||a.Ib.G<=0){return false}AXc(a);return !!a.Mb&&Nqg(a.Mb,b-d,c-d,2*d,2*d)} +function e$c(b){var c;if(b.Mb){return true}try{b.Mb=Tog(b.sb,b.f,800)}catch(a){a=Ppb(a);if(ff(a,48)){c=a;nlg('problem creating Curve shape: '+c._c());return false}else throw Qpb(a)}return true} +function S6d(a,b){var c,d,e,f,g,h;h=$6d(a,b);if(!h){return null}d=(f=(new l8b(h.a)).a.Zd().rd(),new m8b(f));g=me(fY,qnh,13,bEb(h.a),0,1);e=0;while(d.a.xf()){g[e++]=(c=d.a.yf(),c.ef())}return g} +function Ome(a){var b,c,d;b=TOe(a.a);if(!b){a.V=me(fY,qnh,13,0,0,1)}else{c=me(fY,qnh,13,b.a.size(),0,1);a.V=IYb(b,c);for(d=0;d0&&(b.a<0||b.c>b.a)){return a}if((a.a<0||a.c>a.a)&&b.c>0){return b}if((a.a<0||a.c>a.a)&&(b.a<0||b.c>b.a)){return new off(k9g,h9g)}return Dc(new off(a.a,b.c))} +function Oif(a,b){if(!djf(a.c,b)||Uef(b)>2*Uef(a.c.a)){Uif(a,b);return}cjf(a.c,b)?sff(a.f,b,new Xif(a),new Yif(a)):ajf(a.c,b)?tff(a.f,b,new $if(a)):bjf(a.c,b)&&uff(a.f,b,new _if(a));Oqb(a.c,b)} +function Wkf(a){var b,c,d;b=new bmf(4);if(a.f[0]!=0){b.f[0]=-a.f[1];b.f[1]=a.f[0];vlf(b)}else{b.f[0]=1}c=(d=new bmf(4),Olf(d,a,b),d.f[3]=0,d.a=true,d);vlf(c);return pe(ie(S0,1),Jqh,52,0,[b,c])} +function Evf(a,b,c){var d,e,f,g;for(e=(g=(new A8b(Nec(a.c,b).a)).a.Zd().b.Xf(),new B8b(g));e.a.xf();){d=(f=e.a.yf(),f.ef());if(!$1b(d.substr(0,b.length),b)){break}c.a.put(d,(Y1b(),W1b))==null}} +function ed(a,b,c,d){var e={moduleName:(kd(),$moduleName),sessionId:$sessionId,subSystem:'runAsync',evtGroup:a,millis:(new Date).getTime(),type:b};c>=0&&(e.fragment=c);d>=0&&(e.size=d);return e} +function B9b(a,b){var c;if(nf(a)===nf(b)){return true}if(a==null||b==null){return false}if(a.length!=b.length){return false}for(c=0;c170.624){return NaN}if(a<0||a>32||a-$wnd.Math.floor(a)>Bqh){return $wnd.Math.exp(Tpc(a+1))}c=pf(a);while(mfg0&&i<1){g>22-b;e=a.h<>22-b}else if(b<44){c=0;d=a.l<>44-b}else{c=0;d=0;e=a.l<0&&F1b(b.c,b.c.a.length-1)==46&&O4b(b.c,' ');O4b(b.c,'.');return b.c.a} +function zRe(a,b,c){if(a.Em()){c.Z=a.ab[0]*b.Z+a.ab[3]*b.$+a.ab[4]*b._;c.$=a.ab[3]*b.Z+a.ab[1]*b.$+a.ab[5]*b._;c._=a.ab[4]*b.Z+a.ab[5]*b.$+a.ab[2]*b._}else{NNe(c,NaN,NaN,NaN);wLc(c,false,false)}} +function b5f(a,b,c,d,e){var f,g;g=b<0?3:b;if(g<1||g>3){return}f=GYf(YOf(a.b),g);++f.bb;RWf(f,0,$qe(a.a,c,new AVf));RWf(f,1,$qe(a.a,d,new AVf));f.WA()&&RWf(f,2,$qe(a.a,e,new AVf));wQf(f);Zpd(a.d)} +function ueg(a,b){var c,d,e,f,g;e=a&V4g;g=b&V4g;d=a&d7g;f=b&d7g;c=(a&kFh)+(b&kFh);if((d&f)!=0){return c^V4g^e^g}if((d|f)!=0){if((c&d7g)!=0){return c^-1073741824^e^g}return c^d7g^e^g}return c^e^g} +function Rqg(a){var b,c,d,e,f,g,h;b=a.b;if(b>0){g=h=a.a[--b];d=e=a.a[--b];while(b>0){f=a.a[--b];c=a.a[--b];ce&&(e=c);f>h&&(h=f)}}else{d=g=e=h=0}return new Xrg(d,g,e-d,h-g)} +function fAg(a,b){var c;c=new CBg(b.offsetX/Uzg(a.b),b.offsetY/Uzg(a.b),vAg(b.pointerType),a.b);b.altKey&&(c.a=true);b.shiftKey&&(c.i=true);b.ctrlKey&&(c.b=true);b.button==2&&(c.g=true);return c} +function tUg(a,b,c){var d,e,f;a.c=0;for(f=new a8b((new Z7b(c)).a);f.b;){e=_7b(f);d=nUg(a,e.ef(),true);d.addEventListener(VFh,new GUg(a,b,c));d.addEventListener(K5g,new HUg(d));d.src=YSg(e.ff())}} +function ECb(a,b,c,d,e,f,g){mCb.call(this);this.u=d+f+e;this.q=b;this.o=c;this.a=a;switch(g.k){case 0:this.b=d;break;case 1:this.b=d+f-a.u;break;case 2:this.b=d+(f-a.u)/2;break;default:this.b=d;}} +function pPb(a){var b;tQb(a);if(a.o=48&&b<=57){++a.o;return b-48}}throw Qpb(new VWb(a,'A positive integer expected as argument'))} +function sSc(a){var b,c,d,e,f,g;g=new n9b;for(e=new t9b(a);e.a: '+b)}} +function Lkd(a){var b,c,d,e;e=a.a.i.length;if(e==0){a.f=false;return}for(d=new t9b(a.a);d.a0){XEc(f,new cde(f.Mc,e));f.g=false}g=b.$;b.$=false;b.Q=true;JKc(f,c);b.Q=false;b.$=g;return Pee(a,f)} +function CNe(a,b,c){var d;d=$wnd.Math.abs(a.Z)+$wnd.Math.abs(a.$);if(Scg(llf(b))){return $wnd.Math.abs(a.Z*b.f[0]+a.$*b.f[1])0){b=(mhc(0,c.i.length),c.i[0]);eaf((U8e(),O8e,b))&&!b.ln()?PGc(a.i,b):b.jn()?QGc(a.i,b):vFc(a)}else{a.d||vFc(a)}} +function ZOc(a,b,c,d,e,f,g){var h,i,j;i=b+(a.yc-b)*d;j=c+(a.Hc-c)*d;if(Ocg(a.Ec,e)){!a.Qb&&(a.Qb=new Gxg(a));hzc(a.Qb,i,j,g);lzc(a.Qb)}else{h=e/a.Ec;wQc(a,(i-a.yc*h)/(1-h),(j-a.Hc*h)/(1-h),h,f,g)}} +function v4c(a,b,c){var d,e,f,g,h,i,j,k;h=a.c.c;j=a.c.d;d=a.c.a;f=a.c.b;j<5&&(j=5);b.Yh(c);b.Fh(h,j,f,d,8,8);x4c(b,h,j,f,d);i=a.b.c;k=a.b.d;e=a.b.a;g=a.b.b;b.Yh(c);b.Fh(i,k,g,e,8,8);w4c(b,i,k,g,e)} +function Ghd(a,b){var c;if(!b){return false}c=Tbc(b,xph);if(c==null){return false}if($1b(xbh,c)){a.v.g=2}else if($1b('radiant',c)){a.v.g=1}else if($1b(yuh,c)){a.v.g=8}else{return false}return true} +function $Id(a,b){var c;c=$wnd.Math.max($wnd.Math.abs(a.n[b].Z),$wnd.Math.max($wnd.Math.abs(a.n[b].$),$wnd.Math.abs(a.n[b]._)));if(c<1){a.n[b].Z=a.n[b].Z/c;a.n[b].$=a.n[b].$/c;a.n[b]._=a.n[b]._/c}} +function B$d(a){if(a.V[0].Em()&&a.V[1].Em()){if(a.a.Fp()!=a.b||a.c.Fp()!=a.d){a.b=a.a.Fp();a.d=a.c.Fp();a.f=UOf(a.Kc.M.j,a.a.Fp(),a.c.Fp());ZHd(a.e,a.f,true)}else{ZHd(a.e,a.f,true)}}else{YHd(a.e)}} +function Ife(a,b){var c,d,e;for(e=0;e0){try{b9b(b.b,0).Nf();b.b.i.length==0||f9b(b.b,0)}catch(a){a=Ppb(a);if(ff(a,237)){break}else throw Qpb(a)}}} +function bxb(){bxb=xqb;_wb=pe(ie(mu,1),h5g,2,6,['%','$','#','&','{','}','_']);axb=pe(ie(mu,2),W4g,22,0,[pe(ie(mu,1),h5g,2,6,['~','^',l5g]),pe(ie(mu,1),h5g,2,6,['\u223C','\\^{} ','\\backslash{}'])])} +function iEc(a,b,c){var d;if(b.i.length==0){return null}if(a.Jb.w.i.length>2){d=!c&&c9b(b,b9b(a.Jb.w,0),0)!=-1;if(d){return hqd(a.K,null,NCc(a))}}XCc(a,b,500,false,a.Jb.w,(U8e(),s8e),c);return null} +function Igd(b){var c,d,e,f;try{f=Y2b(Tbc(b,'r'),10);e=Y2b(Tbc(b,'g'),10);d=Y2b(Tbc(b,'b'),10);c=Y2b(Tbc(b,E8g),10);return Vuc(f,e,d,c)}catch(a){a=Ppb(a);if(ff(a,43)){return null}else throw Qpb(a)}} +function Opd(a,b,c){var d,e,f,g;if(!a.S){return}for(g=(e=(new A8b(a.o.F.a)).a.Zd().b.Xf(),new B8b(e));g.a.xf();){f=(d=g.a.yf(),d.ef());if(!f.Bi(c)){break}b.bq(f)}if(a.jb){a.jb=false;PAg(a.j.M,500)}} +function vPd(a,b,c){var d,e,f,g;d=(c-b)/a.a;for(e=b;d>0&&ec;e+=d){g=a.o.Cg(e);if(isNaN(g)||!isNaN(g)&&!isFinite(g)){return false}}f=a.o.Cg(c);return !isNaN(f)&&!(!isNaN(f)&&!isFinite(f))} +function $Pd(a,b,c,d){var e;kwc.call(this,a);this.g=b;this.a=c;this.c=d;this.b=c.lp();this.d=d.lp();e=b.hv().o[0];this.e=hue(this.Mc,c,e,d);this.i=ff(b,56)?new vWe(b):new pWe(a);ZPd(this);XPd(this)} +function b6d(a,b,c){if(ff(b,42)){return c==null||$1b(c,b.a)}if(ff(b,18)){return i6d(b,c)}if(ff(b,181)){return b6d(a,b.e,c)||b6d(a,b.f,c)}if(ff(b,267)){return b6d(a,b.e,c)||b6d(a,b.f,c)}return false} +function Q9d(a,b,c){var d;if(!b){return false}d=b.tp();if(ff(d,18)){R6d(d,a,c);return true}else if(ff(d,34)&&!!d.Gb){R6d(d.Gb,a,c);return true}else if(d.Tn()){Vge(a,d.Ap());return true}return false} +function zbe(a,b,c){var d,e;d=a.n.n;e=a.n.o;Iqh0){if(!a.i.a){Eog(a,a.r,a.w,a.A,a.v.e,a.v.g);fpg(a.r,a.v);Eog(a,a.r,a.B,a.C,a.r.f,a.r.i);epg(a.r)}apg(a.j,a.r)}} +function Ksg(a,b,c,d,e){if(a.a!=b||a.b!=e||a.dd){return false}if(cb.TB()){throw Qpb(new mc(CFh+c+'=>'+d+'] for '+b))}a.e=$wnd.Math.min(a.e,c);a.d=$wnd.Math.max(a.d,d);return true} +function k3g(b,c){i3g();var d,e,f,g;d=null;for(g=b.rd();g.xf();){f=g.yf();try{c.kD(f)}catch(a){a=Ppb(a);if(ff(a,48)){e=a;!d&&(d=new PYb);YDb(d.a,e,d)}else throw Qpb(a)}}if(d){throw Qpb(new j3g(d))}} +function Pd(b,c){var d,e,f,g;for(e=0,f=b.length;eb[1]+d&&a.Lc>c[1]+d){return true}if(b[1]>a.Jc+d&&c[1]>a.Jc+d){return true}d=5/a.Ec;if(a.Cc>b[0]+d&&a.Cc>c[0]+d){return true}return b[0]>a.Ac+d&&c[0]>a.Ac+d} +function s$c(a){a.k.i.length=0;a.j.i.length=0;a.a=fQc(a.Pb,a.c.PA().c);a.b=hQc(a.Pb,a.c.PA().d);a.g=a.c.RA()*a.Pb.Ec;a.i=a.c.RA()*a.Pb.Nc;Tpg(a.f,a.a,a.b,a.a+a.g,a.b+a.i);u$c(a);KAc(a,a.xb,0);t$c(a)} +function nPd(a,b,c,d,e){if(b[1]==1){O4b(a,yod(e,b[0],c))}else if(b[1]==0){b[0]>0?(a.a+=' \\infty ',a):(a.a+=Byh,a)}else{if(!d&&b[0]<0){b[0]*=-1;a.a+='-'}oPd(a,yod(e,Fcg(b[0]),c),yod(e,Fcg(b[1]),c))}} +function RRd(a){var b,c;if(a.o){a.A?y0e(a.b[0],a.A):BRe(a.g,a.n,a.b[0]);return}if(a.v){if(WRd(a)){return}}b=a.r||a.Mc.p||a.Mc.N;b?SRd(a):TRd(a);c=a.b;!c[1]._b&&b0e(c[0],c[1])==(Xcg(),Vcg)&&E0e(c[1])} +function MZd(a){var b,c;if(ff(a.d,33)&&ff(a.e,33)&&!!a.g){b=b1e(a.d,a.e);b+=b1e(a.e,a.g);b+=b1e(a.g,a.d);b=b*a.k/2;L1e(kOd(a.q,0),b);return}c=a.d.Ik(a.g);L1e(kOd(a.q,0),a.k*c*c*$wnd.Math.sin(a.f)/2)} +function u2d(b,c,d){var e;kwc.call(this,b);this.a=d;this.c=new i6e(b);rPd(this);e=d.v;if(!!e&&e._b){try{f6e(this.c,e)}catch(a){a=Ppb(a);if(!ff(a,160))throw Qpb(a)}}this.c._=0;s2d(this);JKc(this.c,c)} +function Mue(a,b,c,d,e,f){var g,h,i;if(!d.si().A&&!d.rv(false)){throw Qpb(GCd(a,b,c[0]))}if(!e.si().A&&!e.rv(false)){throw Qpb(GCd(a,b,c[1]))}g=VLd(Kod(a.f),d,e);i=new ATd(Vad(b),g,f);h=i.g;return h} +function ZRe(a){a.F=Xeg(a.r,a.s);if(a.F!=1){a.r=a.r/a.F;a.s=a.s/a.F}j1c(a.q[0],a.r,a.s);a.Mc.p?a.q[1].e*a.r\'"]');d1g=new $wnd.RegExp('&','g');e1g=new $wnd.RegExp('>','g');g1g=new $wnd.RegExp('<','g');i1g=new $wnd.RegExp("'",'g');h1g=new $wnd.RegExp('"','g')} +function S1g(a,b){x0g();var c,d,e,f,g;if(!!N1g&&!!a&&E0g(a,N1g)){c=O1g.a;d=O1g.b;e=O1g.c;f=O1g.d;P1g(O1g);Kub(O1g,b);D0g(a,O1g);g=!(O1g.a&&!O1g.b);O1g.a=c;O1g.b=d;O1g.c=e;O1g.d=f;return g}return true} +function uc(a){var b;if(a.c==null){b=nf(a.b)===nf(sc)?null:a.b;a.d=b==null?T4g:kf(b)?b==null?null:b.name:mf(b)?'String':E2b(Wb(b));a.a=a.a+X4g+(kf(b)?b==null?null:b.message:b+'');a.c='('+a.d+') '+a.a}} +function FDb(a,b,c,d){zDb();var e,f,g,h,i,j,k;i=c*b;k=c+(c<=0.5?i:b-i);j=c*2-k;h=JDb(a-$wnd.Math.floor(a/360)*360+360)/360;g=BDb(j,k,h+V9g);f=BDb(j,k,h);e=BDb(j,k,h-V9g);return iZb((_Yb(XYb),g),f,e,d)} +function LDb(a,b){var c,d,e;if(nf(b)===nf(a)){return true}if(!ff(b,304)){return false}e=b;if(a.size()!=e.size()){return false}for(d=e.Zd().rd();d.xf();){c=d.yf();if(!a.Yd(c)){return false}}return true} +function a7b(a,b,c,d,e){var f,g,h;f=true;for(g=0;g>>e|c[g+d+1]<>>e;++g}return f} +function dVc(a,b,c){var d,e;if(!a.xb.zn()){return false}e=a.Rb+(a.o-(!!a.tb&&!!a.tb.f.Hb?a.tb.b:pf(a.u*1.2+2)))/2;d=(!!a.tb&&!!a.tb.f.Hb?a.tb.b:pf(a.u*1.2+2))+2;return b>a.Qb&&be&&c0&&b9b(b.k,0).Yk()==1){this.d=new cMe(a);$Le(this.d,(jMe(),iMe))}else{this.d=new cId(a)}i$d(this);h$d(this)} +function V_d(a,b,c,d,e,f){kwc.call(this,a);this.e=$mh;this.g=$mh;this.f=$mh;this.j=false;this.b=b;this.k=c;this.n=d;this.p=e;this.o=f;this.c=b.lb;this.a=ff(b,219);this.i=new j$e(a);R_d(this);N_d(this)} +function M7d(a,b){var c;if(a.o.Di()){c=a.o;(a.o==b||wJc(c,b))&&(a.o=c.Dk(c.Kc))}else ff(a.o,219)&&a.o.xw(b);if(a.s){if(a.s.Di()){c=a.s;(a.s==b||wJc(c,b))&&(a.s=c.Dk(c.Kc))}else ff(a.s,219)&&a.s.xw(b)}} +function oue(a,b,c,d,e){if(d.Sn()&&!ff(d,55)){Z8b(c,d.lv());if($1b('y',xVe(d.lv(),(Sud(),oud)))){return $wnd.Math.max(e,2)}return e}else if(ff(d,124)){Vgc(c.i,d);return 2}else{throw Qpb(FCd(a,b.i,d))}} +function L3e(a,b){var c,d;if(a.p||!(!!a.j||!!r3e(a))){if(a.s){return a.s.qp(b)}return o8d(a.Gb,b)}else{return c=r3e(a),!!c&&c.Om()?c.qp(b):a.j?a.j.qp(b):c.qp(b.B==(c9d(),X8d)?(d=dvd(b),d.e=true,d):b)}} +function olf(a,b){var c;c=a.f[1]*b.f[2]-a.f[2]*b.f[1];if(!(Iqh0){d=g.indexOf('?')!=-1?38:63;g+=String.fromCharCode(d)+'manualRetry='+e}f=new Bd(g,c,b,a.a,ud);f.a.gd(f)} +function Pe(a,b){var c,d,e,f;b&=63;c=a.h&C5g;if(b<22){f=c>>>b;e=a.m>>b|c<<22-b;d=a.l>>b|a.m<<22-b}else if(b<44){f=0;e=c>>>b-22;d=a.m>>b-22|a.h<<44-b}else{f=0;e=0;d=c>>>b-44}return ue(d&B5g,e&B5g,f&C5g)} +function WCc(a){var b,c,d,e;d=null;b=null;a!=null&&!!a[0]&&(b=a[0].Nl());if(ff(b,555)){d=b.Si(1);for(c=1;c1&&Pvc(b)){for(e=0;e0){b=b9b(a.k,0).Xk();dKc(a,b);if(a.k.i.length>1){for(d=1;db[c]){return false}}return a.dc.lengtha.j.b){c=new _ig;c.b=b;c.a=a.j;a.j=c}else{d=a.j;while(!!d.a&&b<=d.a.b){d=d.a}if(b==d.b){return}c=new _ig;c.b=b;c.a=d.a;d.a=c}} +function rEg(a){var b,c,d,e;for(c=(e=(new A8b(a.d.a)).a.Zd().b.Xf(),new B8b(e));c.a.xf();){d=(b=c.a.yf(),b.ef());if(d.gt()){if(!d.dt()){return pEg(a,nEg(a,d))}return true}}return pEg(a,x8b(a.d.a.bg()))} +function u3g(){var a;v3g.call(this,(y1g(),a=(XWg==null&&($1b(mlh,typeof($doc))?(XWg=$wnd.document):(XWg=$doc)),XWg).createElement(tGh),a.type='checkbox',a.value='on',a));this.C.className='gwt-CheckBox'} +function ZAb(a,b){var c,d,e;c=a.b.b;e=me(sf,g9g,5,2*c,15,1);for(d=0;db&&$ph>b&&!(Iqh0&&d>0){Wug(a.f,d,c);a.Z=new mCg(Pug(a.f),Oug(a.f),!a.a||qLg(a.a)==0?1:qLg(a.a),false);a.Y=eCg(a.Z);mQc(a);ozg(a)}} +function t3g(a,b){var c;b==null&&(b=(Y1b(),W1b));c=a.v?(Y1b(),!a.b.checked?false:true):(Y1b(),!a.b.defaultChecked?false:true);a.b.checked=(nhc(b),b);a.b.defaultChecked=(nhc(b),b);nhc(b);if(b==c){return}} +function Ad(b,c){var d,e;try{__gwtInstallCode(c)}catch(a){a=Ppb(a);if(ff(a,43)){d=a;e=c;e!=null&&e.length>200&&(e=(thc(0,200,e.length),e.substr(0,200)+z5g));zd(b,new bd(b.g,e,d),false)}else throw Qpb(a)}} +function Tqb(a,b,c,d){var e,f,g,h;g=Vub(a.a,b,c);h=new Wwb;for(f=0;f0?$wnd.Math.floor(f):$wnd.Math.ceil(f));h=a%b;i=f3b(a*b,0);if(h!=0){e=f3b($wnd.Math.abs(h)*2,$wnd.Math.abs(b));g+=d6b(pf(g)&1,i*(5+e),d)}return new V5b(g,c)} +function Xpc(a){Opc();var b;if(isNaN(a)||!isNaN(a)&&!isFinite(a)){return a}if(a>0&&a<=Amh){return 1/(a*a)}if(a>=49){b=1/(a*a);return 1/a+b/2+b/a*(tmh-b*(0.03333333333333333+b/42))}return Xpc(a+1)+1/(a*a)} +function Swc(a){var b,c,d,e,f,g,h;c=new PYb;for(h=(e=(new A8b(swc(a.c))).a.Zd().b.Xf(),new B8b(e));h.a.xf();){g=(d=h.a.yf(),d.ef());b=z4b(g,0,m4b(g,G4b(46)));$1b(vnh,b)||(f=ZDb(c.a,b,c),f==null)}return c} +function U$c(a){var b,c,d,e;d=a.n.k.i.length;if(d>a.c.i.length){for(c=a.c.i.length;ca?1:-1;f=$wnd.Math.min(a,b);g=$wnd.Math.max(a,b);c=pe(ie(uf,1),v5g,5,15,[16,22,28]);e=0;for(d=0;d0&&x4b((t1b(),q1b).protocol,'http')&&dOg(d.a.a)}i=new dNg(h,c);Y8b(a.b,0,i)} +function LSg(b,c,d){var e;e=b.a._B(c);if(e==null||e.length==0){return d}try{return X2b(e)}catch(a){a=Ppb(a);if(ff(a,38)){!!jlg&&klg(jlg,(Clg(),Blg),'Invalid value of '+c+':'+e)}else throw Qpb(a)}return d} +function kUg(a,b){var c,d,e,f,g,h,i;h=b.D;if(!h){return}for(g=(d=(new A8b(h.a)).a.Zd().b.Xf(),new B8b(d));g.a.xf();){f=(c=g.a.yf(),c.ef());e=f.Pb.c;if(e!=null&&e.length>0){kKg(f.Pb);i=f.Pb.c;qUg(a,e,i)}}} +function COb(a,b,c){yOb();var d;this.c=new lZb(0,0,0,0);this.a=a;d=b;xOb!=0?(this.d=d*$wnd.Math.abs(xOb)):(this.d=d);if(!c){this.c.d+=pf(Sih*d);this.c.a+=pf(Sih*d);this.c.b+=pf(Sih*d);this.c.c+=pf(Sih*d)}} +function Pfd(b,c,d){try{Qfd(b,c,d,xph,(_1f(),O0f));Qfd(b,c,d,'onUpdate',W1f);Qfd(b,c,d,'onDragEnd',S0f);Qfd(b,c,d,'onChange',W0f);return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function rkd(a,b){var c,d;if(ff(a,118)&&b){d=oke(a,(Sud(),oud));if($1b('A',d)||$1b('C',d)){return 0.5}}if(!ff(a,18)){return 1}c=a;if(c.q!=(_8f(),q8f)&&!!c.s){return rkd(c.o,b)+rkd(c.s,b)}return rkd(c.o,b)} +function $Fd(a){var b;a.e=a.b.k.i.length;if(!a.b.q){NZe(a.d,false);return}NZe(a.d,true);WYe(a.d);a.c==0&&MYe(a.d,a.a.Dk(a.Kc));for(b=0;b1){Vxd(c,0,a.f,a.a);g=a.f.a;if(g>1){for(f=0;f=e){d=e;d>500?(d=500):d==0&&(d=1);a.d=w9b(a.d,e+d)}e=a.a.length;if(a.b+c>e){d=e;d>pih&&(d=pih);d4294967294){h=R4g;g=-1}else{h=Trg(b,false);d>=0&&(d+=b-h);g=Trg(d,d>=0)}if(c>4294967294){i=R4g;f=-1}else{i=Trg(c,false);e>=0&&(e+=c-i);f=Trg(e,e>=0)}E$b(a,h,i,g,f)} +function tCg(a,b,c,d,e){var f,g,h,i,j,k,l;i=pf((GWg(b.C)-GWg(a.r.C))/JCg(a.r.C,'x'));h=i-e;if(e>0){k=GWg(a.r.C);l=($wnd.goog.global.parseInt(a.r.C[SFh],10)|0)+k;j=i+d;g=l-j;f=j-k;f=e&&(h=i)}return h} +function Wqb(a,b,c){var d,e,f,g,h,i,j,k;erb(b);e=b.a;f=b.b;j=Rub(a.a,c);d=new Gwb(j,1);g=f;k=_qb(e,g,d);h=new Wwb;xwb(d,0,h);crb(h,k);for(i=1;i<1;i++){xwb(d,i,new Wwb)}b.a=h;b.b=$wnd.Math.max(0,0);return d} +function kHb(a){var b,c,d,e;if(a>5){c=a/5|0;d=a%5;e=new FKb(new jHb(5));for(b=1;b0?i:-i);g=$wnd.Math.min(a.b.a,a.b.a+d);h=$wnd.Math.min(a.b.b,a.b.b+e);lvc(a.j,g,h);f=$wnd.Math.abs(e);Nrg(a.j,i,f)} +function cgd(b,c){var d;try{b.n.hy(pf(mjd(Tbc(c,lrh))));b.n.gy((phd(),$1b(Knh,Tbc(c,'points'))));return true}catch(a){a=Ppb(a);if(ff(a,43)){d=a;!!jlg&&klg(jlg,(Clg(),vlg),d);return false}else throw Qpb(a)}} +function qQd(a,b,c){kwc.call(this,a);this.b=c;this.a=new DYe(a,c);BOe(this.a,30,30);this.a.oc=null;pQd(this);!!this.b&&this.b.Em()&&lYe(this.a);JKc(this.a,b);this.a.ac=true;this.a.Jb=true;tLc(this.a,false)} +function wRd(a,b,c,d){var e;rRd.call(this,a);this.b=b;this.d=c;this.f=d;if(ff(c.lb,464)){e=c.lb;this.g=e.Hv(b.lp(),c);this.c=!!this.g}this.c||(this.a=new Dbe(this.Mc));this.e=new O0e(a);uRd(this);tRd(this)} +function N4e(a){NHc();BLc.call(this,a);this.k=false;this.c=1;this.n=-1;this.o=-1;this.G=false;this.i=false;this.p=new i5b;this.r=0;this.e=false;this.a=false;this.C=(Sud(),oud);sKc(this,true);this.F=new n9b} +function H6e(a,b){var c,d,e;kod(b[0].vi());e=a==null?0:a.length;if(e==1&&a[0]!=null&&!$1b(a[0],'')){G6e(a[0],b);jod(b[0].vi());return}for(c=0;che(d.d.b)?a:he(c.d.b)he(d.d.a)?b:c.b==c?b:d.b==d?a:Dkg(c,d)?a:b} +function $Ag(a,b){WAg(a);$wnd.goog.global.requestAnimationFrame(a.b.s);$wnd.goog.global.cancelAnimationFrame(a.c);b?byg(a.a,true):(a.c=$wnd.goog.global.requestAnimationFrame(yqb(aBg.prototype.Cf,aBg,[a])))} +function _Lg(a){var b,c;if((BWg(a.t.a)==null?null:BWg(BWg(a.t.a)))!=null){c=(BWg(a.t.a)==null?null:BWg(BWg(a.t.a))).style;b=RTg(a.t);if(zLg(a)>0&&lLg(a)>0){nXg(c,zLg(a)*b,(t_g(),s_g));cXg(c,lLg(a)*b,s_g)}}} +function tMg(a,b,c,d,e){var f,g,h,i,j,k;k=weg(b);i=k+'.png';g=i;j=p4b(i,G4b(47));j!=-1&&(g=(uhc(j+1,g.length+1),g.substr(j+1)));g=wig(g);i=k+'/'+g;f=oQg(tOb(new qQg(a),c==null),c,d,e);h=jQg(f,i,b);return h} +function pVg(){oVg();var a,b,c,d;d=me(rf,b5g,5,36,15,1);d[8]=d[13]=d[18]=d[23]=45;d[14]=52;for(a=0;a<36;a++){if(d[a]==0){c=_cc(nVg,16);d[a]=a4b((b=a==19?c&3|8:c,b.toString(16)),0)}}return K4b(d,0,d.length)} +function IPb(a){var b,c,d;d=a.o;c=1;while(a.o0||g>0&&i<0} +function _Sd(a,b){var c,d,e,f;f=Pnd(b,a,false);if(f>1){c=0;ihc(0,f,a.length);S9b(a,0,f,yqb(fac.prototype.gg,fac,[]));e=a[0];for(d=1;d0&&(a[d-c]=a[d])}}f-=c}return f} +function ZUd(a){var b,c;a.d=a.a.k.i.length;c=!a.b?1:pf(a.b.H);if(!a.a.q||a.d==0||c<0||c>a.d){NZe(a.c,false);return}NZe(a.c,true);WYe(a.c);if(c==0){return}for(b=a.d-c;b=0&&PYe(a.b,c+1,null)}}if(a.a>d){for(c=pf(a.a);c>d;c--){if(c>=1){b=cZe(a.b,c-1);b.zf();EZe(a.b,c-1)}}}a.a=d} +function O8d(a,b){var c;if(ff(b,31)&&b.Dm()&&!ff(b,515)){return b.Nw(a)}if(b.Jn((_8f(),m8f))){c=b.Ap();if(ff(c.s,155)&&c.s.Lk()==Uvh){return new u8d(a,O8d(a,c.o),m8f,c.s)}}return new u8d(a,new Dee(a),m8f,b)} +function Bbe(a,b){var c,d,e;if(!b){return}imd(a.t.o,a.o[0].a);for(d=(new pec(b)).b.Xf();d.xf();){c=d.yf();e=Uqe(Jod(a.t),c.ff(),true,true);!!e&&Ceg((!a.j&&(a.j=new Deg(100)),a.j),c.ef(),e.d)}imd(a.t.o,null)} +function nhe(a,b,c){var d,e;if(ff(b,13)){return b.yl(c)}else if(ff(b,18)){d=b;if(d.n||L8d(d)>=24||a.b.a.length==0){return n8d(d,c)}e=new h5b;e.a+='(';O4b(e,n8d(d,c));e.a+=')';return e.a}else{return b.jj(c)}} +function lQe(a,b){var c,d,e,f,g,h;c=b.ab;h=0;f=true;for(g=0;g<6;g++){d=Scg(a.ab[g]);e=Scg(c[g]);d&&!e?(f=false):e&&!d?(f=false):!d&&!e&&(h==0?(h=a.ab[g]/c[g]):(f=Ocg(a.ab[g],h*c[g])));if(!f){break}}return f} +function BSe(a,b){a.ab[0]=FSe(b,2,0);a.ab[1]=FSe(b,0,2);a.ab[2]=FSe(b,0,0);a.ab[3]=FSe(b,1,1)/2;a.ab[4]=FSe(b,1,0)/2;a.ab[5]=FSe(b,0,1)/2;BQe(a,false);b.length<=2&&b[0].length<=2&&Scg(FSe(b,1,1))&&(a.gb=10)} +function g$e(a){var b,c,d,e;!a.vc?(a.vc=new n9b):(a.vc.i.length=0,undefined);for(d=0;db.a){return new off(k9g,h9g)}if(b.b){return new off(-1,1)}else if(b.c>b.a||(b.c==h9g||b.a==k9g)&&Ocg(b.a,b.c)){return new off(k9g,h9g)}return Cif(a,jff(new pff(b),new off(Hih,Hih)))} +function wag(a,b){var c,d;if(ff(b,46)){return Xce(b.Ip())}else if(ff(b,98)){d=b.Vw();c=bjc(new fjc(d.d,d.e));L5e(d,c);return d}else{throw Qpb(new fye(a.b,(yTf(),YSf),pe(ie(mu,1),h5g,2,6,[dkh,hye(b),')'])))}} +function Ibg(a,b){var c,d,e,f,g;if(mf(b)){return Hbg(a,b)}for(g=(e=(new n8b(a.j)).a.Zd().rd(),new o8b(e));g.a.xf();){f=(d=g.a.yf(),d.ff());if(nf(f.a)===nf(b)){return f}}c=Hbg(a,bEb(a.j)+1+'');c.a=b;return c} +function Gcg(a,b){var c,d,e;d=$wnd.Math.pow(10,$wnd.Math.floor($wnd.Math.log($wnd.Math.abs(b))/$wnd.Math.log(10)));c=a*Tih;e=lqb(Xpb($wnd.Math.round(c)));if(c==e||c-koh*d0?owb(a.a,a.b-1):null,240)){c=a.b>0?owb(a.a,a.b-1):null;if(c.a.b==2||c.a.c==44||c.a.c==59||c.a.c==58||u2b(c.a.c)){return}mwb(a.a,a.b-1);a.b>0&&--a.b;!!c&&(c.f=b);Z8b(b.d,c)}} +function bjc(a){var b;if(a.c){return Hic}if(a.d==0&&a.a==0){return new fjc(0,0)}b=$wnd.Math.sqrt(($wnd.Math.abs(a.d)+Lic(a))/2);return a.d>=0?new fjc(b,a.a/(2*b)):new fjc($wnd.Math.abs(a.a)/(2*b),H3b(a.a)*b)} +function Ovc(b,c,d){var e,f,g;if(!b.W){return}try{g=(Sud(),Rud);e=b.Pi(Rud);b.Yi(e)?b.Qi(g,c):O4b(c,Bvc(b,e,g));d&&Mvc(b,c)}catch(a){a=Ppb(a);if(ff(a,38)){f=a;!!jlg&&klg(jlg,(Clg(),vlg),f)}else throw Qpb(a)}} +function DZc(a,b,c,d){var e,f;e=yZc(a,b,d);if(b==(r_e(),q_e)||b==n_e){f=BZc(b,d.size())+200-e;_6e(c,new _lf(-a.Pb.Db*f/2,0,0),null,a.Pb)}else{f=CZc(b,d.size())+48-e;_6e(c,new _lf(0,a.Pb.Eb*f/2,0),null,a.Pb)}} +function $5c(a,b,c,d,e,f,g,h,i){S5c();this.a=a;this.w=b;this.v=c;this.i=d;this.n=e;this.A=f;this.f=g;this.q=h;this.p=i;this.o=a.vr();this.r=false;this.c=a.vr();this.k=new p6c(new QQc(f));Z5c(this)&&W5c(this)} +function MKd(b){var c;try{b.d=A6d(b.a.Gb,(Sud(),oud)).Vw();if(h3b(b.d.d)||h3b(b.d.e)){E0e(b.a)}else{c=b.a.Gb;s0e(b.a,b.d.d,b.d.e,1,true);wKc(b.a,c)}}catch(a){a=Ppb(a);if(ff(a,38)){E0e(b.a)}else throw Qpb(a)}} +function J5d(a,b,c){var d;d=new h5b;c?O4b(d,n8d(c,b)):(d.a+='0',d);b.B==(c9d(),W8d)?Z6d(a.o)==(Hje(),yje)||Z6d(a.q)==yje?(d.a+='%=',d):(d.a+='=',d):O4b(d,tvd(b));a.q?O4b(d,n8d(a.q,b)):(d.a+='0',d);return d.a} +function u9d(a,b,c){if(ff(b,98)){return b.Vw().d}else if(ff(b,382)){return b.ts()[0]}else if(ff(b,55)){return b.Z}else if(c==(_8f(),D8f)&&ff(b,46)){return b.Lk()}else{throw Qpb(D9d(a,b,c==W8f?'x(':'real('))}} +function v9d(a,b,c){if(ff(b,98)){return b.Vw().e}else if(ff(b,382)){return b.ts()[1]}else if(ff(b,55)){return b.$}else if(c==(_8f(),X7f)&&ff(b,46)){return 0}else{throw Qpb(D9d(a,b,c==Y8f?'y(':'imaginary('))}} +function F2e(a,b,c){var d,e,f;d=b;e=c;f=-(a._+a.Z*d+a.$*e)/(a.Z*a.Z+a.$*a.$);d+=f*a.Z;e+=f*a.$;if($wnd.Math.abs(a.Z)<=$wnd.Math.abs(a.$)){return (a.v._*d-a.v.Z)/(a.$*a.v._)}return (a.v.$-a.v._*e)/(a.Z*a.v._)} +function r3e(a){var b;if(a.f){return a.r}b=h3e(a);ff(b,271)&&b._s();ff(b,50)&&b.Go(true);!!a.r&&a.r.zf();if(!!a.r&&!!b){kLc(b,a);a.r=b.lp()}else if(!b){a.r=null}else{a.r=b.lp();kLc(a,a.r)}a.f=true;return a.r} +function ijg(a,b){var c,d,e,f,g,h;b.i.length=0;for(d=0;d0?new nff(0):new off(k9g,h9g)}if(!(ide(c.c)&&Pcg(c.a,c.c,t9g))){return Bhf(a,b,c)}return xhf(a,b,c.c)} +function YTf(a,b,c,d){var e,f;if(!b||c9b(a.k,b,0)!=-1){return}e=b.lp();w0f(OOf(a.c.j),new r0f((_1f(),C1f),e,''));Z8b(a.k,e);_Kc(e,true);c&&Zpd(a.c);d&&IUf(a,true);for(f=new t9b(a.J);f.a0&&a.pC(b);a.hC();a.nC()} +function aQg(){this.g=new FZf(this);this.p=new h5b;this.q=pe(ie(uf,1),v5g,5,15,[3,5,10,15]);this.i=2;this.q[this.q.length-1]=13;this.f=new _Vf(this);this.d=KDh;this.b=(ing(),dmg);this.c=jng(this.b);this.a=true} +function E4b(a){var b,c,d;c=a.length;d=0;while(dd&&(uhc(b-1,a.length),a.charCodeAt(b-1)<=32)){--b}return d>0||b>1);R9b(b,a,i,j,-e,f);R9b(b,a,j,h,-e,f);if(f.bf(a[j-1],a[j])<=0){while(c2){throw Qpb(new Xkc(a,1,2))}if(b<1||b>2){throw Qpb(new Xkc(b,1,2))}c=a-1+(b-1);return c<=0.5?Upc(1+c):c<=1.5?Upc(c)+(c==0?c:$wnd.Math.log(c+1)):Upc(c-1)+$wnd.Math.log(c*(1+c))} +function hIc(a,b){var c,d;if(!a.hb){d=KIc(a,(Sud(),oud));N1b(b.b,b.a?6:0);O4b(b.b,d);return Pdg(b)}c=a.Uk();if(a.Xb!=null&&m4b(a.Xb,G4b(95))>-1){Odg(b,c);return Pdg(b)}else{N1b(b.b,b.a?6:0);O4b(b.b,c);return c}} +function qWc(a,b){var c,d,e;if(a.s.Tb){c=new tqg(a.L);d=new tqg(a.N);e=new tqg(LNc(a.Pb));e.b=bsg(new msg,e.b,c.b);e.a=null;e.b=bsg(new msg,e.b,d.b);e.a=null;yAc(a,b,e)}else{a.M&&yAc(a,b,a.L);a.O&&yAc(a,b,a.N)}} +function Yed(b,c){if(!b.n._m()){nlg('wrong element type for : '+b.n.mD);return false}try{SXe(b.n,(phd(),$1b(Knh,Tbc(c,xph))));return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function qfd(b,c){if(!(b.n._m()||b.n.Rm()||b.n.qn())){nlg('wrong element type for : '+b.n.mD);return false}try{b.n.No(Tbc(c,Zih));return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function Pid(b,c){var d,e;try{d=$1b(Knh,Tbc(c,'blocked'));yPf(b.a,d);e=$1b(Knh,Tbc(c,tvh));SPf(b.a,e)}catch(a){a=Ppb(a);if(ff(a,43)){!!jlg&&klg(jlg,(Clg(),xlg),'error in element ')}else throw Qpb(a)}} +function Yvd(a,b,c){var d,e;if(b.An()){if(!c){return false}if(ff(b,142)&&!!b.jv()){d=q8d(b.jv());e=L8d(d);return e!=-1&&e<24}return false}if(b.Ap().q==(_8f(),L7f)){return Yvd(a,b.Ap().o,c)}return L8d(b.tp())<24} +function a2d(a){var b,c,d,e;e=a.b.v;if(e==null){NZe(a.a,false);return}NZe(a.a,true);WYe(a.a);d=e.length;if(d==0){return}for(b=0;bb){if(c==0){return -1}return b9b(a.a,c-1).a}}return b9b(a.a,c-1).a} +function Q7c(a){var b,c,d,e,f,g;mac();l9b(a.g,new W7c);for(b=0;b1))||LAg(a,b)} +function jKg(){var a,b,c,d;hKg=false;c=(t1b(),p1b).querySelectorAll('.ggw_resource');for(b=0;b0?b9b(c.d,0):null,b);b.a+=N7g;nxb(a,!!c.d&&c.d.i.length>1?b9b(c.d,1):null,b);b.a+='}';return true} +function SCb(a,b,c,d){var e,f;H_b(b.d);N_b(b.d,c,d);e=tHb(a.b.c);a.c!=1&&g_b(b,a.c,a.c);f=b.f;!!e&&f.c==e.c&&f.e==e.e&&f.d==e.d||j_b(b,e);a.a[0]=a.b.b;Z$b(b,a.a);!!e&&f.c==e.c&&f.e==e.e&&f.d==e.d||j_b(b,f);e_b(b)} +function uYb(a,b,c){var d,e,f,g;if(g=tYb(a,b)){f=null;e=false;if(a.o: '+b.n.mD);return false}try{d=b.n;d.yx(Y2b(Tbc(c,xph),10));return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function Khd(b,c){var d,e;try{d=$1b(Knh,Tbc(c,'expRoots'));kWf(YOf(b.a).b,d);e=Y2b(Tbc(c,'timeout'),10);e>0&&lWf(YOf(b.a).b,tcd(e).a*pih);return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function Pmd(a){var b,c,d,e,f;if(!a.U){return}d=(c=(new A8b(a.U.a)).a.Zd().b.Xf(),new B8b(c));while(d.a.xf()){e=(b=d.a.yf(),b.ef());if(e.hn()&&!e.lb){f=e;f.u&&ide(iHd(f))&&ide(jHd(f))&&(f.H=kHd(f));_Hd(f,false)}}} +function KCd(a,b,c,d){var e,f;if(d==null){throw Qpb(GCd(a,b,b9b(b.c,c)))}f=d;if($1b(d,Nbh)){f='i';e=new tke(a.f,f);R4d(b,cje(Vod(a.f),e))}else if($1b(d,Zvh)){f='e';e=new tke(a.f,f);R4d(b,cje(Rod(a.f),e))}return f} +function WId(a,b,c,d){var e;kwc.call(this,a);this.e=c;this.f=d;this.d=new CSe(a);this.b=new YNe(a);this.c=me(tY,Qoh,55,4,0,1);for(e=0;e<4;e++){this.c[e]=new YNe(a);SNe(this.c[e])}VId(this);TId(this);H6e(b,this.Y)} +function yTd(a){if(!a.i){a.V=me(fY,qnh,13,3,0,1);a.V[0]=a.a.V[0];a.V[1]=a.a.V[1];a.V[2]=a.e.lp()}else{a.V=me(fY,qnh,13,3,0,1);a.V[0]=a.a.V[0];a.V[1]=a.a.V[1];a.V[2]=a.i}a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.g);Xvc(a)} +function z3d(a,b){var c,d;if(!a.b){return false}if(!OYb(a.b,b)){return false}d=null;c=a.a;while(c){if(c.a==b){if(!d){Oqb(a,c.b);!a.a&&(a.d=null)}else{d.b=c.b;!d.b&&(a.d=d)}--a.c;return true}d=c;c=c.b}return false} +function MZf(a,b){var c,d,e,f;e=null;f=0;while(rcc(a.d)){c=tcc(a.d);++f;if(!!c.b&&(c.d==null||$1b(c.d,b))){e=c;break}if(c.a==(_1f(),p1f)&&c.c.length>1&&$1b(c.c[1],b)){e=c;break}}for(d=0;d0?owb(a.a,a.b-1):null,240)){c=a.b>0?owb(a.a,a.b-1):null;if(c.a.b==2||c.a.c==44||c.a.c==59||c.a.c==58||u2b(c.a.c)){break}mwb(a.a,a.b-1);a.b>0&&--a.b;Rwb(d,0,c)}} +function XQb(a,b,c,d,e){NAb.call(this);this.a=a;if(e){this.e=null;this.g=(EOb(),EOb(),DOb);this.f=false;this.b=b;this.d=c;this.c=d}else{this.e=b;this.g=c;this.f=d;this.d=(EOb(),EOb(),DOb);this.b=null;this.c=false}} +function $sc(a){var b;b=mqb(jqb(hqb(Spb(g3b(a),_mh),52),k5g));switch(b){case Q9g:return $wnd.Math.abs(a);case -1023:return $mh;default:b=b-52;return b>=-1022?vhc(Spb(gqb(Rpb(b,k5g),52),_mh)):vhc(gqb(1,b- -1074));}} +function cCc(a,b,c,d,e,f,g){var h,i;h=fCc(a,b,c,d,e,f,g);i=bSc(a.kc.Bb.e,(U8e(),r8e));!!i&&!h&&a.Jb.w.i.length==1&&(a.V==2||a.V==15||a.V==18||a.V==7||a.V==10||a.V==24||a.V==51)&&bDc(a,i,false,(P4c(),M4c));return h} +function sCc(a,b,c){if(b.i.length==0){return false}a.Jb.j.i.length==0&&XCc(a,b,1,false,a.Jb.j,(U8e(),e8e),c);if(a.Jb.j.i.length==1){m9b(a.Jb.j,me(lY,Noh,56,0,0,1));TBc(a,a.Jb.j);KPf(a.f,0,0);null.pD()}return false} +function vEc(a,b,c){var d,e;if(b.i.length==0){return false}XCc(a,b,4,false,a.Jb.n,(U8e(),c8e),c);e=a.Jb.n.i.length;if(e>=2){d=ICc(a);Vsd(new Wsd(a.f,d[0],d[1],e>2?d[2]:null,e>3?d[3]:null));return true}return false} +function i5c(a,b,c){var d,e,f,g,h,i;g=me(A0,Joh,120,4,0,1);h=a.b.a;i=a.b.b;if(c){d=g5c(a,b,true);e=d[0];f=d[1]}else{e=b.f.a;f=b.f.b}g[0]=r5c(a,h,i);g[1]=r5c(a,e,i);g[2]=r5c(a,e,f);g[3]=r5c(a,h,f);ozg(a.k);return g} +function wfd(b,c){if(!b.n._m()){nlg('wrong element type for : '+b.n.mD);return false}try{c3c(b.n,(phd(),$1b(Knh,Tbc(c,xph))));return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function jrd(a,b){dod();var c,d,e;if(Tpb(a,0)==0||Tpb(b,0)==0){return Ypb(Tpb(a,0)<0?dqb(a):a,Tpb(b,0)<0?dqb(b):b)?Tpb(a,0)<0?dqb(a):a:Tpb(b,0)<0?dqb(b):b}c=a;d=b;while(eqb(bqb(c,d),0)){e=bqb(c,d);c=d;d=e}return d} +function oKd(a,b){lwc.call(this,a,false);b.Dw(true);cld(a,this,false);this.e=b;this.d=new sXe(a);gXe(this.d,b);this.c=b.n;this.a=eKd(this.c);this.a&&(this.b=new Xae(b,this.Mc));nKd(this);mKd(this);sKc(this.d,true)} +function zOd(a,b,c){var d,e,f,g,h;f=ipd(a.Mc,a.k[0])[1];g=ipd(a.Mc,a.k[0])[0];h=yOf(a.Mc.j,g,f);d=h*(c-b)/(f-g);e=$wnd.Math.min(d/5,400);if(isNaN(e)){return 50}return mqb(Xpb($wnd.Math.round($wnd.Math.max(e,50))))} +function W$d(b,c,d){var e,f,g;f=oVe(b.b,c,d);try{g=wod(b.Mc,f,true,b.a,(Sud(),Gud));return $qe(Jod(b.Mc),g,new AVf).Fp()}catch(a){a=Ppb(a);if(ff(a,48)){e=a;!!jlg&&klg(jlg,(Clg(),vlg),e);return 0}else throw Qpb(a)}} +function b5d(a,b,c,d){var e,f;f=b.o;f.tp().eo()&&f.qo(cJe(new fJe(false),2));if(!!d&&(e=b.o,!(e.Ok()||e.cm()==(Hje(),vje)||ff(e.tp(),55)))){return _4d(a,b,d)}else if(a5d(b)){return _4d(a,b,new ude(b.k,c))}return b} +function ckf(a,b,c,d,e,f){var g,h,i,j,k;for(j=new t9b(c);j.a: '+b.n.mD);return false}try{MAb(b.n,(phd(),$1b(Knh,Tbc(c,xph))));return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function tsd(a,b,c){var d;d=a;if(b==c){return 0}dc&&(d=c);if(b==h9g){if(c==k9g){return d==h9g?0:d==k9g?1:0.5+0.5*ssd(d)}if(d==h9g){return 0}return 1+ssd(d-c)}if(c==k9g){return ssd(d-b)}return (d-b)/(c-b)} +function PJd(b){var c,d;try{c=A6d(b.a.Gb,(Sud(),oud))}catch(a){a=Ppb(a);if(ff(a,38)){c=null}else throw Qpb(a)}d=b.a.Gb;if(ff(c,198)){qOe(b.a,c.tw());!c.Em()&&Xkd(d)?pOe(b.a):(b.a.c=true)}else{b.a.e=false}wKc(b.a,d)} +function uMd(a,b,c,d){var e,f,g;e=bMd(a,c,d);e.W=true;cld(e.Kc,e,true);g=(f=me(JY,Roh,33,2,0,1),lOd(e.f,f));b!=null&&b.length==1&&e.f.d.i.length>1&&b[0]!=null&&!$1b(b[0],'')?nOd(e.f,b[0]):oOd(e.f,b);hwc(e);return g} +function LWd(a,b){var c,d,e,f;c=b;d=me(Npb,y5g,5,3,16,1);for(f=0;f-1){return mhg(),lig(0,c,b,null)}return c} +function Lqg(a){var b,c;c=a.b;if(a.c<1||c<1){return null}if(a.d[a.c-1]==4){d:for(b=a.c-2;b>0;b--){switch(a.d[b]){case 0:break d;case 1:c-=2;break;case 2:c-=4;break;case 3:c-=6;}}}return new nvc(a.a[c-2],a.a[c-2+1])} +function urg(a,b){var c,d,e,f,g,h;c=a[2];d=a[1];e=a[0];h=0;if(c==0){if(d==0){return -1}b[h++]=-e/d}else{f=d*d-4*c*e;if(f<0){return 0}f=$wnd.Math.sqrt(f);d<0&&(f=-f);g=(d+f)/-2;b[h++]=g/c;g!=0&&(b[h++]=e/g)}return h} +function U3g(a){var b;b=V3g(a,false);if(b==null){if(V3g(a,true)!=null){throw Qpb(new mc('nextImpl() returned null, but hasNext says otherwise'))}else{throw Qpb(new Hcc('No more elements in the iterator'))}}return b} +function y4g(a,b,c){var d,e,f;if(c<0||c>a.c){throw Qpb(new S1b)}if(a.c==a.a.length){f=me(Lpb,Z4g,129,a.a.length*2,0,1);for(e=0;ec;--d){a.a[d]=a.a[d-1]}a.a[c]=b} +function wAb(b,c){var d,e,f,g;try{e=(f=$sb(b.c,c),g=f.a,hrb(b.d,!!g.d&&g.d.i.length>0?b9b(g.d,0):null),f)}catch(a){a=Ppb(a);if(ff(a,291)){d=a;if(b.e){return c}throw Qpb(new oc(d))}else throw Qpb(a)}return Zwb(b.f,e)} +function DAb(){DAb=xqb;CAb=new iac(pe(ie(Rt,1),R5g,507,0,[z2b(8304),z2b(185),z2b(178),z2b(179),z2b(8308),z2b(8309),z2b(8310),z2b(8311),z2b(8312),z2b(8313)]));AAb=String.fromCharCode(176);BAb=String.fromCharCode(960)} +function $5b(a,b,c){if(c: '+b.n.mD);return false}try{d=b.n;d.wx(Y2b(Tbc(c,xph),10));return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function TPd(a){var b,c,d;if(!a.b.q||a.b.j!=(i3f(),H2f)||a.b.k.i.length<4){a.a.r=false;return}b=new tde(a.Mc);c=new u8d(a.Mc,b,(_8f(),K7f),a.b);d=new Fbe(c,b);$Ve(a.a,d);a.a.r=true;_Ve(a.a,cZe(a.b,0).H,cZe(a.b,1).H)} +function yWd(a,b){var c,d,e;c=pe(ie(Npb,1),y5g,5,16,[false,false,false]);for(e=0;e: '+b.n.mD);return false}try{d=b.n;sMe(d,Tbc(c,'src'),(I$f(),D$f));return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function Dhd(b,c){var d,e,f;try{e=w4b(Tbc(c,xph),',',0);f=me(uf,v5g,5,e.length,15,1);for(d=0;db){e=a.o.Ow(b);if(e.Qw()==2||e.Qw()==3){f=new s8d(c,0);for(d=0;d-140737488355328&&a<140737488355328){if(a==0){return 0}b=a<0;b&&(a=-a);c=pf($wnd.Math.floor($wnd.Math.log(a)/0.6931471805599453));(!b||a!=$wnd.Math.pow(2,c))&&++c;return c}return a6b(Xpb(a))} +function vic(a,b,c){var d,e,f,g,h,i;d=gjc(Psc(a.b.a));f=new fjc(0.5*(b+c),0);i=zic(a.a,d,f);if(yic(a.a,b,c,i)){return i.d}else{g=NaN;h=Aic(a.a,d,f);for(e=0;e0){a.P[c]=b.H;a.H[c]=b;a.D[c]=false;ePc(a,dOc(a,c),c);!b.j&&(b.j=new n9b);c9b(b.j,a,0)!=-1||b.j.add(a)}else{a.H[c]=null;a.D[c]=true;ePc(a,dOc(a,c),c)}} +function o4c(a){var b,c,d;K3c(a.e,a.f);d=((a.f.n-10)/a.e.c.a|0)+1;b=a.f.o/a.e.c.b|0;c=a.e.b.i.length;if(ca.a||a.a<-1||a.c>1){a.c=k9g;a.a=h9g;a.b=false}else{c=a.a>=1?0:Lif($wnd.Math.acos(a.a));b=a.c<=-1?Iih:Kif($wnd.Math.acos(a.c));a.c=-0.==c||-0.=48&&c<=57){++a.o;b=c-48;while(a.o=48&&c<=57){++a.o;b=10*b+c-48}else{return b}}return b}}throw Qpb(new VWb(a,'Expect a positive integer'))} +function U7b(){U7b=xqb;T7b=new V7b('UP',0);N7b=new V7b('DOWN',1);M7b=new V7b('CEILING',2);O7b=new V7b('FLOOR',3);R7b=new V7b('HALF_UP',4);P7b=new V7b('HALF_DOWN',5);Q7b=new V7b('HALF_EVEN',6);S7b=new V7b('UNNECESSARY',7)} +function ioc(){ioc=xqb;hoc=pe(ie(sf,1),g9g,5,15,[0.5,0.5,1]);foc=pe(ie(sf,2),nih,17,0,[pe(ie(sf,1),g9g,5,15,[0.5]),pe(ie(sf,1),g9g,5,15,[0,0.5]),pe(ie(sf,1),g9g,5,15,[0,0,1])]);goc=pe(ie(sf,1),g9g,5,15,[tmh,V9g,V9g,tmh])} +function nDc(a,b,c){var d,e;d=null;if(b.i.length==0){if(c){return false}}else{XCc(a,b,1,false,a.Jb.w,(U8e(),s8e),c);if(a.Jb.w.i.length>=1){e=MCc(a);d=e[0]}else if(!c){d=new O0e(a.K.o);s0e(d,a.mc,a.oc,1,true)}}return true} +function COc(a,b,c){var d,e,f,g,h,i;g=EWf(a.bc);f=CWf(a.bc);if(g==0){h=a.bc.U;i=a.bc.Y;g=mqb(Xpb($wnd.Math.round(h*2)));f=mqb(Xpb($wnd.Math.round(i*2)))}d=(b-g)/2;e=(c-f)/2;a.yc=a.bc.U+d;a.Hc=a.bc.Y+e;fXf(a.bc,a.yc,a.Hc)} +function MWc(a,b,c,d){var e,f,g,h;if(isNaN(a)||isNaN(b)||isNaN(c)||isNaN(d)){return null}e=(a+c)/2;f=(b+d)/2;h=1/$wnd.Math.pow(e-c,2);g=1/$wnd.Math.pow(f-d,2);return pe(ie(sf,1),g9g,5,15,[h,g,-1+e*e*h+f*f*g,0,-e*h,-f*g])} +function nZc(a,b,c,d,e){var f,g,h;f=null;g=c: '+b.n.mD);return false}try{d=b.n;Oqb(d,(phd(),$1b(Knh,Tbc(c,vrh))));return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function _ed(b,c){var d;if(!b.n.en()){nlg('wrong element type for : '+b.n.mD);return false}try{d=b.n;xNb(d,(phd(),$1b(Knh,Tbc(c,xph))));return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function $fd(b,c){var d;if(!b.n.hn()){nlg('wrong element type for : '+b.n.mD);return false}try{d=b.n;WHd(d,Y2b(Tbc(c,xph),10));return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function Rwd(a,b,c){var d,e,f;if(ff(b,301)){a.ku(b.v,c.v);a.Ii();a.ku(b,c)}else if(ff(b,74)){a.ku(b.v,c.v);a.Ii();a.ku(b.p,c.p);a.Ii();a.ku(b,c)}if(ff(b,242)){e=b.a.k;f=b.a.i;d=a.lu(b);d?WSe(c,e,f,true):WSe(c,f,e,false)}} +function V$d(b,c){var d,e,f,g;e='Solve('+c.jj((Sud(),Jud))+' = 0)';g=wod(b.Mc,e,true,b.a,Gud);try{f=Gqf(cpd(b.Mc),g);d=new a_d;p8d(f,d);return d.a}catch(a){a=Ppb(a);if(ff(a,114)){return mac(),mac(),lac}else throw Qpb(a)}} +function P1d(a){var b,c;if(!a.a.Em()||!!a.d&&!a.d.Em()||!!a.f&&!a.f.c){a.g.v=null;return}b=!a.f||a.f.e;c=!!a.c&&a.c.e;a.a.pn()?C4e(a.g,a.a.v):C4e(a.g,a.a.rl(_3e(a.g),b));t4e(a.g,c,false);J4e(a.g,false);!!a.e&&a.e.Mz(a.d)} +function TVe(a,b){var c,d;c=(x0e(b,null),b.s);if(llf(c)==1);else{Vlf(c,c.f[0]/llf(c))}SVe(a,false,c);c.f[2]=1;c.a=true;w0e(b,c.f[0],c.f[1],llf(c));d=(!b.L&&(b.L=new Tsd),b.L);ysd(d,c.f[0]);Ssd(d,c.f[1]);M0e(b,false,null)} +function LZe(a,b){var c,d,e;e=b;if(e==a.b){return}a.b=e;switch(e.k){case 1:e=(jMe(),hMe);break;case 2:e=(jMe(),gMe);break;default:e=(jMe(),fMe);}for(d=new t9b(a.k);d.ae){i=e;j=d}h=f;$wnd.Math.abs(f-i)<2&&(h=mqb(Xpb($wnd.Math.round(f>i?i+2:i-2))));a.ob=(h-i)/(g-j);a.pb<0?(a.pb=-j*a.ob):a.pb>e&&(a.pb=e-j*a.ob)} +function ESd(a){var b,c,d;FSd(a,a.a,a.k,a.g);iOd(a.i,a.g.i.length>0?a.g.i.length:1,true);c=0;for(;ca.a||a.a<-1||a.c>1){a.c=k9g;a.a=h9g;a.b=false}else{c=a.c<=-1?Qph:Lif($wnd.Math.asin(a.c));b=a.a>=1?Hih:Lif($wnd.Math.asin(a.a));a.c=-0.==c||-0.=48&&b<=57){d=1;c=b-48;while(a.o=48&&b<=57){++d;c=10*c+b-48;++a.o;if(d==6){sQb(a);return c/XOb[6]}}else{break}}return c/XOb[d]}}return 0} +function WZb(a){var b,c;b=p4b(a,G4b(46));c=p4b(a,G4b(92));c==-1&&(c=p4b(a,G4b(47)));c=c>-1?c:0;if(b>c){return thc(c>0?c+1:0,b,a.length),a.substr(c>0?c+1:0,b-(c>0?c+1:0))}return uhc(c>0?c+1:0,a.length+1),a.substr(c>0?c+1:0)} +function J5b(a,b){var c;c=a.e+b.e;if(a.a==0&&a.f!=-1||b.a==0&&b.f!=-1){return i6b(c)}if(a.a+b.a<54){return new V5b(a.f*b.f,e6b(c))}return new Z5b(E6b((!a.c&&(a.c=V6b(Xpb(a.f))),a.c),(!b.c&&(b.c=V6b(Xpb(b.f))),b.c)),e6b(c))} +function UJc(a){var b,c,d,e,f;if(a.Rn((_1f(),u1f))){return}d=false;f=jIc(a);e=(c=(new A8b(f.a)).a.Zd().b.Xf(),new B8b(c));while(e.a.xf()&&!d){(b=e.a.yf(),b.ef()).Rn(u1f)&&(d=true)}if(d){a.cp();a.yp()}else{a.zf();Wpd(a.Mc)}} +function RPc(a){var b;a.Cc=-a.yc*a.Db;a.Ac=(pf(a.f.e.C.width/a.f.p)-a.yc)*a.Db;a.Jc=a.Hc*a.Eb;a.Lc=(a.Hc-pf(a.f.e.C.height/a.f.p))*a.Eb;b=a.bc?a.bc.S:0;new zog(-(a.yc-b)*a.Db,a.Ac,(a.Hc-pf(a.f.e.C.height/a.f.p))*a.Eb,a.Jc)} +function hid(b,c){var d,e;try{Y2b(Tbc(c,'mode'),10);bWf((e=YOf(b.a).o,yhd(b,Tbc(c,'low')),yhd(b,Tbc(c,'high')),e))}catch(a){a=Ppb(a);if(ff(a,43)){d=a;!!jlg&&klg(jlg,(Clg(),Blg),tuh);q3f(!d.Zc()?d:d.Zc())}else throw Qpb(a)}} +function Bnd(a,b){var c,d,e,f;b.a+=zvh;yjd(b,true,null,a.e.M.j);b.a+='\n';for(e=(f=(new n8b(a.f)).a.Zd().rd(),new o8b(f));e.a.xf();){d=(c=e.a.yf(),c.ff());!d.Wm()&&nJc(d,false,b)}b.a+='<\/defaults>\n<\/geogebra>'} +function c3d(a,b,c){var d,e,f,g,h,i;f=(!b.q&&!!b.d&&(b.q=Ode(b,b.d)),b.q);i=(!c.q&&!!c.d&&(c.q=Ode(c,c.d)),c.q);for(e=new t9b(f);e.ab.c&&0=0){return new off(a.c*b.a,a.a*b.a)}return new off(k9g,h9g)} +function cpg(a,b,c){var d;if(a.c+b>a.d.length){d=me(qf,Rlh,5,a.c+$wnd.Math.max(a.d.length,b),15,1);n5b(a.d,0,d,0,a.c);a.d=d}if(a.a+c>a.b.length){d=me(sf,g9g,5,a.a+$wnd.Math.max(a.b.length,c),15,1);n5b(a.b,0,d,0,a.a);a.b=d}} +function LEg(a,b,c,d){var e,f,g;e=b.C;f=(g=e.getAttribute(d9g),g!=null?g:'');e.removeAttribute(d9g);e.setAttribute(KGh,yod(a.a.pb,c,(Sud(),Mud))+' '+d);t1b();$wnd.goog.global.setTimeout(yqb(QEg.prototype.Bf,QEg,[e,f]),pih)} +function vPh(a){yAc(this,a,this.B);if(_Hc(!this.yb?this.xb:this.yb)){a.Zh(this.Kb);a.Uh(eJc(this.xb));a.th(this.B)}a.Zh(this.Ib);a.Uh(YIc(this.xb));a.th(this.B);if(this.U){a.Wh(UNc(this.Pb));a.Uh(YIc(this.xb));uAc(this,a)}} +function Pnc(a,b,c,d,e,f){var g;if(d.length!=b.ah()){throw Qpb(new zkc(d.length,b.ah()))}if(f.length!=b.ah()){throw Qpb(new zkc(f.length,b.ah()))}g=new boc(b);g.f=c;_nc(g,d);a.$g(g,e);n5b(Psc(g.d),0,f,0,f.length);return g.f} +function ZYc(a){switch(a.A.k){default:case 1:case 4:a.o=a.w.i.length==1;a.o&&(a.C=b9b(a.w,0));break;case 2:case 3:a.o=a.t.i.length==1||a.f.i.length==1;break;case 5:a.o=a.w.i.length==2;if(a.o){a.C=b9b(a.w,0);a.B=b9b(a.w,1)}}} +function v1c(a,b,c,d,e,f){var g,h;a.b=b;a.g=jVe(a.b);a.i=a.g.q;if(c8b(q1c,a.i)==-1){return false}a.f=c;a.e=d;a.d=e;a.a=f;a.i==(_8f(),U7f)?(g=a.g.o,h=g.e.Ap(),t1c(a,(mac(),new wac(h))),undefined):a.i==V7f&&u1c(a);return true} +function Thd(b,c){var d;try{Jub(b.N,!$1b(Tbc(c,Jrh),mrh));Iub(b.N,!$1b(Tbc(c,'east'),mrh));return true}catch(a){a=Ppb(a);if(ff(a,43)){d=a;!!jlg&&klg(jlg,(Clg(),Blg),tuh);q3f(!d.Zc()?d:d.Zc());return false}else throw Qpb(a)}} +function aKd(a){var b,c,d,e;if(!a.g){for(c=0;c0?a.c.i.length:1,true);c=0;for(;c0;if(i){i4d(a,d);--d}}} +function ebe(b,c){var d,e;try{e=Mqf(cpd(b.t),c);e.qo(new fJe(false));if(!ff(e,18)||i6d(e,null)){return null}return e}catch(a){a=Ppb(a);if(ff(a,38)||ff(a,180)){d=a;!!jlg&&klg(jlg,(Clg(),vlg),d);return null}else throw Qpb(a)}} +function TJe(a,b,c){var d,e,f,g;if(!PJe(a,b,c)){return}g=SJe(b,(EIe(),aGe));e=SJe(b,Fze);d=SCd(c,b,new fJe(false));if(d.length<1){return}f=d[0];if(g&&BJc(f)){throw Qpb(FCd(c,b.i,f))}if(e&&ff(f,271)){throw Qpb(FCd(c,b.i,f))}} +function G4e(a,b){var c;c=b.B;N1b(a.p,0);if(c==(c9d(),X8d)){yhg(a.v)||O4b(a.p,rph);L4b(a.p,8220)}else{L4b(a.p,yvd(b))}a.v!=null&&O4b(a.p,a.v);if(c==X8d){L4b(a.p,8221);yhg(a.v)||O4b(a.p,'}')}else{L4b(a.p,qvd(b))}return a.p.a} +function C7e(){C7e=xqb;y7e=new E7e(V6g,0);z7e=new E7e('LINE',1);B7e=new E7e('SQUARE_OUTLINE',2);A7e=new E7e(F7g,3);u7e=new E7e('ARROW',4);v7e=new E7e('ARROW_FILLED',5);x7e=new E7e('CIRCLE_OUTLINE',6);w7e=new E7e('CIRCLE',7)} +function xaf(a,b,c){switch(b){case 2:a.a+='\t=0){Dvd(b,(c9d(),X8d))?(c.a+=g5g,c):(c.a+='$',c);T4b(c,a.K+1)}}return c.a} +function sRe(a){a.gb=9;a.R=a.n.e/a.C;a.Q=(a.n.e*a.R-a.ab[2])/(2*a.n.d);VRe(a,pe(ie(sf,1),g9g,5,15,[a.s*a.R+a.r*a.Q,a.s*a.Q-a.r*a.R]));ZRe(a);a.eb=-a.n.d/a.C;if(a.eb<0){j1c(a.q[0],-a.q[0].d,-a.q[0].e);a.eb=-a.eb}a._=a.eb/2;a.Y=1} +function ycf(a,b){var c,d,e,f,g,h;e=new sWe(a.Kc,a.c,b);c=new BRd(a.Kc,e,new dId(a.Kc,sVe(b)),new dId(a.Kc,qVe(b)));lmd(a.Kc,c);f=c.k;h=new n9b;for(d=0;d>16);b=d>>16&16;c=16-b;a=a>>b;d=a-256;b=d>>16&8;c+=b;a<<=b;d=a-g7g;b=d>>16&4;c+=b;a<<=b;d=a-zlh;b=d>>16&2;c+=b;a<<=b;d=a>>14;b=d&~(d>>1);return c+2-b}} +function dic(a,b){var c,d,e,f;e=$wnd.Math.min(a.a.length,b.a.length);c=$wnd.Math.max(a.a.length,b.a.length);f=me(sf,g9g,5,c,15,1);for(d=0;da.n.a-1&&b4c(a.j.i,(h3c(),e3c))}}else{if(e>b-1){e-=b;f=true;e=1){d=cZe(a.b,0).Lk();c=cZe(a.b,1).Lk();if(d>c){return f}g=(c-d)/e}else{return f}for(b=2;b0){return XRf(a,c)}}return e} +function aUf(a,b,c,d){var e;if(!c){return 0}e=0;if(c9b(b,c,0)!=-1){g9b(b,c);b8b(b,a.n)||g9b(a.n,c);sUf(a,c,true,true);e=-1}else{if(b.i.length100){a.j=0;for(d=0;d>16&255,d.b>>8&255,d.b&255,pf(e*255)));h.j.fillRect(0,0,f*3,g*3);Uug(h,c);bvg(h,b);return h} +function zid(a,b,c){var d;if(!a.q){!!jlg&&klg(jlg,(Clg(),xlg),Krh+b+'>');return}d=true;$1b($uh,b)?(d=Ihd(a,c)):!!jlg&&klg(jlg,(Clg(),xlg),'unknown tag in : '+b);d||!!jlg&&klg(jlg,(Clg(),xlg),'error in : '+b)} +function XNd(a,b,c,d){kwc.call(this,a);this.a=c;this.d=d;this.c=new cId(a);this.b=new SId((Kod(this.Mc),a),d,c);lmd(a,this.b);WNd(this);this.b?ZHd(this.c,F_e(this.b.a,this.a),true):ZHd(this.c,this.d.Ik(this.a),true);JKc(this.c,b)} +function dZd(a){var b,c;if(a.a){a.V=me(fY,qnh,13,1,0,1);a.V[0]=a.a}else{a.V=me(fY,qnh,13,a.b.length,0,1);for(c=0;cg?(h=g):hAmh&&(h=Fcg(h)),h));b.Bv(e,true)} +function pqf(a,b){var c,d,e;(e=a.I).e?(a.I=a.I.e):(a.I=a.I.e=Fsf(a.J));a.B=-1;if(a.I.d==b){++a.p;if(++a.o>100){a.o=0;for(d=0;d0?H0g(a,new V0g(a,b,c)):(d=N0g(a,b,null),d.add(c));return new U0g(a,b,c)} +function Rgc(a,b,c,d,e,f){var g,h,i,j,k;if(e==0){return}if(nf(a)===nf(c)){a=a.slice(b,b+e);b=0}i=c;for(h=b,j=b+e;h0&&a<=Amh){return -0.5772156649015329-1/a}if(a>=49){b=1/(a*a);return $wnd.Math.log(a)-0.5/a-b*(wmh+b*(0.008333333333333333-b/252))}return Ppc(a+1)-1/a} +function UVc(a,b){var c,d,e,f,g;if(b<0){a.a+='-:-';return}c=pf($wnd.Math.floor(b/3600));d=pf($wnd.Math.floor((b-c*3600)/60));f=pf($wnd.Math.floor(b-c*3600-d*60));e=d+'';g=f+'';d<10&&(e='0'+d);f<10&&(g='0'+f);a.a+=e;a.a+=':';a.a+=g} +function Med(b,c){var d;if(!ff(b.n,406)){nlg('wrong element type for : '+b.n.mD);return false}try{d=b.n;d.vx((phd(),$1b(Knh,Tbc(c,xph))));return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function sfd(b,c){var d;if(!ff(b.n,406)){nlg('wrong element type for : '+b.n.mD);return false}try{d=b.n;d.Ax((phd(),$1b(Knh,Tbc(c,xph))));return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function usd(a,b,c){var d;d=a;if(b==c){return b}d<0?(d=0):d>1&&(d=1);if(b==h9g){if(c==k9g){return (2*d-1)/(1-$wnd.Math.abs(2*d-1))}return c+(d-1)/(1-$wnd.Math.abs(d-1))}if(c==k9g){return b+d/(1-$wnd.Math.abs(d))}return (1-d)*b+d*c} +function fTd(a,b,c){var d;if(a.c.Em()&&b.b){if(Scg(b.$)){j4d(a.o,-b._/b.Z)}else{Jbe(a.c.hv(),b,a.a);dTd(a,a.a)}for(d=0;dc){return false}if(d<15||d>e){return false}a.Qb=b;a.Rb=d;x4b(a.Bb,'$')&&(a.Rb-=10);return true} +function K0c(a,b){MAc.call(this);this.u=new Prg;this.d=me(sf,g9g,5,2,15,1);this.a=new Npg;this.f=new Bqg;this.q=new Uog(1);this.r=new Uog(2);this.g=new crg(0);this.Pb=a;this.t=b;this.xb=b;Mrg(this.u,0,0,0,0);J0c(this);b.aA(b.A,b.B)} +function s5c(a,b,c){var d;if(a.g.i.length==0){return}arg(a.i);Uqg(a.i,b9b(a.g,0).a,b9b(a.g,0).b);if(a.g.i.length<2){return}for(d=1;d=0&&Mhg((uhc(e,a.length),a.charCodeAt(e)))){--e}++e;d=b;c=a.length;while(d=0&&d<=c){return thc(e,d,a.length),a.substr(e,d-e)}return null} +function Aid(a,b,c){var d;if(!a.q){!!jlg&&klg(jlg,(Clg(),xlg),Krh+b+'>');return}d=true;$1b($uh,b)?(d=Jhd(a,c)):!!jlg&&klg(jlg,(Clg(),xlg),'unknown tag in : '+b);d||!!jlg&&klg(jlg,(Clg(),xlg),'error in : '+b)} +function DYe(a,b){NHc();GOe.call(this,a);this.c=20;this.e=-1;this.f=-1;this.p=false;this.o=(Sud(),oud);this.i=true;this.n=(Ibf(),Gbf);this.g=true;!b?(this.d=new O4e(a,'')):(this.d=b);this.b=new A6e(this);this.a=new cbf(this,this.d)} +function s5f(a,b){var c,d,e,f;if(a.a['x']==null&&a.a['y']==null){KWf(b,true,true);return}c=pe(ie(sf,1),g9g,5,15,[(e=a.a['x'],e!=null?$2b(e):0),(f=a.a['y'],f!=null?$2b(f):0),(d=a.a[L8g],d!=null?$2b(d):Xph)]);c[0]>0&&c[1]>0&&aXf(b,c)} +function oeg(a,b){var c,d,e,f,g,h;if(b==null||$1b('',b)){return null}c=new n9b;f=Yvb(b);for(h=(e=(new A8b(a.a.a)).a.Zd().b.Xf(),new B8b(e));h.a.xf();){g=(d=h.a.yf(),d.ef());x4b(Yvb(g),f)&&Z8b(c,fwb(g).a)}return c.i.length==0?null:c} +function thg(a,b){mhg();var c,d;if(b<=Q4g){L4b(a,b&Q4g)}else{c=(ghc(b>=0&&b<=1114111),b>=i5g?pe(ie(rf,1),b5g,5,15,[j5g+(b-i5g>>10&k5g)&Q4g,56320+(b-i5g&k5g)&Q4g]):pe(ie(rf,1),b5g,5,15,[b&Q4g]));for(d=0;da.b.k.i.length||!a.a.pw(cZe(a.b,0))){a.d.cp();return}a.a.sw(cZe(a.b,0),a.Mc);for(b=1;bd&&(a.a+=J4b(me(rf,b5g,5,-d,15,1)));a.a+=K4b(b,0,b.length)} +function bYe(a){NHc();BLc.call(this,a);this.k=true;this.g=false;this.s=me(sf,g9g,5,2,15,1);this.a=null;this.b=false;this.e=false;sKc(this,true);dKc(this,1);lKc(this,true);this.c=me(JY,Roh,33,4,0,1);xdc(this.Mc.j.kb,this);this.f=true} +function gqf(a){var b;b=a.D;if(sqf(a,60)){a.D=b;if(sqf(a,61))return true}b=a.D;if(sqf(a,84)){a.D=b;if(dqf(a)){a.D=b;if(sqf(a,44)){a.D=b;if(cqf(a)){a.D=b;if(apf(a)){a.D=b;if(sqf(a,48)){a.D=b;if(sqf(a,62))return true}}}}}}return false} +function zxg(){zxg=xqb;wxg=new JVg('home_zoom_black18','<\/svg>')} +function E3g(a,b){pyg(a,(XWg==null&&($1b(mlh,typeof($doc))?(XWg=$wnd.document):(XWg=$doc)),XWg).createElement(rlh));F1g(a.C,C6g);a.w==-1?(y1g(),a2g(a.C,133398655|V1g(a.C))):(a.w|=133398655);!!a.a&&(a.C[YGh]='',undefined);a.C.src=b.a} +function fPb(a){var b,c,d,e,f;bPb(a);while(!I8b(a.q)){c=O8b(a.q);c.Hd(a)&&(c=O8b(a.q));if(ff(c,231)){b=BKb(c.b);if(I8b(a.q)){return b}else{f=R8b(a.q);Yc(a.q).Gd(a,b);e=R8b(a.q);if(e>f){for(d=0;d: '+b.n.mD);return false}try{d=b.n;d.zx((phd(),$1b(Knh,Tbc(c,xph))));return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function Fnd(a,b,c){var d,e,f,g;a.j=$wnd.Math.max(b,1);a.g=$wnd.Math.max(c,1);f=(g=(new n8b(a.f)).a.Zd().rd(),new o8b(g));while(f.a.xf()){e=(d=f.a.yf(),d.ff());switch(e.ul().k){case 13:e.Uy(e.Hn()?a.j:a.g);break;case 10:VZe(e,a.j);}}} +function qke(a,b,c,d,e){var f,g,h;if(d==1){return new NTe(a.a.o,a.b)}h=Hpd(a.a,a.b,b,d);g=e||nke(a);if(!!h&&g||!h&&!c){return h}if(d==2){return new NTe(a.a.o,a.b)}f=a.a.j.B;throw Qpb(new FTf(f,(yTf(),wTf),pe(ie(mu,1),h5g,2,6,[a.b])))} +function GPe(a,b){var c;if(!b&&!!a.O){c=a.O;a.O=null;c.Db=null;c.Jk()}a.O=b;if(!a.O){return}tKc(a.O,a);a.O._o(a.lb);a.O.hn()&&!!a.v&&(a.v.qs(Coh)||a.v.qs(_oh))&&HHd(a.O,true,false);if(YPe(a.O)){a.O.cp();a.O.ib=false}else{a.O.ib=true}} +function e3e(a,b){var c,d;a.i=gpd(a.Mc);a.g=fpd(a.Mc);if(a.i==-1){d=new S4d(a.Mc,'Round');A4d(d,b.Ap());A4d(d,_ce(new cde(a.Mc,a.g)))}else{d=new S4d(a.Mc,Lnh);A4d(d,b.Ap());A4d(d,_ce(new cde(a.Mc,a.i)))}c=i3e(a,d,a.c);return A3e(a,c)} +function c4e(a){var b;b=new h5b;if(a.e&&!a.u){b.a+=mCh;T4b(b,a.Zb);b.a+=Rxh;T4b(b,a.$b);b.a+=lph}else{if(a.u){a.u.cz(b,a.e);if(a.Zb!=0||a.$b!=0){b.a+='\t=48&&b<=57){c=new FKb(new OCb(b,false));++a.o;while(a.o=48&&b<=57){uKb(c,pe(ie(Zg,1),Z4g,41,0,[new OCb(b,false)]));++a.o}else{break}}aPb(a,new aLb(new _Ib,BKb(c),null));return true}return false} +function Gpc(a,b){var c,d,e,f,g,h;if(a<10){throw Qpb(new Okc(a,10,true))}if(b<10){throw Qpb(new Okc(b,10,true))}c=$wnd.Math.min(a,b);d=$wnd.Math.max(a,b);f=10/c;g=f*f;h=zpc[zpc.length-1];for(e=zpc.length-2;e>=0;e--){h=g*h+zpc[e]}return h/c+Bpc(c,d)} +function m5c(a,b){var c,d;d=me(JY,Roh,33,3,0,1);c=b.f.b-a.b.b;if(c>=0){d[0]=r5c(a,a.b.a,b.f.b);d[1]=r5c(a,b.f.a,b.f.b);d[2]=r5c(a,(a.b.a+b.f.a)/2,a.b.b)}else{d[0]=r5c(a,(a.b.a+b.f.a)/2,b.f.b);d[1]=r5c(a,a.b.a,a.b.b);d[2]=r5c(a,b.f.a,a.b.b)}return d} +function Oxd(a){switch(a.k){default:case 3:case 0:a.V=me(fY,qnh,13,1,0,1);a.V[0]=a.e.lp();break;case 1:a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.e.lp();a.V[1]=a.f.lp();break;case 2:a.V=me(fY,qnh,13,2,0,1);a.V[0]=a.e.lp();a.V[1]=a.j;}bwc(a,a.n);xxd(a);Xvc(a)} +function h5e(a){var b,c,d,e,f,g;d=new y5e(a.a);G5e(a,d);e=new z5e(a.a,Rmh,0);e.d+=d.d;e.e+=d.e;e.d+=a.d;e.e+=a.e;b=new z5e(a.a,a.d,a.e);for(c=2;c<100;c++){f=b.d;g=b.e;b.d=f*a.d-g*a.e;b.e=f*a.e+g*a.d;p5e(b,(c-1)/c/c);e.d+=b.d;e.e+=b.e}e.b=5;return e} +function Faf(a,b,c,d){if(!c[b]){return}a.a+='\t=0){throw Qpb(new HQf(a.H,b))}d=!c||(ing(),rng(z4b(a.H.d,0,2)).a==44);e=Xhg(b,new jrf(c,d));Umf(a,new Qtf(E4b(e)));a.e=false;a.c=false;a.f=false;a.g=true;a.d.b=false;a.b=Jod(a.G).s;a.K.i.length=0} +function Msf(b,c,d){try{b.a=Ntf(b.c)}catch(a){a=Ppb(a);if(ff(a,165)){Vsf(b,0,c,d);return 1}else throw Qpb(a)}switch(b.a){case 58:return Nsf(b,c,64,d,0);case 97:return Nsf(b,c,kDh,d,256);case 101:return Nsf(b,c,uDh,d,0);}return Ksf(b,Vsf(b,0,c,d),1)} +function L1b(a){var b,c,d,e;d=a.a.length;if(d<=1){return}b=me(rf,b5g,5,d,15,1);b[0]=a4b(a.a,d-1);for(c=1;c=j5g&&b[c]<=56319&&b[c-1]>=56320&&b[c-1]<=57343&&(e=b[c-1],b[c-1]=b[c],b[c]=e,undefined)}a.a=K4b(b,0,b.length)} +function azc(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o;e=b.a.d-b.b.d;g=b.b.c-b.a.c;i=e*b.b.c+g*b.b.d;f=d.d-c.d;h=c.c-d.c;j=_yc(a,f*c.c+h*c.d);k=e*h-f*g;l=h*i-g*j;n=_yc(a,l/k);m=e*j-f*i;o=_yc(a,m/k);if(isNaN(n)||isNaN(o)){return null}return new Oad(n,o,d.b)} +function lMc(a,b,c){var d,e,f,g,h,i,j;if(c.a==0){return 0}h=0;i=c.b/c.a;j=c.e/c.a;g=xMc(c);for(f=0;f=0?'\nMin FPS: '+a.e+'\nMax FPS: '+a.d:'')+sEh)));a.a=0;a.b=0;a.e=R4g;a.d=-1} +function SLg(a,b,c){var d,e;d='ggs'.length;if(!$1b(c.substr(c.length-d,d),'ggs')&&false){new U$f((c_f(),Y$f));$wnd.base64Util.bytesToBase64(new $wnd.Uint8Array(b));null.pD()}else{rUg(a.w);e=(!a.f&&(a.f=new mTg(a)),a.f);bTg(e,new $wnd.Uint8Array(b))}} +function Zsb(a,b){c:while(true){if(Prb(a));else{break c}if(Qrb(a)){Irb(a,b)}else{switch(a.u==-1?!(a.t=a.C.e)?(a.u=(a.C.e=Btb(a.D)).d):(a.u=a.t.d):a.u){case 35:case 36:case 38:case 39:{Xsb(a,b);break}default:a.q[3]=a.k;Qsb(a,-1);throw Qpb(new urb);}}}} +function vIb(a,b,c){var d,e,f,g,h;d=tIb(a);e=tIb(a);for(g=0;g<=b;g++){rIb(d,b9b(a.b,g))}for(h=b+c;hb+1&&sIb(e,b9b(a.a,f).a-b-1)}}return pe(ie(ok,1),f9g,106,0,[d,e])} +function JHc(a,b){uHc();var c;this.A=new n9b;this.v=(Huc(),Ztc);this.C=new n9b;this.G=b;this.p=a;this.F=new NRg(this,Gjh);c=new ZLc(this,a.pb.o);this.q=c;this.B=5;this.w=0;this.v=Ztc;this.u=216;XLc(this.q,this.B);WLc(this.q,this.u);YLc(this.q,this.v)} +function PQc(a,b){var c,d;if(Ocg(b.c,h9g)&&Ocg(b.a,k9g)){return b}if(Ocg(b.c,h9g)&&Ocg(b.a,b.c)){return new nff(NQc(a,a.a.Lc))}if(Ocg(b.c,k9g)&&Ocg(b.a,b.c)){return new nff(0)}d=b.a==k9g?0:NQc(a,b.a);c=b.c==h9g?bzg(a.a):NQc(a,b.c);return new off(d,c)} +function XSd(a,b,c){var d,e,f,g,h,i;i=new n9b;for(d=0;d0){for(d=0;de){++a.b;j=(h=a.a-a.b*a.d,new off(h,h+a.d));Pif(c.a,j)}e=b.a;j=(i=a.a+a.c*a.d,new off(i-a.d,i));while(j.ackh){return}if(isNaN(e)||eckh){return}a.yc=b;a.Hc=c;a.Ec=d;a.Db=1/d;a.Nc=e;a.Eb=1/e;Hpg(a.eb,a.Ec,0,0,-a.Nc,a.yc,a.Hc);RPc(a);oQc(a);pQc(a,false,false);VDc(a.lb);a.uc=true;lQc(a);a.C.pb.N||APf(a.C)} +function B1c(a,b,c){var d,e,f,g;d=a.length;g=(f=OAc(a,b.Jh(),b),f?(f.a<0&&!!f.d&&(f.a=kug(f.d,f.e,pug(f.c))),f.a):0);while(g>c&&d>0){--d;g=(e=OAc((thc(0,d,a.length),a.substr(0,d)),b.Jh(),b),e?(e.a<0&&!!e.d&&(e.a=kug(e.d,e.e,pug(e.c))),e.a):0)}return d} +function QPd(){QPd=xqb;PPd=new RPd('UPPERSUM',0);MPd=new RPd('LOWERSUM',1);LPd=new RPd('LEFTSUM',2);NPd=new RPd('RECTANGLESUM',3);OPd=new RPd('TRAPEZOIDALSUM',4);JPd=new RPd(krh,5);KPd=new RPd('HISTOGRAM_DENSITY',6);IPd=new RPd('BARCHART_BERNOULLI',7)} +function E6e(a,b){var c;c=b;if(c==null){return true}if(c.length==0||$1b(c.substr(0,20),qqh)){return false}c=(mhg(),B4b(c,(Acc(),ycc)));if(!!a&&a.Xm()){if(Wvf(TOf(a.vi().j,false),c)){return false}}return uhc(0,c.length),c.charCodeAt(0)!=36||!!a&&a.Sm()} +function Ydg(a,b){var c,d,e,f,g;Udg.i.length=0;for(d=new t9b(a);d.a=0;f--){e=(mhc(f,b.i.length),b.i[f]);e.Di()&&zJc(e)?e.Go(false):g9b(b,e)}} +function teg(a,b){var c,d;if(a==null){return null}d=$wnd.Math.min(a.length,b.length);for(c=0;c0&&--a.b;d=a.b;e=!!b.d&&b.d.i.length>d&&d>=0?b9b(b.d,d):null;drb(b)&&(!e||e.nd())&&Vqb(!!b.d&&b.d.i.length>d-1&&d-1>=0?b9b(b.d,d-1):null)&&Rwb(b,d,new Hwb);ff(e,241)&&grb(a,e)} +function adc(a,b){var c,d,e,f,g,h;f=a.a*Ylh+a.b*1502;h=a.b*Ylh+11;c=$wnd.Math.floor(h*Zlh);f+=c;h-=c*Y6g;f%=Y6g;a.a=f;a.b=h;if(b<=24){return $wnd.Math.floor(a.a*Wcc[b])}else{e=a.a*(1<=b7g&&(d-=e7g);return d}} +function Dpc(a,b){var c,d,e,f;if(a<0){throw Qpb(new Okc(a,0,true))}if(b<10){throw Qpb(new Okc(b,10,true))}if(a<=b){c=b+(a-0.5);f=Bpc(a,b)}else{c=a+(b-0.5);f=Bpc(b,a)}d=c*(a/b==0?a/b:$wnd.Math.log(a/b+1));e=a*($wnd.Math.log(b)-1);return d<=e?f-d-e:f-e-d} +function Nhd(b,c){var d,e,f;try{f=w4b(Tbc(c,xph),',',0);e=me(uf,v5g,5,f.length,15,1);for(d=0;d=0;d--){g=new hic(pe(ie(sf,1),g9g,5,15,[a[d][a[d].length-1]]));for(e=a[d].length-2;e>=0;e--){g=dic(eic(g,c),new hic(pe(ie(sf,1),g9g,5,15,[a[d][e]])))}!f?(f=g):(f=dic(eic(f,b),g))}return f} +function kSf(a,b,c,d,e){var f,g,h,i,j,k;if(!a.pn()&&!a._m()&&!a.ln()){h=a.Hl();if(h!=0){i=$wnd.Math.max(2,h+b);a.Wo(i)}}if(ff(a,303)){j=a;k=$wnd.Math.max(2,j.Ry()+c);j.Uy(k)}if(a.Om()){f=a;g=$wnd.Math.max(2,f.b+d);f.b=g}if(e){a.wo(0);a.$o((Huc(),Ztc))}} +function VCg(a){if(a.b){if(a.c.i){a.a.C.appendChild(a.c.g);a.i=new aDg;$Tg(a.k.b.o,(t1b(),$wnd.goog.global.window),CGh,a.i);a.d=true}}else if(a.d){a.a.C.removeChild(a.c.g);(t1b(),$wnd.goog.global.window).removeEventListener(CGh,a.i);a.i=null;a.d=false}} +function AYg(){yYg();return pe(ie(Umb,1),I7g,76,0,[MXg,xYg,wYg,uYg,sYg,nYg,kYg,jYg,iYg,hYg,gYg,fYg,eYg,bYg,cYg,dYg,ZXg,YXg,XXg,WXg,VXg,UXg,TXg,RXg,QXg,PXg,OXg,NXg,LXg,KXg,JXg,IXg,HXg,GXg,FXg,EXg,DXg,CXg,tYg,lYg,mYg,oYg,pYg,qYg,rYg,aYg,_Xg,$Xg,SXg,vYg])} +function RJb(a,b,c){var d;PJb.call(this);KJb(this,a);if(c==(oNb(),iNb)){d=new ZJb(0,b/2,0,0);Y8b(this.a,0,d);this.q+=b/2;this.o+=b/2;Z8b(this.a,d)}else if(c==nNb){this.o+=b;NJb(this,new ZJb(0,b,0,0))}else if(c==hNb){this.q+=b;MJb(this,new ZJb(0,b,0,0))}} +function BPb(a){var b,c;++a.o;if(a.o=97&&b<=122||b>=65&&b<=90){c=a.o++;while(a.o=97&&b<=122||b>=65&&b<=90)){return z4b(a.n,c,a.o)}++a.o}return y4b(a.n,c)}++a.o;return String.fromCharCode(b)}return ''} +function xDc(a,b,c){var d,e;if(b.i.length==0){return null}XCc(a,b,2,false,a.Jb.w,(U8e(),s8e),c);if(a.Jb.w.i.length==2){return d=NCc(a),e=pe(ie(fY,1),qnh,13,0,[null]),d[0].Wm()||d[1].Wm()?(e[0]=null.pD()):(e[0]=ZMd(Kod(a.K),null,d[0],d[1])),e}return null} +function yYc(a,b){var c;jVc.call(this);this.Pb=a;this.b=b;this.xb=b;this.c=new ASc(this.b);if(gOc(this.Pb,this.b,this)){PFg(gOc(this.Pb,this.b,this),new GYc(this));QFg(gOc(this.Pb,this.b,this),new DYc(this))}this.j=jYc((c=this,oYe(b),c));qYc(this,false)} +function iTd(a,b,c,d,e){Exd.call(this,a);this.o=new l4d;this.c=c;this.i=d;this.j=e;gTd(this);hTd(this);Xvc(this);eTd(this);if(!a.$){b!=null&&b.length==1&&this.g.d.i.length>1&&b[0]!=null&&!$1b(b[0],'')?nOd(this.g,b[0]):oOd(this.g,b);this.d=true}hwc(this)} +function Ryg(a,b,c){var d,e,f,g,h,i,j,k,l,m;h=a.getImageData(0,0,b,c);e=h.data;for(i=0;ia.b.i.length&&(a.V[a.V.length-1]=b9b(a.a,a.a.i.length-1));a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.c);Xvc(a)} +function U2d(a,b,c){var d,e,f,g,h,i;f=(!c.q&&!!c.d&&(c.q=Ode(c,c.d)),c.q);g=XQe(b.c);for(e=new t9b(f);e.a=$wnd.Math.abs(a[1])){b=a[1]/a[0];c=$wnd.Math.abs(a[0])*$wnd.Math.sqrt(1+b*b)}else{b=a[0]/a[1];c=$wnd.Math.abs(a[1])*$wnd.Math.sqrt(1+b*b)}return c} +function DLg(a){var b;b=a;$1b(b.substr(0,4),': '+a.n.mD);return}e=Tbc(b,xph);d=$1b('_',e)?null:Hpd(a.B.v,e,false,0);c=u_e(Tbc(b,'align'));if(!!d&&!ff(d,359)){nlg(' has incorrect type: '+d.mD);return}j_e(a.n,d,c)} +function Fid(a,b,c){var d;switch(a.k){case 500:if($1b(_8g,b)){d=a.v.r;a.v.r=true;a.k=501;ogd(a.r,c);qQb(a.v,d)}else{!!jlg&&klg(jlg,(Clg(),xlg),'unknown tag in : '+b)}break;case 501:Fgd(a.r,b,c,a.o);break;default:nlg('unknown default mode:'+a.k);}} +function Y_d(a){if(a.c==(c0d(),b0d)){a.V=me(fY,qnh,13,1,0,1);a.V[0]=a.f.lp()}else{!a.e?(a.V=pe(ie(fY,1),qnh,13,0,[a.d.lp(),a.f.lp()])):(a.V=pe(ie(fY,1),qnh,13,0,[a.d.lp(),a.f.lp(),a.e.lp()]))}fPc(a.b,a.f.ul().e);a.Y=me(fY,qnh,13,1,0,1);awc(a,0,a.b);Xvc(a)} +function ZOe(a,b){b.a+=UBh;Chg(b,YOe(a,(Sud(),Rud)));b.a+='"';a.f!=null&&(b.a+=' error="true"',b);a.F&&(b.a+=' native="true"',b);if(!$1b('',a.g)){b.a+=' evalCommand="';Chg(b,a.g);b.a+=Cvh}if(!$1b('',a.i)){b.a+=' evalComment="';Chg(b,a.i);b.a+=Cvh}b.a+=gnh} +function iQe(a,b,c){var d,e,f;f=awd(c);e=yod(a.Mc,a.$[0]*a.$[0],c);for(d=0;da.c&&0=0){return Zhf(a,b)}return new off(k9g,h9g)} +function Xsg(a,b,c,d){var e,f,g,h,i;b-=a;if(d==0){g=-b/c;if(g>=0&&g<=1){return g}}else{e=c*c-4*d*b;if(e>=0){e=$wnd.Math.sqrt(e);c<0&&(e=-e);f=(c+e)/-2;g=f/d;if(g>=0&&g<=1){return g}if(f!=0){g=b/f;if(g>=0&&g<=1){return g}}}}h=b;i=b+c+d;return 0<(h+i)/2?0:1} +function PLg(a,b){var c,d,e;if(a.readyState==(w1b(),v1b)){c=a.result;e=iHh.length;$1b(b.substr(b.length-e,e),iHh)&&$wnd.goog.global.atob(y4b(c,c.indexOf(',')+1));d=jHh.length;$1b(b.substr(b.length-d,d),jHh)&&$wnd.goog.global.atob(y4b(c,c.indexOf(',')+1))}} +function arb(a,b){var c,d,e,f;e=a.b;d=a.a;f=b;while(f>0&&e>0&&ff(!!d.d&&d.d.i.length>e-1&&e-1>=0?b9b(d.d,e-1):null,240)){c=!!d.d&&d.d.i.length>e-1&&e-1>=0?b9b(d.d,e-1):null;if(c.a.b==2||c.a.b==3&&!rrb(c.a.c)){break}mwb(d,e-1);--e;--f}a.b=$wnd.Math.max(e,0)} +function Erb(a,b){var c,d;c=null;d=null;Qsb(a,15);d=new Wwb;c=new Gwb(Sub(a.B,(Lvb(),tvb)),0);!!c&&(c.f=b);Z8b(b.d,c);Ysb(a,d);jwb(c,d);c.a+=1;d=new Wwb;e:while(true){if(Srb(a));else{break e}Qsb(a,35);Ysb(a,d);jwb(c,d);c.a+=1;d=new Wwb}Qsb(a,16);Bwb(c,a.B)} +function _Bc(a,b,c){var d,e,f,g;e=pe(ie(fY,1),qnh,13,0,[null]);if(!c&&b.i.length>1){d=cNd(Kod(a.K),null,b,false);if(d){a.kc.sc!=2&&(f=LIc(d,(Sud(),kud)),g=vSf(a.U,'ListCreated',null,pe(ie(mu,1),h5g,2,6,[f])),Oxg(a,g),undefined);e[0]=d;return e}}return null} +function fGd(a){var b,c,d,e,f;if(!a.b.Em()){YHd(a.a);return}if(a.b.Um()){d=a.b;ZHd(a.a,ljf(d.a),true);return}f=a.b.gb;switch(f){case 1:case 4:e=a.b.$[0];ZHd(a.a,e*e*Iih,true);break;case 3:b=a.b.$[0];c=a.b.$[1];ZHd(a.a,b*c*Iih,true);break;default:YHd(a.a);}} +function l8d(a,b,c){var d,e,f;if(a.t){return a.t.Oi(c)}if(a.n){if(a.o){e=N8d(a.o,b,c);return y8d(e,c)}}d=N8d(a.o,b,c);f=null;!!a.s&&((a.q==(_8f(),M7f)||a.q==D7f)&&ff(a.s,62)?(f=zfe(a.s,b,c)):(f=N8d(a.s,b,c)));e=M9d(a.o,a.s,a.q,d,f,!b,c,a.k);return y8d(e,c)} +function tue(a,b,c,d){var e,f,g,h;if(!d){if(c.length==1){return new u8d(a.f,b,(_8f(),L7f),c[0])}e=new Efe(a.f);for(h=0;h0){p2b((uhc(b,a.length),a.charCodeAt(b)))&&s2b((uhc(b+1,a.length),a.charCodeAt(b+1)))&&++b;++b;--c}}return b} +function ZCc(a,b){var c,d,e;d=NNc(a.kc,b);if(!d){return}c=d;if(b==a.P&&a.kc.Cb==(kBc(),jBc)){if(qDc(d.Kj())){return}c.mr(a.X.a,a.X.b);y0f(OOf(a.f),d.Kj());a.Db=null;return}e=c.or(a.X.a,a.X.b);mhg();if(!(e.length==0||$1b('0',e))){c.mr(a.X.a,a.X.b);null.pD()}} +function k_c(a){var b;a.e=zJc(a.xb);if(a.e){a.f=a.xb.zn();KAc(a,a.i,0);a.e=e_c(a,A1e(a.i));if(!a.e){return}a.d.q=true;a.c=false;a.xb.Tb&&f_c(a);!qOc(a.Pb,a.d)&&!a.xb.Tb&&(a.e=false);if(a.i.w){a.Ab=true;b=JNc(a.Pb);!!b&&yAc(a,b,a.d)}else{a.Ab&&(a.Ab=false)}}} +function kfd(b,c){var d;if(ff(b.n,394)){try{xAb(b.n,Y2b(Tbc(c,wrh),10));wUe(b.n,Tbc(c,Goh));MAb(b.n,Tbc(c,'url'))}catch(a){a=Ppb(a);if(ff(a,43)){d=a;nlg('Problem parsing embed '+d._c())}else throw Qpb(a)}}else{nlg('wrong element type for : '+b.n.mD)}} +function ufd(b,c){var d;if(!ff(b.n,119)){nlg('wrong element type for : '+b.n.mD);return false}try{d=Y2b(Tbc(c,xph),10);Iub(b.n,(laf(),pe(ie(F$,1),I7g,623,0,[kaf,jaf]))[d]);return true}catch(a){a=Ppb(a);if(ff(a,43)){return false}else throw Qpb(a)}} +function S_d(a,b,c,d){var e,f,g;if(a.d||a.i.k.i.length==0){return}e=b;f=0;while(d>0&&e<=c+Amh||d<0&&e>=c-Amh){g=cZe(a.i,f);T_d(a,e);if(a.b.Em()){g.ro(a.b);g.en()&&GZe(g,a.k)}else{g.cp()}O_d(a,g);g.up(false);e+=d;Qcg(e)&&(e=lqb(Xpb($wnd.Math.round(e))));++f}} +function Bve(a,b){var c,d;c=q8d(b9b(b.c,2));d=c.jj((Sud(),oud));if(!ff(c,118)||!($1b(dBh,d)||$1b(YPg(a.g,dBh),d)||$1b('space',d)||$1b(YPg(a.g,'space'),d))){throw Qpb(ICd(a,b,b.c.i.length))}N4d(b,2,ALc(new NTe(a.e,d)));return Ave(a,b,SCd(a,b,new fJe(false)))} +function AJe(a){var b,c,d,e,f;if(u8b(a.a,'t')){return 't'}if(u8b(a.a,q8g)){return q8g}e=(d=(new A8b(a.a)).a.Zd().b.Xf(),new B8b(d));f=(c=e.a.yf(),c.ef());if($1b('X',f)){if(e.a.xf()){return b=e.a.yf(),b.ef()}return 't'}else if($1b('y',f)){return h8g}return f} +function Z2e(a,b,c){YMe();var d,e,f,g,h,i;e=hlf(a,0);f=hlf(b,0);d=hlf(c,0);if(e-koh<=f&&f<=e+koh){h=hlf(a,1);i=hlf(b,1);g=hlf(c,1);if(h-koh<=i&&i<=h+koh){return true}return h-koh<=g&&g<=i+koh||i-koh<=g&&g<=h+koh}return e-koh<=d&&d<=f+koh||f-koh<=d&&d<=e+koh} +function idf(a){var b,c;if(a.b!=null){a.c=ke(sf,[W4g,nih],[82,17],0,[1,a.b.length],2);for(b=0;b(=*)([A-Za-z]+)$');oxc=new utg('(.*)([,{])(\\(*)?([-0-9.E]+)(\\)*)?>(=*)([A-Za-z]+)([,}\\)])(.*)')} +function sEc(a,b,c){var d,e;if(b.i.length==0){return null}XCc(a,b,2,false,a.Jb.w,(U8e(),s8e),c);if(a.Jb.w.i.length==2){return d=NCc(a),e=pe(ie(fY,1),qnh,13,0,[null]),d[0].Wm()||d[1].Wm()?(e[0]=null.pD().pD()):(e[0]=wNd(Kod(a.K),null,d[0],d[1])),e}return null} +function IHc(a,b){var c,d,e,f;for(e=3;e60){return null}c=true;for(f=1;f');return c} +function Y0e(a,b,c,d,e,f){NHc();var g;if(b.B==(c9d(),W8d)){f.a+=Hwh;O4b(f,yod(a,c,b));f.a+=',';O4b(f,yod(a,d,b));f.a+=',';O4b(f,yod(a,e,b));f.a+=')';return}f.a+='(';O4b(f,yod(a,c,b));g=e1e(a,b);f.a+=''+g;O4b(f,yod(a,d,b));f.a+=''+g;O4b(f,yod(a,e,b));f.a+=')'} +function t4f(a,b,c){var d,e,f;if(c<-1||c>2||c==0){return false}e=Hpd(a.d,b,false,0);if(ff(e,337)){d=GYf(YOf(a.b),c<0?3:c);f=e.a;if(f==2&&c>0){return false}return d.M[f]}if(!e){return false}if(e.Sm()){return !!e.O&&e6f(e.O,c)}return KJc(e,c==-1?512:c==1?1:16)} +function LWg(a,b){var c,d,e,f,g,h;b=RWg(b);h=(d=a.className,d==null?'':d);f=PWg(h,b);if(f!=-1){c=E4b((thc(0,f,h.length),h.substr(0,f)));e=E4b(y4b(h,f+b.length));c.length==0?(g=e):e.length==0?(g=c):(g=c+' '+e);a.className=g==null?'':g;return true}return false} +function QGb(a,b,c){var d,e,f,g,h,i,j,k;if(c>4){return RLb(a,b)}k=b.k;j=b.i;f=ONb(k,a.a,j);for(g=1;g<=c&&(i=f.c,!!i.le(f.a));g++){f=WNb(f,j)}if(g<=c&&(h=f.c,!h.le(f.a))){d=new TCb(NNb(k,65,(MQb(),LQb[0]),j));e=PGb(a.a,b,c*(d.q+d.o));return e}return new TCb(f)} +function kCc(a,b){var c,d,e;switch(b){case 27:for(d=new t9b(a.Jb.k);d.a0){if(Pcg(a.c,h9g,a.d)){if(Pcg(b.a,k9g,b.d)){return new off(h9g,a.a/b.c)}return new off(h9g,a.a/b.a)}c=new off(a.c/b.c,a.a/b.c);Iub(c,a.b);return c}return new off(k9g,h9g)} +function cd(b,c){var d,e,f,g,h,i,j;if(b.b.b!=b.a){return}i=b.b.g;b.b.g=me(Hf,Z4g,1245,b.b.f+1,0,1);Xc(b.b.j);b.b.b=-1;j=null;for(f=i,g=0,h=f.length;gc?1:-1:t7b(a.a,b.a,h))==-1){return a}f=c;e=me(uf,v5g,5,f,15,1);if(f==1){e[0]=p7b(a.a,h,b.a[0])}else{d=h-c+1;e=i7b(null,d,a.a,h,b.a,c)}g=new O6b(a.e,f,e);t6b(g);return g} +function uLc(a,b){var c,d,e,f,g;if(!a.mb){if(!b.mb){return}C3d(b.mb)}else{if(!b.mb){C3d(a.mb)}else{g=(!MHc&&(MHc=new Qec(LHc)),MHc);g.a.clear();u3d(a.mb,g);u3d(b.mb,g);for(d=(f=(new A8b(g.a)).a.Zd().b.Xf(),new B8b(f));d.a.xf();){c=(e=d.a.yf(),e.ef());c.Hi()}}}} +function hXc(a,b){var c,d,e;if(zJc(a.a)&&!!a.b.g){d=a.a.o;c=a.a.n;b.Zh(a.Ib);b.Oh();b.$h(a.b.g);if(a.xb.el()){b.Yh(a.xb.el());b.Eh(0,0,pf(a.a.s),pf(a.a.p))}S1c(a.b,d,c);b.Ph(R1c(a.b)/d,Q1c(a.b)/c);b._h(8,8);e=new tug(xih,0,a.Pb.sb);vAc(a,b,e,YIc(a.xb));b.Nh()}} +function Edd(){Edd=xqb;ydd=new Fdd(krh,0);wdd=new Fdd('BOXPLOT',1);xdd=new Fdd('DOTPLOT',2);Add=new Fdd('NORMALQUANTILE',3);Ddd=new Fdd('STEMPLOT',4);vdd=new Fdd('BARCHART',5);Cdd=new Fdd('SCATTERPLOT',6);Bdd=new Fdd('RESIDUAL',7);zdd=new Fdd('MULTIBOXPLOT',8)} +function Bmd(a,b){var c,d;q3f(a.Z+' to'+b);if(b==a.Z||b<-1||b>=a.n.i.length){return}a.M.f=false;c=a.M.Q;a.M.Q=false;if(b=b+1;d--){b9b(a.n,d).Gi()}}else{for(d=a.Z+1;d<=b;++d){b9b(a.n,d).Fi()}}Iqd(a.M,c);a.Z=b;a.M.f=true;Omd(a)} +function jKd(a){var b,c,d,e,f,g,h;d=q8d(a.n).Ap();if(!!d.s&&!ff(d.s.tp(),42)){return null}e=d.o;if(e.Lm()){b=d.o;if(b.q==(_8f(),v7f)){if(b.o.Di()){f=b.o;if(f.xn()){c=b.s;if(ff(c,46)){g=c;h=g.Fp();if(h>0&&Qcg(h)){return f.Xb+(''+fig("'",pf(h)))}}}}}}return null} +function u1d(a,b,c,d,e,f){m1d();kwc.call(this,a);this.t=new Q4b;this.w=null;this.n=null;this.V=b;this.i=d;this.b=e;this.q=f;this.u=new N4e(a);l4e(this.u,0,0);m4e(this.u,true);t4e(this.u,true,false);this.u.i=true;t1d(this);o1d(this);this.u.q=false;JKc(this.u,c)} +function $2d(a,b,c,d,e,f){var g;g=QWe(a.f).e;(a.d==null||a.d.length!=g)&&(a.d=ke(GL,[W4g,Wyh],[334,16],0,[g,g],2));!a.d[d][e]?OVe(b.d,false)?d3d(a,d,e,new kTd(a.Kc,b.d,c.d)):d3d(a,d,e,new MRd(a.Kc,b.d,c.d,new O0e(a.Kc))):a.d[d][e].Ii();R2d(a,a.d[d][e],f,false)} +function Dlf(a,b,c,d,e,f){var g;g=(b.f[1]*llf(c)-llf(b)*c.f[1])*d.f[0]+(llf(b)*c.f[0]-b.f[0]*llf(c))*d.f[1]+(b.f[0]*c.f[1]-b.f[1]*c.f[0])*llf(d);if(Iqh0&&ff(!!f.d&&f.d.i.length>e-1&&e-1>=0?b9b(f.d,e-1):null,240)&&(!!f.d&&f.d.i.length>e-1&&e-1>=0?b9b(f.d,e-1):null).a.b==2)&&(b.a+=M7g,b);b.a+=d;b.a+='{';nxb(a,!!c.d&&c.d.i.length>0?b9b(c.d,0):null,b);b.a+='}'} +function PPc(a){var b,c;if(!BOc(a)){return}b=pf(a.f.e.C.width/a.f.p)/2;c=pf(a.f.e.C.height/a.f.p)/2;a.cb.a=true;if($wnd.Math.abs(a.Nc/a.Ec-1)>$ph){!a.Q&&(a.Q=new Gxg(a));izc(a.Q,2,2,false);kzc(a.Q,b,c);a.cb.d=true;lzc(a.Q)}else{ZOc(a,b,c,0,50,15,false)}pMg(a.C)} +function mgd(b,c){var d;if(!ff(b.n,943)){nlg('wrong element type for