x_ite
Version:
X_ITE X3D Browser, view and manipulate X3D, VRML, glTF and other 3D sources in HTML.
1,751 lines (1,493 loc) • 3.42 MB
JavaScript
/* X_ITE v12.2.3 */
var __webpack_modules__ = ({
/***/ 254:
/***/ ((__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__(3078);
/* harmony import */ var _Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8899);
/* harmony import */ var _Fields_SFNodeCache_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6882);
/* harmony import */ var _Components_Core_X3DNode_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8415);
/* harmony import */ var _Execution_X3DImportedNode_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7627);
/* harmony import */ var _Namespace_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6707);
/* provided dependency */ var $ = __webpack_require__(7682);
const
_executionContext = Symbol (),
_sourceNode = Symbol (),
_sourceFieldName = Symbol (),
_sourceField = Symbol (),
_destinationNode = Symbol (),
_destinationFieldName = Symbol (),
_destinationField = Symbol (),
_disposed = Symbol ();
function X3DRoute (executionContext, sourceNode, sourceFieldName, destinationNode, destinationFieldName)
{
_Base_X3DObject_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .call (this, executionContext);
this [_executionContext] = executionContext;
this [_sourceNode] = sourceNode;
this [_sourceFieldName] = sourceFieldName;
this [_destinationNode] = destinationNode;
this [_destinationFieldName] = destinationFieldName;
if (sourceNode instanceof _Execution_X3DImportedNode_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A)
sourceNode .getInlineNode () ._loadState .addInterest ("reconnect", this);
if (destinationNode instanceof _Execution_X3DImportedNode_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A)
destinationNode .getInlineNode () ._loadState .addInterest ("reconnect", this);
this .reconnect ();
}
Object .assign (Object .setPrototypeOf (X3DRoute .prototype, _Base_X3DObject_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .prototype),
{
getExecutionContext ()
{
return this [_executionContext];
},
getRouteId ()
{
return X3DRoute .getRouteId (this [_sourceNode], this [_sourceFieldName], this [_destinationNode], this [_destinationFieldName]);
},
getSourceNode ()
{
/// SAI
if (this [_sourceNode] instanceof _Execution_X3DImportedNode_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A)
return this [_sourceNode] .getExportedNode ();
return this [_sourceNode];
},
getSourceField ()
{
/// SAI
if (this [_sourceField])
{
return this [_sourceField] .getAccessType () === _Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A .inputOutput
? this [_sourceField] .getName () + "_changed"
: this [_sourceField] .getName ();
}
else
{
return this [_sourceFieldName];
}
},
getDestinationNode ()
{
/// SAI
if (this [_destinationNode] instanceof _Execution_X3DImportedNode_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A)
return this [_destinationNode] .getExportedNode ();
return this [_destinationNode];
},
getDestinationField ()
{
/// SAI
if (this [_destinationField])
{
return this [_destinationField] .getAccessType () === _Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A .inputOutput
? "set_" + this [_destinationField] .getName ()
: this [_destinationField] .getName ();
}
else
{
return this [_destinationFieldName];
}
},
reconnect ()
{
try
{
this .disconnect ();
this .connect ();
}
catch (error)
{
if ((this [_sourceNode] instanceof _Components_Core_X3DNode_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A ||
this [_sourceNode] .getInlineNode () .checkLoadState () === _Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A .COMPLETE_STATE) &&
(this [_destinationNode] instanceof _Components_Core_X3DNode_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A ||
this [_destinationNode] .getInlineNode () .checkLoadState () === _Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A .COMPLETE_STATE))
{
console .warn (error);
}
}
},
connect ()
{
if (this [_disposed])
return;
let firstError, secondError;
try
{
const sourceNode = this [_sourceNode] instanceof _Components_Core_X3DNode_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A
? this [_sourceNode]
: this [_sourceNode] .getExportedNode ();
this [_sourceField] = sourceNode .getField (this [_sourceFieldName]);
}
catch (error)
{
firstError = error;
}
try
{
const destinationNode = this [_destinationNode] instanceof _Components_Core_X3DNode_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A
? this [_destinationNode]
: this [_destinationNode] .getExportedNode ();
this [_destinationField] = destinationNode .getField (this [_destinationFieldName]);
}
catch (error)
{
secondError = error;
}
if (this [_sourceField] && this [_destinationField])
{
if (this [_sourceField] .getType () !== this [_destinationField] .getType ())
throw new Error (`Bad ROUTE statement: Source field type must match destination field type of fields named "${this [_sourceField] .getName ()}" and "${this [_destinationField] .getName ()}".`);
if (!this [_sourceField] .isOutput ())
throw new Error (`Bad ROUTE statement: Source field "${this [_sourceField] .getName ()}" must be an output.`);
if (!this [_destinationField] .isInput ())
throw new Error (`Bad ROUTE statement: Destination field "${this [_destinationField] .getName ()}" must be an input.`);
this [_sourceField] .addOutputRoute (this);
this [_destinationField] .addInputRoute (this);
this [_sourceField] .addFieldInterest (this [_destinationField]);
}
else
{
throw firstError ?? secondError;
}
},
disconnect ()
{
this [_sourceField] ?.removeOutputRoute (this);
this [_destinationField] ?.removeInputRoute (this);
if (this [_sourceField] && this [_destinationField])
this [_sourceField] .removeFieldInterest (this [_destinationField]);
this [_sourceField] = null;
this [_destinationField] = null;
},
toVRMLStream (generator)
{
if (!generator .ExistsRouteNode (this [_sourceNode]))
throw new Error (`Source node does not exist in scene graph.`);
if (!generator .ExistsRouteNode (this [_destinationNode]))
throw new Error (`Destination node does not exist in scene graph.`);
const sourceNodeName = this [_sourceNode] instanceof _Components_Core_X3DNode_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A
? generator .Name (this [_sourceNode])
: generator .ImportedName (this [_sourceNode]);
const destinationNodeName = this [_destinationNode] instanceof _Components_Core_X3DNode_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A
? generator .Name (this [_destinationNode])
: generator .ImportedName (this [_destinationNode]);
generator .Indent ();
generator .string += "ROUTE";
generator .Space ();
generator .string += sourceNodeName;
generator .string += ".";
generator .string += this .getSourceField ();
generator .Space ();
generator .string += "TO";
generator .Space ();
generator .string += destinationNodeName;
generator .string += ".";
generator .string += this .getDestinationField ();
},
toXMLStream (generator)
{
if (!generator .ExistsRouteNode (this [_sourceNode]))
throw new Error (`Source node does not exist in scene graph.`);
if (!generator .ExistsRouteNode (this [_destinationNode]))
throw new Error (`Destination node does not exist in scene graph.`);
const sourceNodeName = this [_sourceNode] instanceof _Components_Core_X3DNode_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A
? generator .Name (this [_sourceNode])
: generator .ImportedName (this [_sourceNode]);
const destinationNodeName = this [_destinationNode] instanceof _Components_Core_X3DNode_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A
? generator .Name (this [_destinationNode])
: generator .ImportedName (this [_destinationNode]);
generator .openTag ("ROUTE");
generator .attribute ("fromNode", sourceNodeName);
generator .attribute ("fromField", this .getSourceField ());
generator .attribute ("toNode", destinationNodeName);
generator .attribute ("toField", this .getDestinationField ());
generator .closeTag ("ROUTE");
},
toJSONStream (generator)
{
if (!generator .ExistsRouteNode (this [_sourceNode]))
throw new Error (`Source node does not exist in scene graph.`);
if (!generator .ExistsRouteNode (this [_destinationNode]))
throw new Error (`Destination node does not exist in scene graph.`);
const sourceNodeName = this [_sourceNode] instanceof _Components_Core_X3DNode_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A
? generator .Name (this [_sourceNode])
: generator .ImportedName (this [_sourceNode]);
const destinationNodeName = this [_destinationNode] instanceof _Components_Core_X3DNode_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A
? generator .Name (this [_destinationNode])
: generator .ImportedName (this [_destinationNode]);
generator .TidyBreak ();
generator .Indent ();
generator .beginObject ("ROUTE", false, true);
generator .stringProperty ("@fromNode", sourceNodeName, false);
generator .stringProperty ("@fromField", this .getSourceField ());
generator .stringProperty ("@toNode", destinationNodeName);
generator .stringProperty ("@toField", this .getDestinationField ());
generator .endObject ();
generator .endObject ();
},
dispose ()
{
if (this [_disposed])
return;
this [_disposed] = true;
this .disconnect ();
if (this [_sourceNode] instanceof _Execution_X3DImportedNode_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A)
this [_sourceNode] .getInlineNode () ._loadState .removeInterest ("reconnect", this);
if (this [_destinationNode] instanceof _Execution_X3DImportedNode_js__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .A)
this [_destinationNode] .getInlineNode () ._loadState .removeInterest ("reconnect", this);
this [_executionContext] .deleteRoute (this);
_Base_X3DObject_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .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_js__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A .get (this .getSourceNode ());
},
enumerable: true,
},
sourceField:
{
get: X3DRoute .prototype .getSourceField,
enumerable: true,
},
destinationNode:
{
get ()
{
return _Fields_SFNodeCache_js__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .A .get (this .getDestinationNode ());
},
enumerable: true,
},
destinationField:
{
get: X3DRoute .prototype .getDestinationField,
enumerable: true,
},
});
Object .defineProperties (X3DRoute,
{
typeName:
{
value: "X3DRoute",
enumerable: true,
},
});
Object .assign (X3DRoute,
{
getRouteId (sourceNode, sourceFieldName, destinationNode, destinationFieldName)
{
const sourceField = sourceNode instanceof _Components_Core_X3DNode_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A
? sourceNode .getField (sourceFieldName)
: $.try (() => sourceNode .getExportedNode () .getField (sourceFieldName));
const destinationField = destinationNode instanceof _Components_Core_X3DNode_js__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .A
? destinationNode .getField (destinationFieldName)
: $.try (() => destinationNode .getExportedNode () .getField (destinationFieldName));
if (sourceField)
{
sourceFieldName = sourceField .getName ();
if (sourceField .getAccessType () === _Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A .inputOutput)
sourceFieldName += "_changed";
}
if (destinationField)
{
destinationFieldName = destinationField .getName ();
if (destinationField .getAccessType () === _Base_X3DConstants_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A .inputOutput)
destinationFieldName = "set_" + destinationFieldName;
}
return `${sourceNode .getId ()}.${sourceFieldName}.${destinationNode .getId ()}.${destinationFieldName}`;
},
});
const __default__ = X3DRoute;
;
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_Namespace_js__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .A .add ("X3DRoute", __default__));
/***/ }),
/***/ 388:
/***/ ((__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 _Numbers_Vector3_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2639);
/* harmony import */ var _x_ite_Namespace_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6707);
function Line3 (point = _Numbers_Vector3_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .ZERO, direction = _Numbers_Vector3_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .Z_AXIS)
{
this .point = new _Numbers_Vector3_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A ();
this .direction = new _Numbers_Vector3_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A ();
this .set (point, direction);
}
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;
},
equals (line)
{
return this .point .equals (line .point) && this .direction .equals (line .direction);
},
set (point = _Numbers_Vector3_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .ZERO, direction = _Numbers_Vector3_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A .Z_AXIS)
{
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 = new _Numbers_Vector3_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A ())
{
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_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A ();
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_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A ();
return function (point, result = new _Numbers_Vector3_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A ())
{
result .assign (this .point) .subtract (point);
return result .subtract (t .assign (this .direction) .multiply (result .dot (this .direction)));
};
})(),
getPerpendicularVectorToLine: (() =>
{
const
diff = new _Numbers_Vector3_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A (),
proj = new _Numbers_Vector3_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A (),
d = new _Numbers_Vector3_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A (),
point1 = new _Numbers_Vector3_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A ();
return function (line, result = new _Numbers_Vector3_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A ())
{
const
{ point: p1, direction: d1 } = this,
{ point: p2, direction: d2 } = line;
const t = d1 .dot (d2);
if (Math .abs (t) >= 1)
{
// Lines are parallel
diff .assign (p2) .subtract (p1);
proj .assign (d1) .multiply (diff .dot (d1) / d1 .dot (d1));
return proj .subtract (diff);
}
d .assign (p1) .subtract (p2);
const
re1 = d .dot (d1),
re2 = d .dot (d2),
e12 = d1 .dot (d2),
E12 = e12 * e12;
const
a = (re1 - re2 * e12) / (1 - E12),
b = -(re2 - re1 * e12) / (1 - E12);
point1 .assign (d1) .multiply (a);
result .assign (d2) .multiply (b);
return result .subtract (point1) .add (d);
};
})(),
intersectsTriangle: (() =>
{
const
pvec = new _Numbers_Vector3_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A (),
tvec = new _Numbers_Vector3_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A ();
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 u = edge2 .dot (qvec) * inv_det;
uvt .u = 1 - u - v;
uvt .v = u;
uvt .t = 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 __default__ = Line3;
;
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_x_ite_Namespace_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .A .add ("Line3", __default__));
/***/ }),
/***/ 564:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
A: () => (/* binding */ x_ite_Fields)
});
// EXTERNAL MODULE: ./src/x_ite/Base/X3DField.js
var X3DField = __webpack_require__(5702);
// EXTERNAL MODULE: ./src/x_ite/Base/X3DConstants.js
var X3DConstants = __webpack_require__(8899);
// EXTERNAL MODULE: ./src/x_ite/Namespace.js
var Namespace = __webpack_require__(6707);
;// ./src/x_ite/Fields/SFScalar.js
function SFBoolTemplate (TypeName)
{
function SFBool (value)
{
X3DField/* default */.A .call (this, !! value);
}
return SFScalarPrototypeTemplate (SFBool, TypeName,
{
isDefaultValue ()
{
return this .getValue () === false;
},
set (value)
{
X3DField/* default */.A .prototype .set .call (this, !! value);
},
toStream (generator)
{
generator .string += this .getValue () ? "TRUE" : "FALSE";
},
toXMLStream (generator)
{
generator .string += this .getValue () ? "true" : "false";
},
toJSONStreamValue (generator)
{
generator .string += this .getValue () ? "true" : "false";
},
});
}
function SFNumberTemplate (TypeName, double, defaultValue)
{
const _formatter = double ? "DoubleFormat" : "FloatFormat";
function SFNumber (value)
{
X3DField/* default */.A .call (this, arguments .length ? +value : defaultValue);
}
return SFScalarPrototypeTemplate (SFNumber, TypeName,
{
isDefaultValue ()
{
return this .getValue () === defaultValue;
},
set (value)
{
X3DField/* default */.A .prototype .set .call (this, +value);
},
toStream (generator)
{
const category = this .getUnit ();
generator .string += generator [_formatter] (generator .ToUnit (category, this .getValue ()));
},
toJSONStreamValue (generator)
{
const category = this .getUnit ();
generator .string += generator .Number (generator [_formatter] (generator .ToUnit (category, this .getValue ())));
},
});
}
function SFInt32Template (TypeName)
{
function SFInt32 (value)
{
X3DField/* default */.A .call (this, value|0);
}
return SFScalarPrototypeTemplate (SFInt32, TypeName,
{
isDefaultValue ()
{
return this .getValue () === 0;
},
set (value)
{
X3DField/* default */.A .prototype .set .call (this, value|0);
},
});
}
function SFStringTemplate (TypeName)
{
function SFString (value)
{
X3DField/* default */.A .call (this, arguments .length ? String (value) : "");
}
SFScalarPrototypeTemplate (SFString, TypeName,
{
*[Symbol .iterator] ()
{
yield* this .getValue ();
},
isDefaultValue ()
{
return this .getValue () === "";
},
set (value)
{
X3DField/* default */.A .prototype .set .call (this, String (value));
},
toStream (generator)
{
generator .string += '"';
generator .string += SFString .escape (this .getValue ());
generator .string += '"';
},
toXMLStream (generator, sourceText = false)
{
generator .string += sourceText
? generator .EncodeSourceText (this .getValue ())
: generator .EncodeString (this .getValue ());
},
toJSONStreamValue (generator)
{
generator .string += '"';
generator .string += generator .EncodeString (this .getValue ());
generator .string += '"';
},
});
Object .defineProperty (SFString .prototype, "length",
{
get ()
{
return this .getValue () .length;
},
});
Object .assign (SFString,
{
unescape (string)
{
return string .replace (/\\([\\"])/g, "$1");
},
escape (string)
{
return string .replace (/([\\"])/g, "\\$1");
},
});
return SFString;
}
function SFScalarPrototypeTemplate (Constructor, TypeName, properties = { })
{
Object .defineProperties (Constructor,
{
type:
{
value: X3DConstants/* default */.A [TypeName],
enumerable: true,
},
typeName:
{
value: TypeName,
enumerable: true,
},
});
Object .assign (Object .setPrototypeOf (Constructor .prototype, X3DField/* default */.A .prototype),
{
copy ()
{
return new Constructor (this .getValue ());
},
valueOf: X3DField/* default */.A .prototype .getValue,
toStream (generator)
{
generator .string += String (this .getValue ());
},
toVRMLStream (generator)
{
this .toStream (generator);
},
toXMLStream (generator)
{
this .toStream (generator);
},
toJSONStream (generator)
{
this .toJSONStreamValue (generator);
},
toJSONStreamValue (generator)
{
this .toStream (generator);
},
},
properties);
for (const key of Object .keys (Constructor .prototype))
Object .defineProperty (Constructor .prototype, key, { enumerable: false });
return Constructor;
}
const SFScalar = {
SFBool: SFBoolTemplate ("SFBool"),
SFDouble: SFNumberTemplate ("SFDouble", true, 0),
SFFloat: SFNumberTemplate ("SFFloat", false, 0),
SFInt32: SFInt32Template ("SFInt32"),
SFString: SFStringTemplate ("SFString"),
SFTime: SFNumberTemplate ("SFTime", true, -1),
};
const __default__ = SFScalar;
;
/* harmony default export */ const Fields_SFScalar = (Namespace/* default */.A .add ("SFScalar", __default__));
// EXTERNAL MODULE: ./src/standard/Math/Numbers/Color3.js
var Color3 = __webpack_require__(567);
;// ./src/x_ite/Fields/SFColor.js
function SFColor (r, g, b)
{
switch (arguments .length)
{
case 0:
X3DField/* default */.A .call (this, new Color3/* default */.A ());
break;
case 1:
X3DField/* default */.A .call (this, arguments [0]);
break;
case 3:
X3DField/* default */.A .call (this, new Color3/* default */.A (+r, +g, +b));
break;
default:
throw new Error ("Invalid arguments.");
}
}
Object .assign (Object .setPrototypeOf (SFColor .prototype, X3DField/* default */.A .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 (Color3/* default */.A .BLACK);
},
set (value)
{
this .getValue () .assign (value);
},
getHSV ()
{
return this .getValue () .getHSV ([ ]);
},
setHSV (h, s, v)
{
this .getValue () .setHSV (h, s, v);
this .addEvent ();
},
linearToSRGB ()
{
return new SFColor (this .getValue () .linearToSRGB ());
},
sRGBToLinear ()
{
return new SFColor (this .getValue () .sRGBToLinear ());
},
lerp: (() =>
{
const
s = [ ],
d = [ ],
r = [ ];
return function (destination, t)
{
const result = new SFColor ();
this .getValue () .getHSV (s);
destination .getValue () .getHSV (d);
Color3/* default */.A .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 .Space ();
}
generator .string += generator .FloatFormat (value [last]);
},
toVRMLStream (generator)
{
this .toStream (generator);
},
toXMLStream (generator)
{
this .toStream (generator);
},
toJSONStream (generator)
{
generator .string += '[';
generator .TidySpace ();
this .toJSONStreamValue (generator);
generator .TidySpace ();
generator .string += ']';
},
toJSONStreamValue (generator)
{
const
value = this .getValue (),
last = value .length - 1;
for (let i = 0; i < last; ++ i)
{
generator .string += generator .Number (generator .FloatFormat (value [i]));
generator .string += ',';
generator .TidySpace ();
}
generator .string += generator .Number (generator .FloatFormat (value [last]));
},
});
for (const key of Object .keys (SFColor .prototype))
Object .defineProperty (SFColor .prototype, key, { enumerable: false });
const r = {
get ()
{
return this .getValue () .r;
},
set (value)
{
this .getValue () .r = +value;
this .addEvent ();
},
};
const g = {
get ()
{
return this .getValue () .g;
},
set (value)
{
this .getValue () .g = +value;
this .addEvent ();
},
};
const b = {
get ()
{
return this .getValue () .b;
},
set (value)
{
this .getValue () .b = +value;
this .addEvent ();
},
};
Object .defineProperties (SFColor .prototype,
{
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 .defineProperties (SFColor,
{
type:
{
value: X3DConstants/* default */.A .SFColor,
enumerable: true,
},
typeName:
{
value: "SFColor",
enumerable: true,
},
});
const SFColor_default_ = SFColor;
;
/* harmony default export */ const Fields_SFColor = (Namespace/* default */.A .add ("SFColor", SFColor_default_));
// EXTERNAL MODULE: ./src/standard/Math/Numbers/Color4.js
var Color4 = __webpack_require__(9302);
;// ./src/x_ite/Fields/SFColorRGBA.js
function SFColorRGBA (r, g, b, a)
{
switch (arguments .length)
{
case 0:
X3DField/* default */.A .call (this, new Color4/* default */.A ());
break;
case 1:
X3DField/* default */.A .call (this, arguments [0]);
break;
case 4:
X3DField/* default */.A .call (this, new Color4/* default */.A (+r, +g, +b, +a));
break
default:
throw new Error ("Invalid arguments.");
}
}
Object .assign (Object .setPrototypeOf (SFColorRGBA .prototype, X3DField/* default */.A .prototype),
{
*[Symbol .iterator] ()
{
yield* this .getValue ();
},
copy ()
{
return new SFColorRGBA (this .getValue () .copy ());
},
equals: Fields_SFColor .prototype .equals,
isDefaultValue ()
{
return this .getValue () .equals (Color4/* default */.A .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 ();
},
linearToSRGB ()
{
return new SFColorRGBA (this .getValue () .linearToSRGB ());
},
sRGBToLinear ()
{
return new SFColorRGBA (this .getValue () .sRGBToLinear ());
},
lerp: (() =>
{
const
s = [ ],
d = [ ],
r = [ ];
return function (destination, t)
{
const result = new SFColorRGBA ();
this .getValue () .getHSVA (s);
destination .getValue () .getHSVA (d);
Color4/* default */.A .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 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: 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 }, a),
});
Object .defineProperties (SFColorRGBA,
{
type:
{
value: X3DConstants/* default */.A .SFColorRGBA,
enumerable: true,
},
typeName:
{
value: "SFColorRGBA",
enumerable: true,
},
});
const SFColorRGBA_default_ = SFColorRGBA;
;
/* harmony default export */ const Fields_SFColorRGBA = (Namespace/* default */.A .add ("SFColorRGBA", SFColorRGBA_default_));
;// ./src/x_ite/Fields/SFMatrixPrototypeTemplate.js
function SFMatrixPrototypeTemplate (Constructor, TypeName, Matrix, double, properties = { })
{
const _formatter = double ? "DoubleFormat" : "FloatFormat";
Object .defineProperties (Constructor,
{
type:
{
value: X3DConstants/* default */.A [TypeName],
enumerable: true,
},
typeName:
{
value: TypeName,
enumerable: true,
},
});
Object .assign (Object .setPrototypeOf (Constructor .prototype, X3DField/* default */.A .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: (() =>
{
const args = [ ];
return function (translation, rotation, scale, scaleOrientation, center)
{
args .push (translation ?.getValue (),
rotation ?.getValue (),
scale ?.getValue (),
scaleOrientation ?.getValue (),
center ?.getValue ());
for (let i = args .length - 1; i > -1; -- i)
{
if (args [i])
break;
args .pop ();
}
this .getValue () .set (... args);
args .length = 0;
};
})(),
getTransform: (() =>
{
const args = [ ];
return function (translation, rotation, scale, scaleOrientation, center)
{
args .push (translation ?.getValue (),
rotation ?.getValue (),
scale ?.getValue (),
scaleOrientation ?.getValue (),
center ?.getValue ());
for (let i = args .length - 1; i > -1; -- i)
{
if (args [i])
break;
args .pop ();
}
this .getValue () .get (... args);
translation ?.addEvent ();
rotation ?.addEvent ();
scale ?.addEvent ();
scaleOrientation ?.addEvent ();
args .length = 0;
};
})(),
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 (vector .constructor) (this .getValue () .multVecMatrix (vector .getValue () .copy ()));
},
multMatrixVec (vector)
{
return new (vector .constructor) (this .getValue () .multMatrixVec (vector .getValue () .copy ()));
},
multDirMatrix (vector)
{
return new (vector .constructor) (this .getValue () .multDirMatrix (vector .getValue () .copy ()));
},
multMatrixDir (vector)
{
return new (vector .constructor) (this .getValue () .multMatrixDir (vector .getValue () .copy ()));
},
translate (translation)
{
return new (this .constructor) (this .getValue () .copy () .translate (translation .getValue ()));
},
rotate (rotation)
{
return new (this .constructor) (this .getValue () .copy () .rotate (rotation .getValue ()));
},
scale (scale)
{
return new (this .constructor) (this .getValue () .copy () .scale (scale .getValue ()));
},
toStream (generator)
{
const
value = this .getValue (),
last = value .length - 1;
for (let i = 0; i < last; ++ i)
{
generator .string += generator [_formatter] (value [i]);
generator .Space ();
}
generator .string += generator [_formatter] (value [last]);
},
toVRMLStream (generator)
{
this .toStream (generator);
},
toXMLStream (generator)
{
this .toStream (generator);
},
toJSONStream (generator)
{
generator .string += '[';
generator .TidySpace ();
this .toJSONStreamValue (generator);
generator .TidySpace ();
generator .string += ']';
},
toJSONStreamValue (generator)
{
const
value = this .getValue (),
last = value .length - 1;
for (let i = 0; i < last; ++ i)
{
generator .string += generator .Number (generator [_formatter] (value [i]));
generator .string += ',';
generator .TidySpace ();
}
generator .string += generator .Number (generator [_formatter] (value [last]));
},
},
properties);
for (const key of Object .keys (Constructor .prototype))
Object .defineProperty (Constructor .prototype, key, { enumerable: false });
function defineProperty (i)
{
Object .defineProperty (Constructor .prototype, i,
{
get ()
{
return this .getValue () [i];
},
set (value)
{
this .getValue () [i] = +value;
this .addEvent ();
},
enumerable: true,
});
}
for (let i = 0; i < Matrix .prototype .length; ++ i)
defineProperty (i);
return Constructor;
}
const SFMatrixPrototypeTemplate_default_ = SFMatrixPrototypeTemplate;
;
/* harmony default export */ const Fields_SFMatrixPrototypeTemplate = (Namespace/* default */.A .add ("SFMatrixPrototypeTemplate", SFMatrixPrototypeTemplate_default_));
// EXTERNAL MODULE: ./src/standard/Math/Numbers/Matrix3.js + 1 modules
var Matrix3 = __webpack_require__(3012);
;// ./src/x_ite/Fields/SFMatrix3.js
function SFMatrix3Template (TypeName, double)
{
function SFMatrix3 (m00, m01, m02,
m10, m11, m12,
m20, m21, m22)
{
switch (arguments .length)
{
case 0:
X3DField/* default */.A .call (this, new Matrix3/* default */.A ());
break;
case 1:
X3DField/* default */.A .call (this, arguments [0]);
break;
case 3:
{
const
r0 = arguments [0],
r1 = arguments [1],
r2 = arguments [2];
X3DField/* default */.A .call (this, new Matrix3/* default */.A (r0 .x, r0 .y, r0 .z,
r1 .x, r1 .y, r1 .z,
r2 .x, r2 .y, r2 .z));
break;
}
case 9:
{
X3DField/* default */.A .call (this, new Matrix3/* default */.A (+m00, +m01, +m02,
+m10, +m11, +m12,
+m20, +m21, +m22));
break;
}
default:
throw new Error ("Invalid arguments.");
}
}
return Fields_SFMatrixPrototypeTemplate (SFMatrix3, TypeName, Matrix3/* default */.A, double,
{
setTransform: (() =>
{
const args = [ ];
return function (translation, rotation, scale, scaleOrientation, center)
{
args .push (translation ?.getValue (), rotation, scale ?.getValue (), scaleOrientation, center ?.getValue ());
for (let i = args .length - 1; i > -1; -- i)
{
if (args [i])
break;
args .pop ();
}
this .getValue () .set (... args);
args .length = 0;
};
})(),
rotate (rotation)
{
return new (this .constructor) (this .getValue () .copy () .rotate (rotation));
},
skewX (angle)
{
return new (this .constructor) (this .getValue () .copy () .skewX (angle));
},
skewY (angle)
{
return new (this .constructor) (this .getValue () .copy () .skewY (angle));
},
});
}
const SFMatrix3 = {
SFMatrix3d: SFMatrix3Template ("SFMatrix3d", true),
SFMatrix3f: SFMatrix3Template ("SFMatrix3f", false),
};
const SFMatrix3_default_ = SFMatrix3;
;
/* harmony default export */ const Fields_SFMatrix3 = (Namespace/* default */.A .add ("SFMatrix3", SFMatrix3_default_));
// EXTERNAL MODULE: ./src/standard/Math/Numbers/Matrix4.js
var Matrix4 = __webpack_require__(1048);
;// ./src/x_ite/Fields/SFMatrix4.js
function SFMatrix4Template (TypeName, double)
{
function SFMatrix4 (m00, m01, m02, m03,
m10, m11, m12, m13,
m20, m21, m22, m23,
m30, m31, m32, m33)
{
switch (arguments .length)
{
case 0:
X3DField/* default */.A .call (this, new Matrix4/* default */.A ());
break;
case 1:
X3DField/* default */.A .call (this, arguments [0]);
break;
case 4:
{
const
r0 = arguments [0],
r1 = arguments [1],
r2 = arguments [2],
r3 = arguments [3];
X3DField/* default */.A .call (this, new Matrix4/* default */.A (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:
{
X3DField/* default */.A .call (this, new Matrix4/* default */.A (+m00, +m01, +m02, +m03,
+m10, +m11, +m12, +m13,
+m20, +m21, +m22, +m23,
+m30, +m31, +m32, +m33));
break;
}
default:
throw new Error ("Invalid arguments.");
}
}
return Fields_SFMatrixPrototypeTemplate (SFMatrix4, TypeName, Matrix4/* default */.A, double);
}
const SFMatrix4 = {
SFMatrix4d: SFMatrix4Template ("SFMatrix4d", true),
SFMatrix4f: SFMatrix4Template ("SFMatrix4f", false),
VrmlMatrix: SFMatrix4Template ("VrmlMatrix", false),
};
const SFMatrix4_default_ = SFMatrix4;
;
/* harmony default export */ const Fields_SFMatrix4 = (Namespace/* default */.A .add ("SFMatrix4", SFMatrix4_default_));
// EXTERNAL MODULE: ./src/x_ite/Fields/SFNode.js
var SFNode = __webpack_require__(1426);
;// ./src/x_ite/Fields/SFVecPrototypeTemplate.js
function SFVecPrototypeTemplate (Constructor, TypeName, Vector, double, properties = { })
{
const _formatter = double ? "DoubleFormat" : "FloatFormat";
Object .defineProperties (Constructor,
{
type:
{
value: X3DConstants/* default */.A [TypeName],
enumerable: true,
},
typeName:
{
value: TypeName,
enumerable: true,
},
});
Object .assign (Object .setPrototypeOf (Constructor .prototype, X3DField/* default */.A .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 ()));
},
clamp (low, high)
{
return new (this .constructor) (this .getValue () .copy () .clamp (low .getValue (), high .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 () .norm ();
},
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 = this .getUnit ();
for (let i = 0; i < last; ++ i)
{
generator .string += generator [_formatter] (generator .ToUnit (category, value [i]));
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 .TidySpace ();
this .toJSONStreamValue (generator);
generator .TidySpace ();
generator .string += ']';
},
toJSONStreamValue (generator)
{
const
value = thi