x_ite 5.0.2 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +12 -5
- package/.vscode/tasks.json +21 -0
- package/Makefile +10 -15
- package/README.md +6 -11
- package/build/bin/dist.pl +0 -6
- package/build/bin/version.pl +1 -4
- package/dist/assets/components/annotation.js +2 -2
- package/dist/assets/components/annotation.min.js +1 -1
- package/dist/assets/components/cad-geometry.js +2 -2
- package/dist/assets/components/cad-geometry.min.js +1 -1
- package/dist/assets/components/cube-map-texturing.js +6 -19
- package/dist/assets/components/cube-map-texturing.min.js +1 -1
- package/dist/assets/components/dis.js +2 -2
- package/dist/assets/components/dis.min.js +1 -1
- package/dist/assets/components/event-utilities.js +3 -3
- package/dist/assets/components/event-utilities.min.js +1 -1
- package/dist/assets/components/geometry2d.js +4 -4
- package/dist/assets/components/geometry2d.min.js +1 -1
- package/dist/assets/components/geospatial.js +32 -1685
- package/dist/assets/components/geospatial.min.js +1 -1
- package/dist/assets/components/h-anim.js +70 -77
- package/dist/assets/components/h-anim.min.js +1 -1
- package/dist/assets/components/key-device-sensor.js +3 -3
- package/dist/assets/components/key-device-sensor.min.js +1 -1
- package/dist/assets/components/layout.js +38 -52
- package/dist/assets/components/layout.min.js +1 -1
- package/dist/assets/components/nurbs.js +277 -194
- package/dist/assets/components/nurbs.min.js +1 -1
- package/dist/assets/components/particle-systems.js +1918 -1658
- package/dist/assets/components/particle-systems.min.js +1 -1
- package/dist/assets/components/picking.js +33 -41
- package/dist/assets/components/picking.min.js +1 -1
- package/dist/assets/components/projective-texture-mapping.js +72 -86
- package/dist/assets/components/projective-texture-mapping.min.js +1 -1
- package/dist/assets/components/rigid-body-physics.js +36 -57
- package/dist/assets/components/rigid-body-physics.min.js +1 -1
- package/dist/assets/components/scripting.js +2 -2
- package/dist/assets/components/scripting.min.js +1 -1
- package/dist/assets/components/texturing-3d.js +26 -75
- package/dist/assets/components/texturing-3d.min.js +3 -3
- package/dist/assets/components/volume-rendering.js +10 -10
- package/dist/assets/components/volume-rendering.min.js +1 -1
- package/dist/assets/components/x_ite.js +2 -2
- package/dist/assets/components/x_ite.min.js +1 -1
- package/dist/assets/linetype/1.png +0 -0
- package/dist/assets/linetype/10.png +0 -0
- package/dist/assets/linetype/11.png +0 -0
- package/dist/assets/linetype/12.png +0 -0
- package/dist/assets/linetype/13.png +0 -0
- package/dist/assets/linetype/14.png +0 -0
- package/dist/assets/linetype/15.png +0 -0
- package/dist/assets/linetype/16.png +0 -0
- package/dist/assets/linetype/2.png +0 -0
- package/dist/assets/linetype/3.png +0 -0
- package/dist/assets/linetype/4.png +0 -0
- package/dist/assets/linetype/5.png +0 -0
- package/dist/assets/linetype/6.png +0 -0
- package/dist/assets/linetype/7.png +0 -0
- package/dist/assets/linetype/8.png +0 -0
- package/dist/assets/linetype/9.png +0 -0
- package/dist/assets/shaders/webgl1/Line.fs +0 -21
- package/dist/assets/shaders/webgl1/Line.vs +0 -10
- package/dist/assets/shaders/webgl1/PBR.vs +1 -1
- package/dist/assets/shaders/webgl2/Depth.vs +29 -1
- package/dist/assets/shaders/webgl2/Gouraud.vs +31 -3
- package/dist/assets/shaders/webgl2/Line.fs +24 -12
- package/dist/assets/shaders/webgl2/Line.vs +36 -11
- package/dist/assets/shaders/webgl2/LineTransform.fs +4 -0
- package/dist/assets/shaders/webgl2/LineTransform.vs +57 -0
- package/dist/assets/shaders/webgl2/PBR.vs +35 -7
- package/dist/assets/shaders/webgl2/Phong.vs +31 -3
- package/dist/assets/shaders/webgl2/Point.vs +29 -1
- package/dist/assets/shaders/webgl2/Unlit.vs +31 -3
- package/dist/example.html +6 -6
- package/dist/x_ite.css +180 -208
- package/dist/x_ite.js +16477 -16629
- package/dist/x_ite.min.js +17 -17
- package/dist/x_ite.zip +0 -0
- package/docs/404.md +6 -0
- package/docs/Accessing-the-External-Browser.md +20 -14
- package/docs/Browser-Support.md +6 -0
- package/docs/Custom-Shaders.md +17 -24
- package/docs/Features.md +7 -1
- package/docs/Gemfile +44 -0
- package/docs/Gemfile.lock +122 -0
- package/docs/Glossary.md +6 -0
- package/docs/How-To-Configure-Your-Web-Server.md +6 -0
- package/docs/Supported-Nodes.md +9 -1
- package/docs/What's-New.md +31 -0
- package/docs/XHTML-DOM-Integration.md +6 -0
- package/docs/_config.yml +1 -1
- package/docs/assets/css/main.scss +26 -0
- package/docs/index.md +38 -46
- package/docs/reference/Browser-Services.md +9 -3
- package/docs/reference/Constants-Services.md +6 -0
- package/docs/reference/ECMAScript-Object-and-Function-Definitions.md +6 -0
- package/docs/reference/Field-Services-and-Objects.md +6 -0
- package/docs/reference/Prototype-Services.md +6 -0
- package/docs/reference/Route-Services.md +6 -0
- package/docs/reference/Scene-Services.md +8 -2
- package/docs/reference/Script-Node-Authoring-Interface.md +7 -1
- package/docs/tutorials/Adding-backgrounds.md +6 -0
- package/docs/tutorials/Adding-fog.md +6 -0
- package/docs/tutorials/Adding-sound.md +6 -0
- package/docs/tutorials/Animating-transforms.md +6 -0
- package/docs/tutorials/Basic-Nodes.md +6 -0
- package/docs/tutorials/Building-a-X3D-world.md +6 -0
- package/docs/tutorials/Building-elevation-grids.md +6 -0
- package/docs/tutorials/Building-extruded-shapes.md +6 -0
- package/docs/tutorials/Building-primitive-shapes.md +6 -0
- package/docs/tutorials/Building-shapes-out-of-points,-lines,-and-faces.md +6 -0
- package/docs/tutorials/Controlling-appearance-with-materials.md +6 -0
- package/docs/tutorials/Controlling-color-on-coordinate-based-geometry.md +6 -0
- package/docs/tutorials/Controlling-detail.md +6 -0
- package/docs/tutorials/Controlling-how-textures-are-mapped.md +6 -0
- package/docs/tutorials/Controlling-navigation.md +6 -0
- package/docs/tutorials/Controlling-shading-on-coordinate-based-geometry.md +6 -0
- package/docs/tutorials/Controlling-the-viewpoint.md +6 -0
- package/docs/tutorials/Creating-new-node-types.md +6 -0
- package/docs/tutorials/Grouping-nodes.md +6 -0
- package/docs/tutorials/Hello,-World!.md +6 -0
- package/docs/tutorials/Improving-Performance.md +6 -0
- package/docs/tutorials/Increasing-Rendering-Speed.md +6 -0
- package/docs/tutorials/Introducing-X3D.md +6 -0
- package/docs/tutorials/Introducing-animation.md +6 -0
- package/docs/tutorials/Introducing-script-use.md +6 -0
- package/docs/tutorials/Lighting-your-world.md +6 -0
- package/docs/tutorials/Mapping-textures.md +6 -0
- package/docs/tutorials/Naming-nodes.md +6 -0
- package/docs/tutorials/Providing-information-about-your-world.md +6 -0
- package/docs/tutorials/Sensing-the-viewer.md +6 -0
- package/docs/tutorials/Sensing-viewer-actions.md +6 -0
- package/docs/tutorials/Transforming-Shapes.md +6 -0
- package/docs/tutorials/Writing-program-scripts-with-ECMAScript.md +6 -0
- package/docs/tutorials/index.md +6 -0
- package/package.json +6 -7
- package/src/assets/components/geometry2d.js +1 -1
- package/src/assets/components/key-device-sensor.js +1 -1
- package/src/assets/components/layout.js +1 -1
- package/src/assets/components/particle-systems.js +1 -1
- package/src/assets/components/volume-rendering.js +1 -1
- package/src/assets/linetype/1.png +0 -0
- package/src/assets/linetype/10.png +0 -0
- package/src/assets/linetype/11.png +0 -0
- package/src/assets/linetype/12.png +0 -0
- package/src/assets/linetype/13.png +0 -0
- package/src/assets/linetype/14.png +0 -0
- package/src/assets/linetype/15.png +0 -0
- package/src/assets/linetype/16.png +0 -0
- package/src/assets/linetype/2.png +0 -0
- package/src/assets/linetype/3.png +0 -0
- package/src/assets/linetype/4.png +0 -0
- package/src/assets/linetype/5.png +0 -0
- package/src/assets/linetype/6.png +0 -0
- package/src/assets/linetype/7.png +0 -0
- package/src/assets/linetype/8.png +0 -0
- package/src/assets/linetype/9.png +0 -0
- package/src/assets/shaders/Types.glsl +1 -9
- package/src/assets/shaders/webgl1/Line.fs +3 -28
- package/src/assets/shaders/webgl1/Line.vs +5 -19
- package/src/assets/shaders/webgl1/PBR.vs +1 -1
- package/src/assets/shaders/webgl1/Point.vs +2 -3
- package/src/assets/shaders/webgl2/Depth.vs +4 -1
- package/src/assets/shaders/webgl2/Gouraud.vs +5 -3
- package/src/assets/shaders/webgl2/Line.fs +11 -17
- package/src/assets/shaders/webgl2/Line.vs +16 -20
- package/src/assets/shaders/webgl2/LineTransform.fs +6 -0
- package/src/assets/shaders/webgl2/LineTransform.vs +77 -0
- package/src/assets/shaders/webgl2/PBR.vs +10 -7
- package/src/assets/shaders/webgl2/Phong.vs +6 -3
- package/src/assets/shaders/webgl2/Point.vs +6 -6
- package/src/assets/shaders/webgl2/Unlit.vs +6 -3
- package/src/assets/shaders/webgl2/include/Line2.glsl +20 -0
- package/src/assets/shaders/webgl2/include/Particle.glsl +36 -0
- package/src/example.html +6 -6
- package/src/standard/Math/Algorithm.js +12 -28
- package/src/standard/Math/Geometry/Plane3.js +0 -2
- package/src/standard/Math/Geometry/ViewVolume.js +88 -83
- package/src/standard/Math/Numbers/Color3.js +6 -0
- package/src/standard/Math/Numbers/Color4.js +7 -0
- package/src/standard/Math/Numbers/Complex.js +5 -0
- package/src/standard/Math/Numbers/Matrix2.js +20 -2
- package/src/standard/Math/Numbers/Matrix3.js +129 -110
- package/src/standard/Math/Numbers/Matrix4.js +138 -119
- package/src/standard/Math/Numbers/Quaternion.js +7 -0
- package/src/standard/Math/Numbers/Rotation4.js +7 -0
- package/src/standard/Math/Numbers/Vector2.js +8 -5
- package/src/standard/Math/Numbers/Vector3.js +16 -10
- package/src/standard/Math/Numbers/Vector4.js +12 -7
- package/src/standard/Math/Utility/BVH.js +45 -17
- package/src/tests.js +6 -1
- package/src/x_ite/Base/X3DBaseNode.js +22 -11
- package/src/x_ite/Base/X3DField.js +1 -1
- package/src/x_ite/Browser/Core/BrowserOptions.js +2 -2
- package/src/x_ite/Browser/Core/BrowserTimings.js +4 -2
- package/src/x_ite/Browser/Core/Context.js +185 -0
- package/src/x_ite/Browser/Core/ContextMenu.js +299 -193
- package/src/x_ite/Browser/Core/Notification.js +1 -0
- package/src/x_ite/Browser/Core/X3DCoreContext.js +35 -146
- package/src/x_ite/Browser/Layout/ScreenText.js +11 -4
- package/src/x_ite/Browser/Layout/X3DLayoutContext.js +4 -15
- package/src/x_ite/Browser/Navigation/ExamineViewer.js +12 -19
- package/src/x_ite/Browser/Navigation/LookAtViewer.js +0 -3
- package/src/x_ite/Browser/Navigation/PlaneViewer.js +0 -3
- package/src/x_ite/Browser/Navigation/X3DFlyViewer.js +14 -7
- package/src/x_ite/Browser/Navigation/X3DViewer.js +12 -20
- package/src/x_ite/Browser/Networking/X3DNetworkingContext.js +11 -7
- package/src/x_ite/Browser/ParticleSystems/BVH.glsl +183 -0
- package/src/x_ite/Browser/ParticleSystems/Box3.glsl +47 -0
- package/src/x_ite/Browser/ParticleSystems/GeometryTypes.js +66 -0
- package/src/x_ite/Browser/ParticleSystems/Line3.glsl +55 -0
- package/src/x_ite/Browser/ParticleSystems/Plane3.glsl +160 -0
- package/src/x_ite/Browser/PointingDeviceSensor/PointingDevice.js +27 -3
- package/src/x_ite/Browser/PointingDeviceSensor/X3DPointingDeviceSensorContext.js +37 -37
- package/src/x_ite/Browser/Rendering/X3DRenderingContext.js +19 -13
- package/src/x_ite/Browser/Shaders/Shader.js +33 -12
- package/src/x_ite/Browser/Shaders/ShaderSource.js +6 -0
- package/src/x_ite/Browser/Shaders/ShaderTest.js +16 -10
- package/src/x_ite/Browser/Shape/X3DShapeContext.js +50 -9
- package/src/x_ite/Browser/Text/X3DTextContext.js +4 -13
- package/src/x_ite/Browser/Texturing/X3DTexturingContext.js +23 -33
- package/src/x_ite/Browser/Texturing3D/DICOMParser.js +2 -2
- package/src/x_ite/Browser/Time/X3DTimeContext.js +3 -1
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Browser/X3DBrowser.js +7 -6
- package/src/x_ite/Browser/X3DBrowserContext.js +35 -10
- package/src/x_ite/Components/Core/X3DNode.js +4 -0
- package/src/x_ite/Components/Core/X3DPrototypeInstance.js +0 -2
- package/src/x_ite/Components/CubeMapTexturing/ComposedCubeMapTexture.js +3 -4
- package/src/x_ite/Components/CubeMapTexturing/GeneratedCubeMapTexture.js +1 -12
- package/src/x_ite/Components/CubeMapTexturing/ImageCubeMapTexture.js +0 -1
- package/src/x_ite/Components/EnvironmentalEffects/TextureBackground.js +1 -1
- package/src/x_ite/Components/EnvironmentalEffects/X3DBackgroundNode.js +76 -77
- package/src/x_ite/Components/EnvironmentalEffects/X3DFogObject.js +2 -9
- package/src/x_ite/Components/EnvironmentalSensor/ProximitySensor.js +51 -65
- package/src/x_ite/Components/EventUtilities/X3DSequencerNode.js +1 -1
- package/src/x_ite/Components/Followers/X3DChaserNode.js +18 -32
- package/src/x_ite/Components/Followers/X3DDamperNode.js +1 -6
- package/src/x_ite/Components/Geometry2D/TriangleSet2D.js +1 -1
- package/src/x_ite/Components/Geometry3D/ElevationGrid.js +12 -4
- package/src/x_ite/Components/Geometry3D/IndexedFaceSet.js +4 -4
- package/src/x_ite/Components/Geospatial/GeoCoordinate.js +10 -27
- package/src/x_ite/Components/Geospatial/GeoPositionInterpolator.js +5 -10
- package/src/x_ite/Components/Geospatial/GeoTouchSensor.js +9 -16
- package/src/x_ite/Components/Geospatial/GeoTransform.js +6 -18
- package/src/x_ite/Components/Geospatial/X3DGeospatialObject.js +20 -27
- package/src/x_ite/Components/Grouping/X3DGroupingNode.js +8 -8
- package/src/x_ite/Components/Grouping/X3DTransformNode.js +0 -4
- package/src/x_ite/Components/HAnim/HAnimHumanoid.js +68 -75
- package/src/x_ite/Components/Interpolation/OrientationInterpolator.js +4 -11
- package/src/x_ite/Components/Interpolation/X3DInterpolatorNode.js +1 -1
- package/src/x_ite/Components/Layout/LayoutGroup.js +4 -9
- package/src/x_ite/Components/Layout/ScreenFontStyle.js +1 -1
- package/src/x_ite/Components/Layout/ScreenGroup.js +18 -23
- package/src/x_ite/Components/Lighting/DirectionalLight.js +28 -36
- package/src/x_ite/Components/Lighting/PointLight.js +32 -47
- package/src/x_ite/Components/Lighting/SpotLight.js +33 -48
- package/src/x_ite/Components/Navigation/Billboard.js +49 -56
- package/src/x_ite/Components/Navigation/LOD.js +1 -1
- package/src/x_ite/Components/Navigation/X3DViewpointNode.js +82 -111
- package/src/x_ite/Components/Networking/Anchor.js +10 -4
- package/src/x_ite/Components/ParticleSystems/BoundedPhysicsModel.js +6 -6
- package/src/x_ite/Components/ParticleSystems/ConeEmitter.js +44 -36
- package/src/x_ite/Components/ParticleSystems/ExplosionEmitter.js +26 -17
- package/src/x_ite/Components/ParticleSystems/ForcePhysicsModel.js +20 -7
- package/src/x_ite/Components/ParticleSystems/ParticleSystem.js +461 -876
- package/src/x_ite/Components/ParticleSystems/PointEmitter.js +39 -35
- package/src/x_ite/Components/ParticleSystems/PolylineEmitter.js +112 -128
- package/src/x_ite/Components/ParticleSystems/SurfaceEmitter.js +105 -112
- package/src/x_ite/Components/ParticleSystems/VolumeEmitter.js +138 -176
- package/src/x_ite/Components/ParticleSystems/WindPhysicsModel.js +16 -11
- package/src/x_ite/Components/ParticleSystems/X3DParticleEmitterNode.js +807 -217
- package/src/x_ite/Components/Picking/LinePickSensor.js +31 -39
- package/src/x_ite/Components/PointingDeviceSensor/CylinderSensor.js +90 -107
- package/src/x_ite/Components/PointingDeviceSensor/PlaneSensor.js +48 -55
- package/src/x_ite/Components/PointingDeviceSensor/SphereSensor.js +53 -70
- package/src/x_ite/Components/PointingDeviceSensor/TouchSensor.js +8 -15
- package/src/x_ite/Components/ProjectiveTextureMapping/TextureProjectorParallel.js +43 -50
- package/src/x_ite/Components/ProjectiveTextureMapping/TextureProjectorPerspective.js +32 -39
- package/src/x_ite/Components/Rendering/ClipPlane.js +3 -11
- package/src/x_ite/Components/Rendering/Color.js +12 -37
- package/src/x_ite/Components/Rendering/ColorRGBA.js +13 -38
- package/src/x_ite/Components/Rendering/IndexedLineSet.js +12 -4
- package/src/x_ite/Components/Rendering/LineSet.js +21 -13
- package/src/x_ite/Components/Rendering/PointSet.js +21 -13
- package/src/x_ite/Components/Rendering/X3DColorNode.js +13 -0
- package/src/x_ite/Components/Rendering/X3DComposedGeometryNode.js +13 -5
- package/src/x_ite/Components/Rendering/X3DGeometryNode.js +248 -325
- package/src/x_ite/Components/Rendering/X3DLineGeometryNode.js +305 -134
- package/src/x_ite/Components/Rendering/X3DPointGeometryNode.js +99 -122
- package/src/x_ite/Components/RigidBodyPhysics/DoubleAxisHingeJoint.js +24 -38
- package/src/x_ite/Components/RigidBodyPhysics/SingleAxisHingeJoint.js +10 -17
- package/src/x_ite/Components/Shaders/ComposedShader.js +35 -75
- package/src/x_ite/Components/Shaders/FloatVertexAttribute.js +5 -15
- package/src/x_ite/Components/Shaders/Matrix3VertexAttribute.js +7 -24
- package/src/x_ite/Components/Shaders/Matrix4VertexAttribute.js +7 -24
- package/src/x_ite/Components/Shaders/ShaderPart.js +1 -10
- package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +219 -209
- package/src/x_ite/Components/Shaders/X3DShaderNode.js +1 -1
- package/src/x_ite/Components/Shaders/X3DVertexAttributeNode.js +23 -1
- package/src/x_ite/Components/Shape/Appearance.js +12 -0
- package/src/x_ite/Components/Shape/FillProperties.js +12 -1
- package/src/x_ite/Components/Shape/LineProperties.js +33 -1
- package/src/x_ite/Components/Shape/PointProperties.js +23 -1
- package/src/x_ite/Components/Shape/Shape.js +27 -34
- package/src/x_ite/Components/Sound/Sound.js +30 -40
- package/src/x_ite/Components/Text/Text.js +6 -20
- package/src/x_ite/Components/Texturing/TextureCoordinate.js +5 -26
- package/src/x_ite/Components/Texturing/TextureProperties.js +4 -4
- package/src/x_ite/Components/Texturing/X3DSingleTextureCoordinateNode.js +21 -0
- package/src/x_ite/Components/Texturing/X3DSingleTextureNode.js +5 -4
- package/src/x_ite/Components/Texturing/X3DTexture2DNode.js +24 -33
- package/src/x_ite/Components/Texturing3D/TextureCoordinate3D.js +5 -26
- package/src/x_ite/Components/Texturing3D/TextureCoordinate4D.js +5 -26
- package/src/x_ite/Components/Texturing3D/X3DTexture3DNode.js +12 -19
- package/src/x_ite/Components/VolumeRendering/X3DVolumeDataNode.js +7 -7
- package/src/x_ite/Components.js +2 -2
- package/src/x_ite/Fallback.js +9 -3
- package/src/x_ite/Fields/SFColor.js +4 -0
- package/src/x_ite/Fields/SFColorRGBA.js +4 -0
- package/src/x_ite/Fields/SFMatrixPrototypeTemplate.js +4 -0
- package/src/x_ite/Fields/SFRotation.js +4 -0
- package/src/x_ite/Fields/SFString.js +4 -0
- package/src/x_ite/Fields/SFVecPrototypeTemplate.js +4 -0
- package/src/x_ite/Parser/XMLParser.js +1 -1
- package/src/x_ite/Rendering/TextureBuffer.js +43 -36
- package/src/x_ite/Rendering/VertexArray.js +101 -0
- package/src/x_ite/Rendering/X3DRenderObject.js +123 -144
- package/src/x_ite/X3D.js +32 -26
- package/src/x_ite.config.js +0 -5
- package/src/x_ite.css +200 -162
- package/src/x_ite.html +26 -10
- package/src/x_ite.js +42 -0
- package/x_ite.min.html +26 -10
- package/dist/assets/hatching/0.png +0 -0
- package/dist/assets/linetype/0.png +0 -0
- package/src/assets/hatching/0.png +0 -0
- package/src/assets/linetype/0.png +0 -0
- package/src/spinner.css +0 -67
- package/src/x_ite/Browser/Shape/LineStipples.xcf +0 -0
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
var module = { }, exports, process;
|
|
5
5
|
|
|
6
6
|
const
|
|
7
|
-
define = window [Symbol .for ("X_ITE.X3D-
|
|
8
|
-
require = window [Symbol .for ("X_ITE.X3D-
|
|
7
|
+
define = window [Symbol .for ("X_ITE.X3D-6.0.0")] .define,
|
|
8
|
+
require = window [Symbol .for ("X_ITE.X3D-6.0.0")] .require;
|
|
9
9
|
/* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
|
|
10
10
|
*******************************************************************************
|
|
11
11
|
*
|
|
@@ -1858,14 +1858,14 @@ function (Fields,
|
|
|
1858
1858
|
|
|
1859
1859
|
this .addType (X3DConstants .X3DVolumeDataNode);
|
|
1860
1860
|
|
|
1861
|
-
this .proximitySensorNode = executionContext .createNode ("ProximitySensor",
|
|
1862
|
-
this .transformNode = executionContext .createNode ("Transform",
|
|
1863
|
-
this .shapeNode = executionContext .createNode ("Shape",
|
|
1864
|
-
this .appearanceNode = executionContext .createNode ("Appearance",
|
|
1865
|
-
this .textureTransformNode = executionContext .createNode ("TextureTransform3D",
|
|
1866
|
-
this .geometryNode = executionContext .createNode ("QuadSet",
|
|
1861
|
+
this .proximitySensorNode = executionContext .createNode ("ProximitySensor", false);
|
|
1862
|
+
this .transformNode = executionContext .createNode ("Transform", false);
|
|
1863
|
+
this .shapeNode = executionContext .createNode ("Shape", false);
|
|
1864
|
+
this .appearanceNode = executionContext .createNode ("Appearance", false);
|
|
1865
|
+
this .textureTransformNode = executionContext .createNode ("TextureTransform3D", false);
|
|
1866
|
+
this .geometryNode = executionContext .createNode ("QuadSet", false);
|
|
1867
1867
|
this .textureCoordinateNode = executionContext .createNode ("TextureCoordinate3D", false);
|
|
1868
|
-
this .coordinateNode = executionContext .createNode ("Coordinate",
|
|
1868
|
+
this .coordinateNode = executionContext .createNode ("Coordinate", false);
|
|
1869
1869
|
|
|
1870
1870
|
this .setCameraObject (true);
|
|
1871
1871
|
}
|
|
@@ -3971,7 +3971,7 @@ function (Components,
|
|
|
3971
3971
|
X3DVolumeDataNode: X3DVolumeDataNode,
|
|
3972
3972
|
X3DVolumeRenderStyleNode: X3DVolumeRenderStyleNode,
|
|
3973
3973
|
},
|
|
3974
|
-
|
|
3974
|
+
context: X3DVolumeRenderingContext,
|
|
3975
3975
|
});
|
|
3976
3976
|
});
|
|
3977
3977
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){const e=window[Symbol.for("X_ITE.X3D-5.0.2")].define,t=window[Symbol.for("X_ITE.X3D-5.0.2")].require;e("x_ite/Components/VolumeRendering/X3DVolumeRenderStyleNode",["x_ite/Components/Core/X3DNode","x_ite/Base/X3DConstants"],(function(e,t){"use strict";function n(n){e.call(this,n),this.addType(t.X3DVolumeRenderStyleNode),this.volumeDataNodes=new Set}return n.prototype=Object.assign(Object.create(e.prototype),{constructor:n,addShaderFields:function(e){},getUniformsText:function(){return""},getFunctionsText:function(){return""},getVolumeData:function(){return this.volumeDataNodes},addVolumeData:function(e){this.volumeDataNodes.add(e)},removeVolumeData:function(e){this.volumeDataNodes.delete(e)},getNormalText:function(e){var t="";return e?(t+="uniform sampler3D surfaceNormals_"+this.getId()+";\n",t+="\n",t+="vec4\n",t+="getNormal_"+this.getId()+" (in vec3 texCoord)\n",t+="{\n",t+="\tvec3 n = texture (surfaceNormals_"+this.getId()+", texCoord) .xyz * 2.0 - 1.0;\n",t+="\n",t+="\treturn vec4 (normalize (x3d_TextureNormalMatrix * n), length (n));\n",t+="}\n"):(t+="\n",t+="vec4\n",t+="getNormal_"+this.getId()+" (in vec3 texCoord)\n",t+="{\n",t+="\tvec4 offset = vec4 (1.0 / x3d_TextureSize, 0.0);\n",t+="\tfloat i0 = texture (x3d_Texture3D [0], texCoord + offset .xww) .r;\n",t+="\tfloat i1 = texture (x3d_Texture3D [0], texCoord - offset .xww) .r;\n",t+="\tfloat i2 = texture (x3d_Texture3D [0], texCoord + offset .wyw) .r;\n",t+="\tfloat i3 = texture (x3d_Texture3D [0], texCoord - offset .wyw) .r;\n",t+="\tfloat i4 = texture (x3d_Texture3D [0], texCoord + offset .wwz) .r;\n",t+="\tfloat i5 = texture (x3d_Texture3D [0], texCoord - offset .wwz) .r;\n",t+="\tvec3 n = vec3 (i1 - i0, i3 - i2, i5 - i4);\n",t+="\n",t+="\treturn vec4 (normalize (x3d_TextureNormalMatrix * n), length (n));\n",t+="}\n"),t}}),n})),e("x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode",["x_ite/Components/VolumeRendering/X3DVolumeRenderStyleNode","x_ite/Base/X3DConstants"],(function(e,t){"use strict";function n(n){e.call(this,n),this.addType(t.X3DComposableVolumeRenderStyleNode)}return n.prototype=Object.assign(Object.create(e.prototype),{constructor:n}),n})),e("x_ite/Components/VolumeRendering/OpacityMapVolumeStyle",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast"],(function(e,t,n,o,i,r){"use strict";function s(e){o.call(this,e),this.addType(i.OpacityMapVolumeStyle)}return s.prototype=Object.assign(Object.create(o.prototype),{constructor:s,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(i.inputOutput,"enabled",new e.SFBool(!0)),new t(i.inputOutput,"metadata",new e.SFNode),new t(i.inputOutput,"transferFunction",new e.SFNode)]),getTypeName:function(){return"OpacityMapVolumeStyle"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"renderStyle"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._transferFunction.addInterest("set_transferFunction__",this),this.set_transferFunction__())},set_transferFunction__:function(){this.transferFunctionNode=r(i.X3DTexture2DNode,this._transferFunction),this.transferFunctionNode||(this.transferFunctionNode=r(i.X3DTexture3DNode,this._transferFunction)),this.transferFunctionNode||(this.transferFunctionNode=this.getBrowser().getDefaultTransferFunction())},addShaderFields:function(t){this._enabled.getValue()&&t.addUserDefinedField(i.inputOutput,"transferFunction_"+this.getId(),new e.SFNode(this.transferFunctionNode))},getUniformsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="// OpacityMapVolumeStyle\n",e+="\n",-1!==this.transferFunctionNode.getType().indexOf(i.X3DTexture2DNode)?(e+="uniform sampler2D transferFunction_"+this.getId()+";\n",e+="\n",e+="vec4\n",e+="getOpacityMapStyle_"+this.getId()+" (in vec4 originalColor)\n",e+="{\n",e+="\treturn texture (transferFunction_"+this.getId()+", originalColor .rg);\n",e+="}\n"):(e+="uniform sampler3D transferFunction_"+this.getId()+";\n",e+="\n",e+="vec4\n",e+="getOpacityMapStyle_"+this.getId()+" (in vec4 originalColor)\n",e+="{\n",e+="\treturn texture (transferFunction_"+this.getId()+", originalColor .rgb);\n",e+="}\n"),e},getFunctionsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="\t// OpacityMapVolumeStyle\n",e+="\n",e+="\ttextureColor = getOpacityMapStyle_"+this.getId()+" (textureColor);\n"}}),s})),e("x_ite/Browser/VolumeRendering/X3DVolumeRenderingContext",["x_ite/Components/Texturing/PixelTexture","x_ite/Components/Texturing/TextureProperties","x_ite/Components/VolumeRendering/OpacityMapVolumeStyle"],(function(e,t,n){"use strict";const o=Symbol(),i=Symbol(),r=Symbol();function s(){}return s.prototype={getDefaultVolumeStyle:function(){return this[o]=new n(this.getPrivateScene()),this[o].setup(),this.getDefaultVolumeStyle=function(){return this[o]},Object.defineProperty(this,"getDefaultVolumeStyle",{enumerable:!1}),this[o]},getDefaultBlendedVolumeStyle:function(){return this[i]=new n(this.getPrivateScene()),this[i].setup(),this.getDefaultBlendedVolumeStyle=function(){return this[i]},Object.defineProperty(this,"getDefaultBlendedVolumeStyle",{enumerable:!1}),this[i]},getDefaultTransferFunction:function(){this[r]=new e(this.getPrivateScene());const n=new t(this.getPrivateScene());n._generateMipMaps=!0,n._boundaryModeS="CLAMP_TO_EDGE",n._boundaryModeT="REPEAT",this[r]._textureProperties=n,this[r]._image.width=256,this[r]._image.height=1,this[r]._image.comp=2;const o=this[r]._image.array;for(let e=0;e<256;++e)o[e]=e<<8|e;return n.setup(),this[r].setup(),this.getDefaultTransferFunction=function(){return this[r]},Object.defineProperty(this,"getDefaultTransferFunction",{enumerable:!1}),this[r]}},s})),e("x_ite/Components/VolumeRendering/BlendedVolumeStyle",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast","x_ite/DEBUG"],(function(e,t,n,o,i,r,s){"use strict";function a(e){o.call(this,e),this.addType(i.BlendedVolumeStyle)}return a.prototype=Object.assign(Object.create(o.prototype),{constructor:a,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(i.inputOutput,"metadata",new e.SFNode),new t(i.inputOutput,"enabled",new e.SFBool(!0)),new t(i.inputOutput,"weightConstant1",new e.SFFloat(.5)),new t(i.inputOutput,"weightConstant2",new e.SFFloat(.5)),new t(i.inputOutput,"weightFunction1",new e.SFString("CONSTANT")),new t(i.inputOutput,"weightFunction2",new e.SFString("CONSTANT")),new t(i.inputOutput,"weightTransferFunction1",new e.SFNode),new t(i.inputOutput,"weightTransferFunction2",new e.SFNode),new t(i.inputOutput,"renderStyle",new e.SFNode),new t(i.inputOutput,"voxels",new e.SFNode)]),getTypeName:function(){return"BlendedVolumeStyle"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"renderStyle"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._weightTransferFunction1.addInterest("set_weightTransferFunction1__",this),this._weightTransferFunction2.addInterest("set_weightTransferFunction2__",this),this._renderStyle.addInterest("set_renderStyle__",this),this._voxels.addInterest("set_voxels__",this),this.set_weightTransferFunction1__(),this.set_weightTransferFunction2__(),this.set_renderStyle__(),this.set_voxels__())},addVolumeData:function(e){o.prototype.addVolumeData.call(this,e),this.renderStyleNode&&this.renderStyleNode.addVolumeData(e)},removeVolumeData:function(e){o.prototype.removeVolumeData.call(this,e),this.renderStyleNode&&this.renderStyleNode.removeVolumeData(e)},set_weightTransferFunction1__:function(){this.weightTransferFunction1Node=r(i.X3DTexture2DNode,this._weightTransferFunction1)},set_weightTransferFunction2__:function(){this.weightTransferFunction2Node=r(i.X3DTexture2DNode,this._weightTransferFunction2)},set_renderStyle__:function(){this.renderStyleNode&&(this.renderStyleNode.removeInterest("addNodeEvent",this),this.getVolumeData().forEach(function(e){this.renderStyleNode.removeVolumeData(e)}.bind(this))),this.renderStyleNode=r(i.X3DComposableVolumeRenderStyleNode,this._renderStyle),this.renderStyleNode&&(this.renderStyleNode.addInterest("addNodeEvent",this),this.getVolumeData().forEach(function(e){this.renderStyleNode.addVolumeData(e)}.bind(this)))},set_voxels__:function(){this.voxelsNode&&this.voxelsNode.removeInterest("set_textureSize__",this),this.voxelsNode=r(i.X3DTexture3DNode,this._voxels),this.voxelsNode&&(this.voxelsNode.addInterest("set_textureSize__",this),this.set_textureSize__())},set_textureSize__:function(){this.getVolumeData().forEach(function(e){try{var t=e.getShader().getField("textureSize_"+this.getId());t.x=this.voxelsNode.getWidth(),t.y=this.voxelsNode.getHeight(),t.z=this.voxelsNode.getDepth()}catch(e){s&&console.error(e)}}.bind(this))},addShaderFields:function(t){if(this._enabled.getValue()){if(t.addUserDefinedField(i.inputOutput,"weightConstant1_"+this.getId(),this._weightConstant1.copy()),t.addUserDefinedField(i.inputOutput,"weightConstant2_"+this.getId(),this._weightConstant2.copy()),this.weightTransferFunction1Node&&t.addUserDefinedField(i.inputOutput,"weightTransferFunction1_"+this.getId(),new e.SFNode(this.weightTransferFunction1Node)),this.weightTransferFunction2Node&&t.addUserDefinedField(i.inputOutput,"weightTransferFunction2_"+this.getId(),new e.SFNode(this.weightTransferFunction2Node)),this.voxelsNode){var n=new e.SFVec3f(this.voxelsNode.getWidth(),this.voxelsNode.getHeight(),this.voxelsNode.getDepth());t.addUserDefinedField(i.inputOutput,"voxels_"+this.getId(),new e.SFNode(this.voxelsNode)),t.addUserDefinedField(i.inputOutput,"textureSize_"+this.getId(),n)}else t.addUserDefinedField(i.inputOutput,"textureSize_"+this.getId(),new e.SFVec3f);this.getBrowser().getDefaultBlendedVolumeStyle().addShaderFields(t),this.renderStyleNode&&this.renderStyleNode.addShaderFields(t)}},getUniformsText:function(){if(!this._enabled.getValue())return"";if(!this.voxelsNode)return"";var e="";e+="\n",e+="// BlendedVolumeStyle\n",e+="\n",e+="uniform float weightConstant1_"+this.getId()+";\n",e+="uniform float weightConstant2_"+this.getId()+";\n",this.weightTransferFunction1Node&&(e+="uniform sampler2D weightTransferFunction1_"+this.getId()+";\n"),this.weightTransferFunction2Node&&(e+="uniform sampler2D weightTransferFunction2_"+this.getId()+";\n"),e+="uniform sampler3D voxels_"+this.getId()+";\n",e+="uniform vec3 textureSize_"+this.getId()+";\n";var t=this.getBrowser().getDefaultBlendedVolumeStyle().getUniformsText();this.renderStyleNode&&(t+=this.renderStyleNode.getUniformsText()),e+="\n",e+=t=(t=t.replace(/x3d_Texture3D \[0\]/g,"voxels_"+this.getId())).replace(/x3d_TextureSize/g,"textureSize_"+this.getId()),e+="\n",e+="vec4\n",e+="getBlendedStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+="\tvec4 blendColor_"+this.getId()+" = texture (voxels_"+this.getId()+", texCoord);";var n=this.getBrowser().getDefaultBlendedVolumeStyle().getFunctionsText();switch(this.renderStyleNode&&(n+=this.renderStyleNode.getFunctionsText()),e+="\n",e+=n=n.replace(/textureColor/g,"blendColor_"+this.getId()),this._weightFunction1.getValue()){default:e+="\tfloat w1_"+this.getId()+" = weightConstant1_"+this.getId()+";\n";break;case"ALPHA0":e+="\tfloat w1_"+this.getId()+" = originalColor .a;\n";break;case"ALPHA1":e+="\tfloat w1_"+this.getId()+" = blendColor_ "+this.getId()+" .a;\n";break;case"ONE_MINUS_ALPHA0":e+="\tfloat w1_"+this.getId()+" = 1.0 - originalColor .a;\n";break;case"ONE_MINUS_ALPHA1":e+="\tfloat w1_"+this.getId()+" = 1.0 - blendColor_ "+this.getId()+" .a;\n";break;case"TABLE":this.weightTransferFunction1Node?e+="\tfloat w1_"+this.getId()+" = texture (weightTransferFunction1_"+this.getId()+", vec2 (originalColor .a, blendColor_"+this.getId()+" .a)) .r;\n":e+="\tfloat w1_"+this.getId()+" = weightConstant1_"+this.getId()+";\n"}switch(this._weightFunction2.getValue()){default:e+="\tfloat w2_"+this.getId()+" = weightConstant2_"+this.getId()+";\n";break;case"ALPHA0":e+="\tfloat w2_"+this.getId()+" = originalColor .a;\n";break;case"ALPHA1":e+="\tfloat w2_"+this.getId()+" = blendColor_ "+this.getId()+" .a;\n";break;case"ONE_MINUS_ALPHA0":e+="\tfloat w2_"+this.getId()+" = 1.0 - originalColor .a;\n";break;case"ONE_MINUS_ALPHA1":e+="\tfloat w2_"+this.getId()+" = 1.0 - blendColor_ "+this.getId()+" .a;\n";break;case"TABLE":this.weightTransferFunction2Node?e+="\tfloat w2_"+this.getId()+" = texture (weightTransferFunction2_"+this.getId()+", vec2 (originalColor .a, blendColor_"+this.getId()+" .a)) .r;\n":e+="\tfloat w2_"+this.getId()+" = weightConstant2_"+this.getId()+";\n"}return e+="\n",e+="\treturn clamp (originalColor * w1_"+this.getId()+" + blendColor_"+this.getId()+" * w2_"+this.getId()+", 0.0, 1.0);\n",e+="}\n"},getFunctionsText:function(){if(!this._enabled.getValue())return"";if(!this.voxelsNode)return"";var e="";return e+="\n",e+="\t// BlendedVolumeStyle\n",e+="\n",e+="\ttextureColor = getBlendedStyle_"+this.getId()+" (textureColor, texCoord);\n"}}),a})),e("x_ite/Components/VolumeRendering/BoundaryEnhancementVolumeStyle",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode","x_ite/Base/X3DConstants"],(function(e,t,n,o,i){"use strict";function r(e){o.call(this,e),this.addType(i.BoundaryEnhancementVolumeStyle)}return r.prototype=Object.assign(Object.create(o.prototype),{constructor:r,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(i.inputOutput,"metadata",new e.SFNode),new t(i.inputOutput,"enabled",new e.SFBool(!0)),new t(i.inputOutput,"retainedOpacity",new e.SFFloat(.2)),new t(i.inputOutput,"boundaryOpacity",new e.SFFloat(.9)),new t(i.inputOutput,"opacityFactor",new e.SFFloat(2))]),getTypeName:function(){return"BoundaryEnhancementVolumeStyle"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"renderStyle"},addShaderFields:function(e){this._enabled.getValue()&&(e.addUserDefinedField(i.inputOutput,"retainedOpacity_"+this.getId(),this._retainedOpacity.copy()),e.addUserDefinedField(i.inputOutput,"boundaryOpacity_"+this.getId(),this._boundaryOpacity.copy()),e.addUserDefinedField(i.inputOutput,"opacityFactor_"+this.getId(),this._opacityFactor.copy()))},getUniformsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="// BoundaryEnhancementVolumeStyle\n",e+="\n",e+="uniform float retainedOpacity_"+this.getId()+";\n",e+="uniform float boundaryOpacity_"+this.getId()+";\n",e+="uniform float opacityFactor_"+this.getId()+";\n",e+="\n",e+="vec4\n",e+="getBoundaryEnhancementStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+="\tfloat f0 = texture (x3d_Texture3D [0], texCoord) .r;\n",e+="\tfloat f1 = texture (x3d_Texture3D [0], texCoord + vec3 (0.0, 0.0, 1.0 / x3d_TextureSize .z)) .r;\n",e+="\tfloat f = abs (f0 - f1);\n",e+="\n",e+="\tfloat retainedOpacity = retainedOpacity_"+this.getId()+";\n",e+="\tfloat boundaryOpacity = boundaryOpacity_"+this.getId()+";\n",e+="\tfloat opacityFactor = opacityFactor_"+this.getId()+";\n",e+="\n",e+="\treturn vec4 (originalColor .rgb, originalColor .a * (retainedOpacity + boundaryOpacity * pow (f, opacityFactor)));\n",e+="}\n"},getFunctionsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="\t// BoundaryEnhancementVolumeStyle\n",e+="\n",e+="\ttextureColor = getBoundaryEnhancementStyle_"+this.getId()+" (textureColor, texCoord);\n"}}),r})),e("x_ite/Components/VolumeRendering/CartoonVolumeStyle",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast"],(function(e,t,n,o,i,r){"use strict";function s(e){o.call(this,e),this.addType(i.CartoonVolumeStyle)}return s.prototype=Object.assign(Object.create(o.prototype),{constructor:s,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(i.inputOutput,"metadata",new e.SFNode),new t(i.inputOutput,"enabled",new e.SFBool(!0)),new t(i.inputOutput,"colorSteps",new e.SFInt32(4)),new t(i.inputOutput,"orthogonalColor",new e.SFColorRGBA(1,1,1,1)),new t(i.inputOutput,"parallelColor",new e.SFColorRGBA(0,0,0,1)),new t(i.inputOutput,"surfaceNormals",new e.SFNode)]),getTypeName:function(){return"CartoonVolumeStyle"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"renderStyle"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__())},set_surfaceNormals__:function(){this.surfaceNormalsNode=r(i.X3DTexture3DNode,this._surfaceNormals)},addShaderFields:function(t){this._enabled.getValue()&&(t.addUserDefinedField(i.inputOutput,"colorSteps_"+this.getId(),this._colorSteps.copy()),t.addUserDefinedField(i.inputOutput,"orthogonalColor_"+this.getId(),this._orthogonalColor.copy()),t.addUserDefinedField(i.inputOutput,"parallelColor_"+this.getId(),this._parallelColor.copy()),this.surfaceNormalsNode&&t.addUserDefinedField(i.inputOutput,"surfaceNormals_"+this.getId(),new e.SFNode(this.surfaceNormalsNode)))},getUniformsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="// CartoonVolumeStyle\n",e+="\n",e+="uniform int colorSteps_"+this.getId()+";\n",e+="uniform vec4 orthogonalColor_"+this.getId()+";\n",e+="uniform vec4 parallelColor_"+this.getId()+";\n",e+=this.getNormalText(this.surfaceNormalsNode),e+="\n",e+="vec3\n",e+="rgb2hsv_"+this.getId()+" (in vec3 color)\n",e+="{\n",e+="\tfloat h = 0.0;\n",e+="\tfloat s = 0.0;\n",e+="\tfloat v = 0.0;\n",e+="\n",e+="\tfloat min = min (min (color .r, color .g), color .b);\n",e+="\tfloat max = max (max (color .r, color .g), color .b);\n",e+="\tv = max; // value\n",e+="\n",e+="\tfloat delta = max - min;\n",e+="\n",e+="\tif (max != 0.0 && delta != 0.0)\n",e+="\t{\n",e+="\t\ts = delta / max; // s\n",e+="\n",e+="\t\tif (color .r == max)\n",e+="\t\t\th = (color .g - color .b) / delta; // between yellow & magenta\n",e+="\t\telse if (color .g == max)\n",e+="\t\t\th = 2.0 + (color .b - color .r) / delta; // between cyan & yellow\n",e+="\t\telse\n",e+="\t\t\th = 4.0 + (color .r - color .g) / delta; // between magenta & cyan\n",e+="\n",e+="\t\th *= M_PI / 3.0; // radiants\n",e+="\t\tif (h < 0.0)\n",e+="\t\t\th += M_PI * 2.0;\n",e+="\t}\n",e+="\telse\n",e+="\t\ts = h = 0.0; // s = 0, h is undefined\n",e+="\n",e+="\treturn vec3 (h, s, v);\n",e+="}\n",e+="\n",e+="vec3\n",e+="hsv2rgb_"+this.getId()+" (in vec3 hsv)\n",e+="{\n",e+="\tfloat h = hsv [0];\n",e+="\tfloat s = clamp (hsv [1], 0.0, 1.0);\n",e+="\tfloat v = clamp (hsv [2], 0.0, 1.0);\n",e+="\n",e+="\t// H is given on [0, 2 * Pi]. S and V are given on [0, 1].\n",e+="\t// RGB are each returned on [0, 1].\n",e+="\n",e+="\tif (s == 0.0)\n",e+="\t{\n",e+="\t\t// achromatic (grey)\n",e+="\t\treturn vec3 (v, v, v);\n",e+="\t}\n",e+="\telse\n",e+="\t{\n",e+="\t\tfloat w = (h * (180.0 / M_PI)) / 60.0; // sector 0 to 5\n",e+="\n",e+="\t\tfloat i = floor (w);\n",e+="\t\tfloat f = w - i; // factorial part of h\n",e+="\t\tfloat p = v * ( 1.0 - s );\n",e+="\t\tfloat q = v * ( 1.0 - s * f );\n",e+="\t\tfloat t = v * ( 1.0 - s * ( 1.0 - f ) );\n",e+="\n",e+="\t\tswitch (int (i) % 6)\n",e+="\t\t{\n",e+="\t\t\tcase 0: return vec3 (v, t, p);\n",e+="\t\t\tcase 1: return vec3 (q, v, p);\n",e+="\t\t\tcase 2: return vec3 (p, v, t);\n",e+="\t\t\tcase 3: return vec3 (p, q, v);\n",e+="\t\t\tcase 4: return vec3 (t, p, v);\n",e+="\t\t\tdefault: return vec3 (v, p, q);\n",e+="\t\t}\n",e+="\t}\n",e+="\n",e+="\treturn vec3 (0.0);\n",e+="}\n",e+="\n",e+="vec3\n",e+="mix_hsv_"+this.getId()+" (in vec3 a, in vec3 b, in float t)\n",e+="{\n",e+="\t// Linearely interpolate in HSV space between source color @a a and destination color @a b by an amount of @a t.\n",e+="\t// Source and destination color must be in HSV space.\n",e+="\n",e+="\tfloat ha = a [0];\n",e+="\tfloat sa = a [1];\n",e+="\tfloat va = a [2];\n",e+="\n",e+="\tfloat hb = b [0];\n",e+="\tfloat sb = b [1];\n",e+="\tfloat vb = b [2];\n",e+="\n",e+="\tif (sa == 0.0)\n",e+="\t\tha = hb;\n",e+="\n",e+="\tif (sb == 0.0)\n",e+="\t\thb = ha;\n",e+="\n",e+="\tfloat range = abs (hb - ha);\n",e+="\n",e+="\tif (range <= M_PI)\n",e+="\t{\n",e+="\t\tfloat h = ha + t * (hb - ha);\n",e+="\t\tfloat s = sa + t * (sb - sa);\n",e+="\t\tfloat v = va + t * (vb - va);\n",e+="\t\treturn vec3 (h, s, v);\n",e+="\t}\n",e+="\n",e+="\tfloat PI2 = M_PI * 2.0;\n",e+="\tfloat step = (PI2 - range) * t;\n",e+="\tfloat h = ha < hb ? ha - step : ha + step;\n",e+="\n",e+="\tif (h < 0.0)\n",e+="\t\th += PI2;\n",e+="\n",e+="\telse if (h > PI2)\n",e+="\t\th -= PI2;\n",e+="\n",e+="\tfloat s = sa + t * (sb - sa);\n",e+="\tfloat v = va + t * (vb - va);\n",e+="\treturn vec3 (h, s, v);\n",e+="}\n",e+="\n",e+="vec4\n",e+="getCartoonStyle_"+this.getId()+" (in vec4 originalColor, vec3 texCoord)\n",e+="{\n",e+="\tvec4 surfaceNormal = getNormal_"+this.getId()+" (texCoord);\n",e+="\n",e+="\tif (surfaceNormal .w == 0.0)\n",e+="\t\treturn vec4 (0.0);\n",e+="\n",e+="\tvec4 orthogonalColor = orthogonalColor_"+this.getId()+";\n",e+="\tvec4 parallelColor = parallelColor_"+this.getId()+";\n",e+="\tint colorSteps = colorSteps_"+this.getId()+";\n",e+="\n",e+="\tfloat steps = clamp (float (colorSteps), 1.0, 64.0);\n",e+="\tfloat step = M_PI / 2.0 / steps;\n",e+="\tfloat cosTheta = min (dot (surfaceNormal .xyz, normalize (vertex)), 1.0);\n",e+="\n",e+="\tif (cosTheta < 0.0)\n",e+="\t\treturn vec4 (0.0);\n",e+="\n",e+="\tfloat t = cos (min (floor (acos (cosTheta) / step) * (steps > 1.0 ? steps / (steps - 1.0) : 1.0), steps) * step);\n",e+="\tvec3 orthogonalHSV = rgb2hsv_"+this.getId()+" (orthogonalColor .rgb);\n",e+="\tvec3 parallelHSV = rgb2hsv_"+this.getId()+" (parallelColor .rgb);\n",e+="\n",e+="\treturn vec4 (hsv2rgb_"+this.getId()+" (mix_hsv_"+this.getId()+" (orthogonalHSV, parallelHSV, t)), originalColor .a);\n",e+="}\n"},getFunctionsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="\t// CartoonVolumeStyle\n",e+="\n",e+="\ttextureColor = getCartoonStyle_"+this.getId()+" (textureColor, texCoord);\n"}}),s})),e("x_ite/Components/VolumeRendering/ComposedVolumeStyle",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast"],(function(e,t,n,o,i,r){"use strict";function s(e){o.call(this,e),this.addType(i.ComposedVolumeStyle),this.renderStyleNodes=[]}return s.prototype=Object.assign(Object.create(o.prototype),{constructor:s,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(i.inputOutput,"metadata",new e.SFNode),new t(i.inputOutput,"enabled",new e.SFBool(!0)),new t(i.inputOutput,"renderStyle",new e.MFNode)]),getTypeName:function(){return"ComposedVolumeStyle"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"renderStyle"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._renderStyle.addInterest("set_renderStyle__",this),this.set_renderStyle__())},addVolumeData:function(e){o.prototype.addVolumeData.call(this,e);for(var t=this.renderStyleNodes,n=0,i=t.length;n<i;++n){t[n].addVolumeData(e)}},removeVolumeData:function(e){o.prototype.removeVolumeData.call(this,e);for(var t=0,n=renderStyleNodes.length;t<n;++t){renderStyleNodes[t].removeVolumeData(e)}},set_renderStyle__:function(){for(var e=this.renderStyleNodes,t=0,n=e.length;t<n;++t){(o=e[t]).removeInterest("addNodeEvent",this),this.getVolumeData().forEach((function(e){o.removeVolumeData(e)}))}e.length=0;for(t=0,n=this._renderStyle.length;t<n;++t){(o=r(i.X3DComposableVolumeRenderStyleNode,this._renderStyle[t]))&&e.push(o)}for(t=0,n=e.length;t<n;++t){var o;(o=e[t]).addInterest("addNodeEvent",this),this.getVolumeData().forEach((function(e){o.addVolumeData(e)}))}},addShaderFields:function(e){if(this._enabled.getValue())for(var t=this.renderStyleNodes,n=0,o=t.length;n<o;++n)t[n].addShaderFields(e)},getUniformsText:function(){if(!this._enabled.getValue())return"";for(var e=this.renderStyleNodes,t="",n=0,o=e.length;n<o;++n)t+=e[n].getUniformsText();t+="\n",t+="vec4\n",t+="getComposedStyle_"+this.getId()+" (in vec4 textureColor, in vec3 texCoord)\n",t+="{\n";for(n=0,o=e.length;n<o;++n)t+=e[n].getFunctionsText();return t+="\n",t+="\treturn textureColor;\n",t+="}\n"},getFunctionsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="\t// ComposedVolumeStyle\n",e+="\n",e+="\ttextureColor = getComposedStyle_"+this.getId()+" (textureColor, texCoord);\n"}}),s})),e("x_ite/Components/VolumeRendering/EdgeEnhancementVolumeStyle",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast"],(function(e,t,n,o,i,r){"use strict";function s(e){o.call(this,e),this.addType(i.EdgeEnhancementVolumeStyle)}return s.prototype=Object.assign(Object.create(o.prototype),{constructor:s,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(i.inputOutput,"metadata",new e.SFNode),new t(i.inputOutput,"enabled",new e.SFBool(!0)),new t(i.inputOutput,"edgeColor",new e.SFColorRGBA(0,0,0,1)),new t(i.inputOutput,"gradientThreshold",new e.SFFloat(.4)),new t(i.inputOutput,"surfaceNormals",new e.SFNode)]),getTypeName:function(){return"EdgeEnhancementVolumeStyle"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"renderStyle"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__())},set_surfaceNormals__:function(){this.surfaceNormalsNode=r(i.X3DTexture3DNode,this._surfaceNormals)},addShaderFields:function(t){this._enabled.getValue()&&(t.addUserDefinedField(i.inputOutput,"edgeColor_"+this.getId(),this._edgeColor.copy()),t.addUserDefinedField(i.inputOutput,"gradientThreshold_"+this.getId(),this._gradientThreshold.copy()),this.surfaceNormalsNode&&t.addUserDefinedField(i.inputOutput,"surfaceNormals_"+this.getId(),new e.SFNode(this.surfaceNormalsNode)))},getUniformsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="// EdgeEnhancementVolumeStyle\n",e+="\n",e+="uniform vec4 edgeColor_"+this.getId()+";\n",e+="uniform float gradientThreshold_"+this.getId()+";\n",e+=this.getNormalText(this.surfaceNormalsNode),e+="\n",e+="vec4\n",e+="getEdgeEnhacementStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+="\tvec4 surfaceNormal = getNormal_"+this.getId()+" (texCoord);\n",e+="\n",e+="\tif (surfaceNormal .w == 0.0)\n",e+="\t\treturn vec4 (0.0);\n",e+="\n",e+="\tvec4 edgeColor = edgeColor_"+this.getId()+";\n",e+="\tfloat gradientThreshold = gradientThreshold_"+this.getId()+";\n",e+="\n",e+="\tfloat angle = abs (dot (surfaceNormal .xyz, normalize (vertex)));\n",e+="\n",e+="\tif (angle >= cos (gradientThreshold))\n",e+="\t\treturn originalColor;\n",e+="\telse\n",e+="\t\treturn vec4 (mix (edgeColor .rgb, originalColor.rgb, angle), originalColor .a);\n",e+="}\n"},getFunctionsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="\t// EdgeEnhancementVolumeStyle\n",e+="\n",e+="\ttextureColor = getEdgeEnhacementStyle_"+this.getId()+" (textureColor, texCoord);\n"}}),s})),e("x_ite/Components/VolumeRendering/X3DVolumeDataNode",["x_ite/Fields","x_ite/Components/Core/X3DChildNode","x_ite/Components/Grouping/X3DBoundedObject","x_ite/Base/X3DConstants","x_ite/Browser/Core/TextureQuality","standard/Math/Numbers/Vector3"],(function(e,t,n,o,i,r){"use strict";function s(e){t.call(this,e),n.call(this,e),this.addType(o.X3DVolumeDataNode),this.proximitySensorNode=e.createNode("ProximitySensor",!1),this.transformNode=e.createNode("Transform",!1),this.shapeNode=e.createNode("Shape",!1),this.appearanceNode=e.createNode("Appearance",!1),this.textureTransformNode=e.createNode("TextureTransform3D",!1),this.geometryNode=e.createNode("QuadSet",!1),this.textureCoordinateNode=e.createNode("TextureCoordinate3D",!1),this.coordinateNode=e.createNode("Coordinate",!1),this.setCameraObject(!0)}return s.prototype=Object.assign(Object.create(t.prototype),n.prototype,{constructor:s,initialize:function(){t.prototype.initialize.call(this),n.prototype.initialize.call(this);var o=this.getBrowser(),i=o.getContext();o.getBrowserOptions()._TextureQuality.addInterest("set_dimensions__",this),i.getVersion()>=2&&(this._dimensions.addInterest("set_dimensions__",this),this.set_dimensions__()),this.appearanceNode.setPrivate(!0),this.proximitySensorNode._size=new e.SFVec3f(-1,-1,-1),this.transformNode._children=new e.MFNode(this.shapeNode),this.shapeNode._appearance=this.appearanceNode,this.shapeNode._geometry=this.geometryNode,this.appearanceNode._alphaMode="BLEND",this.appearanceNode._textureTransform=this.textureTransformNode,this.textureTransformNode._translation=new e.SFVec3f(.5,.5,.5),this.textureTransformNode._center=new e.SFVec3f(-.5,-.5,-.5),this.geometryNode._texCoord=this.textureCoordinateNode,this.geometryNode._coord=this.coordinateNode,this.coordinateNode.setup(),this.textureCoordinateNode.setup(),this.geometryNode.setup(),this.textureTransformNode.setup(),this.appearanceNode.setup(),this.shapeNode.setup(),this.transformNode.setup(),this.proximitySensorNode.setup(),this.proximitySensorNode._orientation_changed.addFieldInterest(this.transformNode._rotation),this.proximitySensorNode._orientation_changed.addFieldInterest(this.textureTransformNode._rotation),this.textureTransformNode.addInterest("set_textureTransform__",this)},getBBox:function(e,t){return this._bboxSize.getValue().equals(this.getDefaultBBoxSize())?e.set(this._dimensions.getValue(),r.Zero):e.set(this._bboxSize.getValue(),this._bboxCenter.getValue())},getAppearance:function(){return this.appearanceNode},setShader:function(t){this.getAppearance()._shaders[0]=t,t.addUserDefinedField(o.inputOutput,"x3d_TextureNormalMatrix",new e.SFMatrix3f),t.setup(),this.set_textureTransform__()},getShader:function(){var e=this.appearanceNode._shaders[0];return e?e.getValue():null},getNumPlanes:function(){switch(this.getBrowser().getBrowserOptions().getTextureQuality()){case i.LOW:return 200;case i.MEDIUM:return 400;case i.HIGH:return 600}return 200},set_dimensions__:function(){var t=this.getNumPlanes(),n=this._dimensions.getValue().abs(),o=n/2,i=[];this.coordinateNode._point.length=0;for(var r=0;r<t;++r){var s=r/(t-1)-.5;i.push(o,o,n*s,-o,o,n*s,-o,-o,n*s,o,-o,n*s)}this.coordinateNode._point=i,this.textureCoordinateNode._point=i,this.textureTransformNode._scale=new e.SFVec3f(1/this._dimensions.x,1/this._dimensions.y,1/this._dimensions.z)},set_textureTransform__:function(){var e=this.getShader();e&&e.getField("x3d_TextureNormalMatrix").setValue(this.textureTransformNode.getMatrix().submatrix.inverse().transpose())},traverse:function(e,t){this.proximitySensorNode.traverse(e,t),this.transformNode.traverse(e,t)}}),s})),e("text!x_ite/Browser/VolumeRendering/VolumeStyle.vs",[],(function(){return"#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nuniform mat4 x3d_ProjectionMatrix;\nuniform mat4 x3d_ModelViewMatrix;\nuniform mat4 x3d_TextureMatrix [1];\n\nin float x3d_FogDepth;\nin vec4 x3d_TexCoord0;\nin vec4 x3d_Vertex;\n\nout float fogDepth;\nout vec3 vertex;\nout vec4 texCoord;\n\nvoid\nmain ()\n{\n vec4 position = x3d_ModelViewMatrix * x3d_Vertex;\n\n fogDepth = x3d_FogDepth;\n vertex = position .xyz;\n texCoord = x3d_TextureMatrix [0] * x3d_TexCoord0;\n\n gl_Position = x3d_ProjectionMatrix * position;\n}\n"})),e("text!x_ite/Browser/VolumeRendering/VolumeStyle.fs",[],(function(){return"#version 300 es\n\nprecision highp float;\nprecision highp int;\nprecision highp sampler3D;\n\nuniform int x3d_NumLights;\nuniform x3d_LightSourceParameters x3d_LightSource [x3d_MaxLights];\n\nuniform int x3d_NumTextures;\nuniform sampler3D x3d_Texture3D [1];\nuniform vec3 x3d_TextureSize;\n\nuniform mat3 x3d_TextureNormalMatrix;\n\nconst float M_PI = 3.14159265359;\n\nin float fogDepth;\nin vec3 vertex;\nin vec4 texCoord;\n\n\nuniform x3d_FogParameters x3d_Fog;\n\nfloat\ngetFogInterpolant ()\n{\n // Returns 0.0 for fog color and 1.0 for material color.\n\n if (x3d_Fog .type == x3d_None)\n return 1.0;\n\n if (x3d_Fog .fogCoord)\n return clamp (1.0 - fogDepth, 0.0, 1.0);\n\n float visibilityRange = x3d_Fog .visibilityRange;\n\n if (visibilityRange <= 0.0)\n return 1.0;\n\n float dV = length (x3d_Fog .matrix * vertex);\n\n if (dV >= visibilityRange)\n return 0.0;\n\n switch (x3d_Fog .type)\n {\n case x3d_LinearFog:\n {\n return (visibilityRange - dV) / visibilityRange;\n }\n case x3d_ExponentialFog:\n {\n return exp (-dV / (visibilityRange - dV));\n }\n default:\n {\n return 1.0;\n }\n }\n}\n\nvec3\ngetFogColor (const in vec3 color)\n{\n return mix (x3d_Fog .color, color, getFogInterpolant ());\n}\n\n// VOLUME_STYLES_UNIFORMS\n\nout vec4 x3d_FragColor;\n\n\nuniform int x3d_NumClipPlanes;\nuniform vec4 x3d_ClipPlane [x3d_MaxClipPlanes];\n\nvoid\nclip ()\n{\n for (int i = 0; i < x3d_MaxClipPlanes; ++ i)\n {\n if (i == x3d_NumClipPlanes)\n break;\n\n if (dot (vertex, x3d_ClipPlane [i] .xyz) - x3d_ClipPlane [i] .w < 0.0)\n discard;\n }\n}\n\nvec4\ngetTextureColor (in vec3 texCoord)\n{\n if (x3d_NumTextures == 0)\n discard;\n\n if (texCoord .s < 0.0 || texCoord .s > 1.0)\n discard;\n\n if (texCoord .t < 0.0 || texCoord .t > 1.0)\n discard;\n\n if (texCoord .p < 0.0 || texCoord .p > 1.0)\n discard;\n\n vec4 textureColor = texture (x3d_Texture3D [0], texCoord);\n\n // Apply volume styles.\n\n// VOLUME_STYLES_FUNCTIONS\n\n return textureColor;\n}\n\nvoid\nmain ()\n{\n clip ();\n\n x3d_FragColor = getTextureColor (texCoord .stp / texCoord .q);\n}\n"})),e("x_ite/Components/VolumeRendering/IsoSurfaceVolumeData",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DVolumeDataNode","x_ite/Components/Shaders/ComposedShader","x_ite/Components/Shaders/ShaderPart","x_ite/Base/X3DConstants","x_ite/Base/X3DCast","text!x_ite/Browser/VolumeRendering/VolumeStyle.vs","text!x_ite/Browser/VolumeRendering/VolumeStyle.fs","x_ite/DEBUG"],(function(e,t,n,o,i,r,s,a,d,l,u){"use strict";function h(e){o.call(this,e),this.addType(s.IsoSurfaceVolumeData),this.renderStyleNodes=[]}return h.prototype=Object.assign(Object.create(o.prototype),{constructor:h,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(s.inputOutput,"metadata",new e.SFNode),new t(s.inputOutput,"dimensions",new e.SFVec3f(1,1,1)),new t(s.inputOutput,"contourStepSize",new e.SFFloat(0)),new t(s.inputOutput,"surfaceValues",new e.MFFloat),new t(s.inputOutput,"surfaceTolerance",new e.SFFloat(0)),new t(s.inputOutput,"visible",new e.SFBool(!0)),new t(s.inputOutput,"bboxDisplay",new e.SFBool),new t(s.initializeOnly,"bboxCenter",new e.SFVec3f(0,0,0)),new t(s.initializeOnly,"bboxSize",new e.SFVec3f(-1,-1,-1)),new t(s.inputOutput,"renderStyle",new e.MFNode),new t(s.inputOutput,"gradients",new e.SFNode),new t(s.inputOutput,"voxels",new e.SFNode)]),getTypeName:function(){return"IsoSurfaceVolumeData"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"children"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._gradients.addInterest("set_gradients__",this),this._renderStyle.addInterest("set_renderStyle__",this),this._voxels.addFieldInterest(this.getAppearance()._texture),this._contourStepSize.addInterest("update",this),this._surfaceValues.addInterest("update",this),this._surfaceTolerance.addInterest("update",this),this._renderStyle.addInterest("update",this),this.getAppearance()._texture=this._voxels,this.set_gradients__(),this.set_renderStyle__(),this.set_voxels__(),this.update())},set_gradients__:function(){this.gradientsNode=a(s.X3DTexture3DNode,this._gradients)},set_renderStyle__:function(){for(var e=this.renderStyleNodes,t=0,n=e.length;t<n;++t){(o=e[t]).removeInterest("update",this),o.removeVolumeData(this)}e.length=0;for(t=0,n=this._renderStyle.length;t<n;++t){(o=a(s.X3DComposableVolumeRenderStyleNode,this._renderStyle[t]))&&e.push(o)}for(t=0,n=e.length;t<n;++t){var o;(o=e[t]).addInterest("update",this),o.addVolumeData(this)}},set_voxels__:function(){this.voxelsNode&&this.voxelsNode.removeInterest("set_textureSize__",this),this.voxelsNode=a(s.X3DTexture3DNode,this._voxels),this.voxelsNode&&(this.voxelsNode.addInterest("set_textureSize__",this),this.set_textureSize__())},set_textureSize__:function(){try{var e=this.getShader().getField("x3d_TextureSize");e.x=this.voxelsNode.getWidth(),e.y=this.voxelsNode.getHeight(),e.z=this.voxelsNode.getDepth()}catch(e){u&&console.log(e.message)}},update:function(){this.setShader(this.createShader(d,l))},createShader:function(t,n){var o=this.getBrowser().getDefaultVolumeStyle(),a=o.getUniformsText(),d=o.getFunctionsText();a+="\n",a+="uniform float surfaceValues ["+this._surfaceValues.length+"];\n",a+="uniform float surfaceTolerance;\n";for(var l=0,u=this.renderStyleNodes.length;l<u;++l)a+=this.renderStyleNodes[l].getUniformsText();if(d+="\n",d+="\t// IsoSurfaceVolumeData\n",d+="\n",this.gradientsNode?(a+="\n",a+="uniform sampler3D gradients;\n",d+="\tif (length (texture (gradients, texCoord) .xyz * 2.0 - 1.0) < surfaceTolerance)\n",d+="\t\tdiscard;\n"):(a+="\n",a+="vec4\n",a+="getNormal (in vec3 texCoord)\n",a+="{\n",a+="\tvec4 offset = vec4 (1.0 / x3d_TextureSize, 0.0);\n",a+="\tfloat i0 = texture (x3d_Texture3D [0], texCoord + offset .xww) .r;\n",a+="\tfloat i1 = texture (x3d_Texture3D [0], texCoord - offset .xww) .r;\n",a+="\tfloat i2 = texture (x3d_Texture3D [0], texCoord + offset .wyw) .r;\n",a+="\tfloat i3 = texture (x3d_Texture3D [0], texCoord - offset .wyw) .r;\n",a+="\tfloat i4 = texture (x3d_Texture3D [0], texCoord + offset .wwz) .r;\n",a+="\tfloat i5 = texture (x3d_Texture3D [0], texCoord - offset .wwz) .r;\n",a+="\tvec3 n = vec3 (i1 - i0, i3 - i2, i5 - i4);\n",a+="\n",a+="\treturn vec4 (normalize (x3d_TextureNormalMatrix * n), length (n));\n",a+="}\n",d+="\tif (getNormal (texCoord) .w < surfaceTolerance)\n",d+="\t\tdiscard;\n"),d+="\n",d+="\tfloat intensity = textureColor .r;\n",d+="\n",1===this._surfaceValues.length){var h=Math.abs(this._contourStepSize.getValue());if(0===h)d+="\tif (intensity > surfaceValues [0])\n",d+="\t{\n",d+="\t\ttextureColor = vec4 (vec3 (surfaceValues [0]), 1.0);\n",this.renderStyleNodes.length&&(d+=this.renderStyleNodes[0].getFunctionsText()),d+="\t}\n",d+="\telse\n",d+="\t{\n",d+="\t\tdiscard;\n",d+="\t}\n",d+="\n";else{for(var c=[],g=this._surfaceValues[0]-h;g>0;g-=h)c.unshift(g);c.push(this._surfaceValues[0]);for(g=this._surfaceValues[0]+h;g<1;g+=h)c.push(g);d+="\tif (false)\n",d+="\t{ }\n";for(l=surfaceValues_.length-1;l>=0;--l)d+="\telse if (intensity > "+c[l]+")\n",d+="\t{\n",d+="\t\ttextureColor = vec4 (vec3 ("+c[l]+"), 1.0);\n",this.renderStyleNodes.length&&(d+=this.renderStyleNodes[0].getFunctionsText()),d+="\t}\n";d+="\telse\n",d+="\t{\n",d+="\t\tdiscard;\n",d+="\t}\n",d+="\n"}}else{d+="\tif (false)\n",d+="\t{ }\n";for(l=this._surfaceValues.length-1;l>=0;--l){if(d+="\telse if (intensity > surfaceValues ["+l+"])\n",d+="\t{\n",d+="\t\ttextureColor = vec4 (vec3 (surfaceValues ["+l+"]), 1.0);\n",this.renderStyleNodes.length){var f=Math.min(l,this.renderStyleNodes.length-1);d+=this.renderStyleNodes[f].getFunctionsText()}d+="\t}\n"}d+="\telse\n",d+="\t{\n",d+="\t\tdiscard;\n",d+="\t}\n",d+="\n"}n=(n=n.replace(/\/\/ VOLUME_STYLES_UNIFORMS\n/,a)).replace(/\/\/ VOLUME_STYLES_FUNCTIONS\n/,d);var p=new r(this.getExecutionContext());p.setName("VolumeDataVertexShader"),p._url.push("data:x-shader/x-vertex,"+t),p.setup();var m=new r(this.getExecutionContext());m.setName("VolumeDataFragmentShader"),m._type="FRAGMENT",m._url.push("data:x-shader/x-fragment,"+n),m.setup();var _=new i(this.getExecutionContext());if(_.setName("VolumeDataShader"),_._language="GLSL",_._parts.push(p),_._parts.push(m),_.addUserDefinedField(s.inputOutput,"surfaceValues",this._surfaceValues.copy()),_.addUserDefinedField(s.inputOutput,"surfaceTolerance",this._surfaceTolerance.copy()),this.gradientsNode&&_.addUserDefinedField(s.inputOutput,"grandients",new e.SFNode(this.gradientsNode)),this.voxelsNode){var x=new e.SFVec3f(this.voxelsNode.getWidth(),this.voxelsNode.getHeight(),this.voxelsNode.getDepth());_.addUserDefinedField(s.inputOutput,"x3d_TextureSize",x)}else _.addUserDefinedField(s.inputOutput,"x3d_TextureSize",new e.SFVec3f);o.addShaderFields(_);for(l=0,u=this.renderStyleNodes.length;l<u;++l)this.renderStyleNodes[l].addShaderFields(_);return _}}),h})),e("x_ite/Components/VolumeRendering/ProjectionVolumeStyle",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DVolumeRenderStyleNode","x_ite/Base/X3DConstants"],(function(e,t,n,o,i){"use strict";function r(e){o.call(this,e),this.addType(i.ProjectionVolumeStyle)}return r.prototype=Object.assign(Object.create(o.prototype),{constructor:r,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(i.inputOutput,"metadata",new e.SFNode),new t(i.inputOutput,"enabled",new e.SFBool(!0)),new t(i.inputOutput,"type",new e.SFString("MAX")),new t(i.inputOutput,"intensityThreshold",new e.SFFloat(0))]),getTypeName:function(){return"ProjectionVolumeStyle"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"renderStyle"},addShaderFields:function(e){this._enabled.getValue()&&e.addUserDefinedField(i.inputOutput,"intensityThreshold_"+this.getId(),this._intensityThreshold.copy())},getUniformsText:function(){if(!this._enabled.getValue())return"";var e="";switch(e+="\n",e+="// ProjectionVolumeStyle\n",e+="\n",e+="uniform float intensityThreshold_"+this.getId()+";\n",e+="\n",e+="vec4\n",e+="getProjectionStyle_"+this.getId()+"(in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",this._type.getValue()){default:case"MAX":case"AVERAGE":e+="\tfloat projectionColor = 0.0;\n";break;case"MIN":e+="\tfloat projectionColor = 1.0;\n"}switch(e+="\tconst int samples = 32;\n",e+="\tvec3 step = normalize (x3d_TextureNormalMatrix * vec3 (0.0, 0.0, 1.0)) / float (samples);\n",e+="\tvec3 ray = texCoord - step * float (samples) * 0.5;\n",e+="\tbool first = false;\n",e+="\n",e+="\tfor (int i = 0; i < samples; ++ i, ray += step)\n",e+="\t{\n",e+="\t\tif (ray .s < 0.0 || ray .s > 1.0)\n",e+="\t\t\tcontinue;\n",e+="\n",e+="\t\tif (ray .t < 0.0 || ray .t > 1.0)\n",e+="\t\t\tcontinue;\n",e+="\n",e+="\t\tif (ray .p < 0.0 || ray .p > 1.0)\n",e+="\t\t\tcontinue;\n",e+="\n",e+="\t\tfloat intensity = texture (x3d_Texture3D [0], ray) .r;\n",e+="\n",this._type.getValue()){default:case"MAX":e+="\t\tif (intensity < intensityThreshold_"+this.getId()+")\n",e+="\t\t\tcontinue;\n",e+="\n",e+="\t\tif (intensityThreshold_"+this.getId()+" > 0.0 && first)\n",e+="\t\t\tbreak;\n",e+="\n",e+="\t\tif (intensity <= projectionColor)\n",e+="\t\t{\n",e+="\t\t\tfirst = true;\n",e+="\t\t\tcontinue;\n",e+="\t\t}\n",e+="\n",e+="\t\tprojectionColor = intensity;\n";break;case"MIN":e+="\t\tif (intensity < intensityThreshold_"+this.getId()+")\n",e+="\t\t\tcontinue;\n",e+="\n",e+="\t\tif (intensityThreshold_"+this.getId()+" > 0.0 && first)\n",e+="\t\t\tbreak;\n",e+="\n",e+="\t\tif (intensity >= projectionColor)\n",e+="\t\t{\n",e+="\t\t\tfirst = true;\n",e+="\t\t\tcontinue;\n",e+="\t\t}\n",e+="\n",e+="\t\tprojectionColor = intensity;\n";break;case"AVERAGE":e+="\t\tprojectionColor += intensity;\n"}return e+="\t}\n",e+="\n","AVERAGE"===this._type.getValue()&&(e+="\tprojectionColor /= float (samples);\n"),e+="\treturn vec4 (vec3 (projectionColor), originalColor .a);\n",e+="}\n"},getFunctionsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="\t// ProjectionVolumeStyle\n",e+="\n",e+="\ttextureColor = getProjectionStyle_"+this.getId()+" (textureColor, texCoord);\n"}}),r})),e("x_ite/Components/VolumeRendering/SegmentedVolumeData",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DVolumeDataNode","x_ite/Components/Shaders/ComposedShader","x_ite/Components/Shaders/ShaderPart","x_ite/Base/X3DConstants","x_ite/Base/X3DCast","text!x_ite/Browser/VolumeRendering/VolumeStyle.vs","text!x_ite/Browser/VolumeRendering/VolumeStyle.fs","x_ite/DEBUG"],(function(e,t,n,o,i,r,s,a,d,l,u){"use strict";function h(e){o.call(this,e),this.addType(s.SegmentedVolumeData),this.segmentIdentifiersNode=null,this.renderStyleNodes=[]}return h.prototype=Object.assign(Object.create(o.prototype),{constructor:h,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(s.inputOutput,"metadata",new e.SFNode),new t(s.inputOutput,"dimensions",new e.SFVec3f(1,1,1)),new t(s.inputOutput,"segmentEnabled",new e.MFBool),new t(s.inputOutput,"visible",new e.SFBool(!0)),new t(s.inputOutput,"bboxDisplay",new e.SFBool),new t(s.initializeOnly,"bboxCenter",new e.SFVec3f(0,0,0)),new t(s.initializeOnly,"bboxSize",new e.SFVec3f(-1,-1,-1)),new t(s.inputOutput,"segmentIdentifiers",new e.SFNode),new t(s.inputOutput,"renderStyle",new e.MFNode),new t(s.inputOutput,"voxels",new e.SFNode)]),getTypeName:function(){return"SegmentedVolumeData"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"children"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._segmentIdentifiers.addInterest("set_segmentIdentifiers__",this),this._renderStyle.addInterest("set_renderStyle__",this),this._voxels.addFieldInterest(this.getAppearance()._texture),this._segmentEnabled.addInterest("update",this),this._segmentIdentifiers.addInterest("update",this),this._renderStyle.addInterest("update",this),this.getAppearance()._texture=this._voxels,this.set_segmentIdentifiers__(),this.set_renderStyle__(),this.set_voxels__(),this.update())},getSegmentEnabled:function(e){return!(e<this._segmentEnabled.length)||this._segmentEnabled[e]},set_segmentIdentifiers__:function(){this.segmentIdentifiersNode=a(s.X3DTexture3DNode,this._segmentIdentifiers)},set_renderStyle__:function(){for(var e=this.renderStyleNodes,t=0,n=e.length;t<n;++t){(o=e[t]).removeInterest("update",this),o.removeVolumeData(this)}e.length=0;for(t=0,n=this._renderStyle.length;t<n;++t){(o=a(s.X3DComposableVolumeRenderStyleNode,this._renderStyle[t]))&&e.push(o)}for(t=0,n=e.length;t<n;++t){var o;(o=e[t]).addInterest("update",this),o.addVolumeData(this)}},set_voxels__:function(){this.voxelsNode&&this.voxelsNode.removeInterest("set_textureSize__",this),this.voxelsNode=a(s.X3DTexture3DNode,this._voxels),this.voxelsNode&&(this.voxelsNode.addInterest("set_textureSize__",this),this.set_textureSize__())},set_textureSize__:function(){try{var e=this.getShader().getField("x3d_TextureSize");e.x=this.voxelsNode.getWidth(),e.y=this.voxelsNode.getHeight(),e.z=this.voxelsNode.getDepth()}catch(e){u&&console.log(e.message)}},update:function(){this.setShader(this.createShader(d,l))},createShader:function(t,n){var o=this.getBrowser().getDefaultVolumeStyle(),a=o.getUniformsText(),d=o.getFunctionsText();if(this.segmentIdentifiersNode?(a+="\n",a+="uniform sampler3D segmentIdentifiers;\n",d+="\n",d+="\n",d+="\tint segment = int (texture (segmentIdentifiers, texCoord) .r * 255.0);\n"):d+="\tint segment = 0;\n",this.renderStyleNodes.length){d+="\n",d+="\tswitch (segment)\n",d+="\t{\n";for(var l=0,u=this.renderStyleNodes.length;l<u;++l)d+="\t\tcase "+l+":\n",d+="\t\t{\n",this.getSegmentEnabled(l)?(a+=this.renderStyleNodes[l].getUniformsText(),d+=this.renderStyleNodes[l].getFunctionsText(),d+="\t\t\tbreak;\n"):d+="\t\t\tdiscard;\n",d+="\t\t}\n";d+="\t}\n"}n=(n=n.replace(/\/\/ VOLUME_STYLES_UNIFORMS\n/,a)).replace(/\/\/ VOLUME_STYLES_FUNCTIONS\n/,d);var h=new r(this.getExecutionContext());h.setName("SegmentedVolumeDataVertexShader"),h._url.push("data:x-shader/x-vertex,"+t),h.setup();var c=new r(this.getExecutionContext());c.setName("SegmentedVolumeDataFragmentShader"),c._type="FRAGMENT",c._url.push("data:x-shader/x-fragment,"+n),c.setup();var g=new i(this.getExecutionContext());if(g.setName("SegmentedVolumeDataShader"),g._language="GLSL",g._parts.push(h),g._parts.push(c),this.voxelsNode){var f=new e.SFVec3f(this.voxelsNode.getWidth(),this.voxelsNode.getHeight(),this.voxelsNode.getDepth());g.addUserDefinedField(s.inputOutput,"x3d_TextureSize",f)}else g.addUserDefinedField(s.inputOutput,"x3d_TextureSize",new e.SFVec3f);this.segmentIdentifiersNode&&g.addUserDefinedField(s.inputOutput,"segmentIdentifiers",new e.SFNode(this.segmentIdentifiersNode)),o.addShaderFields(g);for(l=0,u=this.renderStyleNodes.length;l<u;++l)this.getSegmentEnabled(l)&&this.renderStyleNodes[l].addShaderFields(g);return g}}),h})),e("x_ite/Components/VolumeRendering/ShadedVolumeStyle",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast"],(function(e,t,n,o,i,r){"use strict";function s(e){o.call(this,e),this.addType(i.ShadedVolumeStyle)}return s.prototype=Object.assign(Object.create(o.prototype),{constructor:s,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(i.inputOutput,"metadata",new e.SFNode),new t(i.inputOutput,"enabled",new e.SFBool(!0)),new t(i.inputOutput,"lighting",new e.SFBool),new t(i.inputOutput,"shadows",new e.SFBool),new t(i.initializeOnly,"phaseFunction",new e.SFString("Henyey-Greenstein")),new t(i.inputOutput,"material",new e.SFNode),new t(i.inputOutput,"surfaceNormals",new e.SFNode)]),getTypeName:function(){return"ShadedVolumeStyle"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"renderStyle"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._material.addInterest("set_material__",this),this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_material__(),this.set_surfaceNormals__())},set_material__:function(){this.materialNode&&this.materialNode.removeInterest("addNodeEvent",this),this.materialNode=r(i.X3DMaterialNode,this._material),this.materialNode&&this.materialNode.addInterest("addNodeEvent",this)},set_surfaceNormals__:function(){this.surfaceNormalsNode=r(i.X3DTexture3DNode,this._surfaceNormals)},addShaderFields:function(t){this._enabled.getValue()&&(this.materialNode&&(t.addUserDefinedField(i.inputOutput,"ambientIntensity_"+this.getId(),this.materialNode._ambientIntensity.copy()),t.addUserDefinedField(i.inputOutput,"diffuseColor_"+this.getId(),this.materialNode._diffuseColor.copy()),t.addUserDefinedField(i.inputOutput,"specularColor_"+this.getId(),this.materialNode._specularColor.copy()),t.addUserDefinedField(i.inputOutput,"emissiveColor_"+this.getId(),this.materialNode._emissiveColor.copy()),t.addUserDefinedField(i.inputOutput,"shininess_"+this.getId(),this.materialNode._shininess.copy()),t.addUserDefinedField(i.inputOutput,"transparency_"+this.getId(),this.materialNode._transparency.copy())),this.surfaceNormalsNode&&t.addUserDefinedField(i.inputOutput,"surfaceNormals_"+this.getId(),new e.SFNode(this.surfaceNormalsNode)))},getUniformsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="// ShadedVolumeStyle\n",e+="\n",e+="uniform float ambientIntensity_"+this.getId()+";\n",e+="uniform vec3 diffuseColor_"+this.getId()+";\n",e+="uniform vec3 specularColor_"+this.getId()+";\n",e+="uniform vec3 emissiveColor_"+this.getId()+";\n",e+="uniform float shininess_"+this.getId()+";\n",e+="uniform float transparency_"+this.getId()+";\n",e+=this.getNormalText(this.surfaceNormalsNode),e+="\n",e+="float\n",e+="getSpotFactor_"+this.getId()+" (const in float cutOffAngle, const in float beamWidth, const in vec3 L, const in vec3 d)\n",e+="{\n",e+="\tfloat spotAngle = acos (clamp (dot (-L, d), -1.0, 1.0));\n",e+="\n",e+="\tif (spotAngle >= cutOffAngle)\n",e+="\t\treturn 0.0;\n",e+="\telse if (spotAngle <= beamWidth)\n",e+="\t\treturn 1.0;\n",e+="\n",e+="\treturn (spotAngle - cutOffAngle) / (beamWidth - cutOffAngle);\n",e+="}\n",e+="\n",e+="vec4\n",e+="getShadedStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+="\tvec4 surfaceNormal = getNormal_"+this.getId()+" (texCoord);\n",e+="\n",e+="\tif (surfaceNormal .w == 0.0)\n",e+="\t\treturn vec4 (0.0);\n",e+="\n",e+="\tvec4 shadedColor = vec4 (0.0);\n",this._lighting.getValue()?(this.materialNode?(e+="\tvec3 diffuseFactor = diffuseColor_"+this.getId()+";\n",e+="\tvec3 ambientTerm = diffuseFactor * ambientIntensity_"+this.getId()+";\n",e+="\n",e+="\tshadedColor .a = originalColor .a * (1.0 - transparency_"+this.getId()+");\n"):(e+="\tvec3 diffuseFactor = originalColor .rgb;\n",e+="\tvec3 ambientTerm = vec3 (0.0);\n",e+="\n",e+="\tshadedColor .a = originalColor .a;\n"),e+="\n",e+="\tvec3 N = surfaceNormal .xyz;\n",e+="\tvec3 V = normalize (-vertex); // normalized vector from point on geometry to viewer's position\n",e+="\n",e+="\tfor (int i = 0; i < x3d_MaxLights; ++ i)\n",e+="\t{\n",e+="\t\tif (i == x3d_NumLights)\n",e+="\t\t\tbreak;\n",e+="\n",e+="\t\tx3d_LightSourceParameters light = x3d_LightSource [i];\n",e+="\n",e+="\t\tvec3 vL = light .location - vertex; // Light to fragment\n",e+="\t\tfloat dL = length (light .matrix * vL);\n",e+="\t\tbool di = light .type == x3d_DirectionalLight;\n",e+="\n",e+="\t\tif (di || dL <= light .radius)\n",e+="\t\t{\n",e+="\t\t\tvec3 d = light .direction;\n",e+="\t\t\tvec3 c = light .attenuation;\n",e+="\t\t\tvec3 L = di ? -d : normalize (vL); // Normalized vector from point on geometry to light source i position.\n",e+="\t\t\tvec3 H = normalize (L + V); // Specular term\n",e+="\n",e+="\t\t\tfloat lightAngle = max (dot (N, L), 0.0); // Angle between normal and light ray.\n",e+="\t\t\tvec3 diffuseTerm = diffuseFactor * lightAngle;\n",e+="\t\t\tfloat specularFactor = shininess_"+this.getId()+" > 0.0 ? pow (max (dot (N, H), 0.0), shininess_"+this.getId()+" * 128.0) : 1.0;\n",e+="\t\t\tvec3 specularTerm = light .intensity * specularColor_"+this.getId()+" * specularFactor;\n",e+="\n",e+="\t\t\tfloat attenuationFactor = di ? 1.0 : 1.0 / max (c [0] + c [1] * dL + c [2] * (dL * dL), 1.0);\n",e+="\t\t\tfloat spotFactor = light .type == x3d_SpotLight ? getSpotFactor_"+this.getId()+" (light .cutOffAngle, light .beamWidth, L, d) : 1.0;\n",e+="\t\t\tfloat attenuationSpotFactor = attenuationFactor * spotFactor;\n",e+="\t\t\tvec3 ambientColor = light .ambientIntensity * ambientTerm;\n",e+="\t\t\tvec3 diffuseSpecularColor = light .intensity * (diffuseTerm + specularTerm);\n",e+="\n",e+="\t\t\tshadedColor .rgb += attenuationSpotFactor * light .color * (ambientColor + diffuseSpecularColor);\n",e+="\t\t}\n",e+="\n",e+="\t\tshadedColor .rgb += emissiveColor_"+this.getId()+";\n",e+="\t\tshadedColor .rgb = getFogColor (shadedColor .rgb);\n",e+="\t}\n"):this.materialNode?(e+="\tshadedColor .rgb = diffuseColor_"+this.getId()+";\n",e+="\tshadedColor .a = originalColor .a * (1.0 - transparency_"+this.getId()+");\n"):e+="\tshadedColor = originalColor;\n",e+="\n",e+="\treturn shadedColor;\n",e+="}\n"},getFunctionsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="\t// ShadedVolumeStyle\n",e+="\n",e+="\ttextureColor = getShadedStyle_"+this.getId()+" (textureColor, texCoord);\n"}}),s})),e("x_ite/Components/VolumeRendering/SilhouetteEnhancementVolumeStyle",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast"],(function(e,t,n,o,i,r){"use strict";function s(e){o.call(this,e),this.addType(i.SilhouetteEnhancementVolumeStyle)}return s.prototype=Object.assign(Object.create(o.prototype),{constructor:s,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(i.inputOutput,"metadata",new e.SFNode),new t(i.inputOutput,"enabled",new e.SFBool(!0)),new t(i.inputOutput,"silhouetteRetainedOpacity",new e.SFFloat(1)),new t(i.inputOutput,"silhouetteBoundaryOpacity",new e.SFFloat(0)),new t(i.inputOutput,"silhouetteSharpness",new e.SFFloat(.5)),new t(i.inputOutput,"surfaceNormals",new e.SFNode)]),getTypeName:function(){return"SilhouetteEnhancementVolumeStyle"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"renderStyle"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__())},set_surfaceNormals__:function(){this.surfaceNormalsNode=r(i.X3DTexture3DNode,this._surfaceNormals)},addShaderFields:function(t){this._enabled.getValue()&&(t.addUserDefinedField(i.inputOutput,"silhouetteRetainedOpacity_"+this.getId(),this._silhouetteRetainedOpacity.copy()),t.addUserDefinedField(i.inputOutput,"silhouetteBoundaryOpacity_"+this.getId(),this._silhouetteBoundaryOpacity.copy()),t.addUserDefinedField(i.inputOutput,"silhouetteSharpness_"+this.getId(),this._silhouetteSharpness.copy()),this.surfaceNormalsNode&&t.addUserDefinedField(i.inputOutput,"surfaceNormals_"+this.getId(),new e.SFNode(this.surfaceNormalsNode)))},getUniformsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="// SilhouetteEnhancementVolumeStyle\n",e+="\n",e+="uniform float silhouetteRetainedOpacity_"+this.getId()+";\n",e+="uniform float silhouetteBoundaryOpacity_"+this.getId()+";\n",e+="uniform float silhouetteSharpness_"+this.getId()+";\n",e+=this.getNormalText(this.surfaceNormalsNode),e+="\n",e+="vec4\n",e+="getSilhouetteEnhancementStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+="\tvec4 surfaceNormal = getNormal_"+this.getId()+" (texCoord);\n",e+="\n",e+="\tif (surfaceNormal .w == 0.0)\n",e+="\t\treturn vec4 (0.0);\n",e+="\t\n",e+="\tfloat silhouetteRetainedOpacity = silhouetteRetainedOpacity_"+this.getId()+";\n",e+="\tfloat silhouetteBoundaryOpacity = silhouetteBoundaryOpacity_"+this.getId()+";\n",e+="\tfloat silhouetteSharpness = silhouetteSharpness_"+this.getId()+";\n",e+="\n",e+="\treturn vec4 (originalColor .rgb, originalColor .a * (silhouetteRetainedOpacity + silhouetteBoundaryOpacity * pow (1.0 - abs (dot (surfaceNormal .xyz, normalize (vertex))), silhouetteSharpness)));\n",e+="}\n"},getFunctionsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="\t// SilhouetteEnhancementVolumeStyle\n",e+="\n",e+="\ttextureColor = getSilhouetteEnhancementStyle_"+this.getId()+" (textureColor, texCoord);\n"}}),s})),e("x_ite/Components/VolumeRendering/ToneMappedVolumeStyle",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast"],(function(e,t,n,o,i,r){"use strict";function s(e){o.call(this,e),this.addType(i.ToneMappedVolumeStyle)}return s.prototype=Object.assign(Object.create(o.prototype),{constructor:s,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(i.inputOutput,"metadata",new e.SFNode),new t(i.inputOutput,"enabled",new e.SFBool(!0)),new t(i.inputOutput,"coolColor",new e.SFColorRGBA(0,0,1,0)),new t(i.inputOutput,"warmColor",new e.SFColorRGBA(1,1,0,0)),new t(i.inputOutput,"surfaceNormals",new e.SFNode)]),getTypeName:function(){return"ToneMappedVolumeStyle"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"renderStyle"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__())},set_surfaceNormals__:function(){this.surfaceNormalsNode=r(i.X3DTexture3DNode,this._surfaceNormals)},addShaderFields:function(t){this._enabled.getValue()&&(t.addUserDefinedField(i.inputOutput,"coolColor_"+this.getId(),this._coolColor.copy()),t.addUserDefinedField(i.inputOutput,"warmColor_"+this.getId(),this._warmColor.copy()),this.surfaceNormalsNode&&t.addUserDefinedField(i.inputOutput,"surfaceNormals_"+this.getId(),new e.SFNode(this.surfaceNormalsNode)))},getUniformsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="// ToneMappedVolumeStyle\n",e+="\n",e+="uniform vec4 coolColor_"+this.getId()+";\n",e+="uniform vec4 warmColor_"+this.getId()+";\n",e+=this.getNormalText(this.surfaceNormalsNode),e+="\n",e+="vec4\n",e+="getToneMappedStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+="\tvec4 surfaceNormal = getNormal_"+this.getId()+" (texCoord);\n",e+="\n",e+="\tif (surfaceNormal .w == 0.0)\n",e+="\t\treturn vec4 (0.0);\n",e+="\n",e+="\tvec3 toneColor = vec3 (0.0);\n",e+="\tvec3 coolColor = coolColor_"+this.getId()+" .rgb;\n",e+="\tvec3 warmColor = warmColor_"+this.getId()+" .rgb;\n",e+="\n",e+="\tfor (int i = 0; i < x3d_MaxLights; ++ i)\n",e+="\t{\n",e+="\t\tif (i == x3d_NumLights)\n",e+="\t\t\tbreak;\n",e+="\n",e+="\t\tx3d_LightSourceParameters light = x3d_LightSource [i];\n",e+="\n",e+="\t\tvec3 L = light .type == x3d_DirectionalLight ? -light .direction : normalize (light .location - vertex);\n",e+="\t\tfloat colorFactor = (1.0 + dot (L, surfaceNormal .xyz)) * 0.5;\n",e+="\n",e+="\t\ttoneColor += mix (warmColor .rgb, coolColor .rgb, colorFactor);\n",e+="\t}\n",e+="\n",e+="\treturn vec4 (toneColor, originalColor .a);\n",e+="}\n"},getFunctionsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="\t// ToneMappedVolumeStyle\n",e+="\n",e+="\ttextureColor = getToneMappedStyle_"+this.getId()+" (textureColor, texCoord);\n"}}),s})),e("x_ite/Components/VolumeRendering/VolumeData",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DVolumeDataNode","x_ite/Components/Shaders/ComposedShader","x_ite/Components/Shaders/ShaderPart","x_ite/Base/X3DConstants","x_ite/Base/X3DCast","text!x_ite/Browser/VolumeRendering/VolumeStyle.vs","text!x_ite/Browser/VolumeRendering/VolumeStyle.fs","x_ite/DEBUG"],(function(e,t,n,o,i,r,s,a,d,l,u){"use strict";function h(e){o.call(this,e),this.addType(s.VolumeData),this.renderStyleNode=null}return h.prototype=Object.assign(Object.create(o.prototype),{constructor:h,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(s.inputOutput,"metadata",new e.SFNode),new t(s.inputOutput,"dimensions",new e.SFVec3f(1,1,1)),new t(s.inputOutput,"visible",new e.SFBool(!0)),new t(s.inputOutput,"bboxDisplay",new e.SFBool),new t(s.initializeOnly,"bboxCenter",new e.SFVec3f(0,0,0)),new t(s.initializeOnly,"bboxSize",new e.SFVec3f(-1,-1,-1)),new t(s.inputOutput,"renderStyle",new e.SFNode),new t(s.inputOutput,"voxels",new e.SFNode)]),getTypeName:function(){return"VolumeData"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"children"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._renderStyle.addInterest("set_renderStyle__",this),this._voxels.addInterest("set_voxels__",this),this._voxels.addFieldInterest(this.getAppearance()._texture),this._renderStyle.addInterest("update",this),this.getAppearance()._texture=this._voxels,this.set_renderStyle__(),this.set_voxels__(),this.update())},set_renderStyle__:function(){this.renderStyleNode&&(this.renderStyleNode.removeInterest("update",this),this.renderStyleNode.removeVolumeData(this)),this.renderStyleNode=a(s.X3DVolumeRenderStyleNode,this._renderStyle),this.renderStyleNode&&(this.renderStyleNode.addInterest("update",this),this.renderStyleNode.addVolumeData(this))},set_voxels__:function(){this.voxelsNode&&this.voxelsNode.removeInterest("set_textureSize__",this),this.voxelsNode=a(s.X3DTexture3DNode,this._voxels),this.voxelsNode&&(this.voxelsNode.addInterest("set_textureSize__",this),this.set_textureSize__())},set_textureSize__:function(){try{var e=this.getShader().getField("x3d_TextureSize");e.x=this.voxelsNode.getWidth(),e.y=this.voxelsNode.getHeight(),e.z=this.voxelsNode.getDepth()}catch(e){u&&console.log(e.message)}},update:function(){this.setShader(this.createShader(d,l))},createShader:function(t,n){var o=this.getBrowser().getDefaultVolumeStyle(),a=o.getUniformsText(),d=o.getFunctionsText();this.renderStyleNode&&(a+=this.renderStyleNode.getUniformsText(),d+=this.renderStyleNode.getFunctionsText()),n=(n=n.replace(/\/\/ VOLUME_STYLES_UNIFORMS\n/,a)).replace(/\/\/ VOLUME_STYLES_FUNCTIONS\n/,d);var l=new r(this.getExecutionContext());l.setName("VolumeDataVertexShader"),l._url.push("data:x-shader/x-vertex,"+t),l.setup();var u=new r(this.getExecutionContext());u.setName("VolumeDataFragmentShader"),u._type="FRAGMENT",u._url.push("data:x-shader/x-fragment,"+n),u.setup();var h=new i(this.getExecutionContext());if(h.setName("VolumeDataShader"),h._language="GLSL",h._parts.push(l),h._parts.push(u),this.voxelsNode){var c=new e.SFVec3f(this.voxelsNode.getWidth(),this.voxelsNode.getHeight(),this.voxelsNode.getDepth());h.addUserDefinedField(s.inputOutput,"x3d_TextureSize",c)}else h.addUserDefinedField(s.inputOutput,"x3d_TextureSize",new e.SFVec3f);return o.addShaderFields(h),this.renderStyleNode&&this.renderStyleNode.addShaderFields(h),h}}),h})),e(t.getComponentUrl("volume-rendering"),["x_ite/Components","x_ite/Browser/VolumeRendering/X3DVolumeRenderingContext","x_ite/Components/VolumeRendering/BlendedVolumeStyle","x_ite/Components/VolumeRendering/BoundaryEnhancementVolumeStyle","x_ite/Components/VolumeRendering/CartoonVolumeStyle","x_ite/Components/VolumeRendering/ComposedVolumeStyle","x_ite/Components/VolumeRendering/EdgeEnhancementVolumeStyle","x_ite/Components/VolumeRendering/IsoSurfaceVolumeData","x_ite/Components/VolumeRendering/OpacityMapVolumeStyle","x_ite/Components/VolumeRendering/ProjectionVolumeStyle","x_ite/Components/VolumeRendering/SegmentedVolumeData","x_ite/Components/VolumeRendering/ShadedVolumeStyle","x_ite/Components/VolumeRendering/SilhouetteEnhancementVolumeStyle","x_ite/Components/VolumeRendering/ToneMappedVolumeStyle","x_ite/Components/VolumeRendering/VolumeData","x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode","x_ite/Components/VolumeRendering/X3DVolumeDataNode","x_ite/Components/VolumeRendering/X3DVolumeRenderStyleNode",t.getComponentUrl("cad-geometry"),t.getComponentUrl("texturing-3d")],(function(e,t,n,o,i,r,s,a,d,l,u,h,c,g,f,p,m,_){"use strict";e.addComponent({name:"VolumeRendering",types:{BlendedVolumeStyle:n,BoundaryEnhancementVolumeStyle:o,CartoonVolumeStyle:i,ComposedVolumeStyle:r,EdgeEnhancementVolumeStyle:s,IsoSurfaceVolumeData:a,OpacityMapVolumeStyle:d,ProjectionVolumeStyle:l,SegmentedVolumeData:u,ShadedVolumeStyle:h,SilhouetteEnhancementVolumeStyle:c,ToneMappedVolumeStyle:g,VolumeData:f},abstractTypes:{X3DComposableVolumeRenderStyleNode:p,X3DVolumeDataNode:m,X3DVolumeRenderStyleNode:_},browser:t})}))}();
|
|
1
|
+
!function(){const e=window[Symbol.for("X_ITE.X3D-6.0.0")].define,t=window[Symbol.for("X_ITE.X3D-6.0.0")].require;e("x_ite/Components/VolumeRendering/X3DVolumeRenderStyleNode",["x_ite/Components/Core/X3DNode","x_ite/Base/X3DConstants"],(function(e,t){"use strict";function n(n){e.call(this,n),this.addType(t.X3DVolumeRenderStyleNode),this.volumeDataNodes=new Set}return n.prototype=Object.assign(Object.create(e.prototype),{constructor:n,addShaderFields:function(e){},getUniformsText:function(){return""},getFunctionsText:function(){return""},getVolumeData:function(){return this.volumeDataNodes},addVolumeData:function(e){this.volumeDataNodes.add(e)},removeVolumeData:function(e){this.volumeDataNodes.delete(e)},getNormalText:function(e){var t="";return e?(t+="uniform sampler3D surfaceNormals_"+this.getId()+";\n",t+="\n",t+="vec4\n",t+="getNormal_"+this.getId()+" (in vec3 texCoord)\n",t+="{\n",t+="\tvec3 n = texture (surfaceNormals_"+this.getId()+", texCoord) .xyz * 2.0 - 1.0;\n",t+="\n",t+="\treturn vec4 (normalize (x3d_TextureNormalMatrix * n), length (n));\n",t+="}\n"):(t+="\n",t+="vec4\n",t+="getNormal_"+this.getId()+" (in vec3 texCoord)\n",t+="{\n",t+="\tvec4 offset = vec4 (1.0 / x3d_TextureSize, 0.0);\n",t+="\tfloat i0 = texture (x3d_Texture3D [0], texCoord + offset .xww) .r;\n",t+="\tfloat i1 = texture (x3d_Texture3D [0], texCoord - offset .xww) .r;\n",t+="\tfloat i2 = texture (x3d_Texture3D [0], texCoord + offset .wyw) .r;\n",t+="\tfloat i3 = texture (x3d_Texture3D [0], texCoord - offset .wyw) .r;\n",t+="\tfloat i4 = texture (x3d_Texture3D [0], texCoord + offset .wwz) .r;\n",t+="\tfloat i5 = texture (x3d_Texture3D [0], texCoord - offset .wwz) .r;\n",t+="\tvec3 n = vec3 (i1 - i0, i3 - i2, i5 - i4);\n",t+="\n",t+="\treturn vec4 (normalize (x3d_TextureNormalMatrix * n), length (n));\n",t+="}\n"),t}}),n})),e("x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode",["x_ite/Components/VolumeRendering/X3DVolumeRenderStyleNode","x_ite/Base/X3DConstants"],(function(e,t){"use strict";function n(n){e.call(this,n),this.addType(t.X3DComposableVolumeRenderStyleNode)}return n.prototype=Object.assign(Object.create(e.prototype),{constructor:n}),n})),e("x_ite/Components/VolumeRendering/OpacityMapVolumeStyle",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast"],(function(e,t,n,o,i,r){"use strict";function s(e){o.call(this,e),this.addType(i.OpacityMapVolumeStyle)}return s.prototype=Object.assign(Object.create(o.prototype),{constructor:s,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(i.inputOutput,"enabled",new e.SFBool(!0)),new t(i.inputOutput,"metadata",new e.SFNode),new t(i.inputOutput,"transferFunction",new e.SFNode)]),getTypeName:function(){return"OpacityMapVolumeStyle"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"renderStyle"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._transferFunction.addInterest("set_transferFunction__",this),this.set_transferFunction__())},set_transferFunction__:function(){this.transferFunctionNode=r(i.X3DTexture2DNode,this._transferFunction),this.transferFunctionNode||(this.transferFunctionNode=r(i.X3DTexture3DNode,this._transferFunction)),this.transferFunctionNode||(this.transferFunctionNode=this.getBrowser().getDefaultTransferFunction())},addShaderFields:function(t){this._enabled.getValue()&&t.addUserDefinedField(i.inputOutput,"transferFunction_"+this.getId(),new e.SFNode(this.transferFunctionNode))},getUniformsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="// OpacityMapVolumeStyle\n",e+="\n",-1!==this.transferFunctionNode.getType().indexOf(i.X3DTexture2DNode)?(e+="uniform sampler2D transferFunction_"+this.getId()+";\n",e+="\n",e+="vec4\n",e+="getOpacityMapStyle_"+this.getId()+" (in vec4 originalColor)\n",e+="{\n",e+="\treturn texture (transferFunction_"+this.getId()+", originalColor .rg);\n",e+="}\n"):(e+="uniform sampler3D transferFunction_"+this.getId()+";\n",e+="\n",e+="vec4\n",e+="getOpacityMapStyle_"+this.getId()+" (in vec4 originalColor)\n",e+="{\n",e+="\treturn texture (transferFunction_"+this.getId()+", originalColor .rgb);\n",e+="}\n"),e},getFunctionsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="\t// OpacityMapVolumeStyle\n",e+="\n",e+="\ttextureColor = getOpacityMapStyle_"+this.getId()+" (textureColor);\n"}}),s})),e("x_ite/Browser/VolumeRendering/X3DVolumeRenderingContext",["x_ite/Components/Texturing/PixelTexture","x_ite/Components/Texturing/TextureProperties","x_ite/Components/VolumeRendering/OpacityMapVolumeStyle"],(function(e,t,n){"use strict";const o=Symbol(),i=Symbol(),r=Symbol();function s(){}return s.prototype={getDefaultVolumeStyle:function(){return this[o]=new n(this.getPrivateScene()),this[o].setup(),this.getDefaultVolumeStyle=function(){return this[o]},Object.defineProperty(this,"getDefaultVolumeStyle",{enumerable:!1}),this[o]},getDefaultBlendedVolumeStyle:function(){return this[i]=new n(this.getPrivateScene()),this[i].setup(),this.getDefaultBlendedVolumeStyle=function(){return this[i]},Object.defineProperty(this,"getDefaultBlendedVolumeStyle",{enumerable:!1}),this[i]},getDefaultTransferFunction:function(){this[r]=new e(this.getPrivateScene());const n=new t(this.getPrivateScene());n._generateMipMaps=!0,n._boundaryModeS="CLAMP_TO_EDGE",n._boundaryModeT="REPEAT",this[r]._textureProperties=n,this[r]._image.width=256,this[r]._image.height=1,this[r]._image.comp=2;const o=this[r]._image.array;for(let e=0;e<256;++e)o[e]=e<<8|e;return n.setup(),this[r].setup(),this.getDefaultTransferFunction=function(){return this[r]},Object.defineProperty(this,"getDefaultTransferFunction",{enumerable:!1}),this[r]}},s})),e("x_ite/Components/VolumeRendering/BlendedVolumeStyle",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast","x_ite/DEBUG"],(function(e,t,n,o,i,r,s){"use strict";function a(e){o.call(this,e),this.addType(i.BlendedVolumeStyle)}return a.prototype=Object.assign(Object.create(o.prototype),{constructor:a,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(i.inputOutput,"metadata",new e.SFNode),new t(i.inputOutput,"enabled",new e.SFBool(!0)),new t(i.inputOutput,"weightConstant1",new e.SFFloat(.5)),new t(i.inputOutput,"weightConstant2",new e.SFFloat(.5)),new t(i.inputOutput,"weightFunction1",new e.SFString("CONSTANT")),new t(i.inputOutput,"weightFunction2",new e.SFString("CONSTANT")),new t(i.inputOutput,"weightTransferFunction1",new e.SFNode),new t(i.inputOutput,"weightTransferFunction2",new e.SFNode),new t(i.inputOutput,"renderStyle",new e.SFNode),new t(i.inputOutput,"voxels",new e.SFNode)]),getTypeName:function(){return"BlendedVolumeStyle"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"renderStyle"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._weightTransferFunction1.addInterest("set_weightTransferFunction1__",this),this._weightTransferFunction2.addInterest("set_weightTransferFunction2__",this),this._renderStyle.addInterest("set_renderStyle__",this),this._voxels.addInterest("set_voxels__",this),this.set_weightTransferFunction1__(),this.set_weightTransferFunction2__(),this.set_renderStyle__(),this.set_voxels__())},addVolumeData:function(e){o.prototype.addVolumeData.call(this,e),this.renderStyleNode&&this.renderStyleNode.addVolumeData(e)},removeVolumeData:function(e){o.prototype.removeVolumeData.call(this,e),this.renderStyleNode&&this.renderStyleNode.removeVolumeData(e)},set_weightTransferFunction1__:function(){this.weightTransferFunction1Node=r(i.X3DTexture2DNode,this._weightTransferFunction1)},set_weightTransferFunction2__:function(){this.weightTransferFunction2Node=r(i.X3DTexture2DNode,this._weightTransferFunction2)},set_renderStyle__:function(){this.renderStyleNode&&(this.renderStyleNode.removeInterest("addNodeEvent",this),this.getVolumeData().forEach(function(e){this.renderStyleNode.removeVolumeData(e)}.bind(this))),this.renderStyleNode=r(i.X3DComposableVolumeRenderStyleNode,this._renderStyle),this.renderStyleNode&&(this.renderStyleNode.addInterest("addNodeEvent",this),this.getVolumeData().forEach(function(e){this.renderStyleNode.addVolumeData(e)}.bind(this)))},set_voxels__:function(){this.voxelsNode&&this.voxelsNode.removeInterest("set_textureSize__",this),this.voxelsNode=r(i.X3DTexture3DNode,this._voxels),this.voxelsNode&&(this.voxelsNode.addInterest("set_textureSize__",this),this.set_textureSize__())},set_textureSize__:function(){this.getVolumeData().forEach(function(e){try{var t=e.getShader().getField("textureSize_"+this.getId());t.x=this.voxelsNode.getWidth(),t.y=this.voxelsNode.getHeight(),t.z=this.voxelsNode.getDepth()}catch(e){s&&console.error(e)}}.bind(this))},addShaderFields:function(t){if(this._enabled.getValue()){if(t.addUserDefinedField(i.inputOutput,"weightConstant1_"+this.getId(),this._weightConstant1.copy()),t.addUserDefinedField(i.inputOutput,"weightConstant2_"+this.getId(),this._weightConstant2.copy()),this.weightTransferFunction1Node&&t.addUserDefinedField(i.inputOutput,"weightTransferFunction1_"+this.getId(),new e.SFNode(this.weightTransferFunction1Node)),this.weightTransferFunction2Node&&t.addUserDefinedField(i.inputOutput,"weightTransferFunction2_"+this.getId(),new e.SFNode(this.weightTransferFunction2Node)),this.voxelsNode){var n=new e.SFVec3f(this.voxelsNode.getWidth(),this.voxelsNode.getHeight(),this.voxelsNode.getDepth());t.addUserDefinedField(i.inputOutput,"voxels_"+this.getId(),new e.SFNode(this.voxelsNode)),t.addUserDefinedField(i.inputOutput,"textureSize_"+this.getId(),n)}else t.addUserDefinedField(i.inputOutput,"textureSize_"+this.getId(),new e.SFVec3f);this.getBrowser().getDefaultBlendedVolumeStyle().addShaderFields(t),this.renderStyleNode&&this.renderStyleNode.addShaderFields(t)}},getUniformsText:function(){if(!this._enabled.getValue())return"";if(!this.voxelsNode)return"";var e="";e+="\n",e+="// BlendedVolumeStyle\n",e+="\n",e+="uniform float weightConstant1_"+this.getId()+";\n",e+="uniform float weightConstant2_"+this.getId()+";\n",this.weightTransferFunction1Node&&(e+="uniform sampler2D weightTransferFunction1_"+this.getId()+";\n"),this.weightTransferFunction2Node&&(e+="uniform sampler2D weightTransferFunction2_"+this.getId()+";\n"),e+="uniform sampler3D voxels_"+this.getId()+";\n",e+="uniform vec3 textureSize_"+this.getId()+";\n";var t=this.getBrowser().getDefaultBlendedVolumeStyle().getUniformsText();this.renderStyleNode&&(t+=this.renderStyleNode.getUniformsText()),e+="\n",e+=t=(t=t.replace(/x3d_Texture3D \[0\]/g,"voxels_"+this.getId())).replace(/x3d_TextureSize/g,"textureSize_"+this.getId()),e+="\n",e+="vec4\n",e+="getBlendedStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+="\tvec4 blendColor_"+this.getId()+" = texture (voxels_"+this.getId()+", texCoord);";var n=this.getBrowser().getDefaultBlendedVolumeStyle().getFunctionsText();switch(this.renderStyleNode&&(n+=this.renderStyleNode.getFunctionsText()),e+="\n",e+=n=n.replace(/textureColor/g,"blendColor_"+this.getId()),this._weightFunction1.getValue()){default:e+="\tfloat w1_"+this.getId()+" = weightConstant1_"+this.getId()+";\n";break;case"ALPHA0":e+="\tfloat w1_"+this.getId()+" = originalColor .a;\n";break;case"ALPHA1":e+="\tfloat w1_"+this.getId()+" = blendColor_ "+this.getId()+" .a;\n";break;case"ONE_MINUS_ALPHA0":e+="\tfloat w1_"+this.getId()+" = 1.0 - originalColor .a;\n";break;case"ONE_MINUS_ALPHA1":e+="\tfloat w1_"+this.getId()+" = 1.0 - blendColor_ "+this.getId()+" .a;\n";break;case"TABLE":this.weightTransferFunction1Node?e+="\tfloat w1_"+this.getId()+" = texture (weightTransferFunction1_"+this.getId()+", vec2 (originalColor .a, blendColor_"+this.getId()+" .a)) .r;\n":e+="\tfloat w1_"+this.getId()+" = weightConstant1_"+this.getId()+";\n"}switch(this._weightFunction2.getValue()){default:e+="\tfloat w2_"+this.getId()+" = weightConstant2_"+this.getId()+";\n";break;case"ALPHA0":e+="\tfloat w2_"+this.getId()+" = originalColor .a;\n";break;case"ALPHA1":e+="\tfloat w2_"+this.getId()+" = blendColor_ "+this.getId()+" .a;\n";break;case"ONE_MINUS_ALPHA0":e+="\tfloat w2_"+this.getId()+" = 1.0 - originalColor .a;\n";break;case"ONE_MINUS_ALPHA1":e+="\tfloat w2_"+this.getId()+" = 1.0 - blendColor_ "+this.getId()+" .a;\n";break;case"TABLE":this.weightTransferFunction2Node?e+="\tfloat w2_"+this.getId()+" = texture (weightTransferFunction2_"+this.getId()+", vec2 (originalColor .a, blendColor_"+this.getId()+" .a)) .r;\n":e+="\tfloat w2_"+this.getId()+" = weightConstant2_"+this.getId()+";\n"}return e+="\n",e+="\treturn clamp (originalColor * w1_"+this.getId()+" + blendColor_"+this.getId()+" * w2_"+this.getId()+", 0.0, 1.0);\n",e+="}\n"},getFunctionsText:function(){if(!this._enabled.getValue())return"";if(!this.voxelsNode)return"";var e="";return e+="\n",e+="\t// BlendedVolumeStyle\n",e+="\n",e+="\ttextureColor = getBlendedStyle_"+this.getId()+" (textureColor, texCoord);\n"}}),a})),e("x_ite/Components/VolumeRendering/BoundaryEnhancementVolumeStyle",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode","x_ite/Base/X3DConstants"],(function(e,t,n,o,i){"use strict";function r(e){o.call(this,e),this.addType(i.BoundaryEnhancementVolumeStyle)}return r.prototype=Object.assign(Object.create(o.prototype),{constructor:r,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(i.inputOutput,"metadata",new e.SFNode),new t(i.inputOutput,"enabled",new e.SFBool(!0)),new t(i.inputOutput,"retainedOpacity",new e.SFFloat(.2)),new t(i.inputOutput,"boundaryOpacity",new e.SFFloat(.9)),new t(i.inputOutput,"opacityFactor",new e.SFFloat(2))]),getTypeName:function(){return"BoundaryEnhancementVolumeStyle"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"renderStyle"},addShaderFields:function(e){this._enabled.getValue()&&(e.addUserDefinedField(i.inputOutput,"retainedOpacity_"+this.getId(),this._retainedOpacity.copy()),e.addUserDefinedField(i.inputOutput,"boundaryOpacity_"+this.getId(),this._boundaryOpacity.copy()),e.addUserDefinedField(i.inputOutput,"opacityFactor_"+this.getId(),this._opacityFactor.copy()))},getUniformsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="// BoundaryEnhancementVolumeStyle\n",e+="\n",e+="uniform float retainedOpacity_"+this.getId()+";\n",e+="uniform float boundaryOpacity_"+this.getId()+";\n",e+="uniform float opacityFactor_"+this.getId()+";\n",e+="\n",e+="vec4\n",e+="getBoundaryEnhancementStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+="\tfloat f0 = texture (x3d_Texture3D [0], texCoord) .r;\n",e+="\tfloat f1 = texture (x3d_Texture3D [0], texCoord + vec3 (0.0, 0.0, 1.0 / x3d_TextureSize .z)) .r;\n",e+="\tfloat f = abs (f0 - f1);\n",e+="\n",e+="\tfloat retainedOpacity = retainedOpacity_"+this.getId()+";\n",e+="\tfloat boundaryOpacity = boundaryOpacity_"+this.getId()+";\n",e+="\tfloat opacityFactor = opacityFactor_"+this.getId()+";\n",e+="\n",e+="\treturn vec4 (originalColor .rgb, originalColor .a * (retainedOpacity + boundaryOpacity * pow (f, opacityFactor)));\n",e+="}\n"},getFunctionsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="\t// BoundaryEnhancementVolumeStyle\n",e+="\n",e+="\ttextureColor = getBoundaryEnhancementStyle_"+this.getId()+" (textureColor, texCoord);\n"}}),r})),e("x_ite/Components/VolumeRendering/CartoonVolumeStyle",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast"],(function(e,t,n,o,i,r){"use strict";function s(e){o.call(this,e),this.addType(i.CartoonVolumeStyle)}return s.prototype=Object.assign(Object.create(o.prototype),{constructor:s,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(i.inputOutput,"metadata",new e.SFNode),new t(i.inputOutput,"enabled",new e.SFBool(!0)),new t(i.inputOutput,"colorSteps",new e.SFInt32(4)),new t(i.inputOutput,"orthogonalColor",new e.SFColorRGBA(1,1,1,1)),new t(i.inputOutput,"parallelColor",new e.SFColorRGBA(0,0,0,1)),new t(i.inputOutput,"surfaceNormals",new e.SFNode)]),getTypeName:function(){return"CartoonVolumeStyle"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"renderStyle"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__())},set_surfaceNormals__:function(){this.surfaceNormalsNode=r(i.X3DTexture3DNode,this._surfaceNormals)},addShaderFields:function(t){this._enabled.getValue()&&(t.addUserDefinedField(i.inputOutput,"colorSteps_"+this.getId(),this._colorSteps.copy()),t.addUserDefinedField(i.inputOutput,"orthogonalColor_"+this.getId(),this._orthogonalColor.copy()),t.addUserDefinedField(i.inputOutput,"parallelColor_"+this.getId(),this._parallelColor.copy()),this.surfaceNormalsNode&&t.addUserDefinedField(i.inputOutput,"surfaceNormals_"+this.getId(),new e.SFNode(this.surfaceNormalsNode)))},getUniformsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="// CartoonVolumeStyle\n",e+="\n",e+="uniform int colorSteps_"+this.getId()+";\n",e+="uniform vec4 orthogonalColor_"+this.getId()+";\n",e+="uniform vec4 parallelColor_"+this.getId()+";\n",e+=this.getNormalText(this.surfaceNormalsNode),e+="\n",e+="vec3\n",e+="rgb2hsv_"+this.getId()+" (in vec3 color)\n",e+="{\n",e+="\tfloat h = 0.0;\n",e+="\tfloat s = 0.0;\n",e+="\tfloat v = 0.0;\n",e+="\n",e+="\tfloat min = min (min (color .r, color .g), color .b);\n",e+="\tfloat max = max (max (color .r, color .g), color .b);\n",e+="\tv = max; // value\n",e+="\n",e+="\tfloat delta = max - min;\n",e+="\n",e+="\tif (max != 0.0 && delta != 0.0)\n",e+="\t{\n",e+="\t\ts = delta / max; // s\n",e+="\n",e+="\t\tif (color .r == max)\n",e+="\t\t\th = (color .g - color .b) / delta; // between yellow & magenta\n",e+="\t\telse if (color .g == max)\n",e+="\t\t\th = 2.0 + (color .b - color .r) / delta; // between cyan & yellow\n",e+="\t\telse\n",e+="\t\t\th = 4.0 + (color .r - color .g) / delta; // between magenta & cyan\n",e+="\n",e+="\t\th *= M_PI / 3.0; // radiants\n",e+="\t\tif (h < 0.0)\n",e+="\t\t\th += M_PI * 2.0;\n",e+="\t}\n",e+="\telse\n",e+="\t\ts = h = 0.0; // s = 0, h is undefined\n",e+="\n",e+="\treturn vec3 (h, s, v);\n",e+="}\n",e+="\n",e+="vec3\n",e+="hsv2rgb_"+this.getId()+" (in vec3 hsv)\n",e+="{\n",e+="\tfloat h = hsv [0];\n",e+="\tfloat s = clamp (hsv [1], 0.0, 1.0);\n",e+="\tfloat v = clamp (hsv [2], 0.0, 1.0);\n",e+="\n",e+="\t// H is given on [0, 2 * Pi]. S and V are given on [0, 1].\n",e+="\t// RGB are each returned on [0, 1].\n",e+="\n",e+="\tif (s == 0.0)\n",e+="\t{\n",e+="\t\t// achromatic (grey)\n",e+="\t\treturn vec3 (v, v, v);\n",e+="\t}\n",e+="\telse\n",e+="\t{\n",e+="\t\tfloat w = (h * (180.0 / M_PI)) / 60.0; // sector 0 to 5\n",e+="\n",e+="\t\tfloat i = floor (w);\n",e+="\t\tfloat f = w - i; // factorial part of h\n",e+="\t\tfloat p = v * ( 1.0 - s );\n",e+="\t\tfloat q = v * ( 1.0 - s * f );\n",e+="\t\tfloat t = v * ( 1.0 - s * ( 1.0 - f ) );\n",e+="\n",e+="\t\tswitch (int (i) % 6)\n",e+="\t\t{\n",e+="\t\t\tcase 0: return vec3 (v, t, p);\n",e+="\t\t\tcase 1: return vec3 (q, v, p);\n",e+="\t\t\tcase 2: return vec3 (p, v, t);\n",e+="\t\t\tcase 3: return vec3 (p, q, v);\n",e+="\t\t\tcase 4: return vec3 (t, p, v);\n",e+="\t\t\tdefault: return vec3 (v, p, q);\n",e+="\t\t}\n",e+="\t}\n",e+="\n",e+="\treturn vec3 (0.0);\n",e+="}\n",e+="\n",e+="vec3\n",e+="mix_hsv_"+this.getId()+" (in vec3 a, in vec3 b, in float t)\n",e+="{\n",e+="\t// Linearely interpolate in HSV space between source color @a a and destination color @a b by an amount of @a t.\n",e+="\t// Source and destination color must be in HSV space.\n",e+="\n",e+="\tfloat ha = a [0];\n",e+="\tfloat sa = a [1];\n",e+="\tfloat va = a [2];\n",e+="\n",e+="\tfloat hb = b [0];\n",e+="\tfloat sb = b [1];\n",e+="\tfloat vb = b [2];\n",e+="\n",e+="\tif (sa == 0.0)\n",e+="\t\tha = hb;\n",e+="\n",e+="\tif (sb == 0.0)\n",e+="\t\thb = ha;\n",e+="\n",e+="\tfloat range = abs (hb - ha);\n",e+="\n",e+="\tif (range <= M_PI)\n",e+="\t{\n",e+="\t\tfloat h = ha + t * (hb - ha);\n",e+="\t\tfloat s = sa + t * (sb - sa);\n",e+="\t\tfloat v = va + t * (vb - va);\n",e+="\t\treturn vec3 (h, s, v);\n",e+="\t}\n",e+="\n",e+="\tfloat PI2 = M_PI * 2.0;\n",e+="\tfloat step = (PI2 - range) * t;\n",e+="\tfloat h = ha < hb ? ha - step : ha + step;\n",e+="\n",e+="\tif (h < 0.0)\n",e+="\t\th += PI2;\n",e+="\n",e+="\telse if (h > PI2)\n",e+="\t\th -= PI2;\n",e+="\n",e+="\tfloat s = sa + t * (sb - sa);\n",e+="\tfloat v = va + t * (vb - va);\n",e+="\treturn vec3 (h, s, v);\n",e+="}\n",e+="\n",e+="vec4\n",e+="getCartoonStyle_"+this.getId()+" (in vec4 originalColor, vec3 texCoord)\n",e+="{\n",e+="\tvec4 surfaceNormal = getNormal_"+this.getId()+" (texCoord);\n",e+="\n",e+="\tif (surfaceNormal .w == 0.0)\n",e+="\t\treturn vec4 (0.0);\n",e+="\n",e+="\tvec4 orthogonalColor = orthogonalColor_"+this.getId()+";\n",e+="\tvec4 parallelColor = parallelColor_"+this.getId()+";\n",e+="\tint colorSteps = colorSteps_"+this.getId()+";\n",e+="\n",e+="\tfloat steps = clamp (float (colorSteps), 1.0, 64.0);\n",e+="\tfloat step = M_PI / 2.0 / steps;\n",e+="\tfloat cosTheta = min (dot (surfaceNormal .xyz, normalize (vertex)), 1.0);\n",e+="\n",e+="\tif (cosTheta < 0.0)\n",e+="\t\treturn vec4 (0.0);\n",e+="\n",e+="\tfloat t = cos (min (floor (acos (cosTheta) / step) * (steps > 1.0 ? steps / (steps - 1.0) : 1.0), steps) * step);\n",e+="\tvec3 orthogonalHSV = rgb2hsv_"+this.getId()+" (orthogonalColor .rgb);\n",e+="\tvec3 parallelHSV = rgb2hsv_"+this.getId()+" (parallelColor .rgb);\n",e+="\n",e+="\treturn vec4 (hsv2rgb_"+this.getId()+" (mix_hsv_"+this.getId()+" (orthogonalHSV, parallelHSV, t)), originalColor .a);\n",e+="}\n"},getFunctionsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="\t// CartoonVolumeStyle\n",e+="\n",e+="\ttextureColor = getCartoonStyle_"+this.getId()+" (textureColor, texCoord);\n"}}),s})),e("x_ite/Components/VolumeRendering/ComposedVolumeStyle",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast"],(function(e,t,n,o,i,r){"use strict";function s(e){o.call(this,e),this.addType(i.ComposedVolumeStyle),this.renderStyleNodes=[]}return s.prototype=Object.assign(Object.create(o.prototype),{constructor:s,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(i.inputOutput,"metadata",new e.SFNode),new t(i.inputOutput,"enabled",new e.SFBool(!0)),new t(i.inputOutput,"renderStyle",new e.MFNode)]),getTypeName:function(){return"ComposedVolumeStyle"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"renderStyle"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._renderStyle.addInterest("set_renderStyle__",this),this.set_renderStyle__())},addVolumeData:function(e){o.prototype.addVolumeData.call(this,e);for(var t=this.renderStyleNodes,n=0,i=t.length;n<i;++n){t[n].addVolumeData(e)}},removeVolumeData:function(e){o.prototype.removeVolumeData.call(this,e);for(var t=0,n=renderStyleNodes.length;t<n;++t){renderStyleNodes[t].removeVolumeData(e)}},set_renderStyle__:function(){for(var e=this.renderStyleNodes,t=0,n=e.length;t<n;++t){(o=e[t]).removeInterest("addNodeEvent",this),this.getVolumeData().forEach((function(e){o.removeVolumeData(e)}))}e.length=0;for(t=0,n=this._renderStyle.length;t<n;++t){(o=r(i.X3DComposableVolumeRenderStyleNode,this._renderStyle[t]))&&e.push(o)}for(t=0,n=e.length;t<n;++t){var o;(o=e[t]).addInterest("addNodeEvent",this),this.getVolumeData().forEach((function(e){o.addVolumeData(e)}))}},addShaderFields:function(e){if(this._enabled.getValue())for(var t=this.renderStyleNodes,n=0,o=t.length;n<o;++n)t[n].addShaderFields(e)},getUniformsText:function(){if(!this._enabled.getValue())return"";for(var e=this.renderStyleNodes,t="",n=0,o=e.length;n<o;++n)t+=e[n].getUniformsText();t+="\n",t+="vec4\n",t+="getComposedStyle_"+this.getId()+" (in vec4 textureColor, in vec3 texCoord)\n",t+="{\n";for(n=0,o=e.length;n<o;++n)t+=e[n].getFunctionsText();return t+="\n",t+="\treturn textureColor;\n",t+="}\n"},getFunctionsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="\t// ComposedVolumeStyle\n",e+="\n",e+="\ttextureColor = getComposedStyle_"+this.getId()+" (textureColor, texCoord);\n"}}),s})),e("x_ite/Components/VolumeRendering/EdgeEnhancementVolumeStyle",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast"],(function(e,t,n,o,i,r){"use strict";function s(e){o.call(this,e),this.addType(i.EdgeEnhancementVolumeStyle)}return s.prototype=Object.assign(Object.create(o.prototype),{constructor:s,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(i.inputOutput,"metadata",new e.SFNode),new t(i.inputOutput,"enabled",new e.SFBool(!0)),new t(i.inputOutput,"edgeColor",new e.SFColorRGBA(0,0,0,1)),new t(i.inputOutput,"gradientThreshold",new e.SFFloat(.4)),new t(i.inputOutput,"surfaceNormals",new e.SFNode)]),getTypeName:function(){return"EdgeEnhancementVolumeStyle"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"renderStyle"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__())},set_surfaceNormals__:function(){this.surfaceNormalsNode=r(i.X3DTexture3DNode,this._surfaceNormals)},addShaderFields:function(t){this._enabled.getValue()&&(t.addUserDefinedField(i.inputOutput,"edgeColor_"+this.getId(),this._edgeColor.copy()),t.addUserDefinedField(i.inputOutput,"gradientThreshold_"+this.getId(),this._gradientThreshold.copy()),this.surfaceNormalsNode&&t.addUserDefinedField(i.inputOutput,"surfaceNormals_"+this.getId(),new e.SFNode(this.surfaceNormalsNode)))},getUniformsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="// EdgeEnhancementVolumeStyle\n",e+="\n",e+="uniform vec4 edgeColor_"+this.getId()+";\n",e+="uniform float gradientThreshold_"+this.getId()+";\n",e+=this.getNormalText(this.surfaceNormalsNode),e+="\n",e+="vec4\n",e+="getEdgeEnhacementStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+="\tvec4 surfaceNormal = getNormal_"+this.getId()+" (texCoord);\n",e+="\n",e+="\tif (surfaceNormal .w == 0.0)\n",e+="\t\treturn vec4 (0.0);\n",e+="\n",e+="\tvec4 edgeColor = edgeColor_"+this.getId()+";\n",e+="\tfloat gradientThreshold = gradientThreshold_"+this.getId()+";\n",e+="\n",e+="\tfloat angle = abs (dot (surfaceNormal .xyz, normalize (vertex)));\n",e+="\n",e+="\tif (angle >= cos (gradientThreshold))\n",e+="\t\treturn originalColor;\n",e+="\telse\n",e+="\t\treturn vec4 (mix (edgeColor .rgb, originalColor.rgb, angle), originalColor .a);\n",e+="}\n"},getFunctionsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="\t// EdgeEnhancementVolumeStyle\n",e+="\n",e+="\ttextureColor = getEdgeEnhacementStyle_"+this.getId()+" (textureColor, texCoord);\n"}}),s})),e("x_ite/Components/VolumeRendering/X3DVolumeDataNode",["x_ite/Fields","x_ite/Components/Core/X3DChildNode","x_ite/Components/Grouping/X3DBoundedObject","x_ite/Base/X3DConstants","x_ite/Browser/Core/TextureQuality","standard/Math/Numbers/Vector3"],(function(e,t,n,o,i,r){"use strict";function s(e){t.call(this,e),n.call(this,e),this.addType(o.X3DVolumeDataNode),this.proximitySensorNode=e.createNode("ProximitySensor",!1),this.transformNode=e.createNode("Transform",!1),this.shapeNode=e.createNode("Shape",!1),this.appearanceNode=e.createNode("Appearance",!1),this.textureTransformNode=e.createNode("TextureTransform3D",!1),this.geometryNode=e.createNode("QuadSet",!1),this.textureCoordinateNode=e.createNode("TextureCoordinate3D",!1),this.coordinateNode=e.createNode("Coordinate",!1),this.setCameraObject(!0)}return s.prototype=Object.assign(Object.create(t.prototype),n.prototype,{constructor:s,initialize:function(){t.prototype.initialize.call(this),n.prototype.initialize.call(this);var o=this.getBrowser(),i=o.getContext();o.getBrowserOptions()._TextureQuality.addInterest("set_dimensions__",this),i.getVersion()>=2&&(this._dimensions.addInterest("set_dimensions__",this),this.set_dimensions__()),this.appearanceNode.setPrivate(!0),this.proximitySensorNode._size=new e.SFVec3f(-1,-1,-1),this.transformNode._children=new e.MFNode(this.shapeNode),this.shapeNode._appearance=this.appearanceNode,this.shapeNode._geometry=this.geometryNode,this.appearanceNode._alphaMode="BLEND",this.appearanceNode._textureTransform=this.textureTransformNode,this.textureTransformNode._translation=new e.SFVec3f(.5,.5,.5),this.textureTransformNode._center=new e.SFVec3f(-.5,-.5,-.5),this.geometryNode._texCoord=this.textureCoordinateNode,this.geometryNode._coord=this.coordinateNode,this.coordinateNode.setup(),this.textureCoordinateNode.setup(),this.geometryNode.setup(),this.textureTransformNode.setup(),this.appearanceNode.setup(),this.shapeNode.setup(),this.transformNode.setup(),this.proximitySensorNode.setup(),this.proximitySensorNode._orientation_changed.addFieldInterest(this.transformNode._rotation),this.proximitySensorNode._orientation_changed.addFieldInterest(this.textureTransformNode._rotation),this.textureTransformNode.addInterest("set_textureTransform__",this)},getBBox:function(e,t){return this._bboxSize.getValue().equals(this.getDefaultBBoxSize())?e.set(this._dimensions.getValue(),r.Zero):e.set(this._bboxSize.getValue(),this._bboxCenter.getValue())},getAppearance:function(){return this.appearanceNode},setShader:function(t){this.getAppearance()._shaders[0]=t,t.addUserDefinedField(o.inputOutput,"x3d_TextureNormalMatrix",new e.SFMatrix3f),t.setup(),this.set_textureTransform__()},getShader:function(){var e=this.appearanceNode._shaders[0];return e?e.getValue():null},getNumPlanes:function(){switch(this.getBrowser().getBrowserOptions().getTextureQuality()){case i.LOW:return 200;case i.MEDIUM:return 400;case i.HIGH:return 600}return 200},set_dimensions__:function(){var t=this.getNumPlanes(),n=this._dimensions.getValue().abs(),o=n/2,i=[];this.coordinateNode._point.length=0;for(var r=0;r<t;++r){var s=r/(t-1)-.5;i.push(o,o,n*s,-o,o,n*s,-o,-o,n*s,o,-o,n*s)}this.coordinateNode._point=i,this.textureCoordinateNode._point=i,this.textureTransformNode._scale=new e.SFVec3f(1/this._dimensions.x,1/this._dimensions.y,1/this._dimensions.z)},set_textureTransform__:function(){var e=this.getShader();e&&e.getField("x3d_TextureNormalMatrix").setValue(this.textureTransformNode.getMatrix().submatrix.inverse().transpose())},traverse:function(e,t){this.proximitySensorNode.traverse(e,t),this.transformNode.traverse(e,t)}}),s})),e("text!x_ite/Browser/VolumeRendering/VolumeStyle.vs",[],(function(){return"#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nuniform mat4 x3d_ProjectionMatrix;\nuniform mat4 x3d_ModelViewMatrix;\nuniform mat4 x3d_TextureMatrix [1];\n\nin float x3d_FogDepth;\nin vec4 x3d_TexCoord0;\nin vec4 x3d_Vertex;\n\nout float fogDepth;\nout vec3 vertex;\nout vec4 texCoord;\n\nvoid\nmain ()\n{\n vec4 position = x3d_ModelViewMatrix * x3d_Vertex;\n\n fogDepth = x3d_FogDepth;\n vertex = position .xyz;\n texCoord = x3d_TextureMatrix [0] * x3d_TexCoord0;\n\n gl_Position = x3d_ProjectionMatrix * position;\n}\n"})),e("text!x_ite/Browser/VolumeRendering/VolumeStyle.fs",[],(function(){return"#version 300 es\n\nprecision highp float;\nprecision highp int;\nprecision highp sampler3D;\n\nuniform int x3d_NumLights;\nuniform x3d_LightSourceParameters x3d_LightSource [x3d_MaxLights];\n\nuniform int x3d_NumTextures;\nuniform sampler3D x3d_Texture3D [1];\nuniform vec3 x3d_TextureSize;\n\nuniform mat3 x3d_TextureNormalMatrix;\n\nconst float M_PI = 3.14159265359;\n\nin float fogDepth;\nin vec3 vertex;\nin vec4 texCoord;\n\n\nuniform x3d_FogParameters x3d_Fog;\n\nfloat\ngetFogInterpolant ()\n{\n // Returns 0.0 for fog color and 1.0 for material color.\n\n if (x3d_Fog .type == x3d_None)\n return 1.0;\n\n if (x3d_Fog .fogCoord)\n return clamp (1.0 - fogDepth, 0.0, 1.0);\n\n float visibilityRange = x3d_Fog .visibilityRange;\n\n if (visibilityRange <= 0.0)\n return 1.0;\n\n float dV = length (x3d_Fog .matrix * vertex);\n\n if (dV >= visibilityRange)\n return 0.0;\n\n switch (x3d_Fog .type)\n {\n case x3d_LinearFog:\n {\n return (visibilityRange - dV) / visibilityRange;\n }\n case x3d_ExponentialFog:\n {\n return exp (-dV / (visibilityRange - dV));\n }\n default:\n {\n return 1.0;\n }\n }\n}\n\nvec3\ngetFogColor (const in vec3 color)\n{\n return mix (x3d_Fog .color, color, getFogInterpolant ());\n}\n\n// VOLUME_STYLES_UNIFORMS\n\nout vec4 x3d_FragColor;\n\n\nuniform int x3d_NumClipPlanes;\nuniform vec4 x3d_ClipPlane [x3d_MaxClipPlanes];\n\nvoid\nclip ()\n{\n for (int i = 0; i < x3d_MaxClipPlanes; ++ i)\n {\n if (i == x3d_NumClipPlanes)\n break;\n\n if (dot (vertex, x3d_ClipPlane [i] .xyz) - x3d_ClipPlane [i] .w < 0.0)\n discard;\n }\n}\n\nvec4\ngetTextureColor (in vec3 texCoord)\n{\n if (x3d_NumTextures == 0)\n discard;\n\n if (texCoord .s < 0.0 || texCoord .s > 1.0)\n discard;\n\n if (texCoord .t < 0.0 || texCoord .t > 1.0)\n discard;\n\n if (texCoord .p < 0.0 || texCoord .p > 1.0)\n discard;\n\n vec4 textureColor = texture (x3d_Texture3D [0], texCoord);\n\n // Apply volume styles.\n\n// VOLUME_STYLES_FUNCTIONS\n\n return textureColor;\n}\n\nvoid\nmain ()\n{\n clip ();\n\n x3d_FragColor = getTextureColor (texCoord .stp / texCoord .q);\n}\n"})),e("x_ite/Components/VolumeRendering/IsoSurfaceVolumeData",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DVolumeDataNode","x_ite/Components/Shaders/ComposedShader","x_ite/Components/Shaders/ShaderPart","x_ite/Base/X3DConstants","x_ite/Base/X3DCast","text!x_ite/Browser/VolumeRendering/VolumeStyle.vs","text!x_ite/Browser/VolumeRendering/VolumeStyle.fs","x_ite/DEBUG"],(function(e,t,n,o,i,r,s,a,d,l,u){"use strict";function h(e){o.call(this,e),this.addType(s.IsoSurfaceVolumeData),this.renderStyleNodes=[]}return h.prototype=Object.assign(Object.create(o.prototype),{constructor:h,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(s.inputOutput,"metadata",new e.SFNode),new t(s.inputOutput,"dimensions",new e.SFVec3f(1,1,1)),new t(s.inputOutput,"contourStepSize",new e.SFFloat(0)),new t(s.inputOutput,"surfaceValues",new e.MFFloat),new t(s.inputOutput,"surfaceTolerance",new e.SFFloat(0)),new t(s.inputOutput,"visible",new e.SFBool(!0)),new t(s.inputOutput,"bboxDisplay",new e.SFBool),new t(s.initializeOnly,"bboxCenter",new e.SFVec3f(0,0,0)),new t(s.initializeOnly,"bboxSize",new e.SFVec3f(-1,-1,-1)),new t(s.inputOutput,"renderStyle",new e.MFNode),new t(s.inputOutput,"gradients",new e.SFNode),new t(s.inputOutput,"voxels",new e.SFNode)]),getTypeName:function(){return"IsoSurfaceVolumeData"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"children"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._gradients.addInterest("set_gradients__",this),this._renderStyle.addInterest("set_renderStyle__",this),this._voxels.addFieldInterest(this.getAppearance()._texture),this._contourStepSize.addInterest("update",this),this._surfaceValues.addInterest("update",this),this._surfaceTolerance.addInterest("update",this),this._renderStyle.addInterest("update",this),this.getAppearance()._texture=this._voxels,this.set_gradients__(),this.set_renderStyle__(),this.set_voxels__(),this.update())},set_gradients__:function(){this.gradientsNode=a(s.X3DTexture3DNode,this._gradients)},set_renderStyle__:function(){for(var e=this.renderStyleNodes,t=0,n=e.length;t<n;++t){(o=e[t]).removeInterest("update",this),o.removeVolumeData(this)}e.length=0;for(t=0,n=this._renderStyle.length;t<n;++t){(o=a(s.X3DComposableVolumeRenderStyleNode,this._renderStyle[t]))&&e.push(o)}for(t=0,n=e.length;t<n;++t){var o;(o=e[t]).addInterest("update",this),o.addVolumeData(this)}},set_voxels__:function(){this.voxelsNode&&this.voxelsNode.removeInterest("set_textureSize__",this),this.voxelsNode=a(s.X3DTexture3DNode,this._voxels),this.voxelsNode&&(this.voxelsNode.addInterest("set_textureSize__",this),this.set_textureSize__())},set_textureSize__:function(){try{var e=this.getShader().getField("x3d_TextureSize");e.x=this.voxelsNode.getWidth(),e.y=this.voxelsNode.getHeight(),e.z=this.voxelsNode.getDepth()}catch(e){u&&console.log(e.message)}},update:function(){this.setShader(this.createShader(d,l))},createShader:function(t,n){var o=this.getBrowser().getDefaultVolumeStyle(),a=o.getUniformsText(),d=o.getFunctionsText();a+="\n",a+="uniform float surfaceValues ["+this._surfaceValues.length+"];\n",a+="uniform float surfaceTolerance;\n";for(var l=0,u=this.renderStyleNodes.length;l<u;++l)a+=this.renderStyleNodes[l].getUniformsText();if(d+="\n",d+="\t// IsoSurfaceVolumeData\n",d+="\n",this.gradientsNode?(a+="\n",a+="uniform sampler3D gradients;\n",d+="\tif (length (texture (gradients, texCoord) .xyz * 2.0 - 1.0) < surfaceTolerance)\n",d+="\t\tdiscard;\n"):(a+="\n",a+="vec4\n",a+="getNormal (in vec3 texCoord)\n",a+="{\n",a+="\tvec4 offset = vec4 (1.0 / x3d_TextureSize, 0.0);\n",a+="\tfloat i0 = texture (x3d_Texture3D [0], texCoord + offset .xww) .r;\n",a+="\tfloat i1 = texture (x3d_Texture3D [0], texCoord - offset .xww) .r;\n",a+="\tfloat i2 = texture (x3d_Texture3D [0], texCoord + offset .wyw) .r;\n",a+="\tfloat i3 = texture (x3d_Texture3D [0], texCoord - offset .wyw) .r;\n",a+="\tfloat i4 = texture (x3d_Texture3D [0], texCoord + offset .wwz) .r;\n",a+="\tfloat i5 = texture (x3d_Texture3D [0], texCoord - offset .wwz) .r;\n",a+="\tvec3 n = vec3 (i1 - i0, i3 - i2, i5 - i4);\n",a+="\n",a+="\treturn vec4 (normalize (x3d_TextureNormalMatrix * n), length (n));\n",a+="}\n",d+="\tif (getNormal (texCoord) .w < surfaceTolerance)\n",d+="\t\tdiscard;\n"),d+="\n",d+="\tfloat intensity = textureColor .r;\n",d+="\n",1===this._surfaceValues.length){var h=Math.abs(this._contourStepSize.getValue());if(0===h)d+="\tif (intensity > surfaceValues [0])\n",d+="\t{\n",d+="\t\ttextureColor = vec4 (vec3 (surfaceValues [0]), 1.0);\n",this.renderStyleNodes.length&&(d+=this.renderStyleNodes[0].getFunctionsText()),d+="\t}\n",d+="\telse\n",d+="\t{\n",d+="\t\tdiscard;\n",d+="\t}\n",d+="\n";else{for(var c=[],g=this._surfaceValues[0]-h;g>0;g-=h)c.unshift(g);c.push(this._surfaceValues[0]);for(g=this._surfaceValues[0]+h;g<1;g+=h)c.push(g);d+="\tif (false)\n",d+="\t{ }\n";for(l=surfaceValues_.length-1;l>=0;--l)d+="\telse if (intensity > "+c[l]+")\n",d+="\t{\n",d+="\t\ttextureColor = vec4 (vec3 ("+c[l]+"), 1.0);\n",this.renderStyleNodes.length&&(d+=this.renderStyleNodes[0].getFunctionsText()),d+="\t}\n";d+="\telse\n",d+="\t{\n",d+="\t\tdiscard;\n",d+="\t}\n",d+="\n"}}else{d+="\tif (false)\n",d+="\t{ }\n";for(l=this._surfaceValues.length-1;l>=0;--l){if(d+="\telse if (intensity > surfaceValues ["+l+"])\n",d+="\t{\n",d+="\t\ttextureColor = vec4 (vec3 (surfaceValues ["+l+"]), 1.0);\n",this.renderStyleNodes.length){var f=Math.min(l,this.renderStyleNodes.length-1);d+=this.renderStyleNodes[f].getFunctionsText()}d+="\t}\n"}d+="\telse\n",d+="\t{\n",d+="\t\tdiscard;\n",d+="\t}\n",d+="\n"}n=(n=n.replace(/\/\/ VOLUME_STYLES_UNIFORMS\n/,a)).replace(/\/\/ VOLUME_STYLES_FUNCTIONS\n/,d);var p=new r(this.getExecutionContext());p.setName("VolumeDataVertexShader"),p._url.push("data:x-shader/x-vertex,"+t),p.setup();var m=new r(this.getExecutionContext());m.setName("VolumeDataFragmentShader"),m._type="FRAGMENT",m._url.push("data:x-shader/x-fragment,"+n),m.setup();var _=new i(this.getExecutionContext());if(_.setName("VolumeDataShader"),_._language="GLSL",_._parts.push(p),_._parts.push(m),_.addUserDefinedField(s.inputOutput,"surfaceValues",this._surfaceValues.copy()),_.addUserDefinedField(s.inputOutput,"surfaceTolerance",this._surfaceTolerance.copy()),this.gradientsNode&&_.addUserDefinedField(s.inputOutput,"grandients",new e.SFNode(this.gradientsNode)),this.voxelsNode){var x=new e.SFVec3f(this.voxelsNode.getWidth(),this.voxelsNode.getHeight(),this.voxelsNode.getDepth());_.addUserDefinedField(s.inputOutput,"x3d_TextureSize",x)}else _.addUserDefinedField(s.inputOutput,"x3d_TextureSize",new e.SFVec3f);o.addShaderFields(_);for(l=0,u=this.renderStyleNodes.length;l<u;++l)this.renderStyleNodes[l].addShaderFields(_);return _}}),h})),e("x_ite/Components/VolumeRendering/ProjectionVolumeStyle",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DVolumeRenderStyleNode","x_ite/Base/X3DConstants"],(function(e,t,n,o,i){"use strict";function r(e){o.call(this,e),this.addType(i.ProjectionVolumeStyle)}return r.prototype=Object.assign(Object.create(o.prototype),{constructor:r,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(i.inputOutput,"metadata",new e.SFNode),new t(i.inputOutput,"enabled",new e.SFBool(!0)),new t(i.inputOutput,"type",new e.SFString("MAX")),new t(i.inputOutput,"intensityThreshold",new e.SFFloat(0))]),getTypeName:function(){return"ProjectionVolumeStyle"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"renderStyle"},addShaderFields:function(e){this._enabled.getValue()&&e.addUserDefinedField(i.inputOutput,"intensityThreshold_"+this.getId(),this._intensityThreshold.copy())},getUniformsText:function(){if(!this._enabled.getValue())return"";var e="";switch(e+="\n",e+="// ProjectionVolumeStyle\n",e+="\n",e+="uniform float intensityThreshold_"+this.getId()+";\n",e+="\n",e+="vec4\n",e+="getProjectionStyle_"+this.getId()+"(in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",this._type.getValue()){default:case"MAX":case"AVERAGE":e+="\tfloat projectionColor = 0.0;\n";break;case"MIN":e+="\tfloat projectionColor = 1.0;\n"}switch(e+="\tconst int samples = 32;\n",e+="\tvec3 step = normalize (x3d_TextureNormalMatrix * vec3 (0.0, 0.0, 1.0)) / float (samples);\n",e+="\tvec3 ray = texCoord - step * float (samples) * 0.5;\n",e+="\tbool first = false;\n",e+="\n",e+="\tfor (int i = 0; i < samples; ++ i, ray += step)\n",e+="\t{\n",e+="\t\tif (ray .s < 0.0 || ray .s > 1.0)\n",e+="\t\t\tcontinue;\n",e+="\n",e+="\t\tif (ray .t < 0.0 || ray .t > 1.0)\n",e+="\t\t\tcontinue;\n",e+="\n",e+="\t\tif (ray .p < 0.0 || ray .p > 1.0)\n",e+="\t\t\tcontinue;\n",e+="\n",e+="\t\tfloat intensity = texture (x3d_Texture3D [0], ray) .r;\n",e+="\n",this._type.getValue()){default:case"MAX":e+="\t\tif (intensity < intensityThreshold_"+this.getId()+")\n",e+="\t\t\tcontinue;\n",e+="\n",e+="\t\tif (intensityThreshold_"+this.getId()+" > 0.0 && first)\n",e+="\t\t\tbreak;\n",e+="\n",e+="\t\tif (intensity <= projectionColor)\n",e+="\t\t{\n",e+="\t\t\tfirst = true;\n",e+="\t\t\tcontinue;\n",e+="\t\t}\n",e+="\n",e+="\t\tprojectionColor = intensity;\n";break;case"MIN":e+="\t\tif (intensity < intensityThreshold_"+this.getId()+")\n",e+="\t\t\tcontinue;\n",e+="\n",e+="\t\tif (intensityThreshold_"+this.getId()+" > 0.0 && first)\n",e+="\t\t\tbreak;\n",e+="\n",e+="\t\tif (intensity >= projectionColor)\n",e+="\t\t{\n",e+="\t\t\tfirst = true;\n",e+="\t\t\tcontinue;\n",e+="\t\t}\n",e+="\n",e+="\t\tprojectionColor = intensity;\n";break;case"AVERAGE":e+="\t\tprojectionColor += intensity;\n"}return e+="\t}\n",e+="\n","AVERAGE"===this._type.getValue()&&(e+="\tprojectionColor /= float (samples);\n"),e+="\treturn vec4 (vec3 (projectionColor), originalColor .a);\n",e+="}\n"},getFunctionsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="\t// ProjectionVolumeStyle\n",e+="\n",e+="\ttextureColor = getProjectionStyle_"+this.getId()+" (textureColor, texCoord);\n"}}),r})),e("x_ite/Components/VolumeRendering/SegmentedVolumeData",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DVolumeDataNode","x_ite/Components/Shaders/ComposedShader","x_ite/Components/Shaders/ShaderPart","x_ite/Base/X3DConstants","x_ite/Base/X3DCast","text!x_ite/Browser/VolumeRendering/VolumeStyle.vs","text!x_ite/Browser/VolumeRendering/VolumeStyle.fs","x_ite/DEBUG"],(function(e,t,n,o,i,r,s,a,d,l,u){"use strict";function h(e){o.call(this,e),this.addType(s.SegmentedVolumeData),this.segmentIdentifiersNode=null,this.renderStyleNodes=[]}return h.prototype=Object.assign(Object.create(o.prototype),{constructor:h,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(s.inputOutput,"metadata",new e.SFNode),new t(s.inputOutput,"dimensions",new e.SFVec3f(1,1,1)),new t(s.inputOutput,"segmentEnabled",new e.MFBool),new t(s.inputOutput,"visible",new e.SFBool(!0)),new t(s.inputOutput,"bboxDisplay",new e.SFBool),new t(s.initializeOnly,"bboxCenter",new e.SFVec3f(0,0,0)),new t(s.initializeOnly,"bboxSize",new e.SFVec3f(-1,-1,-1)),new t(s.inputOutput,"segmentIdentifiers",new e.SFNode),new t(s.inputOutput,"renderStyle",new e.MFNode),new t(s.inputOutput,"voxels",new e.SFNode)]),getTypeName:function(){return"SegmentedVolumeData"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"children"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._segmentIdentifiers.addInterest("set_segmentIdentifiers__",this),this._renderStyle.addInterest("set_renderStyle__",this),this._voxels.addFieldInterest(this.getAppearance()._texture),this._segmentEnabled.addInterest("update",this),this._segmentIdentifiers.addInterest("update",this),this._renderStyle.addInterest("update",this),this.getAppearance()._texture=this._voxels,this.set_segmentIdentifiers__(),this.set_renderStyle__(),this.set_voxels__(),this.update())},getSegmentEnabled:function(e){return!(e<this._segmentEnabled.length)||this._segmentEnabled[e]},set_segmentIdentifiers__:function(){this.segmentIdentifiersNode=a(s.X3DTexture3DNode,this._segmentIdentifiers)},set_renderStyle__:function(){for(var e=this.renderStyleNodes,t=0,n=e.length;t<n;++t){(o=e[t]).removeInterest("update",this),o.removeVolumeData(this)}e.length=0;for(t=0,n=this._renderStyle.length;t<n;++t){(o=a(s.X3DComposableVolumeRenderStyleNode,this._renderStyle[t]))&&e.push(o)}for(t=0,n=e.length;t<n;++t){var o;(o=e[t]).addInterest("update",this),o.addVolumeData(this)}},set_voxels__:function(){this.voxelsNode&&this.voxelsNode.removeInterest("set_textureSize__",this),this.voxelsNode=a(s.X3DTexture3DNode,this._voxels),this.voxelsNode&&(this.voxelsNode.addInterest("set_textureSize__",this),this.set_textureSize__())},set_textureSize__:function(){try{var e=this.getShader().getField("x3d_TextureSize");e.x=this.voxelsNode.getWidth(),e.y=this.voxelsNode.getHeight(),e.z=this.voxelsNode.getDepth()}catch(e){u&&console.log(e.message)}},update:function(){this.setShader(this.createShader(d,l))},createShader:function(t,n){var o=this.getBrowser().getDefaultVolumeStyle(),a=o.getUniformsText(),d=o.getFunctionsText();if(this.segmentIdentifiersNode?(a+="\n",a+="uniform sampler3D segmentIdentifiers;\n",d+="\n",d+="\n",d+="\tint segment = int (texture (segmentIdentifiers, texCoord) .r * 255.0);\n"):d+="\tint segment = 0;\n",this.renderStyleNodes.length){d+="\n",d+="\tswitch (segment)\n",d+="\t{\n";for(var l=0,u=this.renderStyleNodes.length;l<u;++l)d+="\t\tcase "+l+":\n",d+="\t\t{\n",this.getSegmentEnabled(l)?(a+=this.renderStyleNodes[l].getUniformsText(),d+=this.renderStyleNodes[l].getFunctionsText(),d+="\t\t\tbreak;\n"):d+="\t\t\tdiscard;\n",d+="\t\t}\n";d+="\t}\n"}n=(n=n.replace(/\/\/ VOLUME_STYLES_UNIFORMS\n/,a)).replace(/\/\/ VOLUME_STYLES_FUNCTIONS\n/,d);var h=new r(this.getExecutionContext());h.setName("SegmentedVolumeDataVertexShader"),h._url.push("data:x-shader/x-vertex,"+t),h.setup();var c=new r(this.getExecutionContext());c.setName("SegmentedVolumeDataFragmentShader"),c._type="FRAGMENT",c._url.push("data:x-shader/x-fragment,"+n),c.setup();var g=new i(this.getExecutionContext());if(g.setName("SegmentedVolumeDataShader"),g._language="GLSL",g._parts.push(h),g._parts.push(c),this.voxelsNode){var f=new e.SFVec3f(this.voxelsNode.getWidth(),this.voxelsNode.getHeight(),this.voxelsNode.getDepth());g.addUserDefinedField(s.inputOutput,"x3d_TextureSize",f)}else g.addUserDefinedField(s.inputOutput,"x3d_TextureSize",new e.SFVec3f);this.segmentIdentifiersNode&&g.addUserDefinedField(s.inputOutput,"segmentIdentifiers",new e.SFNode(this.segmentIdentifiersNode)),o.addShaderFields(g);for(l=0,u=this.renderStyleNodes.length;l<u;++l)this.getSegmentEnabled(l)&&this.renderStyleNodes[l].addShaderFields(g);return g}}),h})),e("x_ite/Components/VolumeRendering/ShadedVolumeStyle",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast"],(function(e,t,n,o,i,r){"use strict";function s(e){o.call(this,e),this.addType(i.ShadedVolumeStyle)}return s.prototype=Object.assign(Object.create(o.prototype),{constructor:s,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(i.inputOutput,"metadata",new e.SFNode),new t(i.inputOutput,"enabled",new e.SFBool(!0)),new t(i.inputOutput,"lighting",new e.SFBool),new t(i.inputOutput,"shadows",new e.SFBool),new t(i.initializeOnly,"phaseFunction",new e.SFString("Henyey-Greenstein")),new t(i.inputOutput,"material",new e.SFNode),new t(i.inputOutput,"surfaceNormals",new e.SFNode)]),getTypeName:function(){return"ShadedVolumeStyle"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"renderStyle"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._material.addInterest("set_material__",this),this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_material__(),this.set_surfaceNormals__())},set_material__:function(){this.materialNode&&this.materialNode.removeInterest("addNodeEvent",this),this.materialNode=r(i.X3DMaterialNode,this._material),this.materialNode&&this.materialNode.addInterest("addNodeEvent",this)},set_surfaceNormals__:function(){this.surfaceNormalsNode=r(i.X3DTexture3DNode,this._surfaceNormals)},addShaderFields:function(t){this._enabled.getValue()&&(this.materialNode&&(t.addUserDefinedField(i.inputOutput,"ambientIntensity_"+this.getId(),this.materialNode._ambientIntensity.copy()),t.addUserDefinedField(i.inputOutput,"diffuseColor_"+this.getId(),this.materialNode._diffuseColor.copy()),t.addUserDefinedField(i.inputOutput,"specularColor_"+this.getId(),this.materialNode._specularColor.copy()),t.addUserDefinedField(i.inputOutput,"emissiveColor_"+this.getId(),this.materialNode._emissiveColor.copy()),t.addUserDefinedField(i.inputOutput,"shininess_"+this.getId(),this.materialNode._shininess.copy()),t.addUserDefinedField(i.inputOutput,"transparency_"+this.getId(),this.materialNode._transparency.copy())),this.surfaceNormalsNode&&t.addUserDefinedField(i.inputOutput,"surfaceNormals_"+this.getId(),new e.SFNode(this.surfaceNormalsNode)))},getUniformsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="// ShadedVolumeStyle\n",e+="\n",e+="uniform float ambientIntensity_"+this.getId()+";\n",e+="uniform vec3 diffuseColor_"+this.getId()+";\n",e+="uniform vec3 specularColor_"+this.getId()+";\n",e+="uniform vec3 emissiveColor_"+this.getId()+";\n",e+="uniform float shininess_"+this.getId()+";\n",e+="uniform float transparency_"+this.getId()+";\n",e+=this.getNormalText(this.surfaceNormalsNode),e+="\n",e+="float\n",e+="getSpotFactor_"+this.getId()+" (const in float cutOffAngle, const in float beamWidth, const in vec3 L, const in vec3 d)\n",e+="{\n",e+="\tfloat spotAngle = acos (clamp (dot (-L, d), -1.0, 1.0));\n",e+="\n",e+="\tif (spotAngle >= cutOffAngle)\n",e+="\t\treturn 0.0;\n",e+="\telse if (spotAngle <= beamWidth)\n",e+="\t\treturn 1.0;\n",e+="\n",e+="\treturn (spotAngle - cutOffAngle) / (beamWidth - cutOffAngle);\n",e+="}\n",e+="\n",e+="vec4\n",e+="getShadedStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+="\tvec4 surfaceNormal = getNormal_"+this.getId()+" (texCoord);\n",e+="\n",e+="\tif (surfaceNormal .w == 0.0)\n",e+="\t\treturn vec4 (0.0);\n",e+="\n",e+="\tvec4 shadedColor = vec4 (0.0);\n",this._lighting.getValue()?(this.materialNode?(e+="\tvec3 diffuseFactor = diffuseColor_"+this.getId()+";\n",e+="\tvec3 ambientTerm = diffuseFactor * ambientIntensity_"+this.getId()+";\n",e+="\n",e+="\tshadedColor .a = originalColor .a * (1.0 - transparency_"+this.getId()+");\n"):(e+="\tvec3 diffuseFactor = originalColor .rgb;\n",e+="\tvec3 ambientTerm = vec3 (0.0);\n",e+="\n",e+="\tshadedColor .a = originalColor .a;\n"),e+="\n",e+="\tvec3 N = surfaceNormal .xyz;\n",e+="\tvec3 V = normalize (-vertex); // normalized vector from point on geometry to viewer's position\n",e+="\n",e+="\tfor (int i = 0; i < x3d_MaxLights; ++ i)\n",e+="\t{\n",e+="\t\tif (i == x3d_NumLights)\n",e+="\t\t\tbreak;\n",e+="\n",e+="\t\tx3d_LightSourceParameters light = x3d_LightSource [i];\n",e+="\n",e+="\t\tvec3 vL = light .location - vertex; // Light to fragment\n",e+="\t\tfloat dL = length (light .matrix * vL);\n",e+="\t\tbool di = light .type == x3d_DirectionalLight;\n",e+="\n",e+="\t\tif (di || dL <= light .radius)\n",e+="\t\t{\n",e+="\t\t\tvec3 d = light .direction;\n",e+="\t\t\tvec3 c = light .attenuation;\n",e+="\t\t\tvec3 L = di ? -d : normalize (vL); // Normalized vector from point on geometry to light source i position.\n",e+="\t\t\tvec3 H = normalize (L + V); // Specular term\n",e+="\n",e+="\t\t\tfloat lightAngle = max (dot (N, L), 0.0); // Angle between normal and light ray.\n",e+="\t\t\tvec3 diffuseTerm = diffuseFactor * lightAngle;\n",e+="\t\t\tfloat specularFactor = shininess_"+this.getId()+" > 0.0 ? pow (max (dot (N, H), 0.0), shininess_"+this.getId()+" * 128.0) : 1.0;\n",e+="\t\t\tvec3 specularTerm = light .intensity * specularColor_"+this.getId()+" * specularFactor;\n",e+="\n",e+="\t\t\tfloat attenuationFactor = di ? 1.0 : 1.0 / max (c [0] + c [1] * dL + c [2] * (dL * dL), 1.0);\n",e+="\t\t\tfloat spotFactor = light .type == x3d_SpotLight ? getSpotFactor_"+this.getId()+" (light .cutOffAngle, light .beamWidth, L, d) : 1.0;\n",e+="\t\t\tfloat attenuationSpotFactor = attenuationFactor * spotFactor;\n",e+="\t\t\tvec3 ambientColor = light .ambientIntensity * ambientTerm;\n",e+="\t\t\tvec3 diffuseSpecularColor = light .intensity * (diffuseTerm + specularTerm);\n",e+="\n",e+="\t\t\tshadedColor .rgb += attenuationSpotFactor * light .color * (ambientColor + diffuseSpecularColor);\n",e+="\t\t}\n",e+="\n",e+="\t\tshadedColor .rgb += emissiveColor_"+this.getId()+";\n",e+="\t\tshadedColor .rgb = getFogColor (shadedColor .rgb);\n",e+="\t}\n"):this.materialNode?(e+="\tshadedColor .rgb = diffuseColor_"+this.getId()+";\n",e+="\tshadedColor .a = originalColor .a * (1.0 - transparency_"+this.getId()+");\n"):e+="\tshadedColor = originalColor;\n",e+="\n",e+="\treturn shadedColor;\n",e+="}\n"},getFunctionsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="\t// ShadedVolumeStyle\n",e+="\n",e+="\ttextureColor = getShadedStyle_"+this.getId()+" (textureColor, texCoord);\n"}}),s})),e("x_ite/Components/VolumeRendering/SilhouetteEnhancementVolumeStyle",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast"],(function(e,t,n,o,i,r){"use strict";function s(e){o.call(this,e),this.addType(i.SilhouetteEnhancementVolumeStyle)}return s.prototype=Object.assign(Object.create(o.prototype),{constructor:s,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(i.inputOutput,"metadata",new e.SFNode),new t(i.inputOutput,"enabled",new e.SFBool(!0)),new t(i.inputOutput,"silhouetteRetainedOpacity",new e.SFFloat(1)),new t(i.inputOutput,"silhouetteBoundaryOpacity",new e.SFFloat(0)),new t(i.inputOutput,"silhouetteSharpness",new e.SFFloat(.5)),new t(i.inputOutput,"surfaceNormals",new e.SFNode)]),getTypeName:function(){return"SilhouetteEnhancementVolumeStyle"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"renderStyle"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__())},set_surfaceNormals__:function(){this.surfaceNormalsNode=r(i.X3DTexture3DNode,this._surfaceNormals)},addShaderFields:function(t){this._enabled.getValue()&&(t.addUserDefinedField(i.inputOutput,"silhouetteRetainedOpacity_"+this.getId(),this._silhouetteRetainedOpacity.copy()),t.addUserDefinedField(i.inputOutput,"silhouetteBoundaryOpacity_"+this.getId(),this._silhouetteBoundaryOpacity.copy()),t.addUserDefinedField(i.inputOutput,"silhouetteSharpness_"+this.getId(),this._silhouetteSharpness.copy()),this.surfaceNormalsNode&&t.addUserDefinedField(i.inputOutput,"surfaceNormals_"+this.getId(),new e.SFNode(this.surfaceNormalsNode)))},getUniformsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="// SilhouetteEnhancementVolumeStyle\n",e+="\n",e+="uniform float silhouetteRetainedOpacity_"+this.getId()+";\n",e+="uniform float silhouetteBoundaryOpacity_"+this.getId()+";\n",e+="uniform float silhouetteSharpness_"+this.getId()+";\n",e+=this.getNormalText(this.surfaceNormalsNode),e+="\n",e+="vec4\n",e+="getSilhouetteEnhancementStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+="\tvec4 surfaceNormal = getNormal_"+this.getId()+" (texCoord);\n",e+="\n",e+="\tif (surfaceNormal .w == 0.0)\n",e+="\t\treturn vec4 (0.0);\n",e+="\t\n",e+="\tfloat silhouetteRetainedOpacity = silhouetteRetainedOpacity_"+this.getId()+";\n",e+="\tfloat silhouetteBoundaryOpacity = silhouetteBoundaryOpacity_"+this.getId()+";\n",e+="\tfloat silhouetteSharpness = silhouetteSharpness_"+this.getId()+";\n",e+="\n",e+="\treturn vec4 (originalColor .rgb, originalColor .a * (silhouetteRetainedOpacity + silhouetteBoundaryOpacity * pow (1.0 - abs (dot (surfaceNormal .xyz, normalize (vertex))), silhouetteSharpness)));\n",e+="}\n"},getFunctionsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="\t// SilhouetteEnhancementVolumeStyle\n",e+="\n",e+="\ttextureColor = getSilhouetteEnhancementStyle_"+this.getId()+" (textureColor, texCoord);\n"}}),s})),e("x_ite/Components/VolumeRendering/ToneMappedVolumeStyle",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode","x_ite/Base/X3DConstants","x_ite/Base/X3DCast"],(function(e,t,n,o,i,r){"use strict";function s(e){o.call(this,e),this.addType(i.ToneMappedVolumeStyle)}return s.prototype=Object.assign(Object.create(o.prototype),{constructor:s,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(i.inputOutput,"metadata",new e.SFNode),new t(i.inputOutput,"enabled",new e.SFBool(!0)),new t(i.inputOutput,"coolColor",new e.SFColorRGBA(0,0,1,0)),new t(i.inputOutput,"warmColor",new e.SFColorRGBA(1,1,0,0)),new t(i.inputOutput,"surfaceNormals",new e.SFNode)]),getTypeName:function(){return"ToneMappedVolumeStyle"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"renderStyle"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__())},set_surfaceNormals__:function(){this.surfaceNormalsNode=r(i.X3DTexture3DNode,this._surfaceNormals)},addShaderFields:function(t){this._enabled.getValue()&&(t.addUserDefinedField(i.inputOutput,"coolColor_"+this.getId(),this._coolColor.copy()),t.addUserDefinedField(i.inputOutput,"warmColor_"+this.getId(),this._warmColor.copy()),this.surfaceNormalsNode&&t.addUserDefinedField(i.inputOutput,"surfaceNormals_"+this.getId(),new e.SFNode(this.surfaceNormalsNode)))},getUniformsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="// ToneMappedVolumeStyle\n",e+="\n",e+="uniform vec4 coolColor_"+this.getId()+";\n",e+="uniform vec4 warmColor_"+this.getId()+";\n",e+=this.getNormalText(this.surfaceNormalsNode),e+="\n",e+="vec4\n",e+="getToneMappedStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+="\tvec4 surfaceNormal = getNormal_"+this.getId()+" (texCoord);\n",e+="\n",e+="\tif (surfaceNormal .w == 0.0)\n",e+="\t\treturn vec4 (0.0);\n",e+="\n",e+="\tvec3 toneColor = vec3 (0.0);\n",e+="\tvec3 coolColor = coolColor_"+this.getId()+" .rgb;\n",e+="\tvec3 warmColor = warmColor_"+this.getId()+" .rgb;\n",e+="\n",e+="\tfor (int i = 0; i < x3d_MaxLights; ++ i)\n",e+="\t{\n",e+="\t\tif (i == x3d_NumLights)\n",e+="\t\t\tbreak;\n",e+="\n",e+="\t\tx3d_LightSourceParameters light = x3d_LightSource [i];\n",e+="\n",e+="\t\tvec3 L = light .type == x3d_DirectionalLight ? -light .direction : normalize (light .location - vertex);\n",e+="\t\tfloat colorFactor = (1.0 + dot (L, surfaceNormal .xyz)) * 0.5;\n",e+="\n",e+="\t\ttoneColor += mix (warmColor .rgb, coolColor .rgb, colorFactor);\n",e+="\t}\n",e+="\n",e+="\treturn vec4 (toneColor, originalColor .a);\n",e+="}\n"},getFunctionsText:function(){if(!this._enabled.getValue())return"";var e="";return e+="\n",e+="\t// ToneMappedVolumeStyle\n",e+="\n",e+="\ttextureColor = getToneMappedStyle_"+this.getId()+" (textureColor, texCoord);\n"}}),s})),e("x_ite/Components/VolumeRendering/VolumeData",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/VolumeRendering/X3DVolumeDataNode","x_ite/Components/Shaders/ComposedShader","x_ite/Components/Shaders/ShaderPart","x_ite/Base/X3DConstants","x_ite/Base/X3DCast","text!x_ite/Browser/VolumeRendering/VolumeStyle.vs","text!x_ite/Browser/VolumeRendering/VolumeStyle.fs","x_ite/DEBUG"],(function(e,t,n,o,i,r,s,a,d,l,u){"use strict";function h(e){o.call(this,e),this.addType(s.VolumeData),this.renderStyleNode=null}return h.prototype=Object.assign(Object.create(o.prototype),{constructor:h,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new n([new t(s.inputOutput,"metadata",new e.SFNode),new t(s.inputOutput,"dimensions",new e.SFVec3f(1,1,1)),new t(s.inputOutput,"visible",new e.SFBool(!0)),new t(s.inputOutput,"bboxDisplay",new e.SFBool),new t(s.initializeOnly,"bboxCenter",new e.SFVec3f(0,0,0)),new t(s.initializeOnly,"bboxSize",new e.SFVec3f(-1,-1,-1)),new t(s.inputOutput,"renderStyle",new e.SFNode),new t(s.inputOutput,"voxels",new e.SFNode)]),getTypeName:function(){return"VolumeData"},getComponentName:function(){return"VolumeRendering"},getContainerField:function(){return"children"},initialize:function(){o.prototype.initialize.call(this),this.getBrowser().getContext().getVersion()<2||(this._renderStyle.addInterest("set_renderStyle__",this),this._voxels.addInterest("set_voxels__",this),this._voxels.addFieldInterest(this.getAppearance()._texture),this._renderStyle.addInterest("update",this),this.getAppearance()._texture=this._voxels,this.set_renderStyle__(),this.set_voxels__(),this.update())},set_renderStyle__:function(){this.renderStyleNode&&(this.renderStyleNode.removeInterest("update",this),this.renderStyleNode.removeVolumeData(this)),this.renderStyleNode=a(s.X3DVolumeRenderStyleNode,this._renderStyle),this.renderStyleNode&&(this.renderStyleNode.addInterest("update",this),this.renderStyleNode.addVolumeData(this))},set_voxels__:function(){this.voxelsNode&&this.voxelsNode.removeInterest("set_textureSize__",this),this.voxelsNode=a(s.X3DTexture3DNode,this._voxels),this.voxelsNode&&(this.voxelsNode.addInterest("set_textureSize__",this),this.set_textureSize__())},set_textureSize__:function(){try{var e=this.getShader().getField("x3d_TextureSize");e.x=this.voxelsNode.getWidth(),e.y=this.voxelsNode.getHeight(),e.z=this.voxelsNode.getDepth()}catch(e){u&&console.log(e.message)}},update:function(){this.setShader(this.createShader(d,l))},createShader:function(t,n){var o=this.getBrowser().getDefaultVolumeStyle(),a=o.getUniformsText(),d=o.getFunctionsText();this.renderStyleNode&&(a+=this.renderStyleNode.getUniformsText(),d+=this.renderStyleNode.getFunctionsText()),n=(n=n.replace(/\/\/ VOLUME_STYLES_UNIFORMS\n/,a)).replace(/\/\/ VOLUME_STYLES_FUNCTIONS\n/,d);var l=new r(this.getExecutionContext());l.setName("VolumeDataVertexShader"),l._url.push("data:x-shader/x-vertex,"+t),l.setup();var u=new r(this.getExecutionContext());u.setName("VolumeDataFragmentShader"),u._type="FRAGMENT",u._url.push("data:x-shader/x-fragment,"+n),u.setup();var h=new i(this.getExecutionContext());if(h.setName("VolumeDataShader"),h._language="GLSL",h._parts.push(l),h._parts.push(u),this.voxelsNode){var c=new e.SFVec3f(this.voxelsNode.getWidth(),this.voxelsNode.getHeight(),this.voxelsNode.getDepth());h.addUserDefinedField(s.inputOutput,"x3d_TextureSize",c)}else h.addUserDefinedField(s.inputOutput,"x3d_TextureSize",new e.SFVec3f);return o.addShaderFields(h),this.renderStyleNode&&this.renderStyleNode.addShaderFields(h),h}}),h})),e(t.getComponentUrl("volume-rendering"),["x_ite/Components","x_ite/Browser/VolumeRendering/X3DVolumeRenderingContext","x_ite/Components/VolumeRendering/BlendedVolumeStyle","x_ite/Components/VolumeRendering/BoundaryEnhancementVolumeStyle","x_ite/Components/VolumeRendering/CartoonVolumeStyle","x_ite/Components/VolumeRendering/ComposedVolumeStyle","x_ite/Components/VolumeRendering/EdgeEnhancementVolumeStyle","x_ite/Components/VolumeRendering/IsoSurfaceVolumeData","x_ite/Components/VolumeRendering/OpacityMapVolumeStyle","x_ite/Components/VolumeRendering/ProjectionVolumeStyle","x_ite/Components/VolumeRendering/SegmentedVolumeData","x_ite/Components/VolumeRendering/ShadedVolumeStyle","x_ite/Components/VolumeRendering/SilhouetteEnhancementVolumeStyle","x_ite/Components/VolumeRendering/ToneMappedVolumeStyle","x_ite/Components/VolumeRendering/VolumeData","x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode","x_ite/Components/VolumeRendering/X3DVolumeDataNode","x_ite/Components/VolumeRendering/X3DVolumeRenderStyleNode",t.getComponentUrl("cad-geometry"),t.getComponentUrl("texturing-3d")],(function(e,t,n,o,i,r,s,a,d,l,u,h,c,g,f,p,m,_){"use strict";e.addComponent({name:"VolumeRendering",types:{BlendedVolumeStyle:n,BoundaryEnhancementVolumeStyle:o,CartoonVolumeStyle:i,ComposedVolumeStyle:r,EdgeEnhancementVolumeStyle:s,IsoSurfaceVolumeData:a,OpacityMapVolumeStyle:d,ProjectionVolumeStyle:l,SegmentedVolumeData:u,ShadedVolumeStyle:h,SilhouetteEnhancementVolumeStyle:c,ToneMappedVolumeStyle:g,VolumeData:f},abstractTypes:{X3DComposableVolumeRenderStyleNode:p,X3DVolumeDataNode:m,X3DVolumeRenderStyleNode:_},context:t})}))}();
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
var module = { }, exports, process;
|
|
5
5
|
|
|
6
6
|
const
|
|
7
|
-
define = window [Symbol .for ("X_ITE.X3D-
|
|
8
|
-
require = window [Symbol .for ("X_ITE.X3D-
|
|
7
|
+
define = window [Symbol .for ("X_ITE.X3D-6.0.0")] .define,
|
|
8
|
+
require = window [Symbol .for ("X_ITE.X3D-6.0.0")] .require;
|
|
9
9
|
/* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
|
|
10
10
|
*******************************************************************************
|
|
11
11
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){const t=window[Symbol.for("X_ITE.X3D-
|
|
1
|
+
!function(){const t=window[Symbol.for("X_ITE.X3D-6.0.0")].define,e=window[Symbol.for("X_ITE.X3D-6.0.0")].require;t("x_ite/Components/X_ITE/BlendMode",["x_ite/Fields","x_ite/Base/X3DFieldDefinition","x_ite/Base/FieldDefinitionArray","x_ite/Components/Shape/X3DAppearanceChildNode","x_ite/Rendering/TraverseType","x_ite/Base/X3DConstants"],(function(t,e,o,i,s,a){"use strict";function n(t){i.call(this,t),this.addType(a.BlendMode),this.factorTypes=new Map,this.equationTypes=new Map}return n.prototype=Object.assign(Object.create(i.prototype),{constructor:n,[Symbol.for("X_ITE.X3DBaseNode.fieldDefinitions")]:new o([new e(a.inputOutput,"metadata",new t.SFNode),new e(a.inputOutput,"blendColor",new t.SFColorRGBA),new e(a.inputOutput,"sourceColorFactor",new t.SFString("SRC_ALPHA")),new e(a.inputOutput,"sourceAlphaFactor",new t.SFString("ONE")),new e(a.inputOutput,"destinationColorFactor",new t.SFString("ONE_MINUS_SRC_ALPHA")),new e(a.inputOutput,"destinationAlphaFactor",new t.SFString("ONE_MINUS_SRC_ALPHA")),new e(a.inputOutput,"colorEquation",new t.SFString("FUNC_ADD")),new e(a.inputOutput,"alphaEquation",new t.SFString("FUNC_ADD"))]),getTypeName:function(){return"BlendMode"},getComponentName:function(){return"X_ITE"},getContainerField:function(){return"blendMode"},initialize:function(){i.prototype.initialize.call(this);const t=this.getBrowser().getContext(),e=t.getExtension("EXT_blend_minmax");this.factorTypes.set("ZERO",t.ZERO),this.factorTypes.set("ONE",t.ONE),this.factorTypes.set("SRC_COLOR",t.SRC_COLOR),this.factorTypes.set("ONE_MINUS_SRC_COLOR",t.ONE_MINUS_SRC_COLOR),this.factorTypes.set("DST_COLOR",t.DST_COLOR),this.factorTypes.set("ONE_MINUS_DST_COLOR",t.ONE_MINUS_DST_COLOR),this.factorTypes.set("SRC_ALPHA",t.SRC_ALPHA),this.factorTypes.set("ONE_MINUS_SRC_ALPHA",t.ONE_MINUS_SRC_ALPHA),this.factorTypes.set("DST_ALPHA",t.DST_ALPHA),this.factorTypes.set("ONE_MINUS_DST_ALPHA",t.ONE_MINUS_DST_ALPHA),this.factorTypes.set("SRC_ALPHA_SATURATE",t.SRC_ALPHA_SATURATE),this.factorTypes.set("CONSTANT_COLOR",t.CONSTANT_COLOR),this.factorTypes.set("ONE_MINUS_CONSTANT_COLOR",t.ONE_MINUS_CONSTANT_COLOR),this.factorTypes.set("CONSTANT_ALPHA",t.CONSTANT_ALPHA),this.factorTypes.set("ONE_MINUS_CONSTANT_ALPHA",t.ONE_MINUS_CONSTANT_ALPHA),this.equationTypes.set("FUNC_ADD",t.FUNC_ADD),this.equationTypes.set("FUNC_SUBTRACT",t.FUNC_SUBTRACT),this.equationTypes.set("FUNC_REVERSE_SUBTRACT",t.FUNC_REVERSE_SUBTRACT),this.equationTypes.set("MIN",t.MIN||e&&e.MIN_EXT),this.equationTypes.set("MAX",t.MAX||e&&e.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__:function(){this.sourceColorFactorType=this.factorTypes.get(this._sourceColorFactor.getValue()),void 0===this.sourceColorFactorType&&(this.sourceColorFactorType=this.factorTypes.get("SRC_ALPHA"))},set_sourceAlphaFactor__:function(){this.sourceAlphaFactorType=this.factorTypes.get(this._sourceAlphaFactor.getValue()),void 0===this.sourceAlphaFactorType&&(this.sourceAlphaFactorType=this.factorTypes.get("ONE"))},set_destinationColorFactor__:function(){this.destinationColorFactorType=this.factorTypes.get(this._destinationColorFactor.getValue()),void 0===this.destinationColorFactorType&&(this.destinationColorFactorType=this.factorTypes.get("ONE_MINUS_SRC_ALPHA"))},set_destinationAlphaFactor__:function(){this.destinationAlphaFactorType=this.factorTypes.get(this._destinationAlphaFactor.getValue()),void 0===this.destinationAlphaFactorType&&(this.destinationAlphaFactorType=this.factorTypes.get("ONE_MINUS_SRC_ALPHA"))},set_colorEquation__:function(){this.colorEquationType=this.equationTypes.get(this._colorEquation.getValue()),void 0===this.colorEquationType&&(this.colorEquationType=this.equationTypes.get("FUNC_ADD"))},set_alphaEquation__:function(){this.alphaEquationType=this.equationTypes.get(this._alphaEquation.getValue()),void 0===this.alphaEquationType&&(this.alphaEquationType=this.equationTypes.get("FUNC_ADD"))},enable:function(t){const e=this._blendColor.getValue();t.blendColor(e.r,e.g,e.b,e.a),t.blendFuncSeparate(this.sourceColorFactorType,this.destinationColorFactorType,this.sourceAlphaFactorType,this.destinationAlphaFactorType),t.blendEquationSeparate(this.colorEquationType,this.alphaEquationType)},disable:function(t){t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA),t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD)}}),n})),t(e.getComponentUrl("x_ite"),["x_ite/Components","x_ite/Components/X_ITE/BlendMode"],(function(t,e){"use strict";t.addComponent({name:"X_ITE",types:{BlendMode:e},abstractTypes:{}})}))}();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -9,10 +9,6 @@ uniform ivec4 x3d_Viewport;
|
|
|
9
9
|
varying float fogDepth;
|
|
10
10
|
varying vec4 color;
|
|
11
11
|
varying vec3 vertex;
|
|
12
|
-
#ifdef X_ITE
|
|
13
|
-
varying vec3 startPosition;
|
|
14
|
-
varying vec3 vertexPosition;
|
|
15
|
-
#endif
|
|
16
12
|
#ifdef X3D_LOGARITHMIC_DEPTH_BUFFER
|
|
17
13
|
uniform float x3d_LogarithmicFarFactor1_2;
|
|
18
14
|
varying float depth;
|
|
@@ -55,27 +51,10 @@ if (dot (vertex, x3d_ClipPlane [i] .xyz) - x3d_ClipPlane [i] .w < 0.0)
|
|
|
55
51
|
discard;
|
|
56
52
|
}
|
|
57
53
|
}
|
|
58
|
-
#ifdef X_ITE
|
|
59
|
-
void
|
|
60
|
-
stipple ()
|
|
61
|
-
{
|
|
62
|
-
if (x3d_LineProperties .applied)
|
|
63
|
-
{
|
|
64
|
-
vec2 direction = (vertexPosition .xy - startPosition .xy) * vec2 (x3d_Viewport .zw) * 0.5;
|
|
65
|
-
float distance = length (direction) / 16.0;
|
|
66
|
-
float color = texture2D (x3d_LineProperties .linetype, vec2 (distance, distance)) .a;
|
|
67
|
-
if (color == 0.0)
|
|
68
|
-
discard;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
#endif
|
|
72
54
|
void
|
|
73
55
|
main ()
|
|
74
56
|
{
|
|
75
57
|
clip ();
|
|
76
|
-
#ifdef X_ITE
|
|
77
|
-
stipple ();
|
|
78
|
-
#endif
|
|
79
58
|
vec4 finalColor = vec4 (0.0);
|
|
80
59
|
finalColor .rgb = getFogColor (color .rgb);
|
|
81
60
|
finalColor .a = color .a;
|
|
@@ -10,11 +10,6 @@ attribute vec4 x3d_Vertex;
|
|
|
10
10
|
varying float fogDepth;
|
|
11
11
|
varying vec4 color;
|
|
12
12
|
varying vec3 vertex;
|
|
13
|
-
#ifdef X_ITE
|
|
14
|
-
attribute vec4 x3d_TexCoord0;
|
|
15
|
-
varying vec3 startPosition;
|
|
16
|
-
varying vec3 vertexPosition;
|
|
17
|
-
#endif
|
|
18
13
|
#ifdef X3D_LOGARITHMIC_DEPTH_BUFFER
|
|
19
14
|
varying float depth;
|
|
20
15
|
#endif
|
|
@@ -25,11 +20,6 @@ vec4 position = x3d_ModelViewMatrix * x3d_Vertex;
|
|
|
25
20
|
fogDepth = x3d_FogDepth;
|
|
26
21
|
vertex = position .xyz;
|
|
27
22
|
gl_Position = x3d_ProjectionMatrix * position;
|
|
28
|
-
#ifdef X_ITE
|
|
29
|
-
vec4 start = x3d_ProjectionMatrix * x3d_ModelViewMatrix * x3d_TexCoord0;
|
|
30
|
-
startPosition = start .xyz / start .w;
|
|
31
|
-
vertexPosition = gl_Position .xyz / gl_Position .w;
|
|
32
|
-
#endif
|
|
33
23
|
#ifdef X3D_LOGARITHMIC_DEPTH_BUFFER
|
|
34
24
|
depth = 1.0 + gl_Position .w;
|
|
35
25
|
#endif
|
|
@@ -24,7 +24,7 @@ main ()
|
|
|
24
24
|
{
|
|
25
25
|
vec4 position = x3d_ModelViewMatrix * x3d_Vertex;
|
|
26
26
|
vertex = position .xyz;
|
|
27
|
-
normal =
|
|
27
|
+
normal = x3d_NormalMatrix * x3d_Normal;
|
|
28
28
|
texCoord0 = x3d_TexCoord0;
|
|
29
29
|
texCoord1 = x3d_TexCoord1;
|
|
30
30
|
color = x3d_Color;
|