UNPKG

x_ite

Version:

X_ITE X3D Browser, view and manipulate X3D, VRML, glTF and other 3D sources in HTML.

1,434 lines (1,258 loc) 4.3 MB
/* X_ITE v11.5.10 */ var __webpack_modules__ = ({ /***/ 1: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _Prototype_X3DProtoDeclaration_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7597); /* harmony import */ var _Namespace_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4141); /* provided dependency */ var $ = __webpack_require__(1514); /******************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. * * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>. * * The copyright notice above does not evidence any actual of intended * publication of such source code, and is an unpublished work by create3000. * This material contains CONFIDENTIAL INFORMATION that is the property of * create3000. * * No permission is granted to copy, distribute, or create derivative works from * the contents of this software, in whole or in part, without the prior written * permission of create3000. * * NON-MILITARY USE ONLY * * All create3000 software are effectively free software with a non-military use * restriction. It is free. Well commented source is provided. You may reuse the * source in any way you please with the exception anything that uses it must be * marked to indicate is contains 'non-military use only' components. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>. * * This file is part of the X_ITE Project. * * X_ITE is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 only, as published by the * Free Software Foundation. * * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more * details (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License version 3 * along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> 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 (); }, getOuterNode () { return this .getExecutionContext () .getOuterNode (); }, isInsideProtoDeclaration () { return this .getExecutionContext () .getOuterNode () instanceof _Prototype_X3DProtoDeclaration_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A; }, /** * @deprecated Directly use `browser.loadComponents`. */ loadComponents () { return this .getBrowser () .loadComponents (this .getScene ()); }, 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 = $("<div></div>") .hide () .css ("color", defaultColor) .appendTo ($("body")), div = $("<div></div>").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; }, renameExistingNode (name) { try { const namedNode = this .getExecutionContext () .getNamedNode (name); this .getExecutionContext () .updateNamedNode (this .getExecutionContext () .getUniqueName (name), namedNode); } catch { } try { const importedName = this .getExecutionContext () .getUniqueImportName (name); this .getExecutionContext () .renameImportedNode (name, importedName); } catch { } }, }); const __default__ = X3DParser; ; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_Namespace_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A .add ("X3DParser", __default__)); /***/ }), /***/ 64: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _Fields_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5942); /* harmony import */ var _Base_X3DFieldDefinition_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6495); /* harmony import */ var _Base_FieldDefinitionArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7893); /* harmony import */ var _Core_X3DNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8727); /* harmony import */ var _X3DViewpointNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6265); /* harmony import */ var _Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(683); /* harmony import */ var _standard_Math_Geometry_Camera_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(7896); /* harmony import */ var _standard_Math_Numbers_Vector2_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(224); /* harmony import */ var _standard_Math_Numbers_Matrix4_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(2128); /* harmony import */ var _Namespace_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(4141); /******************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. * * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>. * * The copyright notice above does not evidence any actual of intended * publication of such source code, and is an unpublished work by create3000. * This material contains CONFIDENTIAL INFORMATION that is the property of * create3000. * * No permission is granted to copy, distribute, or create derivative works from * the contents of this software, in whole or in part, without the prior written * permission of create3000. * * NON-MILITARY USE ONLY * * All create3000 software are effectively free software with a non-military use * restriction. It is free. Well commented source is provided. You may reuse the * source in any way you please with the exception anything that uses it must be * marked to indicate is contains 'non-military use only' components. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>. * * This file is part of the X_ITE Project. * * X_ITE is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 only, as published by the * Free Software Foundation. * * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more * details (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License version 3 * along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a * copy of the GPLv3 License. * * For Silvio, Joy and Adi. * ******************************************************************************/ function Viewpoint (executionContext) { _X3DViewpointNode_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A .call (this, executionContext); this .addType (_Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A .Viewpoint); // Units this ._position .setUnit ("length"); this ._centerOfRotation .setUnit ("length"); this ._fieldOfView .setUnit ("angle"); // Private properties this .projectionMatrix = new _standard_Math_Numbers_Matrix4_js__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .A (); } Object .assign (Object .setPrototypeOf (Viewpoint .prototype, _X3DViewpointNode_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A .prototype), { getRelativeTransformation (fromViewpointNode) { const relative = _X3DViewpointNode_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A .prototype .getRelativeTransformation .call (this, fromViewpointNode); if (fromViewpointNode .constructor === this .constructor) relative .fieldOfView = fromViewpointNode .getUserFieldOfView (); return relative; }, setInterpolators (fromViewpointNode, relative) { if (fromViewpointNode .constructor === this .constructor) { const scale = relative .fieldOfView / this .getUserFieldOfView (); this .fieldOfViewScaleInterpolator ._keyValue = new _Fields_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .MFFloat (scale, this ._fieldOfViewScale .getValue ()); this ._fieldOfViewScale = scale; } else { this .fieldOfViewScaleInterpolator ._keyValue = new _Fields_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .MFFloat (this ._fieldOfViewScale .getValue (), this ._fieldOfViewScale .getValue ()); this ._fieldOfViewScale = this ._fieldOfViewScale .getValue (); } }, getLogarithmicDepthBuffer () { return false; }, getFieldOfView () { const fov = this ._fieldOfView .getValue (); return fov > 0 && fov < Math .PI ? fov : Math .PI / 4; }, setFieldOfView (value) { this ._fieldOfView = value; }, getUserFieldOfView () { 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], pose = this .getBrowser () .getPose (); // MDN says fov can be determined from projectionMatrix. // https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API/Perspective const fov1_2 = pose ? 1 / pose .views [0] .projectionMatrix [5] : Math .tan (this .getUserFieldOfView () / 2); let size = Math .abs (point .z) * fov1_2 * 2; if (width > height) size /= height; else size /= width; return screenScale .set (size, size, size); }, getViewportSize: (() => { const viewportSize = new _standard_Math_Numbers_Vector2_js__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .A (); return function (viewport, nearValue) { // Returns viewport size in meters. const width = viewport [2], height = viewport [3], size = nearValue * Math .tan (this .getUserFieldOfView () / 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 .getUserFieldOfView () / 2); }, getProjectionMatrixWithLimits (nearValue, farValue, viewport) { return _standard_Math_Geometry_Camera_js__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .A .perspective (this .getUserFieldOfView (), nearValue, farValue, viewport [2], viewport [3], this .projectionMatrix); }, }); Object .defineProperties (Viewpoint, { ... _Core_X3DNode_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A .getStaticProperties ("Viewpoint", "Navigation", 1, "children", "2.0"), fieldDefinitions: { value: new _Base_FieldDefinitionArray_js__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A ([ new _Base_X3DFieldDefinition_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A (_Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A .inputOutput, "metadata", new _Fields_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .SFNode ()), new _Base_X3DFieldDefinition_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A (_Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A .inputOnly, "set_bind", new _Fields_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .SFBool ()), new _Base_X3DFieldDefinition_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A (_Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A .inputOutput, "description", new _Fields_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .SFString ()), new _Base_X3DFieldDefinition_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A (_Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A .inputOutput, "position", new _Fields_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .SFVec3f (0, 0, 10)), new _Base_X3DFieldDefinition_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A (_Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A .inputOutput, "orientation", new _Fields_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .SFRotation ()), new _Base_X3DFieldDefinition_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A (_Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A .inputOutput, "centerOfRotation", new _Fields_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .SFVec3f ()), new _Base_X3DFieldDefinition_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A (_Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A .inputOutput, "fieldOfView", new _Fields_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .SFFloat (0.785398)), new _Base_X3DFieldDefinition_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A (_Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A .inputOutput, "nearDistance", new _Fields_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .SFFloat (-1)), new _Base_X3DFieldDefinition_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A (_Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A .inputOutput, "farDistance", new _Fields_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .SFFloat (-1)), new _Base_X3DFieldDefinition_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A (_Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A .inputOutput, "viewAll", new _Fields_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .SFBool ()), new _Base_X3DFieldDefinition_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A (_Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A .inputOutput, "jump", new _Fields_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .SFBool (true)), new _Base_X3DFieldDefinition_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A (_Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A .inputOutput, "retainUserOffsets", new _Fields_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .SFBool ()), new _Base_X3DFieldDefinition_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A (_Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A .outputOnly, "isBound", new _Fields_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .SFBool ()), new _Base_X3DFieldDefinition_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A (_Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A .outputOnly, "bindTime", new _Fields_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .SFTime ()), new _Base_X3DFieldDefinition_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A (_Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A .inputOutput, "navigationInfo", new _Fields_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .SFNode ()), ]), enumerable: true, }, }); const __default__ = Viewpoint; ; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_Namespace_js__WEBPACK_IMPORTED_MODULE_9__/* ["default"] */ .A .add ("Viewpoint", __default__)); /***/ }), /***/ 74: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _Namespace_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4141); /******************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. * * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>. * * The copyright notice above does not evidence any actual of intended * publication of such source code, and is an unpublished work by create3000. * This material contains CONFIDENTIAL INFORMATION that is the property of * create3000. * * No permission is granted to copy, distribute, or create derivative works from * the contents of this software, in whole or in part, without the prior written * permission of create3000. * * NON-MILITARY USE ONLY * * All create3000 software are effectively free software with a non-military use * restriction. It is free. Well commented source is provided. You may reuse the * source in any way you please with the exception anything that uses it must be * marked to indicate is contains 'non-military use only' components. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>. * * This file is part of the X_ITE Project. * * X_ITE is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 only, as published by the * Free Software Foundation. * * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more * details (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License version 3 * along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a * copy of the GPLv3 License. * * For Silvio, Joy and Adi. * ******************************************************************************/ const __default__ = "11.5.10"; ; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_Namespace_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .add ("BROWSER_VERSION", __default__)); /***/ }), /***/ 95: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _Base_X3DObject_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(358); /* harmony import */ var _Browser_Networking_URLs_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4867); /* harmony import */ var _Namespace_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4141); /******************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. * * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>. * * The copyright notice above does not evidence any actual of intended * publication of such source code, and is an unpublished work by create3000. * This material contains CONFIDENTIAL INFORMATION that is the property of * create3000. * * No permission is granted to copy, distribute, or create derivative works from * the contents of this software, in whole or in part, without the prior written * permission of create3000. * * NON-MILITARY USE ONLY * * All create3000 software are effectively free software with a non-military use * restriction. It is free. Well commented source is provided. You may reuse the * source in any way you please with the exception anything that uses it must be * marked to indicate is contains 'non-military use only' components. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>. * * This file is part of the X_ITE Project. * * X_ITE is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 only, as published by the * Free Software Foundation. * * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more * details (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License version 3 * along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> 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 || _Browser_Networking_URLs_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A .getProviderURL (external && name), enumerable: true }, external: { value: external }, dependencies: { value: dependencies }, }); } Object .assign (Object .setPrototypeOf (ComponentInfo .prototype, _Base_X3DObject_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .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 += "<component"; generator .string += generator .Space (); generator .string += "name='"; generator .string += this .name; generator .string += "'"; generator .string += generator .Space (); generator .string += "level='"; generator .string += this .level; generator .string += "'"; generator .string += generator .closingTags ? "></component>" : "/>"; }, 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 __default__ = ComponentInfo; ; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_Namespace_js__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A .add ("ComponentInfo", __default__)); /***/ }), /***/ 178: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _Namespace_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4141); /******************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. * * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>. * * The copyright notice above does not evidence any actual of intended * publication of such source code, and is an unpublished work by create3000. * This material contains CONFIDENTIAL INFORMATION that is the property of * create3000. * * No permission is granted to copy, distribute, or create derivative works from * the contents of this software, in whole or in part, without the prior written * permission of create3000. * * NON-MILITARY USE ONLY * * All create3000 software are effectively free software with a non-military use * restriction. It is free. Well commented source is provided. You may reuse the * source in any way you please with the exception anything that uses it must be * marked to indicate is contains 'non-military use only' components. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>. * * This file is part of the X_ITE Project. * * X_ITE is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 only, as published by the * Free Software Foundation. * * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more * details (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License version 3 * along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a * copy of the GPLv3 License. * * For Silvio, Joy and Adi. * ******************************************************************************/ const functions = { parse (parser) { this .lastIndex = parser .lastIndex; parser .result = this .exec (parser .input); if (parser .result) { parser .lastIndex = this .lastIndex; return true; } return false; }, 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)) Object .assign (value, functions); return Grammar; } const __default__ = Expressions; ; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_Namespace_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .add ("Expressions", __default__)); /***/ }), /***/ 224: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _Algorithm_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(231); /* harmony import */ var _x_ite_Namespace_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4141); /******************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. * * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>. * * The copyright notice above does not evidence any actual of intended * publication of such source code, and is an unpublished work by create3000. * This material contains CONFIDENTIAL INFORMATION that is the property of * create3000. * * No permission is granted to copy, distribute, or create derivative works from * the contents of this software, in whole or in part, without the prior written * permission of create3000. * * NON-MILITARY USE ONLY * * All create3000 software are effectively free software with a non-military use * restriction. It is free. Well commented source is provided. You may reuse the * source in any way you please with the exception anything that uses it must be * marked to indicate is contains 'non-military use only' components. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>. * * This file is part of the X_ITE Project. * * X_ITE is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 only, as published by the * Free Software Foundation. * * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more * details (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License version 3 * along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a * copy of the GPLv3 License. * * For Silvio, Joy and Adi. * ******************************************************************************/ function Vector2 (x = 0, y = x) { 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 ({ x, y }) { this .x = x; this .y = y; return this; }, set (x = 0, y = x) { this .x = x; this .y = y; return this; }, equals ({ x, y }) { return this .x === x && this .y === 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 ({ x, y }) { this .x += x; this .y += y; return this; }, subtract ({ x, y }) { this .x -= x; this .y -= y; return this; }, multiply (value) { this .x *= value; this .y *= value; return this; }, multVec ({ x, y }) { this .x *= x; this .y *= y; return this; }, divide (value) { this .x /= value; this .y /= value; return this; }, divVec ({ x, y }) { this .x /= x; this .y /= y; return this; }, normalize () { const length = Math .hypot (this .x, this .y); if (length) { this .x /= length; this .y /= length; } return this; }, dot ({ x, y }) { return this .x * x + this .y * y; }, norm () { const { x, y } = this; return x * x + y * y; }, magnitude () { return Math .hypot (this .x, this .y); }, distance ({ x, y }) { return Math .hypot (this .x - x, this .y - y); }, lerp ({ x: dX, y: dY }, t) { const { x, y } = this; this .x = x + t * (dX - x); this .y = y + t * (dY - y); return this; }, abs () { const { x, y } = this; this .x = Math .abs (x); this .y = Math .abs (y); return this; }, min (vector) { let { x, y } = this; for (const { x: minX, y: minY } of arguments) { x = Math .min (x, minX); y = Math .min (y, minY); } this .x = x; this .y = y; return this; }, max (vector) { let { x, y } = this; for (const { x: maxX, y: maxY } of arguments) { x = Math .max (x, maxX); y = Math .max (y, maxY); } this .x = x; this .y = y; return this; }, clamp ({ x: minX, y: minY }, { x: maxX, y: maxY }) { this .x = _Algorithm_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .clamp (this .x, minX, maxX); this .y = _Algorithm_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .clamp (this .y, minY, maxY); return this; }, toString () { return this .x + " " + this .y; } }); for (const key of Object .keys (Vector2 .prototype)) Object .defineProperty (Vector2 .prototype, key, { enumerable: false }); 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: Object .freeze (new Vector2 ()), One: Object .freeze (new Vector2 (1)), xAxis: Object .freeze (new Vector2 (1, 0)), yAxis: Object .freeze (new Vector2 (0, 1)), }); const __default__ = Vector2; ; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_x_ite_Namespace_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A .add ("Vector2", __default__)); /***/ }), /***/ 231: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _x_ite_Namespace_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4141); /******************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. * * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>. * * The copyright notice above does not evidence any actual of intended * publication of such source code, and is an unpublished work by create3000. * This material contains CONFIDENTIAL INFORMATION that is the property of * create3000. * * No permission is granted to copy, distribute, or create derivative works from * the contents of this software, in whole or in part, without the prior written * permission of create3000. * * NON-MILITARY USE ONLY * * All create3000 software are effectively free software with a non-military use * restriction. It is free. Well commented source is provided. You may reuse the * source in any way you please with the exception anything that uses it must be * marked to indicate is contains 'non-military use only' components. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>. * * This file is part of the X_ITE Project. * * X_ITE is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 only, as published by the * Free Software Foundation. * * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more * details (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License version 3 * along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a * copy of the GPLv3 License. * * For Silvio, Joy and Adi. * ******************************************************************************/ const Algorithm = { radians (value) { // Convert degrees to radians. return value * (Math .PI / 180); }, degrees (value) { // Convert radians to degrees. 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; }, project (value, fromLow, fromHigh, toLow, toHigh) { return toLow + ((value - fromLow) / (fromHigh - fromLow)) * (toHigh - toLow); }, 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; }, 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 __default__ = Algorithm; ; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_x_ite_Namespace_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .add ("Algorithm", __default__)); /***/ }), /***/ 331: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _Fields_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5942); /* harmony import */ var _Core_X3DNode_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8727); /* harmony import */ var _Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(683); /* harmony import */ var _standard_Utility_ObjectCache_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2799); /* harmony import */ var _Namespace_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4141); /******************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022. * * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>. * * The copyright notice above does not evidence any actual of intended * publication of such source code, and is an unpublished work by create3000. * This material contains CONFIDENTIAL INFORMATION that is the property of * create3000. * * No permission is granted to copy, distribute, or create derivative works from * the contents of this software, in whole or in part, without the prior written * permission of create3000. * * NON-MILITARY USE ONLY * * All create3000 software are effectively free software with a non-military use * restriction. It is free. Well commented source is provided. You may reuse the * source in any way you please with the exception anything that uses it must be * marked to indicate is contains 'non-military use only' components. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>. * * This file is part of the X_ITE Project. * * X_ITE is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 only, as published by the * Free Software Foundation. * * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more * details (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License version 3 * along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a * copy of the GPLv3 License. * * For Silvio, Joy and Adi. * ******************************************************************************/ const Fogs = (0,_standard_Utility_ObjectCache_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A) (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_FogVisibilityStart, fogNode .visibilityStart); 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_js__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A .X3DFogObject); this .addChildObjects (_Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A .inputOutput, "hidden", new _Fields_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .SFBool ()); // Units this ._visibilityRange .setUnit ("length"); // Private properties 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 ._visibilityStart .addInterest ("set_visibilityRange__", 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 .visibilityStart === 0)) this .fogType = 0; else this .fogType = fogTypes .get (this ._fogType .getValue ()) || 1; }; })(), set_color__ () { this .colorArray .set (this ._color .getValue ()); }, set_visibilityRange__ () { this .visibilityStart = Math .max (this ._visibilityStart .getValue (), 0); this .visibilityRange = Math .max (this ._visibilityRange .getValue (), 0); this .set_fogType__ (); }, dispose () { }, }); Object .defineProperties (X3DFogObject, _Core_X3DNode_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A .getStaticProperties ("X3DFogObject", "EnvironmentalEffects", 1)); const __default__ = X3DFogObject; ; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_Namespace_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A .add ("X3DFogObject", __default__)); /***/ }), /***/ 358: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { // EXPORTS __webpack_require__.d(__webpack_exports__, { A: () => (/* binding */ Base_X3DObject) }); // EXTERNAL MODULE: ./src/x_ite/Base/X3DConstants.js var X3DConstants = __webpack_require__(683); // EXTERNAL MODULE: ./src/standard/Math/Algorithm.js var Algorithm = __webpack_require__(231); // EXTERNAL MODULE: ./src/x_ite/Execution/NamedNodesHandling.js var NamedNodesHandling = __webpack_require__(8197); // EXTERNAL MODULE: ./src/x_ite/Namespace.js var Namespace = __webpack_require__(4141); ;// ./src/x_ite/In