x_ite
Version:
X_ITE X3D Browser, view and manipulate X3D, VRML, glTF and other 3D sources in HTML.
1,159 lines (924 loc) • 119 kB
JavaScript
/* X_ITE v12.2.3 */
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-12.2.3")];
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ // The require scope
/******/ var __webpack_require__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* 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/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/************************************************************************/
// UNUSED EXPORTS: default
;// external "__X_ITE_X3D__ .Components"
const external_X_ITE_X3D_Components_namespaceObject = __X_ITE_X3D__ .Components;
var external_X_ITE_X3D_Components_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Components_namespaceObject);
;// external "__X_ITE_X3D__ .TextureBuffer"
const external_X_ITE_X3D_TextureBuffer_namespaceObject = __X_ITE_X3D__ .TextureBuffer;
var external_X_ITE_X3D_TextureBuffer_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_TextureBuffer_namespaceObject);
;// external "__X_ITE_X3D__ .Namespace"
const external_X_ITE_X3D_Namespace_namespaceObject = __X_ITE_X3D__ .Namespace;
var external_X_ITE_X3D_Namespace_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Namespace_namespaceObject);
;// ./src/x_ite/Browser/X_ITE/X3DX_ITEContext.js
const
_transmissionBuffer = Symbol (),
_volumeScatterBuffer = Symbol ();
function X3DX_ITEContext () { }
Object .assign (X3DX_ITEContext .prototype,
{
initialize ()
{
this .addTextureBuffer (_transmissionBuffer);
this .addTextureBuffer (_volumeScatterBuffer);
},
getTransmissionBuffer ()
{
return this [_transmissionBuffer] ??= new (external_X_ITE_X3D_TextureBuffer_default()) ({
browser: this,
width: this ._viewport [2],
height: this ._viewport [3],
mipMaps: true,
});
},
getVolumeScatterBuffer ()
{
return this [_volumeScatterBuffer] ??= new (external_X_ITE_X3D_TextureBuffer_default()) ({
browser: this,
width: this ._viewport [2],
height: this ._viewport [3],
float: true,
});
},
});
const __default__ = X3DX_ITEContext;
;
/* harmony default export */ const X_ITE_X3DX_ITEContext = (external_X_ITE_X3D_Namespace_default().add ("X3DX_ITEContext", __default__));
;// external "__X_ITE_X3D__ .Fields"
const external_X_ITE_X3D_Fields_namespaceObject = __X_ITE_X3D__ .Fields;
var external_X_ITE_X3D_Fields_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Fields_namespaceObject);
;// external "__X_ITE_X3D__ .X3DFieldDefinition"
const external_X_ITE_X3D_X3DFieldDefinition_namespaceObject = __X_ITE_X3D__ .X3DFieldDefinition;
var external_X_ITE_X3D_X3DFieldDefinition_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DFieldDefinition_namespaceObject);
;// external "__X_ITE_X3D__ .FieldDefinitionArray"
const external_X_ITE_X3D_FieldDefinitionArray_namespaceObject = __X_ITE_X3D__ .FieldDefinitionArray;
var external_X_ITE_X3D_FieldDefinitionArray_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_FieldDefinitionArray_namespaceObject);
;// external "__X_ITE_X3D__ .X3DNode"
const external_X_ITE_X3D_X3DNode_namespaceObject = __X_ITE_X3D__ .X3DNode;
var external_X_ITE_X3D_X3DNode_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DNode_namespaceObject);
;// external "__X_ITE_X3D__ .X3DConstants"
const external_X_ITE_X3D_X3DConstants_namespaceObject = __X_ITE_X3D__ .X3DConstants;
var external_X_ITE_X3D_X3DConstants_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DConstants_namespaceObject);
;// external "__X_ITE_X3D__ .BitSet"
const external_X_ITE_X3D_BitSet_namespaceObject = __X_ITE_X3D__ .BitSet;
var external_X_ITE_X3D_BitSet_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_BitSet_namespaceObject);
;// ./src/x_ite/Components/X_ITE/X3DMaterialExtensionNode.js
function X3DMaterialExtensionNode (executionContext)
{
external_X_ITE_X3D_X3DNode_default().call (this, executionContext);
this .addType ((external_X_ITE_X3D_X3DConstants_default()).X3DMaterialExtensionNode);
this .textureBits = new (external_X_ITE_X3D_BitSet_default()) ();
}
Object .assign (Object .setPrototypeOf (X3DMaterialExtensionNode .prototype, (external_X_ITE_X3D_X3DNode_default()).prototype),
{
setTexture (index, textureNode)
{
index *= 4;
this .textureBits .remove (index, 0xf);
this .textureBits .add (index, textureNode ?.getTextureBits () ?? 0);
},
getTextureBits ()
{
return this .textureBits;
},
});
Object .defineProperties (X3DMaterialExtensionNode, external_X_ITE_X3D_X3DNode_default().getStaticProperties ("X3DMaterialExtensionNode", "X_ITE", 1));
const X3DMaterialExtensionNode_default_ = X3DMaterialExtensionNode;
;
/* harmony default export */ const X_ITE_X3DMaterialExtensionNode = (external_X_ITE_X3D_Namespace_default().add ("X3DMaterialExtensionNode", X3DMaterialExtensionNode_default_));
;// external "__X_ITE_X3D__ .X3DCast"
const external_X_ITE_X3D_X3DCast_namespaceObject = __X_ITE_X3D__ .X3DCast;
var external_X_ITE_X3D_X3DCast_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DCast_namespaceObject);
;// ./src/x_ite/Browser/X_ITE/ExtensionKeys.js
let i = 0;
const ExtensionKeys =
{
add (name)
{
this [name] = i ++;
},
};
const ExtensionKeys_default_ = ExtensionKeys;
;
/* harmony default export */ const X_ITE_ExtensionKeys = (external_X_ITE_X3D_Namespace_default().add ("ExtensionKeys", ExtensionKeys_default_));
;// external "__X_ITE_X3D__ .MaterialTextures"
const external_X_ITE_X3D_MaterialTextures_namespaceObject = __X_ITE_X3D__ .MaterialTextures;
var external_X_ITE_X3D_MaterialTextures_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_MaterialTextures_namespaceObject);
;// ./src/x_ite/Components/X_ITE/AnisotropyMaterialExtension.js
// Register key.
X_ITE_ExtensionKeys .add ("ANISOTROPY_MATERIAL_EXTENSION");
// Register textures.
external_X_ITE_X3D_MaterialTextures_default().add ("x3d_AnisotropyTextureEXT");
/**
* THIS NODE IS STILL EXPERIMENTAL.
*/
function AnisotropyMaterialExtension (executionContext)
{
X_ITE_X3DMaterialExtensionNode .call (this, executionContext);
this .addType ((external_X_ITE_X3D_X3DConstants_default()).AnisotropyMaterialExtension);
// Units
this ._anisotropyRotation .setUnit ("angle");
// Private properties
this .anisotropyArray = new Float32Array (3);
}
Object .assign (Object .setPrototypeOf (AnisotropyMaterialExtension .prototype, X_ITE_X3DMaterialExtensionNode .prototype),
{
initialize ()
{
X_ITE_X3DMaterialExtensionNode .prototype .initialize .call (this);
this ._anisotropyStrength .addInterest ("set_anisotropyStrength__", this);
this ._anisotropyRotation .addInterest ("set_anisotropyRotation__", this);
this ._anisotropyTexture .addInterest ("set_anisotropyTexture__", this);
this .set_anisotropyStrength__ ();
this .set_anisotropyRotation__ ();
this .set_anisotropyTexture__ ();
},
set_anisotropyStrength__ ()
{
this .anisotropyArray [2] = Math .max (this ._anisotropyStrength .getValue (), 0);
},
set_anisotropyRotation__ ()
{
const anisotropyRotation = this ._anisotropyRotation .getValue ();
this .anisotropyArray [0] = Math .cos (anisotropyRotation);
this .anisotropyArray [1] = Math .sin (anisotropyRotation);
},
set_anisotropyTexture__ ()
{
this .anisotropyTextureNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).X3DSingleTextureNode, this ._anisotropyTexture);
this .setTexture (0, this .anisotropyTextureNode);
},
getExtensionKey ()
{
return X_ITE_ExtensionKeys .ANISOTROPY_MATERIAL_EXTENSION;
},
getShaderOptions (options)
{
options .push ("X3D_ANISOTROPY_MATERIAL_EXT");
if (!+this .getTextureBits ())
return;
options .push ("X3D_MATERIAL_TEXTURES");
this .anisotropyTextureNode ?.getShaderOptions (options, "ANISOTROPY", true);
},
getShaderUniforms (uniforms)
{
uniforms .push ("x3d_AnisotropyEXT");
},
setShaderUniforms (gl, shaderObject, textureTransformMapping, textureCoordinateMapping)
{
gl .uniform3fv (shaderObject .x3d_AnisotropyEXT, this .anisotropyArray);
this .anisotropyTextureNode ?.setNamedShaderUniforms (gl,
shaderObject .x3d_AnisotropyTextureEXT,
this ._anisotropyTextureMapping .getValue (),
textureTransformMapping,
textureCoordinateMapping);
},
});
Object .defineProperties (AnisotropyMaterialExtension,
{
... external_X_ITE_X3D_X3DNode_default().getStaticProperties ("AnisotropyMaterialExtension", "X_ITE", 1, "extensions", "4.0"),
fieldDefinitions:
{
value: new (external_X_ITE_X3D_FieldDefinitionArray_default()) ([
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "metadata", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "anisotropyStrength", new (external_X_ITE_X3D_Fields_default()).SFFloat ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "anisotropyRotation", new (external_X_ITE_X3D_Fields_default()).SFFloat ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "anisotropyTextureMapping", new (external_X_ITE_X3D_Fields_default()).SFString ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "anisotropyTexture", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
]),
enumerable: true,
},
});
const AnisotropyMaterialExtension_default_ = AnisotropyMaterialExtension;
;
/* harmony default export */ const X_ITE_AnisotropyMaterialExtension = (external_X_ITE_X3D_Namespace_default().add ("AnisotropyMaterialExtension", AnisotropyMaterialExtension_default_));
;// external "__X_ITE_X3D__ .X3DAppearanceChildNode"
const external_X_ITE_X3D_X3DAppearanceChildNode_namespaceObject = __X_ITE_X3D__ .X3DAppearanceChildNode;
var external_X_ITE_X3D_X3DAppearanceChildNode_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DAppearanceChildNode_namespaceObject);
;// ./src/x_ite/Components/X_ITE/BlendMode.js
/**
* THIS NODE IS STILL EXPERIMENTAL.
*/
function BlendMode (executionContext)
{
external_X_ITE_X3D_X3DAppearanceChildNode_default().call (this, executionContext);
this .addType ((external_X_ITE_X3D_X3DConstants_default()).BlendMode);
this .factorTypes = new Map ();
this .equationTypes = new Map ();
}
Object .assign (Object .setPrototypeOf (BlendMode .prototype, (external_X_ITE_X3D_X3DAppearanceChildNode_default()).prototype),
{
initialize ()
{
external_X_ITE_X3D_X3DAppearanceChildNode_default().prototype .initialize .call (this);
const
gl = this .getBrowser () .getContext (),
ext = gl .getExtension ('EXT_blend_minmax');
this .factorTypes .set ("ZERO", gl .ZERO);
this .factorTypes .set ("ONE", gl .ONE);
this .factorTypes .set ("SRC_COLOR", gl .SRC_COLOR);
this .factorTypes .set ("ONE_MINUS_SRC_COLOR", gl .ONE_MINUS_SRC_COLOR);
this .factorTypes .set ("DST_COLOR", gl .DST_COLOR);
this .factorTypes .set ("ONE_MINUS_DST_COLOR", gl .ONE_MINUS_DST_COLOR);
this .factorTypes .set ("SRC_ALPHA", gl .SRC_ALPHA);
this .factorTypes .set ("ONE_MINUS_SRC_ALPHA", gl .ONE_MINUS_SRC_ALPHA);
this .factorTypes .set ("DST_ALPHA", gl .DST_ALPHA);
this .factorTypes .set ("ONE_MINUS_DST_ALPHA", gl .ONE_MINUS_DST_ALPHA);
this .factorTypes .set ("SRC_ALPHA_SATURATE", gl .SRC_ALPHA_SATURATE);
this .factorTypes .set ("CONSTANT_COLOR", gl .CONSTANT_COLOR);
this .factorTypes .set ("ONE_MINUS_CONSTANT_COLOR", gl .ONE_MINUS_CONSTANT_COLOR);
this .factorTypes .set ("CONSTANT_ALPHA", gl .CONSTANT_ALPHA);
this .factorTypes .set ("ONE_MINUS_CONSTANT_ALPHA", gl .ONE_MINUS_CONSTANT_ALPHA);
this .equationTypes .set ("FUNC_ADD", gl .FUNC_ADD);
this .equationTypes .set ("FUNC_SUBTRACT", gl .FUNC_SUBTRACT);
this .equationTypes .set ("FUNC_REVERSE_SUBTRACT", gl .FUNC_REVERSE_SUBTRACT);
this .equationTypes .set ("MIN", gl .MIN || (ext && ext .MIN_EXT));
this .equationTypes .set ("MAX", gl .MAX || (ext && ext .MAX_EXT));
this ._sourceColorFactor .addInterest ("set_sourceColorFactor__", this);
this ._sourceAlphaFactor .addInterest ("set_sourceAlphaFactor__", this);
this ._destinationColorFactor .addInterest ("set_destinationColorFactor__", this);
this ._destinationAlphaFactor .addInterest ("set_destinationAlphaFactor__", this);
this ._colorEquation .addInterest ("set_colorEquation__", this);
this ._alphaEquation .addInterest ("set_alphaEquation__", this);
this .set_sourceColorFactor__ ();
this .set_sourceAlphaFactor__ ();
this .set_destinationColorFactor__ ();
this .set_destinationAlphaFactor__ ();
this .set_colorEquation__ ();
this .set_alphaEquation__ ();
},
set_sourceColorFactor__ ()
{
this .sourceColorFactorType = this .factorTypes .get (this ._sourceColorFactor .getValue ())
?? this .factorTypes .get ("SRC_ALPHA");
},
set_sourceAlphaFactor__ ()
{
this .sourceAlphaFactorType = this .factorTypes .get (this ._sourceAlphaFactor .getValue ())
?? this .factorTypes .get ("ONE");
},
set_destinationColorFactor__ ()
{
this .destinationColorFactorType = this .factorTypes .get (this ._destinationColorFactor .getValue ())
?? this .factorTypes .get ("ONE_MINUS_SRC_ALPHA");
},
set_destinationAlphaFactor__ ()
{
this .destinationAlphaFactorType = this .factorTypes .get (this ._destinationAlphaFactor .getValue ())
?? this .factorTypes .get ("ONE_MINUS_SRC_ALPHA");
},
set_colorEquation__ ()
{
this .colorEquationType = this .equationTypes .get (this ._colorEquation .getValue ())
?? this .equationTypes .get ("FUNC_ADD");
},
set_alphaEquation__ ()
{
this .alphaEquationType = this .equationTypes .get (this ._alphaEquation .getValue ())
?? this .equationTypes .get ("FUNC_ADD");
},
enable (gl)
{
const color = this ._blendColor .getValue ();
gl .blendColor (color .r, color .g, color .b, color .a);
gl .blendFuncSeparate (this .sourceColorFactorType, this .destinationColorFactorType, this .sourceAlphaFactorType, this .destinationAlphaFactorType);
gl .blendEquationSeparate (this .colorEquationType, this .alphaEquationType);
},
disable (gl)
{
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);
},
});
Object .defineProperties (BlendMode,
{
... external_X_ITE_X3D_X3DNode_default().getStaticProperties ("BlendMode", "X_ITE", 1, "blendMode", "3.3"),
fieldDefinitions:
{
value: new (external_X_ITE_X3D_FieldDefinitionArray_default()) ([
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "metadata", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "blendColor", new (external_X_ITE_X3D_Fields_default()).SFColorRGBA ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "sourceColorFactor", new (external_X_ITE_X3D_Fields_default()).SFString ("SRC_ALPHA")),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "sourceAlphaFactor", new (external_X_ITE_X3D_Fields_default()).SFString ("ONE")),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "destinationColorFactor", new (external_X_ITE_X3D_Fields_default()).SFString ("ONE_MINUS_SRC_ALPHA")),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "destinationAlphaFactor", new (external_X_ITE_X3D_Fields_default()).SFString ("ONE_MINUS_SRC_ALPHA")),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "colorEquation", new (external_X_ITE_X3D_Fields_default()).SFString ("FUNC_ADD")),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "alphaEquation", new (external_X_ITE_X3D_Fields_default()).SFString ("FUNC_ADD")),
]),
enumerable: true,
},
});
const BlendMode_default_ = BlendMode;
;
/* harmony default export */ const X_ITE_BlendMode = (external_X_ITE_X3D_Namespace_default().add ("BlendMode", BlendMode_default_));
;// external "__X_ITE_X3D__ .Algorithm"
const external_X_ITE_X3D_Algorithm_namespaceObject = __X_ITE_X3D__ .Algorithm;
var external_X_ITE_X3D_Algorithm_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Algorithm_namespaceObject);
;// ./src/x_ite/Components/X_ITE/ClearcoatMaterialExtension.js
// Register key.
X_ITE_ExtensionKeys .add ("CLEARCOAT_MATERIAL_EXTENSION");
// Register textures.
external_X_ITE_X3D_MaterialTextures_default().add ("x3d_ClearcoatTextureEXT");
external_X_ITE_X3D_MaterialTextures_default().add ("x3d_ClearcoatRoughnessTextureEXT");
external_X_ITE_X3D_MaterialTextures_default().add ("x3d_ClearcoatNormalTextureEXT");
/**
* THIS NODE IS STILL EXPERIMENTAL.
*/
function ClearcoatMaterialExtension (executionContext)
{
X_ITE_X3DMaterialExtensionNode .call (this, executionContext);
this .addType ((external_X_ITE_X3D_X3DConstants_default()).ClearcoatMaterialExtension);
}
Object .assign (Object .setPrototypeOf (ClearcoatMaterialExtension .prototype, X_ITE_X3DMaterialExtensionNode .prototype),
{
initialize ()
{
X_ITE_X3DMaterialExtensionNode .prototype .initialize .call (this);
this ._clearcoat .addInterest ("set_clearcoat__", this);
this ._clearcoatTexture .addInterest ("set_clearcoatTexture__", this);
this ._clearcoatRoughness .addInterest ("set_clearcoatRoughness__", this);
this ._clearcoatRoughnessTexture .addInterest ("set_clearcoatRoughnessTexture__", this);
this ._clearcoatNormalTexture .addInterest ("set_clearcoatNormalTexture__", this);
this .set_clearcoat__ ();
this .set_clearcoatTexture__ ();
this .set_clearcoatRoughness__ ();
this .set_clearcoatRoughnessTexture__ ();
this .set_clearcoatNormalTexture__ ();
},
set_clearcoat__ ()
{
this .clearcoat = Math .max (this ._clearcoat .getValue (), 0);
},
set_clearcoatTexture__ ()
{
this .clearcoatTextureNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).X3DSingleTextureNode, this ._clearcoatTexture);
this .setTexture (0, this .clearcoatTextureNode);
},
set_clearcoatRoughness__ ()
{
this .clearcoatRoughness = external_X_ITE_X3D_Algorithm_default().clamp (this ._clearcoatRoughness .getValue (), 0, 1);
},
set_clearcoatRoughnessTexture__ ()
{
this .clearcoatRoughnessTextureNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).X3DSingleTextureNode, this ._clearcoatRoughnessTexture);
this .setTexture (1, this .clearcoatRoughnessTextureNode);
},
set_clearcoatNormalTexture__ ()
{
this .clearcoatNormalTextureNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).X3DSingleTextureNode, this ._clearcoatNormalTexture);
this .setTexture (2, this .clearcoatNormalTextureNode);
},
getExtensionKey ()
{
return X_ITE_ExtensionKeys .CLEARCOAT_MATERIAL_EXTENSION;
},
getShaderOptions (options)
{
options .push ("X3D_CLEARCOAT_MATERIAL_EXT");
if (!+this .getTextureBits ())
return;
options .push ("X3D_MATERIAL_TEXTURES");
this .clearcoatTextureNode ?.getShaderOptions (options, "CLEARCOAT", true);
this .clearcoatRoughnessTextureNode ?.getShaderOptions (options, "CLEARCOAT_ROUGHNESS", true);
this .clearcoatNormalTextureNode ?.getShaderOptions (options, "CLEARCOAT_NORMAL", true);
},
getShaderUniforms (uniforms)
{
uniforms .push ("x3d_ClearcoatEXT");
uniforms .push ("x3d_ClearcoatRoughnessEXT");
},
setShaderUniforms (gl, shaderObject, textureTransformMapping, textureCoordinateMapping)
{
gl .uniform1f (shaderObject .x3d_ClearcoatEXT, this .clearcoat);
gl .uniform1f (shaderObject .x3d_ClearcoatRoughnessEXT, this .clearcoatRoughness);
if (!+this .getTextureBits ())
return;
this .clearcoatTextureNode ?.setNamedShaderUniforms (gl,
shaderObject .x3d_ClearcoatTextureEXT,
this ._clearcoatTextureMapping .getValue (),
textureTransformMapping,
textureCoordinateMapping);
this .clearcoatRoughnessTextureNode ?.setNamedShaderUniforms (gl,
shaderObject .x3d_ClearcoatRoughnessTextureEXT,
this ._clearcoatRoughnessTextureMapping .getValue (),
textureTransformMapping,
textureCoordinateMapping);
this .clearcoatNormalTextureNode ?.setNamedShaderUniforms (gl,
shaderObject .x3d_ClearcoatNormalTextureEXT,
this ._clearcoatNormalTextureMapping .getValue (),
textureTransformMapping,
textureCoordinateMapping);
},
});
Object .defineProperties (ClearcoatMaterialExtension,
{
... external_X_ITE_X3D_X3DNode_default().getStaticProperties ("ClearcoatMaterialExtension", "X_ITE", 1, "extensions", "4.0"),
fieldDefinitions:
{
value: new (external_X_ITE_X3D_FieldDefinitionArray_default()) ([
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "metadata", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "clearcoat", new (external_X_ITE_X3D_Fields_default()).SFFloat ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "clearcoatTextureMapping", new (external_X_ITE_X3D_Fields_default()).SFString ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "clearcoatTexture", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "clearcoatRoughness", new (external_X_ITE_X3D_Fields_default()).SFFloat ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "clearcoatRoughnessTextureMapping", new (external_X_ITE_X3D_Fields_default()).SFString ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "clearcoatRoughnessTexture", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "clearcoatNormalTextureMapping", new (external_X_ITE_X3D_Fields_default()).SFString ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "clearcoatNormalTexture", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
]),
enumerable: true,
},
});
const ClearcoatMaterialExtension_default_ = ClearcoatMaterialExtension;
;
/* harmony default export */ const X_ITE_ClearcoatMaterialExtension = (external_X_ITE_X3D_Namespace_default().add ("ClearcoatMaterialExtension", ClearcoatMaterialExtension_default_));
;// ./src/x_ite/Components/X_ITE/DepthMode.js
/**
* THIS NODE IS STILL EXPERIMENTAL.
*/
function DepthMode (executionContext)
{
external_X_ITE_X3D_X3DAppearanceChildNode_default().call (this, executionContext);
this .addType ((external_X_ITE_X3D_X3DConstants_default()).DepthMode);
this .addAlias ("depthFunc", this ._depthFunction);
}
Object .assign (Object .setPrototypeOf (DepthMode .prototype, (external_X_ITE_X3D_X3DAppearanceChildNode_default()).prototype),
{
initialize ()
{
external_X_ITE_X3D_X3DAppearanceChildNode_default().prototype .initialize .call (this);
this ._depthFunction .addInterest ("set_depthFunction__", this);
this .set_depthFunction__ ();
},
set_depthFunction__: (() =>
{
const depthFunctions = new Map ([
["NEVER", "NEVER"],
["LESS", "LESS"],
["EQUAL", "EQUAL"],
["LESS_EQUAL", "LEQUAL"],
["GREATER", "GREATER"],
["NOT_EQUAL", "NOTEQUAL"],
["GREATER_EQUAL", "GEQUAL"],
["ALWAYS", "ALWAYS"],
]);
return function ()
{
const gl = this .getBrowser () .getContext ();
this .depthFunction = gl [depthFunctions .get (this ._depthFunction .getValue ()) ?? "LEQUAL"];
};
})(),
enable (gl)
{
this .depthTest = gl .isEnabled (gl .DEPTH_TEST);
this .depthWriteMask = gl .getParameter (gl .DEPTH_WRITEMASK);
gl .enable (gl .POLYGON_OFFSET_FILL);
gl .polygonOffset (... this ._polygonOffset);
if (this ._depthTest .getValue ())
gl .enable (gl .DEPTH_TEST);
else
gl .disable (gl .DEPTH_TEST);
gl .depthFunc (this .depthFunction);
gl .depthRange (... this ._depthRange .getValue ());
gl .depthMask (this ._depthMask .getValue ());
},
disable (gl)
{
gl .disable (gl .POLYGON_OFFSET_FILL);
if (this .depthTest)
gl .enable (gl .DEPTH_TEST);
else
gl .disable (gl .DEPTH_TEST);
gl .depthFunc (gl .LEQUAL);
gl .depthRange (0, 1);
gl .depthMask (this .depthWriteMask);
},
});
Object .defineProperties (DepthMode,
{
... external_X_ITE_X3D_X3DNode_default().getStaticProperties ("DepthMode", "X_ITE", 1, "depthMode", "4.0"),
fieldDefinitions:
{
value: new (external_X_ITE_X3D_FieldDefinitionArray_default()) ([
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "metadata", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "polygonOffset", new (external_X_ITE_X3D_Fields_default()).SFVec2f ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "depthRange", new (external_X_ITE_X3D_Fields_default()).SFVec2f (0, 1)),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "depthTest", new (external_X_ITE_X3D_Fields_default()).SFBool (true)),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "depthFunction", new (external_X_ITE_X3D_Fields_default()).SFString ("LESS_EQUAL")),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "depthMask", new (external_X_ITE_X3D_Fields_default()).SFBool (true)),
]),
enumerable: true,
},
});
const DepthMode_default_ = DepthMode;
;
/* harmony default export */ const X_ITE_DepthMode = (external_X_ITE_X3D_Namespace_default().add ("DepthMode", DepthMode_default_));
;// ./src/x_ite/Components/X_ITE/DiffuseTransmissionMaterialExtension.js
// Register key.
X_ITE_ExtensionKeys .add ("DIFFUSE_TRANSMISSION_MATERIAL_EXTENSION");
// Register textures.
external_X_ITE_X3D_MaterialTextures_default().add ("x3d_DiffuseTransmissionTextureEXT");
external_X_ITE_X3D_MaterialTextures_default().add ("x3d_DiffuseTransmissionColorTextureEXT");
/**
* THIS NODE IS STILL EXPERIMENTAL.
*/
function DiffuseTransmissionMaterialExtension (executionContext)
{
X_ITE_X3DMaterialExtensionNode .call (this, executionContext);
this .addType ((external_X_ITE_X3D_X3DConstants_default()).DiffuseTransmissionMaterialExtension);
this .diffuseTransmissionColorArray = new Float32Array (3);
}
Object .assign (Object .setPrototypeOf (DiffuseTransmissionMaterialExtension .prototype, X_ITE_X3DMaterialExtensionNode .prototype),
{
initialize ()
{
X_ITE_X3DMaterialExtensionNode .prototype .initialize .call (this);
this ._diffuseTransmission .addInterest ("set_diffuseTransmission__", this);
this ._diffuseTransmissionTexture .addInterest ("set_diffuseTransmissionTexture__", this);
this ._diffuseTransmissionColor .addInterest ("set_diffuseTransmissionColor__", this);
this ._diffuseTransmissionColorTexture .addInterest ("set_diffuseTransmissionColorTexture__", this);
this .set_diffuseTransmission__ ();
this .set_diffuseTransmissionTexture__ ();
this .set_diffuseTransmissionColor__ ();
this .set_diffuseTransmissionColorTexture__ ();
},
set_diffuseTransmission__ ()
{
this .diffuseTransmission = external_X_ITE_X3D_Algorithm_default().clamp (this ._diffuseTransmission .getValue (), 0, 1);
},
set_diffuseTransmissionTexture__ ()
{
this .diffuseTransmissionTextureNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).X3DSingleTextureNode, this ._diffuseTransmissionTexture);
this .setTexture (0, this .diffuseTransmissionTextureNode);
},
set_diffuseTransmissionColor__ ()
{
this .diffuseTransmissionColorArray .set (this ._diffuseTransmissionColor .getValue ());
},
set_diffuseTransmissionColorTexture__ ()
{
this .diffuseTransmissionColorTextureNode = external_X_ITE_X3D_X3DCast_default() ((external_X_ITE_X3D_X3DConstants_default()).X3DSingleTextureNode, this ._diffuseTransmissionColorTexture);
this .setTexture (1, this .diffuseTransmissionColorTextureNode);
},
getExtensionKey ()
{
return X_ITE_ExtensionKeys .DIFFUSE_TRANSMISSION_MATERIAL_EXTENSION;
},
getShaderOptions (options)
{
options .push ("X3D_DIFFUSE_TRANSMISSION_MATERIAL_EXT");
if (!+this .getTextureBits ())
return;
options .push ("X3D_MATERIAL_TEXTURES");
this .diffuseTransmissionTextureNode ?.getShaderOptions (options, "DIFFUSE_TRANSMISSION", true);
this .diffuseTransmissionColorTextureNode ?.getShaderOptions (options, "DIFFUSE_TRANSMISSION_COLOR", true);
},
getShaderUniforms (uniforms)
{
uniforms .push ("x3d_DiffuseTransmissionEXT");
uniforms .push ("x3d_DiffuseTransmissionColorEXT");
},
setShaderUniforms (gl, shaderObject, textureTransformMapping, textureCoordinateMapping)
{
gl .uniform1f (shaderObject .x3d_DiffuseTransmissionEXT, this .diffuseTransmission);
gl .uniform3fv (shaderObject .x3d_DiffuseTransmissionColorEXT, this .diffuseTransmissionColorArray);
if (!+this .getTextureBits ())
return;
this .diffuseTransmissionTextureNode ?.setNamedShaderUniforms (gl,
shaderObject .x3d_DiffuseTransmissionTextureEXT,
this ._diffuseTransmissionTextureMapping .getValue (),
textureTransformMapping,
textureCoordinateMapping);
this .diffuseTransmissionColorTextureNode ?.setNamedShaderUniforms (gl,
shaderObject .x3d_DiffuseTransmissionColorTextureEXT,
this ._diffuseTransmissionColorTextureMapping .getValue (),
textureTransformMapping,
textureCoordinateMapping);
},
});
Object .defineProperties (DiffuseTransmissionMaterialExtension,
{
... external_X_ITE_X3D_X3DNode_default().getStaticProperties ("DiffuseTransmissionMaterialExtension", "X_ITE", 1, "extensions", "4.0"),
fieldDefinitions:
{
value: new (external_X_ITE_X3D_FieldDefinitionArray_default()) ([
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "metadata", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "diffuseTransmission", new (external_X_ITE_X3D_Fields_default()).SFFloat ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "diffuseTransmissionTextureMapping", new (external_X_ITE_X3D_Fields_default()).SFString ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "diffuseTransmissionTexture", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "diffuseTransmissionColor", new (external_X_ITE_X3D_Fields_default()).SFColor (1, 1, 1)),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "diffuseTransmissionColorTextureMapping", new (external_X_ITE_X3D_Fields_default()).SFString ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "diffuseTransmissionColorTexture", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
]),
enumerable: true,
},
});
const DiffuseTransmissionMaterialExtension_default_ = DiffuseTransmissionMaterialExtension;
;
/* harmony default export */ const X_ITE_DiffuseTransmissionMaterialExtension = (external_X_ITE_X3D_Namespace_default().add ("DiffuseTransmissionMaterialExtension", DiffuseTransmissionMaterialExtension_default_));
;// ./src/x_ite/Components/X_ITE/DispersionMaterialExtension.js
// Register key.
X_ITE_ExtensionKeys .add ("DISPERSION_MATERIAL_EXTENSION");
/**
* THIS NODE IS STILL EXPERIMENTAL.
*/
function DispersionMaterialExtension (executionContext)
{
X_ITE_X3DMaterialExtensionNode .call (this, executionContext);
this .addType ((external_X_ITE_X3D_X3DConstants_default()).DispersionMaterialExtension);
}
Object .assign (Object .setPrototypeOf (DispersionMaterialExtension .prototype, X_ITE_X3DMaterialExtensionNode .prototype),
{
initialize ()
{
X_ITE_X3DMaterialExtensionNode .prototype .initialize .call (this);
this ._dispersion .addInterest ("set_dispersion__", this);
this .set_dispersion__ ();
},
set_dispersion__ ()
{
this .dispersion = Math .max (this ._dispersion .getValue (), 0);
},
getExtensionKey ()
{
return X_ITE_ExtensionKeys .DISPERSION_MATERIAL_EXTENSION;
},
getShaderOptions (options)
{
options .push ("X3D_DISPERSION_MATERIAL_EXT");
},
getShaderUniforms (uniforms)
{
uniforms .push ("x3d_DispersionEXT");
},
setShaderUniforms (gl, shaderObject, textureTransformMapping, textureCoordinateMapping)
{
gl .uniform1f (shaderObject .x3d_DispersionEXT, this .dispersion);
},
});
Object .defineProperties (DispersionMaterialExtension,
{
... external_X_ITE_X3D_X3DNode_default().getStaticProperties ("DispersionMaterialExtension", "X_ITE", 1, "extensions", "4.0"),
fieldDefinitions:
{
value: new (external_X_ITE_X3D_FieldDefinitionArray_default()) ([
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "metadata", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "dispersion", new (external_X_ITE_X3D_Fields_default()).SFFloat ()),
]),
enumerable: true,
},
});
const DispersionMaterialExtension_default_ = DispersionMaterialExtension;
;
/* harmony default export */ const X_ITE_DispersionMaterialExtension = (external_X_ITE_X3D_Namespace_default().add ("DispersionMaterialExtension", DispersionMaterialExtension_default_));
;// ./src/x_ite/Components/X_ITE/EmissiveStrengthMaterialExtension.js
// Register key.
X_ITE_ExtensionKeys .add ("EMISSIVE_STRENGTH_MATERIAL_EXTENSION");
/**
* THIS NODE IS STILL EXPERIMENTAL.
*/
function EmissiveStrengthMaterialExtension (executionContext)
{
X_ITE_X3DMaterialExtensionNode .call (this, executionContext);
this .addType ((external_X_ITE_X3D_X3DConstants_default()).EmissiveStrengthMaterialExtension);
}
Object .assign (Object .setPrototypeOf (EmissiveStrengthMaterialExtension .prototype, X_ITE_X3DMaterialExtensionNode .prototype),
{
initialize ()
{
X_ITE_X3DMaterialExtensionNode .prototype .initialize .call (this);
this ._emissiveStrength .addInterest ("set_emissiveStrength__", this);
this .set_emissiveStrength__ ();
},
set_emissiveStrength__ ()
{
this .emissiveStrength = Math .max (this ._emissiveStrength .getValue (), 0);
},
getExtensionKey ()
{
return X_ITE_ExtensionKeys .EMISSIVE_STRENGTH_MATERIAL_EXTENSION;
},
getShaderOptions (options)
{
options .push ("X3D_EMISSIVE_STRENGTH_MATERIAL_EXT");
},
getShaderUniforms (uniforms)
{
uniforms .push ("x3d_EmissiveStrengthEXT");
},
setShaderUniforms (gl, shaderObject, textureTransformMapping, textureCoordinateMapping)
{
gl .uniform1f (shaderObject .x3d_EmissiveStrengthEXT, this .emissiveStrength);
},
});
Object .defineProperties (EmissiveStrengthMaterialExtension,
{
... external_X_ITE_X3D_X3DNode_default().getStaticProperties ("EmissiveStrengthMaterialExtension", "X_ITE", 1, "extensions", "4.0"),
fieldDefinitions:
{
value: new (external_X_ITE_X3D_FieldDefinitionArray_default()) ([
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "metadata", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "emissiveStrength", new (external_X_ITE_X3D_Fields_default()).SFFloat (1)),
]),
enumerable: true,
},
});
const EmissiveStrengthMaterialExtension_default_ = EmissiveStrengthMaterialExtension;
;
/* harmony default export */ const X_ITE_EmissiveStrengthMaterialExtension = (external_X_ITE_X3D_Namespace_default().add ("EmissiveStrengthMaterialExtension", EmissiveStrengthMaterialExtension_default_));
;// external "__X_ITE_X3D__ .X3DShapeNode"
const external_X_ITE_X3D_X3DShapeNode_namespaceObject = __X_ITE_X3D__ .X3DShapeNode;
var external_X_ITE_X3D_X3DShapeNode_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DShapeNode_namespaceObject);
;// external "__X_ITE_X3D__ .VertexArray"
const external_X_ITE_X3D_VertexArray_namespaceObject = __X_ITE_X3D__ .VertexArray;
var external_X_ITE_X3D_VertexArray_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_VertexArray_namespaceObject);
;// external "__X_ITE_X3D__ .Matrix4"
const external_X_ITE_X3D_Matrix4_namespaceObject = __X_ITE_X3D__ .Matrix4;
var external_X_ITE_X3D_Matrix4_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Matrix4_namespaceObject);
;// external "__X_ITE_X3D__ .Box3"
const external_X_ITE_X3D_Box3_namespaceObject = __X_ITE_X3D__ .Box3;
var external_X_ITE_X3D_Box3_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Box3_namespaceObject);
;// ./src/x_ite/Components/X_ITE/InstancedShape.js
/**
* THIS NODE IS STILL EXPERIMENTAL.
*/
function InstancedShape (executionContext)
{
external_X_ITE_X3D_X3DShapeNode_default().call (this, executionContext);
this .addType ((external_X_ITE_X3D_X3DConstants_default()).InstancedShape);
this .addChildObjects ((external_X_ITE_X3D_X3DConstants_default()).outputOnly, "matrices", new (external_X_ITE_X3D_Fields_default()).SFTime ());
// Units
this ._translations .setUnit ("length");
this ._centers .setUnit ("length");
// Private properties
this .numInstances = 0;
this .instancesStride = Float32Array .BYTES_PER_ELEMENT * (16 + 9); // mat4 + mat3
this .matrixOffset = 0;
this .normalMatrixOffset = Float32Array .BYTES_PER_ELEMENT * 16;
this .matrices = [ ];
}
Object .assign (Object .setPrototypeOf (InstancedShape .prototype, (external_X_ITE_X3D_X3DShapeNode_default()).prototype),
{
initialize ()
{
external_X_ITE_X3D_X3DShapeNode_default().prototype .initialize .call (this);
const
browser = this .getBrowser (),
gl = browser .getContext ();
this .instances = Object .assign (gl .createBuffer (),
{
vertexArrayObject: new (external_X_ITE_X3D_VertexArray_default()) (gl),
thickLinesVertexArrayObject: new (external_X_ITE_X3D_VertexArray_default()) (gl),
});
this ._translations .addInterest ("set_transform__", this);
this ._rotations .addInterest ("set_transform__", this);
this ._scales .addInterest ("set_transform__", this);
this ._scaleOrientations .addInterest ("set_transform__", this);
this ._centers .addInterest ("set_transform__", this);
this ._matrices .addInterest ("set_matrices__", this);
this .set_matrices__ ();
},
getShapeKey ()
{
return 3;
},
getNumInstances ()
{
return this .numInstances;
},
getInstances ()
{
return this .instances;
},
set_bbox__: (() =>
{
const bbox = new (external_X_ITE_X3D_Box3_default()) ();
return function ()
{
if (this .isDefaultBBoxSize ())
{
if (this .getGeometry ())
{
this .bbox .set ();
const geometryBBox = this .getGeometry () .getBBox ();
for (const matrix of this .matrices)
this .bbox .add (bbox .assign (geometryBBox) .multRight (matrix));
}
else
{
this .bbox .set ();
}
}
else
{
this .bbox .set (this ._bboxSize .getValue (), this ._bboxCenter .getValue ());
}
this .getBBoxSize () .assign (this .bbox .size);
this .getBBoxCenter () .assign (this .bbox .center);
};
})(),
set_transform__ ()
{
this ._matrices = this .getBrowser () .getCurrentTime ();
},
set_matrices__ ()
{
const
browser = this .getBrowser (),
gl = browser .getContext (),
translations = this ._translations,
rotations = this ._rotations,
scales = this ._scales,
scaleOrientations = this ._scaleOrientations,
centers = this ._centers,
numTranslations = translations .length,
numRotations = rotations .length,
numScales = scales .length,
numScaleOrientations = scaleOrientations .length,
numCenters = centers .length,
numInstances = Math .max (numTranslations, numRotations, numScales, numScaleOrientations, numCenters),
stride = this .instancesStride / Float32Array .BYTES_PER_ELEMENT,
length = this .instancesStride * numInstances,
data = new Float32Array (length);
this .numInstances = numInstances;
for (let i = 0, o = 0; i < numInstances; ++ i, o += stride)
{
const matrix = this .matrices [i] ??= new (external_X_ITE_X3D_Matrix4_default()) ();
matrix .set (numTranslations ? translations [Math .min (i, numTranslations - 1)] .getValue () : null,
numRotations ? rotations [Math .min (i, numRotations - 1)] .getValue () : null,
numScales ? scales [Math .min (i, numScales - 1)] .getValue () : null,
numScaleOrientations ? scaleOrientations [Math .min (i, numScaleOrientations - 1)] .getValue () : null,
numCenters ? centers [Math .min (i, numCenters - 1)] .getValue () : null);
data .set (matrix, o);
data .set (matrix .submatrix .transpose () .inverse (), o + 16);
}
this .matrices .length = numInstances;
gl .bindBuffer (gl .ARRAY_BUFFER, this .instances);
gl .bufferData (gl .ARRAY_BUFFER, data, gl .DYNAMIC_DRAW);
this .set_bbox__ ();
this .set_objects__ ();
},
displaySimple (gl, renderContext, shaderNode)
{
this .getGeometry () .displaySimpleInstanced (gl, shaderNode, this);
},
display (gl, renderContext)
{
this .getGeometry () .displayInstanced (gl, renderContext, this);
},
});
Object .defineProperties (InstancedShape,
{
... external_X_ITE_X3D_X3DNode_default().getStaticProperties ("InstancedShape", "X_ITE", 1, "children", "2.0"),
fieldDefinitions:
{
value: new (external_X_ITE_X3D_FieldDefinitionArray_default()) ([
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "metadata", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "translations", new (external_X_ITE_X3D_Fields_default()).MFVec3f ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "rotations", new (external_X_ITE_X3D_Fields_default()).MFRotation ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "scales", new (external_X_ITE_X3D_Fields_default()).MFVec3f ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "scaleOrientations", new (external_X_ITE_X3D_Fields_default()).MFRotation ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "centers", new (external_X_ITE_X3D_Fields_default()).MFVec3f ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "pointerEvents", new (external_X_ITE_X3D_Fields_default()).SFBool (true)),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "castShadow", new (external_X_ITE_X3D_Fields_default()).SFBool (true)),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "visible", new (external_X_ITE_X3D_Fields_default()).SFBool (true)),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "bboxDisplay", new (external_X_ITE_X3D_Fields_default()).SFBool ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "bboxSize", new (external_X_ITE_X3D_Fields_default()).SFVec3f (-1, -1, -1)),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "bboxCenter", new (external_X_ITE_X3D_Fields_default()).SFVec3f ()),
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3