x_ite 5.0.3 → 6.1.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 +25 -1
- package/Makefile +36 -28
- package/README.md +6 -11
- package/build/bin/dist.pl +0 -6
- package/build/bin/examples-and-tests.pl +75 -0
- package/build/bin/tests-menu.pl +57 -0
- package/build/bin/version.pl +7 -4
- package/build/parts/default.start.frag.js +3 -2
- package/dist/assets/components/annotation.js +3 -2
- package/dist/assets/components/annotation.min.js +1 -1
- package/dist/assets/components/cad-geometry.js +3 -2
- package/dist/assets/components/cad-geometry.min.js +1 -1
- package/dist/assets/components/cube-map-texturing.js +8 -20
- package/dist/assets/components/cube-map-texturing.min.js +1 -1
- package/dist/assets/components/dis.js +3 -2
- package/dist/assets/components/dis.min.js +1 -1
- package/dist/assets/components/event-utilities.js +4 -3
- package/dist/assets/components/event-utilities.min.js +1 -1
- package/dist/assets/components/geometry2d.js +38 -52
- package/dist/assets/components/geometry2d.min.js +1 -1
- package/dist/assets/components/geospatial.js +34 -1686
- package/dist/assets/components/geospatial.min.js +1 -1
- package/dist/assets/components/h-anim.js +71 -77
- package/dist/assets/components/h-anim.min.js +1 -1
- package/dist/assets/components/key-device-sensor.js +4 -3
- package/dist/assets/components/key-device-sensor.min.js +1 -1
- package/dist/assets/components/layout.js +101 -173
- package/dist/assets/components/layout.min.js +1 -1
- package/dist/assets/components/nurbs.js +3 -2
- package/dist/assets/components/nurbs.min.js +1 -1
- package/dist/assets/components/particle-systems.js +1926 -1669
- package/dist/assets/components/particle-systems.min.js +1 -1
- package/dist/assets/components/picking.js +34 -41
- package/dist/assets/components/picking.min.js +1 -1
- package/dist/assets/components/projective-texture-mapping.js +73 -86
- package/dist/assets/components/projective-texture-mapping.min.js +1 -1
- package/dist/assets/components/rigid-body-physics.js +37 -57
- package/dist/assets/components/rigid-body-physics.min.js +1 -1
- package/dist/assets/components/scripting.js +3 -2
- package/dist/assets/components/scripting.min.js +1 -1
- package/dist/assets/components/texturing-3d.js +27 -33
- package/dist/assets/components/texturing-3d.min.js +3 -3
- package/dist/assets/components/volume-rendering.js +12 -11
- package/dist/assets/components/volume-rendering.min.js +1 -1
- package/dist/assets/components/x_ite.js +3 -2
- package/dist/assets/components/x_ite.min.js +1 -1
- package/dist/assets/images/Shading.png +0 -0
- 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/Gouraud.vs +1 -1
- package/dist/assets/shaders/webgl1/Line.fs +0 -21
- package/dist/assets/shaders/webgl1/Line.vs +0 -10
- package/dist/assets/shaders/webgl1/PBR.fs +1 -1
- package/dist/assets/shaders/webgl1/PBR.vs +1 -1
- package/dist/assets/shaders/webgl1/Phong.fs +1 -1
- package/dist/assets/shaders/webgl1/Point.vs +1 -1
- package/dist/assets/shaders/webgl2/Depth.vs +29 -1
- package/dist/assets/shaders/webgl2/Gouraud.vs +32 -4
- 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.fs +1 -1
- package/dist/assets/shaders/webgl2/PBR.vs +35 -7
- package/dist/assets/shaders/webgl2/Phong.fs +1 -1
- package/dist/assets/shaders/webgl2/Phong.vs +31 -3
- package/dist/assets/shaders/webgl2/Point.vs +30 -2
- package/dist/assets/shaders/webgl2/Unlit.vs +31 -3
- package/dist/example.html +6 -6
- package/dist/x_ite.css +199 -224
- package/dist/x_ite.js +16335 -15917
- 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 +21 -15
- package/docs/Browser-Support.md +6 -0
- package/docs/Custom-Shaders.md +18 -25
- package/docs/Features.md +11 -5
- 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 +93 -39
- package/docs/XHTML-DOM-Integration.md +6 -0
- package/docs/_config.yml +2 -2
- package/docs/assets/css/main.scss +26 -0
- package/docs/index.md +42 -50
- 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 +12 -6
- package/docs/reference/Field-Services-and-Objects.md +105 -1
- package/docs/reference/Prototype-Services.md +11 -0
- package/docs/reference/Route-Services.md +9 -0
- package/docs/reference/Scene-Services.md +17 -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 +42 -36
- 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/images/Shading.png +0 -0
- 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/Gouraud.fs +1 -1
- package/src/assets/shaders/webgl1/Gouraud.vs +2 -3
- package/src/assets/shaders/webgl1/Line.fs +3 -28
- package/src/assets/shaders/webgl1/Line.vs +6 -20
- package/src/assets/shaders/webgl1/PBR.fs +6 -6
- package/src/assets/shaders/webgl1/PBR.vs +1 -1
- package/src/assets/shaders/webgl1/Phong.fs +10 -10
- package/src/assets/shaders/webgl1/Point.vs +2 -2
- package/src/assets/shaders/webgl1/Unlit.fs +4 -4
- package/src/assets/shaders/webgl1/include/Normal.glsl +1 -1
- package/src/assets/shaders/webgl1/include/Texture.glsl +3 -8
- package/src/assets/shaders/webgl2/Depth.vs +4 -1
- package/src/assets/shaders/webgl2/Gouraud.fs +1 -1
- package/src/assets/shaders/webgl2/Gouraud.vs +8 -6
- package/src/assets/shaders/webgl2/Line.fs +11 -17
- package/src/assets/shaders/webgl2/Line.vs +17 -21
- package/src/assets/shaders/webgl2/LineTransform.fs +6 -0
- package/src/assets/shaders/webgl2/LineTransform.vs +77 -0
- package/src/assets/shaders/webgl2/PBR.fs +6 -6
- package/src/assets/shaders/webgl2/PBR.vs +10 -7
- package/src/assets/shaders/webgl2/Phong.fs +11 -11
- package/src/assets/shaders/webgl2/Phong.vs +6 -3
- package/src/assets/shaders/webgl2/Point.vs +5 -4
- package/src/assets/shaders/webgl2/Unlit.fs +5 -5
- 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/Normal.glsl +1 -1
- package/src/assets/shaders/webgl2/include/Particle.glsl +36 -0
- package/src/assets/shaders/webgl2/include/Texture.glsl +3 -3
- package/src/example.html +6 -6
- package/src/examples.js +5 -4
- package/src/standard/Math/Algorithm.js +12 -28
- package/src/standard/Math/Geometry/Line2.js +163 -0
- package/src/standard/Math/Geometry/Line3.js +3 -5
- package/src/standard/Math/Geometry/Plane3.js +0 -2
- package/src/standard/Math/Geometry/Triangle3.js +1 -1
- package/src/standard/Math/Geometry/ViewVolume.js +121 -103
- 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 +48 -34
- package/src/standard/Math/Numbers/Matrix2.js +62 -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 +12 -5
- package/src/standard/Math/Numbers/Rotation4.js +8 -1
- package/src/standard/Math/Numbers/Vector2.js +42 -9
- package/src/standard/Math/Numbers/Vector3.js +50 -14
- package/src/standard/Math/Numbers/Vector4.js +48 -11
- package/src/standard/Math/Utility/BVH.js +45 -17
- package/src/tests.js +68 -66
- 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 +24 -143
- package/src/x_ite/Browser/Core/BrowserTimings.js +6 -4
- package/src/x_ite/Browser/Core/Context.js +185 -0
- package/src/x_ite/Browser/Core/ContextMenu.js +398 -211
- 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/Followers/X3DArrayFollowerTemplate.js +1 -1
- package/src/x_ite/Browser/Geometry2D/Disk2DOptions.js +1 -0
- package/src/x_ite/Browser/Geometry2D/X3DGeometry2DContext.js +2 -2
- package/src/x_ite/Browser/Geometry3D/X3DGeometry3DContext.js +41 -2
- package/src/x_ite/Browser/Geospatial/Geocentric.js +2 -2
- package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolatorTemplate.js +1 -1
- package/src/x_ite/Browser/Layout/ScreenText.js +18 -65
- package/src/x_ite/Browser/Layout/X3DLayoutContext.js +59 -16
- package/src/x_ite/Browser/Navigation/ExamineViewer.js +13 -20
- package/src/x_ite/Browser/Navigation/LookAtViewer.js +1 -4
- package/src/x_ite/Browser/Navigation/PlaneViewer.js +0 -3
- package/src/x_ite/Browser/Navigation/X3DFlyViewer.js +15 -8
- 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 +41 -37
- package/src/x_ite/Browser/Rendering/X3DRenderingContext.js +21 -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/Text/X3DTextGeometry.js +2 -1
- package/src/x_ite/Browser/Texturing/X3DTexturingContext.js +71 -34
- package/src/x_ite/Browser/Texturing3D/DICOMParser.js +2 -2
- package/src/x_ite/Browser/Time/X3DTimeContext.js +4 -2
- 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 +43 -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 +1 -2
- 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/ColorDamper.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/Followers/X3DFollowerNode.js +1 -1
- package/src/x_ite/Components/Geometry2D/Disk2D.js +30 -46
- 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/GeoLOD.js +1 -1
- 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/GeoViewpoint.js +26 -30
- 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 +16 -80
- 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 +2 -2
- package/src/x_ite/Components/Navigation/OrthoViewpoint.js +29 -30
- package/src/x_ite/Components/Navigation/Viewpoint.js +16 -20
- package/src/x_ite/Components/Navigation/X3DViewpointNode.js +82 -111
- package/src/x_ite/Components/Networking/Anchor.js +18 -7
- 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 +463 -882
- 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 +91 -108
- package/src/x_ite/Components/PointingDeviceSensor/PlaneSensor.js +56 -59
- package/src/x_ite/Components/PointingDeviceSensor/SphereSensor.js +54 -71
- 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 -24
- package/src/x_ite/Components/Rendering/ColorRGBA.js +13 -25
- package/src/x_ite/Components/Rendering/IndexedLineSet.js +26 -4
- package/src/x_ite/Components/Rendering/LineSet.js +35 -13
- package/src/x_ite/Components/Rendering/PointSet.js +35 -13
- package/src/x_ite/Components/Rendering/X3DComposedGeometryNode.js +13 -5
- package/src/x_ite/Components/Rendering/X3DGeometryNode.js +331 -387
- package/src/x_ite/Components/Rendering/X3DLineGeometryNode.js +350 -140
- package/src/x_ite/Components/Rendering/X3DPointGeometryNode.js +116 -126
- 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 +8 -11
- package/src/x_ite/Components/Shaders/Matrix3VertexAttribute.js +10 -14
- package/src/x_ite/Components/Shaders/Matrix4VertexAttribute.js +10 -14
- package/src/x_ite/Components/Shaders/ShaderPart.js +1 -10
- package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +220 -210
- package/src/x_ite/Components/Shaders/X3DShaderNode.js +28 -10
- package/src/x_ite/Components/Shaders/X3DVertexAttributeNode.js +15 -1
- package/src/x_ite/Components/Shape/Appearance.js +37 -4
- 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 +24 -3
- package/src/x_ite/Components/Shape/Shape.js +30 -39
- package/src/x_ite/Components/Shape/TwoSidedMaterial.js +3 -1
- package/src/x_ite/Components/Sound/Sound.js +31 -41
- package/src/x_ite/Components/Text/Text.js +6 -20
- package/src/x_ite/Components/Texturing/ImageTexture.js +1 -1
- package/src/x_ite/Components/Texturing/MovieTexture.js +1 -1
- package/src/x_ite/Components/Texturing/PixelTexture.js +2 -2
- package/src/x_ite/Components/Texturing/TextureCoordinate.js +5 -5
- package/src/x_ite/Components/Texturing/TextureProperties.js +4 -4
- 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 -5
- package/src/x_ite/Components/Texturing3D/TextureCoordinate4D.js +5 -5
- package/src/x_ite/Components/Texturing3D/X3DTexture3DNode.js +12 -19
- package/src/x_ite/Components/VolumeRendering/X3DVolumeDataNode.js +8 -8
- 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/SFImage.js +2 -11
- 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 +22 -2
- 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 +103 -0
- package/src/x_ite/Rendering/X3DRenderObject.js +127 -148
- package/src/x_ite/X3D.js +32 -26
- package/src/x_ite.config.js +0 -5
- package/src/x_ite.css +216 -175
- package/src/x_ite.html +15 -10
- package/src/x_ite.js +49 -1
- package/x_ite.min.html +15 -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
|
@@ -49,15 +49,27 @@
|
|
|
49
49
|
|
|
50
50
|
define ([
|
|
51
51
|
"x_ite/Components/Rendering/X3DGeometryNode",
|
|
52
|
+
"x_ite/Rendering/VertexArray",
|
|
53
|
+
"standard/Math/Geometry/ViewVolume",
|
|
54
|
+
"standard/Math/Geometry/Box3",
|
|
55
|
+
"standard/Math/Geometry/Line2",
|
|
52
56
|
"standard/Math/Geometry/Line3",
|
|
53
57
|
"standard/Math/Numbers/Vector2",
|
|
54
58
|
"standard/Math/Numbers/Vector3",
|
|
59
|
+
"standard/Math/Numbers/Vector4",
|
|
60
|
+
"standard/Math/Numbers/Matrix2",
|
|
55
61
|
"standard/Math/Numbers/Matrix4",
|
|
56
62
|
],
|
|
57
63
|
function (X3DGeometryNode,
|
|
64
|
+
VertexArray,
|
|
65
|
+
ViewVolume,
|
|
66
|
+
Box3,
|
|
67
|
+
Line2,
|
|
58
68
|
Line3,
|
|
59
69
|
Vector2,
|
|
60
70
|
Vector3,
|
|
71
|
+
Vector4,
|
|
72
|
+
Matrix2,
|
|
61
73
|
Matrix4)
|
|
62
74
|
{
|
|
63
75
|
"use strict";
|
|
@@ -67,174 +79,354 @@ function (X3DGeometryNode,
|
|
|
67
79
|
if (!this .getExecutionContext ())
|
|
68
80
|
X3DGeometryNode .call (this, executionContext);
|
|
69
81
|
|
|
70
|
-
const
|
|
82
|
+
const
|
|
83
|
+
browser = this .getBrowser (),
|
|
84
|
+
gl = browser .getContext ();
|
|
85
|
+
|
|
86
|
+
this .transformVertexArrayObject = new VertexArray ();
|
|
87
|
+
this .thickVertexArrayObject = new VertexArray ();
|
|
88
|
+
this .trianglesBuffer = gl .createBuffer ();
|
|
89
|
+
this .trianglesTexCoordBuffers = new Array (browser .getMaxTextures ()) .fill (this .trianglesBuffer);
|
|
71
90
|
|
|
72
91
|
this .setGeometryType (1);
|
|
73
|
-
this .setPrimitiveMode (
|
|
92
|
+
this .setPrimitiveMode (gl .LINES);
|
|
74
93
|
this .setSolid (false);
|
|
75
94
|
}
|
|
76
95
|
|
|
77
96
|
X3DLineGeometryNode .prototype = Object .assign (Object .create (X3DGeometryNode .prototype),
|
|
78
97
|
{
|
|
79
98
|
constructor: X3DLineGeometryNode,
|
|
80
|
-
|
|
99
|
+
updateVertexArrays: function ()
|
|
81
100
|
{
|
|
82
|
-
|
|
101
|
+
X3DGeometryNode .prototype .updateVertexArrays .call (this);
|
|
83
102
|
|
|
103
|
+
this .transformVertexArrayObject .update ();
|
|
104
|
+
this .thickVertexArrayObject .update ();
|
|
105
|
+
},
|
|
106
|
+
intersectsLine: (function ()
|
|
107
|
+
{
|
|
84
108
|
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
109
|
+
bbox = new Box3 (),
|
|
110
|
+
min = new Vector3 (0, 0, 0),
|
|
111
|
+
max = new Vector3 (0, 0, 0),
|
|
112
|
+
screenScale1_ = new Vector3 (0, 0, 0),
|
|
113
|
+
screenScale2_ = new Vector3 (0, 0, 0),
|
|
114
|
+
modelViewProjectionMatrix = new Matrix4 (),
|
|
115
|
+
point1 = new Vector3 (0, 0, 0),
|
|
116
|
+
point2 = new Vector3 (0, 0, 0),
|
|
117
|
+
projected1 = new Vector2 (0, 0),
|
|
118
|
+
projected2 = new Vector2 (0, 0),
|
|
119
|
+
projected = new Line2 (Vector2 .Zero, Vector2 .yAxis),
|
|
120
|
+
closest = new Vector2 (0, 0),
|
|
121
|
+
ray = new Line3 (Vector3 .Zero, Vector3 .zAxis),
|
|
122
|
+
line = new Line3 (Vector3 .Zero, Vector3 .zAxis),
|
|
123
|
+
point = new Vector3 (0, 0, 0),
|
|
124
|
+
rotation = new Matrix2 (),
|
|
125
|
+
clipPoint = new Vector3 (0, 0, 0);
|
|
126
|
+
|
|
127
|
+
return function (hitRay, renderObject, invModelViewMatrix, appearanceNode, intersections)
|
|
93
128
|
{
|
|
94
|
-
|
|
129
|
+
const
|
|
130
|
+
modelViewMatrix = renderObject .getModelViewMatrix () .get (),
|
|
131
|
+
viewport = renderObject .getViewVolume () .getViewport (),
|
|
132
|
+
extents = bbox .assign (this .getBBox ()) .multRight (modelViewMatrix) .getExtents (min, max),
|
|
133
|
+
linePropertiesNode = appearanceNode .getLineProperties (),
|
|
134
|
+
lineWidth1_2 = Math .max (1.5, linePropertiesNode .getApplied () ? linePropertiesNode .getLinewidthScaleFactor () / 2 : 0),
|
|
135
|
+
screenScale1 = renderObject .getViewpoint () .getScreenScale (min, viewport, screenScale1_), // in m/px
|
|
136
|
+
offsets1 = invModelViewMatrix .multDirMatrix (screenScale1 .multiply (lineWidth1_2)),
|
|
137
|
+
screenScale2 = renderObject .getViewpoint () .getScreenScale (max, viewport, screenScale2_), // in m/px
|
|
138
|
+
offsets2 = invModelViewMatrix .multDirMatrix (screenScale2 .multiply (lineWidth1_2));
|
|
139
|
+
|
|
140
|
+
if (this .intersectsBBox (hitRay, offsets1 .abs () .max (offsets2 .abs ())))
|
|
95
141
|
{
|
|
96
|
-
const
|
|
142
|
+
const
|
|
143
|
+
pointer = renderObject .getBrowser () .getPointer (),
|
|
144
|
+
projectionMatrix = renderObject .getProjectionMatrix () .get (),
|
|
145
|
+
clipPlanes = renderObject .getLocalObjects (),
|
|
146
|
+
vertices = this .getVertices (),
|
|
147
|
+
numVertices = vertices .length;
|
|
148
|
+
|
|
149
|
+
modelViewProjectionMatrix .assign (modelViewMatrix) .multRight (projectionMatrix);
|
|
97
150
|
|
|
98
|
-
for (let i = 0
|
|
151
|
+
for (let i = 0; i < numVertices; i += 8)
|
|
99
152
|
{
|
|
100
153
|
point1 .set (vertices [i + 0], vertices [i + 1], vertices [i + 2]);
|
|
101
154
|
point2 .set (vertices [i + 4], vertices [i + 5], vertices [i + 6]);
|
|
102
155
|
|
|
103
|
-
|
|
156
|
+
ViewVolume .projectPointMatrix (point1, modelViewProjectionMatrix, viewport, projected1);
|
|
157
|
+
ViewVolume .projectPointMatrix (point2, modelViewProjectionMatrix, viewport, projected2);
|
|
104
158
|
|
|
105
|
-
|
|
159
|
+
projected .setPoints (projected1, projected2);
|
|
160
|
+
|
|
161
|
+
if (projected .getClosestPointToPoint (pointer, closest))
|
|
106
162
|
{
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
163
|
+
const
|
|
164
|
+
distance = projected1 .distance (projected2),
|
|
165
|
+
distance1 = projected1 .distance (closest),
|
|
166
|
+
distance2 = projected2 .distance (closest);
|
|
110
167
|
|
|
111
|
-
|
|
168
|
+
if (distance1 <= distance && distance2 <= distance)
|
|
169
|
+
{
|
|
170
|
+
if (closest .distance (pointer) <= lineWidth1_2)
|
|
112
171
|
{
|
|
113
|
-
if (
|
|
114
|
-
|
|
172
|
+
if (clipPlanes .length)
|
|
173
|
+
{
|
|
174
|
+
if (this .isClipped (modelViewMatrix .multVecMatrix (clipPoint .assign (closest)), clipPlanes))
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const
|
|
179
|
+
direction = projected .direction,
|
|
180
|
+
texCoordY = rotation .set (direction .x, direction .y, -direction .y, direction .x) .inverse () .multVecMatrix (pointer .copy () .subtract (closest)),
|
|
181
|
+
texCoord = texCoordY .set (distance1 / distance, (texCoordY .y / lineWidth1_2 + 1) / 2),
|
|
182
|
+
normal = point2 .copy () .subtract (point1) .normalize ();
|
|
115
183
|
|
|
116
|
-
|
|
117
|
-
|
|
184
|
+
ViewVolume .unProjectRay (closest .x, closest .y, modelViewMatrix, projectionMatrix, viewport, ray);
|
|
185
|
+
|
|
186
|
+
line .setPoints (point1, point2) .getClosestPointToLine (ray, point);
|
|
187
|
+
|
|
188
|
+
intersections .push ({ texCoord: texCoord, normal: normal, point: point .copy () });
|
|
118
189
|
}
|
|
119
190
|
}
|
|
120
191
|
}
|
|
121
192
|
}
|
|
122
193
|
}
|
|
123
194
|
|
|
124
|
-
return
|
|
195
|
+
return intersections .length;
|
|
125
196
|
};
|
|
126
197
|
})(),
|
|
198
|
+
intersectsLineWithGeometry: function ()
|
|
199
|
+
{
|
|
200
|
+
return false;
|
|
201
|
+
},
|
|
127
202
|
intersectsBox: function (box, clipPlanes, modelViewMatrix)
|
|
128
203
|
{
|
|
129
204
|
return false;
|
|
130
205
|
},
|
|
131
|
-
|
|
206
|
+
buildTexCoords: function ()
|
|
132
207
|
{
|
|
133
208
|
// Line stipple support.
|
|
134
209
|
|
|
135
|
-
const
|
|
136
|
-
texCoords = this .getTexCoords (),
|
|
137
|
-
vertices = this .getVertices ();
|
|
138
|
-
|
|
139
|
-
this .getMultiTexCoords () .push (texCoords);
|
|
210
|
+
const texCoords = this .getTexCoords ();
|
|
140
211
|
|
|
141
|
-
|
|
212
|
+
if (texCoords .getValue () .length !== this .getVertices () .length)
|
|
142
213
|
{
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
vertices [i + 1],
|
|
149
|
-
vertices [i + 2],
|
|
150
|
-
vertices [i + 3]);
|
|
151
|
-
}
|
|
214
|
+
const
|
|
215
|
+
gl = this .getBrowser () .getContext (),
|
|
216
|
+
numLines = this .getVertices () .length / 8;
|
|
217
|
+
|
|
218
|
+
texCoords .length = this .getVertices () .length;
|
|
152
219
|
|
|
153
|
-
|
|
220
|
+
texCoords .fill (0);
|
|
221
|
+
texCoords .shrinkToFit ();
|
|
154
222
|
|
|
155
|
-
|
|
223
|
+
gl .bindBuffer (gl .ARRAY_BUFFER, this .trianglesBuffer);
|
|
224
|
+
gl .bufferData (gl .ARRAY_BUFFER, new Float32Array (13 * 6 * numLines), gl .DYNAMIC_DRAW);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
this .getMultiTexCoords () .push (texCoords);
|
|
156
228
|
},
|
|
157
|
-
|
|
229
|
+
updateLengthSoFar: (function ()
|
|
158
230
|
{
|
|
159
|
-
|
|
231
|
+
const
|
|
232
|
+
modelViewProjectionMatrix = new Matrix4 (),
|
|
233
|
+
point0 = new Vector4 (0, 0, 0),
|
|
234
|
+
point1 = new Vector4 (0, 0, 0),
|
|
235
|
+
projectedPoint0 = new Vector2 (0, 0),
|
|
236
|
+
projectedPoint1 = new Vector2 (0, 0);
|
|
237
|
+
|
|
238
|
+
return function (gl, context)
|
|
160
239
|
{
|
|
161
240
|
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
241
|
+
viewport = context .renderer .getViewVolume () .getViewport (),
|
|
242
|
+
projectionMatrix = context .renderer .getProjectionMatrix () .get (),
|
|
243
|
+
texCoordArray = this .getTexCoords () .getValue (),
|
|
244
|
+
vertices = this .getVertices (),
|
|
245
|
+
numVertices = vertices .length;
|
|
246
|
+
|
|
247
|
+
modelViewProjectionMatrix .assign (context .modelViewMatrix) .multRight (projectionMatrix);
|
|
248
|
+
|
|
249
|
+
let lengthSoFar = 0;
|
|
165
250
|
|
|
166
|
-
|
|
251
|
+
for (let i = 0; i < numVertices; i += 8)
|
|
167
252
|
{
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
attribNodes = this .attribNodes,
|
|
171
|
-
attribBuffers = this .attribBuffers;
|
|
253
|
+
point0 .set (vertices [i], vertices [i + 1], vertices [i + 2], vertices [i + 3]);
|
|
254
|
+
point1 .set (vertices [i + 4], vertices [i + 5], vertices [i + 6], vertices [i + 7]);
|
|
172
255
|
|
|
173
|
-
|
|
174
|
-
|
|
256
|
+
ViewVolume .projectPointMatrix (point0, modelViewProjectionMatrix, viewport, projectedPoint0);
|
|
257
|
+
ViewVolume .projectPointMatrix (point1, modelViewProjectionMatrix, viewport, projectedPoint1);
|
|
175
258
|
|
|
176
|
-
|
|
259
|
+
texCoordArray [i] = projectedPoint1 .x;
|
|
260
|
+
texCoordArray [i + 1] = projectedPoint1 .y;
|
|
177
261
|
|
|
178
|
-
|
|
179
|
-
|
|
262
|
+
texCoordArray [i + 4] = projectedPoint0 .x;
|
|
263
|
+
texCoordArray [i + 5] = projectedPoint0 .y;
|
|
264
|
+
texCoordArray [i + 6] = lengthSoFar;
|
|
180
265
|
|
|
181
|
-
|
|
266
|
+
lengthSoFar += projectedPoint1 .subtract (projectedPoint0) .magnitude ();
|
|
267
|
+
}
|
|
182
268
|
|
|
183
|
-
|
|
184
|
-
|
|
269
|
+
gl .bindBuffer (gl .ARRAY_BUFFER, this .texCoordBuffers [0]);
|
|
270
|
+
gl .bufferData (gl .ARRAY_BUFFER, texCoordArray, gl .DYNAMIC_DRAW);
|
|
271
|
+
};
|
|
272
|
+
})(),
|
|
273
|
+
display: (function ()
|
|
274
|
+
{
|
|
275
|
+
const
|
|
276
|
+
matrix = new Matrix4 (),
|
|
277
|
+
modelViewProjectionMatrixArray = new Float32Array (16),
|
|
278
|
+
invModelViewProjectionMatrixArray = new Float32Array (16);
|
|
185
279
|
|
|
186
|
-
|
|
187
|
-
|
|
280
|
+
return function (gl, context)
|
|
281
|
+
{
|
|
282
|
+
const
|
|
283
|
+
browser = context .browser,
|
|
284
|
+
appearanceNode = context .shapeNode .getAppearance (),
|
|
285
|
+
linePropertiesNode = appearanceNode .getLineProperties (),
|
|
286
|
+
shaderNode = appearanceNode .getShader () || browser .getLineShader (),
|
|
287
|
+
blendModeNode = appearanceNode .getBlendMode (),
|
|
288
|
+
attribNodes = this .getAttrib (),
|
|
289
|
+
attribBuffers = this .getAttribBuffers ();
|
|
290
|
+
|
|
291
|
+
if (linePropertiesNode .getApplied () && linePropertiesNode .getLinetype () !== 1)
|
|
292
|
+
this .updateLengthSoFar (gl, context);
|
|
293
|
+
|
|
294
|
+
if (linePropertiesNode .getMustTransformLines ())
|
|
295
|
+
{
|
|
296
|
+
const transformShaderNode = browser .getLineTransformShader ();
|
|
188
297
|
|
|
189
|
-
if (
|
|
190
|
-
|
|
298
|
+
if (transformShaderNode .isValid ())
|
|
299
|
+
{
|
|
300
|
+
const
|
|
301
|
+
viewport = context .renderer .getViewVolume () .getViewport (),
|
|
302
|
+
projectionMatrix = context .renderer .getProjectionMatrix () .get (),
|
|
303
|
+
primitiveMode = shaderNode .getPrimitiveMode (gl .TRIANGLES);
|
|
191
304
|
|
|
192
|
-
|
|
193
|
-
|
|
305
|
+
modelViewProjectionMatrixArray .set (matrix .assign (context .modelViewMatrix) .multRight (projectionMatrix));
|
|
306
|
+
invModelViewProjectionMatrixArray .set (matrix .inverse ());
|
|
194
307
|
|
|
195
|
-
|
|
308
|
+
// Start
|
|
196
309
|
|
|
197
|
-
|
|
310
|
+
transformShaderNode .enable (gl);
|
|
198
311
|
|
|
199
|
-
|
|
312
|
+
gl .uniform4f (transformShaderNode .viewport, viewport .x, viewport .y, viewport .z, viewport .w);
|
|
313
|
+
gl .uniformMatrix4fv (transformShaderNode .modelViewProjectionMatrix, false, modelViewProjectionMatrixArray);
|
|
314
|
+
gl .uniformMatrix4fv (transformShaderNode .invModelViewProjectionMatrix, false, invModelViewProjectionMatrixArray);
|
|
315
|
+
gl .uniform1f (transformShaderNode .scale, linePropertiesNode .getLinewidthScaleFactor () / 2);
|
|
200
316
|
|
|
201
|
-
|
|
202
|
-
attribNode .disable (gl, shaderNode);
|
|
317
|
+
// Setup vertex attributes.
|
|
203
318
|
|
|
204
|
-
|
|
205
|
-
|
|
319
|
+
if (this .transformVertexArrayObject .enable (gl, shaderNode))
|
|
320
|
+
{
|
|
321
|
+
const
|
|
322
|
+
fogDepthStride = 2 * Float32Array .BYTES_PER_ELEMENT,
|
|
323
|
+
fogDepthOffset0 = 0,
|
|
324
|
+
fogDepthOffset1 = 1 * Float32Array .BYTES_PER_ELEMENT,
|
|
325
|
+
colorStride = 8 * Float32Array .BYTES_PER_ELEMENT,
|
|
326
|
+
colorOffset0 = 0,
|
|
327
|
+
colorOffset1 = 4 * Float32Array .BYTES_PER_ELEMENT,
|
|
328
|
+
texCoordStride = 8 * Float32Array .BYTES_PER_ELEMENT,
|
|
329
|
+
texCoordOffset0 = 0,
|
|
330
|
+
texCoordOffset1 = 4 * Float32Array .BYTES_PER_ELEMENT,
|
|
331
|
+
vertexStride = 8 * Float32Array .BYTES_PER_ELEMENT,
|
|
332
|
+
vertexOffset0 = 0,
|
|
333
|
+
vertexOffset1 = 4 * Float32Array .BYTES_PER_ELEMENT;
|
|
334
|
+
|
|
335
|
+
// for (let i = 0, length = attribNodes .length; i < length; ++ i)
|
|
336
|
+
// attribNodes [i] .enable (gl, shaderNode, attribBuffers [i]);
|
|
337
|
+
|
|
338
|
+
if (this .fogCoords)
|
|
339
|
+
{
|
|
340
|
+
transformShaderNode .enableFloatAttrib (gl, "x3d_FogDepth0", this .fogDepthBuffer, 1, fogDepthStride, fogDepthOffset0);
|
|
341
|
+
transformShaderNode .enableFloatAttrib (gl, "x3d_FogDepth1", this .fogDepthBuffer, 1, fogDepthStride, fogDepthOffset1);
|
|
342
|
+
}
|
|
206
343
|
|
|
207
|
-
|
|
208
|
-
|
|
344
|
+
if (this .colorMaterial)
|
|
345
|
+
{
|
|
346
|
+
transformShaderNode .enableFloatAttrib (gl, "x3d_Color0", this .colorBuffer, 4, colorStride, colorOffset0);
|
|
347
|
+
transformShaderNode .enableFloatAttrib (gl, "x3d_Color1", this .colorBuffer, 4, colorStride, colorOffset1);
|
|
348
|
+
}
|
|
209
349
|
|
|
210
|
-
|
|
211
|
-
|
|
350
|
+
transformShaderNode .enableFloatAttrib (gl, "x3d_TexCoord0", this .texCoordBuffers [0], 4, texCoordStride, texCoordOffset0);
|
|
351
|
+
transformShaderNode .enableFloatAttrib (gl, "x3d_TexCoord1", this .texCoordBuffers [0], 4, texCoordStride, texCoordOffset1);
|
|
212
352
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
353
|
+
transformShaderNode .enableFloatAttrib (gl, "x3d_Vertex0", this .vertexBuffer, 4, vertexStride, vertexOffset0);
|
|
354
|
+
transformShaderNode .enableFloatAttrib (gl, "x3d_Vertex1", this .vertexBuffer, 4, vertexStride, vertexOffset1);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// Transform lines.
|
|
358
|
+
|
|
359
|
+
gl .bindTransformFeedback (gl .TRANSFORM_FEEDBACK, browser .getLineTransformFeedback ());
|
|
360
|
+
gl .bindBufferBase (gl .TRANSFORM_FEEDBACK_BUFFER, 0, this .trianglesBuffer);
|
|
361
|
+
gl .enable (gl .RASTERIZER_DISCARD);
|
|
362
|
+
gl .beginTransformFeedback (gl .POINTS);
|
|
363
|
+
gl .drawArraysInstanced (gl .POINTS, 0, this .vertexCount / 2, 2);
|
|
364
|
+
gl .endTransformFeedback ();
|
|
365
|
+
gl .disable (gl .RASTERIZER_DISCARD);
|
|
366
|
+
gl .bindTransformFeedback (gl .TRANSFORM_FEEDBACK, null);
|
|
367
|
+
|
|
368
|
+
// DEBUG
|
|
369
|
+
|
|
370
|
+
// const data = new Float32Array (13 * 6 * this .vertexCount / 2);
|
|
371
|
+
// gl .bindBuffer (gl .ARRAY_BUFFER, this .trianglesBuffer);
|
|
372
|
+
// gl .getBufferSubData (gl .ARRAY_BUFFER, 0, data);
|
|
373
|
+
// console .log (data);
|
|
374
|
+
|
|
375
|
+
// Render triangles.
|
|
376
|
+
|
|
377
|
+
if (blendModeNode)
|
|
378
|
+
blendModeNode .enable (gl);
|
|
379
|
+
|
|
380
|
+
// Setup shader.
|
|
381
|
+
|
|
382
|
+
shaderNode .enable (gl);
|
|
383
|
+
shaderNode .setLocalUniforms (gl, context);
|
|
384
|
+
|
|
385
|
+
// Setup vertex attributes.
|
|
386
|
+
|
|
387
|
+
if (this .thickVertexArrayObject .enable (gl, shaderNode))
|
|
388
|
+
{
|
|
389
|
+
const
|
|
390
|
+
stride = 13 * Float32Array .BYTES_PER_ELEMENT,
|
|
391
|
+
fogCoordOffset = 0,
|
|
392
|
+
colorOffset = 1 * Float32Array .BYTES_PER_ELEMENT,
|
|
393
|
+
texCoordOffset = 5 * Float32Array .BYTES_PER_ELEMENT,
|
|
394
|
+
vertexOffset = 9 * Float32Array .BYTES_PER_ELEMENT;
|
|
395
|
+
|
|
396
|
+
// for (let i = 0, length = attribNodes .length; i < length; ++ i)
|
|
397
|
+
// attribNodes [i] .enable (gl, shaderNode, attribBuffers [i]);
|
|
398
|
+
|
|
399
|
+
if (this .fogCoords)
|
|
400
|
+
shaderNode .enableFogDepthAttribute (gl, this .trianglesBuffer, stride, fogCoordOffset);
|
|
401
|
+
|
|
402
|
+
if (this .colorMaterial)
|
|
403
|
+
shaderNode .enableColorAttribute (gl, this .trianglesBuffer, stride, colorOffset);
|
|
404
|
+
|
|
405
|
+
shaderNode .enableTexCoordAttribute (gl, this .trianglesTexCoordBuffers, stride, texCoordOffset);
|
|
406
|
+
shaderNode .enableVertexAttribute (gl, this .trianglesBuffer, stride, vertexOffset);
|
|
407
|
+
|
|
408
|
+
gl .bindBuffer (gl .ARRAY_BUFFER, null);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
if (shaderNode .getWireframe ())
|
|
412
|
+
{
|
|
413
|
+
for (let i = 0, length = this .vertexCount * 3; i < length; i += 3)
|
|
414
|
+
gl .drawArrays (primitiveMode, i, 3);
|
|
415
|
+
}
|
|
416
|
+
else
|
|
417
|
+
{
|
|
418
|
+
gl .frontFace (gl .CCW);
|
|
419
|
+
gl .enable (gl .CULL_FACE);
|
|
420
|
+
gl .drawArrays (primitiveMode, 0, this .vertexCount * 3);
|
|
421
|
+
}
|
|
231
422
|
|
|
232
|
-
|
|
423
|
+
if (blendModeNode)
|
|
424
|
+
blendModeNode .disable (gl);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
else if (shaderNode .isValid ())
|
|
233
428
|
{
|
|
234
|
-
const
|
|
235
|
-
blendModeNode = appearanceNode .blendModeNode,
|
|
236
|
-
attribNodes = this .attribNodes,
|
|
237
|
-
attribBuffers = this .attribBuffers;
|
|
429
|
+
const primitiveMode = shaderNode .getPrimitiveMode (this .primitiveMode);
|
|
238
430
|
|
|
239
431
|
if (blendModeNode)
|
|
240
432
|
blendModeNode .enable (gl);
|
|
@@ -246,63 +438,81 @@ function (X3DGeometryNode,
|
|
|
246
438
|
|
|
247
439
|
// Setup vertex attributes.
|
|
248
440
|
|
|
249
|
-
|
|
250
|
-
|
|
441
|
+
if (this .vertexArrayObject .enable (gl, shaderNode))
|
|
442
|
+
{
|
|
443
|
+
for (let i = 0, length = attribNodes .length; i < length; ++ i)
|
|
444
|
+
attribNodes [i] .enable (gl, shaderNode, attribBuffers [i]);
|
|
251
445
|
|
|
252
|
-
|
|
253
|
-
|
|
446
|
+
if (this .fogCoords)
|
|
447
|
+
shaderNode .enableFogDepthAttribute (gl, this .fogDepthBuffer, 0, 0);
|
|
254
448
|
|
|
255
|
-
|
|
256
|
-
|
|
449
|
+
if (this .colorMaterial)
|
|
450
|
+
shaderNode .enableColorAttribute (gl, this .colorBuffer, 0, 0);
|
|
257
451
|
|
|
258
|
-
|
|
259
|
-
shaderNode .
|
|
452
|
+
shaderNode .enableTexCoordAttribute (gl, this .texCoordBuffers, 0, 0);
|
|
453
|
+
shaderNode .enableVertexAttribute (gl, this .vertexBuffer, 0, 0);
|
|
454
|
+
}
|
|
260
455
|
|
|
261
|
-
|
|
456
|
+
gl .drawArrays (primitiveMode, 0, this .vertexCount);
|
|
262
457
|
|
|
263
|
-
|
|
458
|
+
if (blendModeNode)
|
|
459
|
+
blendModeNode .disable (gl);
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
})(),
|
|
463
|
+
displayParticles: function (gl, context, particleSystem)
|
|
464
|
+
{
|
|
465
|
+
const
|
|
466
|
+
browser = context .browser,
|
|
467
|
+
appearanceNode = context .shapeNode .getAppearance (),
|
|
468
|
+
shaderNode = appearanceNode .getShader () || browser .getLineShader (),
|
|
469
|
+
blendModeNode = appearanceNode .getBlendMode (),
|
|
470
|
+
attribNodes = this .getAttrib (),
|
|
471
|
+
attribBuffers = this .getAttribBuffers (),
|
|
472
|
+
primitiveMode = shaderNode .getPrimitiveMode (this .primitiveMode);
|
|
473
|
+
|
|
474
|
+
if (shaderNode .isValid ())
|
|
475
|
+
{
|
|
476
|
+
if (blendModeNode)
|
|
477
|
+
blendModeNode .enable (gl);
|
|
264
478
|
|
|
265
|
-
|
|
266
|
-
modelViewMatrix = context .modelViewMatrix,
|
|
267
|
-
x = modelViewMatrix [12],
|
|
268
|
-
y = modelViewMatrix [13],
|
|
269
|
-
z = modelViewMatrix [14],
|
|
270
|
-
primitiveMode = shaderNode .primitiveMode === gl .POINTS ? gl .POINTS : this .primitiveMode;
|
|
479
|
+
// Setup shader.
|
|
271
480
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
const particle = particles [p];
|
|
481
|
+
shaderNode .enable (gl);
|
|
482
|
+
shaderNode .setLocalUniforms (gl, context);
|
|
275
483
|
|
|
276
|
-
|
|
277
|
-
modelViewMatrix [13] = y;
|
|
278
|
-
modelViewMatrix [14] = z;
|
|
484
|
+
// Setup vertex attributes.
|
|
279
485
|
|
|
280
|
-
|
|
486
|
+
const outputParticles = particleSystem .outputParticles;
|
|
281
487
|
|
|
282
|
-
|
|
488
|
+
if (outputParticles .vertexArrayObject .update (this .updateParticles) .enable (gl, shaderNode))
|
|
489
|
+
{
|
|
490
|
+
const particleStride = particleSystem .particleStride;
|
|
283
491
|
|
|
284
|
-
|
|
285
|
-
|
|
492
|
+
shaderNode .enableParticleAttribute (gl, outputParticles, particleStride, particleSystem .particleOffset, 1);
|
|
493
|
+
shaderNode .enableParticleMatrixAttribute (gl, outputParticles, particleStride, particleSystem .matrixOffset, 1);
|
|
286
494
|
|
|
287
|
-
for (
|
|
288
|
-
|
|
495
|
+
for (let i = 0, length = attribNodes .length; i < length; ++ i)
|
|
496
|
+
attribNodes [i] .enable (gl, shaderNode, attribBuffers [i]);
|
|
289
497
|
|
|
290
498
|
if (this .fogCoords)
|
|
291
|
-
shaderNode .
|
|
499
|
+
shaderNode .enableFogDepthAttribute (gl, this .fogDepthBuffer, 0, 0);
|
|
292
500
|
|
|
293
501
|
if (this .colorMaterial)
|
|
294
|
-
shaderNode .
|
|
502
|
+
shaderNode .enableColorAttribute (gl, this .colorBuffer, 0, 0);
|
|
295
503
|
|
|
296
|
-
shaderNode .
|
|
504
|
+
shaderNode .enableTexCoordAttribute (gl, this .texCoordBuffers, 0, 0);
|
|
505
|
+
shaderNode .enableVertexAttribute (gl, this .vertexBuffer, 0, 0);
|
|
297
506
|
|
|
298
|
-
|
|
299
|
-
blendModeNode .disable (gl);
|
|
507
|
+
this .updateParticles = false;
|
|
300
508
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
509
|
+
|
|
510
|
+
// Wireframes are always solid so only one drawing call is needed.
|
|
511
|
+
|
|
512
|
+
gl .drawArraysInstanced (primitiveMode, 0, this .vertexCount, particleSystem .numParticles);
|
|
513
|
+
|
|
514
|
+
if (blendModeNode)
|
|
515
|
+
blendModeNode .disable (gl);
|
|
306
516
|
}
|
|
307
517
|
},
|
|
308
518
|
});
|