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
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
define ([
|
|
51
51
|
"jquery",
|
|
52
52
|
"x_ite/Fields",
|
|
53
|
+
"x_ite/Browser/Core/Context",
|
|
53
54
|
"x_ite/Browser/Core/BrowserTimings",
|
|
54
55
|
"x_ite/Browser/Core/BrowserOptions",
|
|
55
56
|
"x_ite/Browser/Core/BrowserProperties",
|
|
@@ -64,6 +65,7 @@ define ([
|
|
|
64
65
|
],
|
|
65
66
|
function ($,
|
|
66
67
|
Fields,
|
|
68
|
+
Context,
|
|
67
69
|
BrowserTimings,
|
|
68
70
|
BrowserOptions,
|
|
69
71
|
BrowserProperties,
|
|
@@ -80,114 +82,14 @@ function ($,
|
|
|
80
82
|
|
|
81
83
|
const WEBGL_LATEST_VERSION = 2;
|
|
82
84
|
|
|
83
|
-
const extensions = [
|
|
84
|
-
"ANGLE_instanced_arrays",
|
|
85
|
-
"EXT_blend_minmax",
|
|
86
|
-
"EXT_frag_depth",
|
|
87
|
-
"EXT_shader_texture_lod",
|
|
88
|
-
"EXT_texture_filter_anisotropic",
|
|
89
|
-
"OES_element_index_uint",
|
|
90
|
-
"OES_standard_derivatives",
|
|
91
|
-
"OES_texture_float",
|
|
92
|
-
"OES_texture_float_linear",
|
|
93
|
-
"OES_texture_half_float",
|
|
94
|
-
"OES_texture_half_float_linear",
|
|
95
|
-
"OES_vertex_array_object",
|
|
96
|
-
"WEBGL_compressed_texture_s3tc",
|
|
97
|
-
"WEBGL_debug_renderer_info",
|
|
98
|
-
"WEBGL_debug_shaders",
|
|
99
|
-
"WEBGL_depth_texture",
|
|
100
|
-
"WEBGL_draw_buffers",
|
|
101
|
-
"WEBGL_lose_context",
|
|
102
|
-
|
|
103
|
-
"EXT_color_buffer_float",
|
|
104
|
-
"EXT_color_buffer_half_float",
|
|
105
|
-
"EXT_disjoint_timer_query",
|
|
106
|
-
"EXT_disjoint_timer_query_webgl2",
|
|
107
|
-
"EXT_sRGB",
|
|
108
|
-
"WEBGL_color_buffer_float",
|
|
109
|
-
"WEBGL_compressed_texture_astc",
|
|
110
|
-
"WEBGL_compressed_texture_atc",
|
|
111
|
-
"WEBGL_compressed_texture_etc",
|
|
112
|
-
"WEBGL_compressed_texture_etc1",
|
|
113
|
-
"WEBGL_compressed_texture_pvrtc",
|
|
114
|
-
"WEBGL_compressed_texture_s3tc",
|
|
115
|
-
"WEBGL_compressed_texture_s3tc_srgb",
|
|
116
|
-
|
|
117
|
-
"EXT_float_blend",
|
|
118
|
-
"OES_fbo_render_mipmap",
|
|
119
|
-
"WEBGL_get_buffer_sub_data_async",
|
|
120
|
-
"WEBGL_multiview",
|
|
121
|
-
"WEBGL_security_sensitive_resources",
|
|
122
|
-
"WEBGL_shared_resources",
|
|
123
|
-
|
|
124
|
-
"EXT_clip_cull_distance",
|
|
125
|
-
"WEBGL_debug",
|
|
126
|
-
"WEBGL_dynamic_texture",
|
|
127
|
-
"WEBGL_subarray_uploads",
|
|
128
|
-
"WEBGL_texture_multisample",
|
|
129
|
-
"WEBGL_texture_source_iframe",
|
|
130
|
-
"WEBGL_video_texture",
|
|
131
|
-
|
|
132
|
-
"EXT_texture_storage",
|
|
133
|
-
"OES_depth24",
|
|
134
|
-
"WEBGL_debug_shader_precision",
|
|
135
|
-
"WEBGL_draw_elements_no_range_check",
|
|
136
|
-
"WEBGL_subscribe_uniform",
|
|
137
|
-
"WEBGL_texture_from_depth_video",
|
|
138
|
-
];
|
|
139
|
-
|
|
140
|
-
function getContext (canvas, version, preserveDrawingBuffer)
|
|
141
|
-
{
|
|
142
|
-
const options = { preserveDrawingBuffer: preserveDrawingBuffer };
|
|
143
|
-
|
|
144
|
-
let gl = null;
|
|
145
|
-
|
|
146
|
-
if (version >= 2 && ! gl)
|
|
147
|
-
{
|
|
148
|
-
gl = canvas .getContext ("webgl2", options);
|
|
149
|
-
|
|
150
|
-
if (gl)
|
|
151
|
-
gl .getVersion = function () { return 2; };
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if (version >= 1 && ! gl)
|
|
155
|
-
{
|
|
156
|
-
gl = canvas .getContext ("webgl", options) ||
|
|
157
|
-
canvas .getContext ("experimental-webgl", options);
|
|
158
|
-
|
|
159
|
-
if (gl)
|
|
160
|
-
gl .getVersion = function () { return 1; };
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
if (! gl)
|
|
164
|
-
throw new Error ("Couldn't create WebGL context.");
|
|
165
|
-
|
|
166
|
-
// Feature detection:
|
|
167
|
-
|
|
168
|
-
// If the aliased lineWidth ranges are both 1, gl.lineWidth is probably not possible,
|
|
169
|
-
// thus we disable it completely to prevent webgl errors.
|
|
170
|
-
|
|
171
|
-
const aliasedLineWidthRange = gl .getParameter (gl .ALIASED_LINE_WIDTH_RANGE);
|
|
172
|
-
|
|
173
|
-
if (aliasedLineWidthRange [0] === 1 && aliasedLineWidthRange [1] === 1)
|
|
174
|
-
{
|
|
175
|
-
gl .lineWidth = Function .prototype;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// Return context.
|
|
179
|
-
|
|
180
|
-
return gl;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
85
|
const
|
|
184
86
|
_number = Symbol (),
|
|
185
87
|
_element = Symbol (),
|
|
186
|
-
|
|
88
|
+
_shadow = Symbol (),
|
|
187
89
|
_surface = Symbol (),
|
|
188
90
|
_canvas = Symbol (),
|
|
189
91
|
_context = Symbol (),
|
|
190
|
-
|
|
92
|
+
_splashScreen = Symbol (),
|
|
191
93
|
_localStorage = Symbol (),
|
|
192
94
|
_mobile = Symbol (),
|
|
193
95
|
_browserTimings = Symbol (),
|
|
@@ -199,40 +101,37 @@ function ($,
|
|
|
199
101
|
_observer = Symbol (),
|
|
200
102
|
_privateScene = Symbol (),
|
|
201
103
|
_keydown = Symbol (),
|
|
202
|
-
_keyup = Symbol ()
|
|
104
|
+
_keyup = Symbol (),
|
|
105
|
+
_pixelPerPoint = Symbol ();
|
|
203
106
|
|
|
204
107
|
let browserNumber = 0;
|
|
205
108
|
|
|
206
109
|
function X3DCoreContext (element)
|
|
207
110
|
{
|
|
208
|
-
this [_number] = ++ browserNumber;
|
|
209
|
-
this [_element] = element;
|
|
210
|
-
|
|
211
111
|
// Get canvas & context.
|
|
212
112
|
|
|
213
113
|
const
|
|
214
|
-
|
|
215
|
-
|
|
114
|
+
shadow = $(element .prop ("shadowRoot")),
|
|
115
|
+
browser = $("<div></div>") .addClass ("x_ite-private-browser"),
|
|
116
|
+
surface = $("<div></div>") .addClass ("x_ite-private-surface") .appendTo (browser),
|
|
117
|
+
splashScreen = $("<div></div>") .hide () .addClass ("x_ite-private-splash-screen") .appendTo (browser),
|
|
216
118
|
spinner = $("<div></div>") .addClass ("x_ite-private-spinner") .appendTo (splashScreen),
|
|
217
|
-
progress = $("<div></div>") .addClass ("x_ite-private-progress") .appendTo (splashScreen)
|
|
218
|
-
surface = $("<div></div>") .addClass ("x_ite-private-surface") .appendTo (browser);
|
|
119
|
+
progress = $("<div></div>") .addClass ("x_ite-private-progress") .appendTo (splashScreen);
|
|
219
120
|
|
|
220
|
-
$("<div></div>") .addClass ("x_ite-private-x_ite") .html ("
|
|
121
|
+
$("<div></div>") .addClass ("x_ite-private-x_ite") .html (this .getName () + "<span class='x_ite-private-x3d'>X3D</span>") .appendTo (progress);
|
|
221
122
|
$("<div></div>") .addClass ("x_ite-private-progressbar") .appendTo (progress) .append ($("<div></div>"));
|
|
222
123
|
$("<div></div>") .addClass ("x_ite-private-spinner-text") .appendTo (progress);
|
|
223
124
|
|
|
224
|
-
this [
|
|
125
|
+
this [_number] = ++ browserNumber;
|
|
126
|
+
this [_element] = element;
|
|
127
|
+
this [_shadow] = shadow .length ? shadow .append (browser .hide ()) : this [_element] .prepend (browser);
|
|
225
128
|
this [_surface] = surface;
|
|
226
129
|
this [_canvas] = $("<canvas></canvas>") .addClass ("x_ite-private-canvas") .prependTo (surface);
|
|
227
|
-
this [_context] =
|
|
228
|
-
this [
|
|
229
|
-
|
|
230
|
-
const gl = this .getContext ();
|
|
130
|
+
this [_context] = Context .create (this [_canvas] [0], WEBGL_LATEST_VERSION, element .attr ("preserveDrawingBuffer") === "true");
|
|
131
|
+
this [_splashScreen] = splashScreen;
|
|
231
132
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
this [_extensions] .set (extension, gl .getExtension (extension));
|
|
235
|
-
}
|
|
133
|
+
if (shadow .length)
|
|
134
|
+
shadow .prop ("loaded") .then (function () { browser .show (); });
|
|
236
135
|
|
|
237
136
|
this [_localStorage] = new DataStorage (localStorage, "X_ITE.X3DBrowser(" + this [_number] + ").");
|
|
238
137
|
this [_mobile] = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i .test (navigator .userAgent);
|
|
@@ -244,6 +143,10 @@ function ($,
|
|
|
244
143
|
this [_notification] = new Notification (this .getPrivateScene ());
|
|
245
144
|
this [_contextMenu] = new ContextMenu (this .getPrivateScene ());
|
|
246
145
|
|
|
146
|
+
const inches = $("<div></div>") .hide () .css ("height", "10in") .appendTo (this [_shadow]);
|
|
147
|
+
this [_pixelPerPoint] = inches .height () / 720;
|
|
148
|
+
inches .remove ();
|
|
149
|
+
|
|
247
150
|
$(".x_ite-console") .empty ();
|
|
248
151
|
|
|
249
152
|
this .addChildObjects ("controlKey", new Fields .SFBool (),
|
|
@@ -259,8 +162,8 @@ function ($,
|
|
|
259
162
|
// Setup browser nodes.
|
|
260
163
|
|
|
261
164
|
this [_browserTimings] .setup ();
|
|
262
|
-
this [_browserOptions] .setup ()
|
|
263
|
-
this [_browserProperties] .setup ()
|
|
165
|
+
this [_browserOptions] .setup ();
|
|
166
|
+
this [_browserProperties] .setup ();
|
|
264
167
|
this [_renderingProperties] .setup ();
|
|
265
168
|
this [_notification] .setup ();
|
|
266
169
|
this [_contextMenu] .setup ();
|
|
@@ -335,6 +238,10 @@ function ($,
|
|
|
335
238
|
{
|
|
336
239
|
return this [_element];
|
|
337
240
|
},
|
|
241
|
+
getShadow: function ()
|
|
242
|
+
{
|
|
243
|
+
return this [_shadow];
|
|
244
|
+
},
|
|
338
245
|
getSurface: function ()
|
|
339
246
|
{
|
|
340
247
|
return this [_surface];
|
|
@@ -351,10 +258,6 @@ function ($,
|
|
|
351
258
|
{
|
|
352
259
|
return this [_context];
|
|
353
260
|
},
|
|
354
|
-
getExtension: function (name)
|
|
355
|
-
{
|
|
356
|
-
return this [_extensions] .get (name);
|
|
357
|
-
},
|
|
358
261
|
getMobile: function ()
|
|
359
262
|
{
|
|
360
263
|
return this [_mobile];
|
|
@@ -481,7 +384,7 @@ function ($,
|
|
|
481
384
|
else
|
|
482
385
|
{
|
|
483
386
|
if (! this .getLoading ())
|
|
484
|
-
this .getCanvas () .
|
|
387
|
+
this .getCanvas () .show ();
|
|
485
388
|
}
|
|
486
389
|
},
|
|
487
390
|
setBrowserEventHandler: function (name)
|
|
@@ -544,15 +447,6 @@ function ($,
|
|
|
544
447
|
this ._altKey = true;
|
|
545
448
|
break;
|
|
546
449
|
}
|
|
547
|
-
case 37: // Left
|
|
548
|
-
case 38: // Up
|
|
549
|
-
case 39: // Right
|
|
550
|
-
case 40: // Down
|
|
551
|
-
{
|
|
552
|
-
// Prevent bug in Firefox that event loop is broken when pressing these keys.
|
|
553
|
-
this .requestAnimationFrame ();
|
|
554
|
-
break;
|
|
555
|
-
}
|
|
556
450
|
case 49: // 1
|
|
557
451
|
{
|
|
558
452
|
if (this .getDebug ())
|
|
@@ -782,15 +676,6 @@ function ($,
|
|
|
782
676
|
this ._altKey = false;
|
|
783
677
|
break;
|
|
784
678
|
}
|
|
785
|
-
case 37: // Left
|
|
786
|
-
case 38: // Up
|
|
787
|
-
case 39: // Right
|
|
788
|
-
case 40: // Down
|
|
789
|
-
{
|
|
790
|
-
// Prevent bug in Firefox that event loop is broken when pressing these keys.
|
|
791
|
-
this .requestAnimationFrame ();
|
|
792
|
-
break;
|
|
793
|
-
}
|
|
794
679
|
case 225: // Alt Gr
|
|
795
680
|
{
|
|
796
681
|
this ._altGrKey = false;
|
|
@@ -802,11 +687,15 @@ function ($,
|
|
|
802
687
|
{
|
|
803
688
|
// The textarea must be visible to make copy work.
|
|
804
689
|
const $temp = $("<textarea></textarea>");
|
|
805
|
-
this .
|
|
690
|
+
this .getShadow () .find (".x_ite-private-browser") .prepend ($temp);
|
|
806
691
|
$temp .text (text) .select ();
|
|
807
692
|
document .execCommand ("copy");
|
|
808
693
|
$temp .remove ();
|
|
809
694
|
},
|
|
695
|
+
getPixelPerPoint: function ()
|
|
696
|
+
{
|
|
697
|
+
return this [_pixelPerPoint];
|
|
698
|
+
},
|
|
810
699
|
};
|
|
811
700
|
|
|
812
701
|
return X3DCoreContext;
|
|
@@ -141,7 +141,7 @@ define (function ()
|
|
|
141
141
|
let distance = 0;
|
|
142
142
|
|
|
143
143
|
for (let i = 0, length = lhs .length; i < length; ++ i)
|
|
144
|
-
distance = Math .max (a .assign (lhs [i]) .subtract (rhs [i]) .
|
|
144
|
+
distance = Math .max (a .assign (lhs [i]) .subtract (rhs [i]) .magnitude ());
|
|
145
145
|
|
|
146
146
|
return distance < tolerance;
|
|
147
147
|
},
|
|
@@ -70,7 +70,7 @@ function (Arc2DOptions,
|
|
|
70
70
|
{
|
|
71
71
|
initialize: function ()
|
|
72
72
|
{
|
|
73
|
-
this .
|
|
73
|
+
this .setPrimitiveQuality2D (this .getBrowserOptions () .getPrimitiveQuality ());
|
|
74
74
|
},
|
|
75
75
|
getArc2DOptions: function ()
|
|
76
76
|
{
|
|
@@ -92,7 +92,7 @@ function (Arc2DOptions,
|
|
|
92
92
|
{
|
|
93
93
|
return getOptionNode .call (this, "getRectangle2DOptions", Rectangle2DOptions);
|
|
94
94
|
},
|
|
95
|
-
|
|
95
|
+
setPrimitiveQuality2D: function (primitiveQuality)
|
|
96
96
|
{
|
|
97
97
|
const
|
|
98
98
|
arc = this .getArc2DOptions (),
|
|
@@ -52,11 +52,13 @@ define ([
|
|
|
52
52
|
"x_ite/Browser/Geometry3D/ConeOptions",
|
|
53
53
|
"x_ite/Browser/Geometry3D/CylinderOptions",
|
|
54
54
|
"x_ite/Browser/Geometry3D/QuadSphereOptions",
|
|
55
|
+
"x_ite/Browser/Core/PrimitiveQuality",
|
|
55
56
|
],
|
|
56
57
|
function (BoxOptions,
|
|
57
58
|
ConeOptions,
|
|
58
59
|
CylinderOptions,
|
|
59
|
-
QuadSphereOptions
|
|
60
|
+
QuadSphereOptions,
|
|
61
|
+
PrimitiveQuality)
|
|
60
62
|
{
|
|
61
63
|
"use strict";
|
|
62
64
|
|
|
@@ -65,7 +67,9 @@ function (BoxOptions,
|
|
|
65
67
|
X3DGeometry3DContext .prototype =
|
|
66
68
|
{
|
|
67
69
|
initialize: function ()
|
|
68
|
-
{
|
|
70
|
+
{
|
|
71
|
+
this .setPrimitiveQuality3D (this .getBrowserOptions () .getPrimitiveQuality ());
|
|
72
|
+
},
|
|
69
73
|
getBoxOptions: function ()
|
|
70
74
|
{
|
|
71
75
|
return getOptionNode .call (this, "getBoxOptions", BoxOptions);
|
|
@@ -82,6 +86,41 @@ function (BoxOptions,
|
|
|
82
86
|
{
|
|
83
87
|
return getOptionNode .call (this, "getSphereOptions", QuadSphereOptions);
|
|
84
88
|
},
|
|
89
|
+
setPrimitiveQuality3D: function (primitiveQuality)
|
|
90
|
+
{
|
|
91
|
+
const
|
|
92
|
+
cone = this .getConeOptions (),
|
|
93
|
+
cylinder = this .getCylinderOptions (),
|
|
94
|
+
sphere = this .getSphereOptions ();
|
|
95
|
+
|
|
96
|
+
switch (primitiveQuality)
|
|
97
|
+
{
|
|
98
|
+
case PrimitiveQuality .LOW:
|
|
99
|
+
{
|
|
100
|
+
cone ._xDimension = 16;
|
|
101
|
+
cylinder ._xDimension = 16;
|
|
102
|
+
sphere ._xDimension = 20;
|
|
103
|
+
sphere ._yDimension = 9;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
case PrimitiveQuality .MEDIUM:
|
|
107
|
+
{
|
|
108
|
+
cone ._xDimension = 20;
|
|
109
|
+
cylinder ._xDimension = 20;
|
|
110
|
+
sphere ._xDimension = 32;
|
|
111
|
+
sphere ._yDimension = 15;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
case PrimitiveQuality .HIGH:
|
|
115
|
+
{
|
|
116
|
+
cone ._xDimension = 32;
|
|
117
|
+
cylinder ._xDimension = 32;
|
|
118
|
+
sphere ._xDimension = 64;
|
|
119
|
+
sphere ._yDimension = 31;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
},
|
|
85
124
|
};
|
|
86
125
|
|
|
87
126
|
function getOptionNode (key, OptionNode)
|
|
@@ -72,8 +72,8 @@ function (Vector3,
|
|
|
72
72
|
slerp: function (source, destination, t)
|
|
73
73
|
{
|
|
74
74
|
const
|
|
75
|
-
sourceLength = source .
|
|
76
|
-
destinationLength = destination .
|
|
75
|
+
sourceLength = source .magnitude (),
|
|
76
|
+
destinationLength = destination .magnitude ();
|
|
77
77
|
|
|
78
78
|
source .normalize ();
|
|
79
79
|
destination .normalize ();
|
|
@@ -54,10 +54,8 @@ define ([
|
|
|
54
54
|
"x_ite/Components/Texturing/PixelTexture",
|
|
55
55
|
"x_ite/Components/Rendering/X3DGeometryNode",
|
|
56
56
|
"standard/Math/Numbers/Vector3",
|
|
57
|
-
"standard/Math/Numbers/Vector4",
|
|
58
57
|
"standard/Math/Numbers/Matrix4",
|
|
59
58
|
"standard/Math/Geometry/Box3",
|
|
60
|
-
"standard/Math/Geometry/ViewVolume",
|
|
61
59
|
"standard/Math/Algorithm",
|
|
62
60
|
],
|
|
63
61
|
function ($,
|
|
@@ -66,10 +64,8 @@ function ($,
|
|
|
66
64
|
PixelTexture,
|
|
67
65
|
X3DGeometryNode,
|
|
68
66
|
Vector3,
|
|
69
|
-
Vector4,
|
|
70
67
|
Matrix4,
|
|
71
68
|
Box3,
|
|
72
|
-
ViewVolume,
|
|
73
69
|
Algorithm)
|
|
74
70
|
{
|
|
75
71
|
"use strict";
|
|
@@ -83,7 +79,7 @@ function ($,
|
|
|
83
79
|
this .texCoordArray = X3DGeometryNode .createArray ();
|
|
84
80
|
this .textureNode = new PixelTexture (text .getExecutionContext ());
|
|
85
81
|
this .canvas = $("<canvas></canvas>");
|
|
86
|
-
this .context = this .canvas [0] .getContext ("2d");
|
|
82
|
+
this .context = this .canvas [0] .getContext ("2d", { willReadFrequently: true });
|
|
87
83
|
this .matrix = new Matrix4 ();
|
|
88
84
|
|
|
89
85
|
this .textureNode ._textureProperties = fontStyle .getBrowser () .getScreenTextureProperties ();
|
|
@@ -247,6 +243,10 @@ function ($,
|
|
|
247
243
|
cx .fillRect (0, 0, canvas .width, canvas .height);
|
|
248
244
|
cx .fillStyle = "rgba(255,255,255,1)";
|
|
249
245
|
|
|
246
|
+
cx .save ();
|
|
247
|
+
cx .translate (0, canvas .height);
|
|
248
|
+
cx .scale (1, -1);
|
|
249
|
+
|
|
250
250
|
// Draw glyphs.
|
|
251
251
|
|
|
252
252
|
if (fontStyle ._horizontal .getValue ())
|
|
@@ -312,13 +312,16 @@ function ($,
|
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
+
cx .restore ();
|
|
316
|
+
|
|
315
317
|
// Transfer texture data.
|
|
316
318
|
|
|
317
319
|
const imageData = cx .getImageData (0, 0, canvas .width, canvas .height);
|
|
318
320
|
|
|
319
|
-
// If the
|
|
321
|
+
// If the canvas is to large imageData is null.
|
|
322
|
+
|
|
320
323
|
if (imageData)
|
|
321
|
-
this .textureNode .setTexture (canvas .width, canvas .height, true, new Uint8Array (imageData .data .buffer),
|
|
324
|
+
this .textureNode .setTexture (canvas .width, canvas .height, true, new Uint8Array (imageData .data .buffer), false);
|
|
322
325
|
else
|
|
323
326
|
this .textureNode .clear ();
|
|
324
327
|
};
|
|
@@ -385,71 +388,21 @@ function ($,
|
|
|
385
388
|
min .set ((glyph .xMin || 0) / unitsPerEm, (glyph .yMin || 0) / unitsPerEm, 0);
|
|
386
389
|
max .set ((glyph .xMax || 0) / unitsPerEm, (glyph .yMax || 0) / unitsPerEm, 0);
|
|
387
390
|
},
|
|
388
|
-
|
|
391
|
+
traverse: (function ()
|
|
389
392
|
{
|
|
390
|
-
const
|
|
391
|
-
x = new Vector4 (0, 0, 0, 0),
|
|
392
|
-
y = new Vector4 (0, 0, 0, 0),
|
|
393
|
-
z = new Vector4 (0, 0, 0, 0),
|
|
394
|
-
screenPoint = new Vector3 (0, 0, 0),
|
|
395
|
-
screenMatrix = new Matrix4 (),
|
|
396
|
-
bbox = new Box3 ();
|
|
397
|
-
|
|
398
|
-
return function (renderObject)
|
|
399
|
-
{
|
|
400
|
-
// throws an exception
|
|
401
|
-
|
|
402
|
-
const
|
|
403
|
-
text = this .getText (),
|
|
404
|
-
modelViewMatrix = renderObject .getModelViewMatrix () .get (),
|
|
405
|
-
projectionMatrix = renderObject .getProjectionMatrix () .get (),
|
|
406
|
-
viewport = renderObject .getViewVolume () .getViewport ();
|
|
407
|
-
|
|
408
|
-
// Determine screenMatrix.
|
|
409
|
-
// Same as in ScreenGroup.
|
|
410
|
-
|
|
411
|
-
const screenScale = renderObject .getViewpoint () .getScreenScale (modelViewMatrix .origin, viewport); // in meter/pixel
|
|
412
|
-
|
|
413
|
-
x .set (modelViewMatrix [ 0], modelViewMatrix [ 1], modelViewMatrix [ 2], modelViewMatrix [ 3]);
|
|
414
|
-
y .set (modelViewMatrix [ 4], modelViewMatrix [ 5], modelViewMatrix [ 6], modelViewMatrix [ 7]);
|
|
415
|
-
z .set (modelViewMatrix [ 8], modelViewMatrix [ 9], modelViewMatrix [10], modelViewMatrix [11]);
|
|
416
|
-
|
|
417
|
-
x .normalize () .multiply (screenScale .x);
|
|
418
|
-
y .normalize () .multiply (screenScale .y);
|
|
419
|
-
z .normalize () .multiply (screenScale .z);
|
|
393
|
+
const bbox = new Box3 ();
|
|
420
394
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
modelViewMatrix [12], modelViewMatrix [13], modelViewMatrix [14], modelViewMatrix [15]);
|
|
425
|
-
|
|
426
|
-
// Snap to whole pixel.
|
|
427
|
-
|
|
428
|
-
ViewVolume .projectPoint (Vector3 .Zero, screenMatrix, projectionMatrix, viewport, screenPoint);
|
|
429
|
-
|
|
430
|
-
screenPoint .x = Math .round (screenPoint .x);
|
|
431
|
-
screenPoint .y = Math .round (screenPoint .y);
|
|
432
|
-
|
|
433
|
-
ViewVolume .unProjectPoint (screenPoint .x, screenPoint .y, screenPoint .z, screenMatrix, projectionMatrix, viewport, screenPoint);
|
|
434
|
-
|
|
435
|
-
screenPoint .z = 0;
|
|
436
|
-
screenMatrix .translate (screenPoint);
|
|
437
|
-
|
|
438
|
-
// Assign modelViewMatrix and calculate relative matrix.
|
|
439
|
-
|
|
440
|
-
this .matrix .assign (modelViewMatrix) .inverse () .multLeft (screenMatrix);
|
|
395
|
+
return function (type, renderObject)
|
|
396
|
+
{
|
|
397
|
+
this .getBrowser () .getScreenScaleMatrix (renderObject, this .matrix);
|
|
441
398
|
|
|
442
399
|
// Update Text bbox.
|
|
443
400
|
|
|
444
401
|
bbox .assign (this .getBBox ()) .multRight (this .matrix);
|
|
445
402
|
|
|
446
|
-
|
|
403
|
+
this .getText () .setBBox (bbox);
|
|
447
404
|
};
|
|
448
405
|
})(),
|
|
449
|
-
traverse: function (type, renderObject)
|
|
450
|
-
{
|
|
451
|
-
this .transform (renderObject);
|
|
452
|
-
},
|
|
453
406
|
display: function (gl, context)
|
|
454
407
|
{
|
|
455
408
|
Matrix4 .prototype .multLeft .call (context .modelViewMatrix, this .matrix);
|
|
@@ -458,12 +411,12 @@ function ($,
|
|
|
458
411
|
},
|
|
459
412
|
transformLine: function (line)
|
|
460
413
|
{
|
|
461
|
-
// Apply
|
|
414
|
+
// Apply screen nodes transformation in place here.
|
|
462
415
|
return line .multLineMatrix (Matrix4 .inverse (this .matrix));
|
|
463
416
|
},
|
|
464
417
|
transformMatrix: function (matrix)
|
|
465
418
|
{
|
|
466
|
-
// Apply
|
|
419
|
+
// Apply screen nodes transformation in place here.
|
|
467
420
|
return matrix .multLeft (this .matrix);
|
|
468
421
|
},
|
|
469
422
|
});
|
|
@@ -50,31 +50,26 @@
|
|
|
50
50
|
define ([
|
|
51
51
|
"jquery",
|
|
52
52
|
"x_ite/Components/Texturing/TextureProperties",
|
|
53
|
+
"standard/Math/Numbers/Vector3",
|
|
54
|
+
"standard/Math/Numbers/Matrix4",
|
|
55
|
+
"standard/Math/Geometry/ViewVolume",
|
|
53
56
|
],
|
|
54
57
|
function ($,
|
|
55
|
-
TextureProperties
|
|
58
|
+
TextureProperties,
|
|
59
|
+
Vector3,
|
|
60
|
+
Matrix4,
|
|
61
|
+
ViewVolume)
|
|
56
62
|
{
|
|
57
63
|
"use strict";
|
|
58
64
|
|
|
59
65
|
const
|
|
60
|
-
_pointSize = Symbol (),
|
|
61
66
|
_screenTextureProperties = Symbol ();
|
|
62
67
|
|
|
63
|
-
function X3DLayoutContext ()
|
|
68
|
+
function X3DLayoutContext ()
|
|
69
|
+
{ }
|
|
64
70
|
|
|
65
71
|
X3DLayoutContext .prototype =
|
|
66
72
|
{
|
|
67
|
-
getPointSize: function ()
|
|
68
|
-
{
|
|
69
|
-
if (this [_pointSize] === undefined)
|
|
70
|
-
{
|
|
71
|
-
const div = $("<div></div>") .css ("height", "1in") .css ("display", "none");
|
|
72
|
-
this [_pointSize] = div .appendTo ($("body")) .height () / 72;
|
|
73
|
-
div .remove ();
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return this [_pointSize];
|
|
77
|
-
},
|
|
78
73
|
getScreenTextureProperties: function ()
|
|
79
74
|
{
|
|
80
75
|
this [_screenTextureProperties] = new TextureProperties (this .getPrivateScene ());
|
|
@@ -82,8 +77,8 @@ function ($,
|
|
|
82
77
|
this [_screenTextureProperties] ._boundaryModeS = "CLAMP";
|
|
83
78
|
this [_screenTextureProperties] ._boundaryModeT = "CLAMP";
|
|
84
79
|
this [_screenTextureProperties] ._boundaryModeR = "CLAMP";
|
|
85
|
-
this [_screenTextureProperties] ._minificationFilter = "
|
|
86
|
-
this [_screenTextureProperties] ._magnificationFilter = "
|
|
80
|
+
this [_screenTextureProperties] ._minificationFilter = "NEAREST_PIXEL";
|
|
81
|
+
this [_screenTextureProperties] ._magnificationFilter = "NEAREST_PIXEL";
|
|
87
82
|
this [_screenTextureProperties] ._generateMipMaps = false;
|
|
88
83
|
|
|
89
84
|
this [_screenTextureProperties] .setup ();
|
|
@@ -94,6 +89,54 @@ function ($,
|
|
|
94
89
|
|
|
95
90
|
return this [_screenTextureProperties];
|
|
96
91
|
},
|
|
92
|
+
getScreenScaleMatrix: (function ()
|
|
93
|
+
{
|
|
94
|
+
const
|
|
95
|
+
screenScale = new Vector3 (0, 0, 0),
|
|
96
|
+
screenPoint = new Vector3 (0, 0, 0),
|
|
97
|
+
screenMatrix = new Matrix4 ();
|
|
98
|
+
|
|
99
|
+
return function (renderObject, matrix)
|
|
100
|
+
{
|
|
101
|
+
// throws domain error
|
|
102
|
+
|
|
103
|
+
const
|
|
104
|
+
modelViewMatrix = renderObject .getModelViewMatrix () .get (),
|
|
105
|
+
projectionMatrix = renderObject .getProjectionMatrix () .get (),
|
|
106
|
+
viewport = renderObject .getViewVolume () .getViewport ();
|
|
107
|
+
|
|
108
|
+
// Determine screenMatrix.
|
|
109
|
+
// Same as in ScreenText.
|
|
110
|
+
|
|
111
|
+
renderObject .getViewpoint () .getScreenScale (modelViewMatrix .origin, viewport, screenScale); // in meter/pixel
|
|
112
|
+
|
|
113
|
+
const
|
|
114
|
+
x = modelViewMatrix .xAxis .normalize () .multiply (screenScale .x),
|
|
115
|
+
y = modelViewMatrix .yAxis .normalize () .multiply (screenScale .y),
|
|
116
|
+
z = modelViewMatrix .zAxis .normalize () .multiply (screenScale .x);
|
|
117
|
+
|
|
118
|
+
screenMatrix .set (x .x, x .y, x .z, 0,
|
|
119
|
+
y .x, y .y, y .z, 0,
|
|
120
|
+
z .x, z .y, z .z, 0,
|
|
121
|
+
modelViewMatrix [12], modelViewMatrix [13], modelViewMatrix [14], 1);
|
|
122
|
+
|
|
123
|
+
// Snap to whole pixel.
|
|
124
|
+
|
|
125
|
+
ViewVolume .projectPoint (Vector3 .Zero, screenMatrix, projectionMatrix, viewport, screenPoint);
|
|
126
|
+
|
|
127
|
+
screenPoint .x = Math .round (screenPoint .x);
|
|
128
|
+
screenPoint .y = Math .round (screenPoint .y);
|
|
129
|
+
|
|
130
|
+
ViewVolume .unProjectPoint (screenPoint .x, screenPoint .y, screenPoint .z, screenMatrix, projectionMatrix, viewport, screenPoint);
|
|
131
|
+
|
|
132
|
+
screenPoint .z = 0;
|
|
133
|
+
screenMatrix .translate (screenPoint);
|
|
134
|
+
|
|
135
|
+
// Assign relative matrix.
|
|
136
|
+
|
|
137
|
+
matrix .assign (modelViewMatrix) .inverse () .multLeft (screenMatrix);
|
|
138
|
+
};
|
|
139
|
+
})(),
|
|
97
140
|
};
|
|
98
141
|
|
|
99
142
|
return X3DLayoutContext;
|