x_ite 5.0.2 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +12 -5
- package/.vscode/tasks.json +21 -0
- package/Makefile +10 -15
- package/README.md +6 -11
- package/build/bin/dist.pl +0 -6
- package/build/bin/version.pl +1 -4
- package/dist/assets/components/annotation.js +2 -2
- package/dist/assets/components/annotation.min.js +1 -1
- package/dist/assets/components/cad-geometry.js +2 -2
- package/dist/assets/components/cad-geometry.min.js +1 -1
- package/dist/assets/components/cube-map-texturing.js +6 -19
- package/dist/assets/components/cube-map-texturing.min.js +1 -1
- package/dist/assets/components/dis.js +2 -2
- package/dist/assets/components/dis.min.js +1 -1
- package/dist/assets/components/event-utilities.js +3 -3
- package/dist/assets/components/event-utilities.min.js +1 -1
- package/dist/assets/components/geometry2d.js +4 -4
- package/dist/assets/components/geometry2d.min.js +1 -1
- package/dist/assets/components/geospatial.js +32 -1685
- package/dist/assets/components/geospatial.min.js +1 -1
- package/dist/assets/components/h-anim.js +70 -77
- package/dist/assets/components/h-anim.min.js +1 -1
- package/dist/assets/components/key-device-sensor.js +3 -3
- package/dist/assets/components/key-device-sensor.min.js +1 -1
- package/dist/assets/components/layout.js +38 -52
- package/dist/assets/components/layout.min.js +1 -1
- package/dist/assets/components/nurbs.js +277 -194
- package/dist/assets/components/nurbs.min.js +1 -1
- package/dist/assets/components/particle-systems.js +1918 -1658
- package/dist/assets/components/particle-systems.min.js +1 -1
- package/dist/assets/components/picking.js +33 -41
- package/dist/assets/components/picking.min.js +1 -1
- package/dist/assets/components/projective-texture-mapping.js +72 -86
- package/dist/assets/components/projective-texture-mapping.min.js +1 -1
- package/dist/assets/components/rigid-body-physics.js +36 -57
- package/dist/assets/components/rigid-body-physics.min.js +1 -1
- package/dist/assets/components/scripting.js +2 -2
- package/dist/assets/components/scripting.min.js +1 -1
- package/dist/assets/components/texturing-3d.js +26 -75
- package/dist/assets/components/texturing-3d.min.js +3 -3
- package/dist/assets/components/volume-rendering.js +10 -10
- package/dist/assets/components/volume-rendering.min.js +1 -1
- package/dist/assets/components/x_ite.js +2 -2
- package/dist/assets/components/x_ite.min.js +1 -1
- package/dist/assets/linetype/1.png +0 -0
- package/dist/assets/linetype/10.png +0 -0
- package/dist/assets/linetype/11.png +0 -0
- package/dist/assets/linetype/12.png +0 -0
- package/dist/assets/linetype/13.png +0 -0
- package/dist/assets/linetype/14.png +0 -0
- package/dist/assets/linetype/15.png +0 -0
- package/dist/assets/linetype/16.png +0 -0
- package/dist/assets/linetype/2.png +0 -0
- package/dist/assets/linetype/3.png +0 -0
- package/dist/assets/linetype/4.png +0 -0
- package/dist/assets/linetype/5.png +0 -0
- package/dist/assets/linetype/6.png +0 -0
- package/dist/assets/linetype/7.png +0 -0
- package/dist/assets/linetype/8.png +0 -0
- package/dist/assets/linetype/9.png +0 -0
- package/dist/assets/shaders/webgl1/Line.fs +0 -21
- package/dist/assets/shaders/webgl1/Line.vs +0 -10
- package/dist/assets/shaders/webgl1/PBR.vs +1 -1
- package/dist/assets/shaders/webgl2/Depth.vs +29 -1
- package/dist/assets/shaders/webgl2/Gouraud.vs +31 -3
- package/dist/assets/shaders/webgl2/Line.fs +24 -12
- package/dist/assets/shaders/webgl2/Line.vs +36 -11
- package/dist/assets/shaders/webgl2/LineTransform.fs +4 -0
- package/dist/assets/shaders/webgl2/LineTransform.vs +57 -0
- package/dist/assets/shaders/webgl2/PBR.vs +35 -7
- package/dist/assets/shaders/webgl2/Phong.vs +31 -3
- package/dist/assets/shaders/webgl2/Point.vs +29 -1
- package/dist/assets/shaders/webgl2/Unlit.vs +31 -3
- package/dist/example.html +6 -6
- package/dist/x_ite.css +180 -208
- package/dist/x_ite.js +16477 -16629
- package/dist/x_ite.min.js +17 -17
- package/dist/x_ite.zip +0 -0
- package/docs/404.md +6 -0
- package/docs/Accessing-the-External-Browser.md +20 -14
- package/docs/Browser-Support.md +6 -0
- package/docs/Custom-Shaders.md +17 -24
- package/docs/Features.md +7 -1
- package/docs/Gemfile +44 -0
- package/docs/Gemfile.lock +122 -0
- package/docs/Glossary.md +6 -0
- package/docs/How-To-Configure-Your-Web-Server.md +6 -0
- package/docs/Supported-Nodes.md +9 -1
- package/docs/What's-New.md +31 -0
- package/docs/XHTML-DOM-Integration.md +6 -0
- package/docs/_config.yml +1 -1
- package/docs/assets/css/main.scss +26 -0
- package/docs/index.md +38 -46
- package/docs/reference/Browser-Services.md +9 -3
- package/docs/reference/Constants-Services.md +6 -0
- package/docs/reference/ECMAScript-Object-and-Function-Definitions.md +6 -0
- package/docs/reference/Field-Services-and-Objects.md +6 -0
- package/docs/reference/Prototype-Services.md +6 -0
- package/docs/reference/Route-Services.md +6 -0
- package/docs/reference/Scene-Services.md +8 -2
- package/docs/reference/Script-Node-Authoring-Interface.md +7 -1
- package/docs/tutorials/Adding-backgrounds.md +6 -0
- package/docs/tutorials/Adding-fog.md +6 -0
- package/docs/tutorials/Adding-sound.md +6 -0
- package/docs/tutorials/Animating-transforms.md +6 -0
- package/docs/tutorials/Basic-Nodes.md +6 -0
- package/docs/tutorials/Building-a-X3D-world.md +6 -0
- package/docs/tutorials/Building-elevation-grids.md +6 -0
- package/docs/tutorials/Building-extruded-shapes.md +6 -0
- package/docs/tutorials/Building-primitive-shapes.md +6 -0
- package/docs/tutorials/Building-shapes-out-of-points,-lines,-and-faces.md +6 -0
- package/docs/tutorials/Controlling-appearance-with-materials.md +6 -0
- package/docs/tutorials/Controlling-color-on-coordinate-based-geometry.md +6 -0
- package/docs/tutorials/Controlling-detail.md +6 -0
- package/docs/tutorials/Controlling-how-textures-are-mapped.md +6 -0
- package/docs/tutorials/Controlling-navigation.md +6 -0
- package/docs/tutorials/Controlling-shading-on-coordinate-based-geometry.md +6 -0
- package/docs/tutorials/Controlling-the-viewpoint.md +6 -0
- package/docs/tutorials/Creating-new-node-types.md +6 -0
- package/docs/tutorials/Grouping-nodes.md +6 -0
- package/docs/tutorials/Hello,-World!.md +6 -0
- package/docs/tutorials/Improving-Performance.md +6 -0
- package/docs/tutorials/Increasing-Rendering-Speed.md +6 -0
- package/docs/tutorials/Introducing-X3D.md +6 -0
- package/docs/tutorials/Introducing-animation.md +6 -0
- package/docs/tutorials/Introducing-script-use.md +6 -0
- package/docs/tutorials/Lighting-your-world.md +6 -0
- package/docs/tutorials/Mapping-textures.md +6 -0
- package/docs/tutorials/Naming-nodes.md +6 -0
- package/docs/tutorials/Providing-information-about-your-world.md +6 -0
- package/docs/tutorials/Sensing-the-viewer.md +6 -0
- package/docs/tutorials/Sensing-viewer-actions.md +6 -0
- package/docs/tutorials/Transforming-Shapes.md +6 -0
- package/docs/tutorials/Writing-program-scripts-with-ECMAScript.md +6 -0
- package/docs/tutorials/index.md +6 -0
- package/package.json +6 -7
- package/src/assets/components/geometry2d.js +1 -1
- package/src/assets/components/key-device-sensor.js +1 -1
- package/src/assets/components/layout.js +1 -1
- package/src/assets/components/particle-systems.js +1 -1
- package/src/assets/components/volume-rendering.js +1 -1
- package/src/assets/linetype/1.png +0 -0
- package/src/assets/linetype/10.png +0 -0
- package/src/assets/linetype/11.png +0 -0
- package/src/assets/linetype/12.png +0 -0
- package/src/assets/linetype/13.png +0 -0
- package/src/assets/linetype/14.png +0 -0
- package/src/assets/linetype/15.png +0 -0
- package/src/assets/linetype/16.png +0 -0
- package/src/assets/linetype/2.png +0 -0
- package/src/assets/linetype/3.png +0 -0
- package/src/assets/linetype/4.png +0 -0
- package/src/assets/linetype/5.png +0 -0
- package/src/assets/linetype/6.png +0 -0
- package/src/assets/linetype/7.png +0 -0
- package/src/assets/linetype/8.png +0 -0
- package/src/assets/linetype/9.png +0 -0
- package/src/assets/shaders/Types.glsl +1 -9
- package/src/assets/shaders/webgl1/Line.fs +3 -28
- package/src/assets/shaders/webgl1/Line.vs +5 -19
- package/src/assets/shaders/webgl1/PBR.vs +1 -1
- package/src/assets/shaders/webgl1/Point.vs +2 -3
- package/src/assets/shaders/webgl2/Depth.vs +4 -1
- package/src/assets/shaders/webgl2/Gouraud.vs +5 -3
- package/src/assets/shaders/webgl2/Line.fs +11 -17
- package/src/assets/shaders/webgl2/Line.vs +16 -20
- package/src/assets/shaders/webgl2/LineTransform.fs +6 -0
- package/src/assets/shaders/webgl2/LineTransform.vs +77 -0
- package/src/assets/shaders/webgl2/PBR.vs +10 -7
- package/src/assets/shaders/webgl2/Phong.vs +6 -3
- package/src/assets/shaders/webgl2/Point.vs +6 -6
- package/src/assets/shaders/webgl2/Unlit.vs +6 -3
- package/src/assets/shaders/webgl2/include/Line2.glsl +20 -0
- package/src/assets/shaders/webgl2/include/Particle.glsl +36 -0
- package/src/example.html +6 -6
- package/src/standard/Math/Algorithm.js +12 -28
- package/src/standard/Math/Geometry/Plane3.js +0 -2
- package/src/standard/Math/Geometry/ViewVolume.js +88 -83
- package/src/standard/Math/Numbers/Color3.js +6 -0
- package/src/standard/Math/Numbers/Color4.js +7 -0
- package/src/standard/Math/Numbers/Complex.js +5 -0
- package/src/standard/Math/Numbers/Matrix2.js +20 -2
- package/src/standard/Math/Numbers/Matrix3.js +129 -110
- package/src/standard/Math/Numbers/Matrix4.js +138 -119
- package/src/standard/Math/Numbers/Quaternion.js +7 -0
- package/src/standard/Math/Numbers/Rotation4.js +7 -0
- package/src/standard/Math/Numbers/Vector2.js +8 -5
- package/src/standard/Math/Numbers/Vector3.js +16 -10
- package/src/standard/Math/Numbers/Vector4.js +12 -7
- package/src/standard/Math/Utility/BVH.js +45 -17
- package/src/tests.js +6 -1
- package/src/x_ite/Base/X3DBaseNode.js +22 -11
- package/src/x_ite/Base/X3DField.js +1 -1
- package/src/x_ite/Browser/Core/BrowserOptions.js +2 -2
- package/src/x_ite/Browser/Core/BrowserTimings.js +4 -2
- package/src/x_ite/Browser/Core/Context.js +185 -0
- package/src/x_ite/Browser/Core/ContextMenu.js +299 -193
- package/src/x_ite/Browser/Core/Notification.js +1 -0
- package/src/x_ite/Browser/Core/X3DCoreContext.js +35 -146
- package/src/x_ite/Browser/Layout/ScreenText.js +11 -4
- package/src/x_ite/Browser/Layout/X3DLayoutContext.js +4 -15
- package/src/x_ite/Browser/Navigation/ExamineViewer.js +12 -19
- package/src/x_ite/Browser/Navigation/LookAtViewer.js +0 -3
- package/src/x_ite/Browser/Navigation/PlaneViewer.js +0 -3
- package/src/x_ite/Browser/Navigation/X3DFlyViewer.js +14 -7
- package/src/x_ite/Browser/Navigation/X3DViewer.js +12 -20
- package/src/x_ite/Browser/Networking/X3DNetworkingContext.js +11 -7
- package/src/x_ite/Browser/ParticleSystems/BVH.glsl +183 -0
- package/src/x_ite/Browser/ParticleSystems/Box3.glsl +47 -0
- package/src/x_ite/Browser/ParticleSystems/GeometryTypes.js +66 -0
- package/src/x_ite/Browser/ParticleSystems/Line3.glsl +55 -0
- package/src/x_ite/Browser/ParticleSystems/Plane3.glsl +160 -0
- package/src/x_ite/Browser/PointingDeviceSensor/PointingDevice.js +27 -3
- package/src/x_ite/Browser/PointingDeviceSensor/X3DPointingDeviceSensorContext.js +37 -37
- package/src/x_ite/Browser/Rendering/X3DRenderingContext.js +19 -13
- package/src/x_ite/Browser/Shaders/Shader.js +33 -12
- package/src/x_ite/Browser/Shaders/ShaderSource.js +6 -0
- package/src/x_ite/Browser/Shaders/ShaderTest.js +16 -10
- package/src/x_ite/Browser/Shape/X3DShapeContext.js +50 -9
- package/src/x_ite/Browser/Text/X3DTextContext.js +4 -13
- package/src/x_ite/Browser/Texturing/X3DTexturingContext.js +23 -33
- package/src/x_ite/Browser/Texturing3D/DICOMParser.js +2 -2
- package/src/x_ite/Browser/Time/X3DTimeContext.js +3 -1
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Browser/X3DBrowser.js +7 -6
- package/src/x_ite/Browser/X3DBrowserContext.js +35 -10
- package/src/x_ite/Components/Core/X3DNode.js +4 -0
- package/src/x_ite/Components/Core/X3DPrototypeInstance.js +0 -2
- package/src/x_ite/Components/CubeMapTexturing/ComposedCubeMapTexture.js +3 -4
- package/src/x_ite/Components/CubeMapTexturing/GeneratedCubeMapTexture.js +1 -12
- package/src/x_ite/Components/CubeMapTexturing/ImageCubeMapTexture.js +0 -1
- package/src/x_ite/Components/EnvironmentalEffects/TextureBackground.js +1 -1
- package/src/x_ite/Components/EnvironmentalEffects/X3DBackgroundNode.js +76 -77
- package/src/x_ite/Components/EnvironmentalEffects/X3DFogObject.js +2 -9
- package/src/x_ite/Components/EnvironmentalSensor/ProximitySensor.js +51 -65
- package/src/x_ite/Components/EventUtilities/X3DSequencerNode.js +1 -1
- package/src/x_ite/Components/Followers/X3DChaserNode.js +18 -32
- package/src/x_ite/Components/Followers/X3DDamperNode.js +1 -6
- package/src/x_ite/Components/Geometry2D/TriangleSet2D.js +1 -1
- package/src/x_ite/Components/Geometry3D/ElevationGrid.js +12 -4
- package/src/x_ite/Components/Geometry3D/IndexedFaceSet.js +4 -4
- package/src/x_ite/Components/Geospatial/GeoCoordinate.js +10 -27
- package/src/x_ite/Components/Geospatial/GeoPositionInterpolator.js +5 -10
- package/src/x_ite/Components/Geospatial/GeoTouchSensor.js +9 -16
- package/src/x_ite/Components/Geospatial/GeoTransform.js +6 -18
- package/src/x_ite/Components/Geospatial/X3DGeospatialObject.js +20 -27
- package/src/x_ite/Components/Grouping/X3DGroupingNode.js +8 -8
- package/src/x_ite/Components/Grouping/X3DTransformNode.js +0 -4
- package/src/x_ite/Components/HAnim/HAnimHumanoid.js +68 -75
- package/src/x_ite/Components/Interpolation/OrientationInterpolator.js +4 -11
- package/src/x_ite/Components/Interpolation/X3DInterpolatorNode.js +1 -1
- package/src/x_ite/Components/Layout/LayoutGroup.js +4 -9
- package/src/x_ite/Components/Layout/ScreenFontStyle.js +1 -1
- package/src/x_ite/Components/Layout/ScreenGroup.js +18 -23
- package/src/x_ite/Components/Lighting/DirectionalLight.js +28 -36
- package/src/x_ite/Components/Lighting/PointLight.js +32 -47
- package/src/x_ite/Components/Lighting/SpotLight.js +33 -48
- package/src/x_ite/Components/Navigation/Billboard.js +49 -56
- package/src/x_ite/Components/Navigation/LOD.js +1 -1
- package/src/x_ite/Components/Navigation/X3DViewpointNode.js +82 -111
- package/src/x_ite/Components/Networking/Anchor.js +10 -4
- package/src/x_ite/Components/ParticleSystems/BoundedPhysicsModel.js +6 -6
- package/src/x_ite/Components/ParticleSystems/ConeEmitter.js +44 -36
- package/src/x_ite/Components/ParticleSystems/ExplosionEmitter.js +26 -17
- package/src/x_ite/Components/ParticleSystems/ForcePhysicsModel.js +20 -7
- package/src/x_ite/Components/ParticleSystems/ParticleSystem.js +461 -876
- package/src/x_ite/Components/ParticleSystems/PointEmitter.js +39 -35
- package/src/x_ite/Components/ParticleSystems/PolylineEmitter.js +112 -128
- package/src/x_ite/Components/ParticleSystems/SurfaceEmitter.js +105 -112
- package/src/x_ite/Components/ParticleSystems/VolumeEmitter.js +138 -176
- package/src/x_ite/Components/ParticleSystems/WindPhysicsModel.js +16 -11
- package/src/x_ite/Components/ParticleSystems/X3DParticleEmitterNode.js +807 -217
- package/src/x_ite/Components/Picking/LinePickSensor.js +31 -39
- package/src/x_ite/Components/PointingDeviceSensor/CylinderSensor.js +90 -107
- package/src/x_ite/Components/PointingDeviceSensor/PlaneSensor.js +48 -55
- package/src/x_ite/Components/PointingDeviceSensor/SphereSensor.js +53 -70
- package/src/x_ite/Components/PointingDeviceSensor/TouchSensor.js +8 -15
- package/src/x_ite/Components/ProjectiveTextureMapping/TextureProjectorParallel.js +43 -50
- package/src/x_ite/Components/ProjectiveTextureMapping/TextureProjectorPerspective.js +32 -39
- package/src/x_ite/Components/Rendering/ClipPlane.js +3 -11
- package/src/x_ite/Components/Rendering/Color.js +12 -37
- package/src/x_ite/Components/Rendering/ColorRGBA.js +13 -38
- package/src/x_ite/Components/Rendering/IndexedLineSet.js +12 -4
- package/src/x_ite/Components/Rendering/LineSet.js +21 -13
- package/src/x_ite/Components/Rendering/PointSet.js +21 -13
- package/src/x_ite/Components/Rendering/X3DColorNode.js +13 -0
- package/src/x_ite/Components/Rendering/X3DComposedGeometryNode.js +13 -5
- package/src/x_ite/Components/Rendering/X3DGeometryNode.js +248 -325
- package/src/x_ite/Components/Rendering/X3DLineGeometryNode.js +305 -134
- package/src/x_ite/Components/Rendering/X3DPointGeometryNode.js +99 -122
- package/src/x_ite/Components/RigidBodyPhysics/DoubleAxisHingeJoint.js +24 -38
- package/src/x_ite/Components/RigidBodyPhysics/SingleAxisHingeJoint.js +10 -17
- package/src/x_ite/Components/Shaders/ComposedShader.js +35 -75
- package/src/x_ite/Components/Shaders/FloatVertexAttribute.js +5 -15
- package/src/x_ite/Components/Shaders/Matrix3VertexAttribute.js +7 -24
- package/src/x_ite/Components/Shaders/Matrix4VertexAttribute.js +7 -24
- package/src/x_ite/Components/Shaders/ShaderPart.js +1 -10
- package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +219 -209
- package/src/x_ite/Components/Shaders/X3DShaderNode.js +1 -1
- package/src/x_ite/Components/Shaders/X3DVertexAttributeNode.js +23 -1
- package/src/x_ite/Components/Shape/Appearance.js +12 -0
- package/src/x_ite/Components/Shape/FillProperties.js +12 -1
- package/src/x_ite/Components/Shape/LineProperties.js +33 -1
- package/src/x_ite/Components/Shape/PointProperties.js +23 -1
- package/src/x_ite/Components/Shape/Shape.js +27 -34
- package/src/x_ite/Components/Sound/Sound.js +30 -40
- package/src/x_ite/Components/Text/Text.js +6 -20
- package/src/x_ite/Components/Texturing/TextureCoordinate.js +5 -26
- package/src/x_ite/Components/Texturing/TextureProperties.js +4 -4
- package/src/x_ite/Components/Texturing/X3DSingleTextureCoordinateNode.js +21 -0
- package/src/x_ite/Components/Texturing/X3DSingleTextureNode.js +5 -4
- package/src/x_ite/Components/Texturing/X3DTexture2DNode.js +24 -33
- package/src/x_ite/Components/Texturing3D/TextureCoordinate3D.js +5 -26
- package/src/x_ite/Components/Texturing3D/TextureCoordinate4D.js +5 -26
- package/src/x_ite/Components/Texturing3D/X3DTexture3DNode.js +12 -19
- package/src/x_ite/Components/VolumeRendering/X3DVolumeDataNode.js +7 -7
- package/src/x_ite/Components.js +2 -2
- package/src/x_ite/Fallback.js +9 -3
- package/src/x_ite/Fields/SFColor.js +4 -0
- package/src/x_ite/Fields/SFColorRGBA.js +4 -0
- package/src/x_ite/Fields/SFMatrixPrototypeTemplate.js +4 -0
- package/src/x_ite/Fields/SFRotation.js +4 -0
- package/src/x_ite/Fields/SFString.js +4 -0
- package/src/x_ite/Fields/SFVecPrototypeTemplate.js +4 -0
- package/src/x_ite/Parser/XMLParser.js +1 -1
- package/src/x_ite/Rendering/TextureBuffer.js +43 -36
- package/src/x_ite/Rendering/VertexArray.js +101 -0
- package/src/x_ite/Rendering/X3DRenderObject.js +123 -144
- package/src/x_ite/X3D.js +32 -26
- package/src/x_ite.config.js +0 -5
- package/src/x_ite.css +200 -162
- package/src/x_ite.html +26 -10
- package/src/x_ite.js +42 -0
- package/x_ite.min.html +26 -10
- package/dist/assets/hatching/0.png +0 -0
- package/dist/assets/linetype/0.png +0 -0
- package/src/assets/hatching/0.png +0 -0
- package/src/assets/linetype/0.png +0 -0
- package/src/spinner.css +0 -67
- package/src/x_ite/Browser/Shape/LineStipples.xcf +0 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
precision highp float;
|
|
4
4
|
precision highp int;
|
|
5
|
+
precision highp sampler2D;
|
|
5
6
|
|
|
6
7
|
uniform mat3 x3d_NormalMatrix;
|
|
7
8
|
uniform mat4 x3d_ProjectionMatrix;
|
|
@@ -39,10 +40,12 @@ out vec4 texCoord1; // texCoord1
|
|
|
39
40
|
out float depth;
|
|
40
41
|
#endif
|
|
41
42
|
|
|
43
|
+
#pragma X3D include "include/Particle.glsl"
|
|
44
|
+
|
|
42
45
|
void
|
|
43
46
|
main ()
|
|
44
47
|
{
|
|
45
|
-
vec4 position = x3d_ModelViewMatrix * x3d_Vertex;
|
|
48
|
+
vec4 position = x3d_ModelViewMatrix * getVertex (x3d_Vertex);
|
|
46
49
|
|
|
47
50
|
fogDepth = x3d_FogDepth;
|
|
48
51
|
color = x3d_Color;
|
|
@@ -52,11 +55,11 @@ main ()
|
|
|
52
55
|
localVertex = x3d_Vertex .xyz;
|
|
53
56
|
|
|
54
57
|
#if x3d_MaxTextures > 0
|
|
55
|
-
texCoord0 = x3d_TexCoord0;
|
|
58
|
+
texCoord0 = getTexCoord (x3d_TexCoord0);
|
|
56
59
|
#endif
|
|
57
60
|
|
|
58
61
|
#if x3d_MaxTextures > 1
|
|
59
|
-
texCoord1 = x3d_TexCoord1;
|
|
62
|
+
texCoord1 = getTexCoord (x3d_TexCoord1);
|
|
60
63
|
#endif
|
|
61
64
|
|
|
62
65
|
gl_Position = x3d_ProjectionMatrix * position;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
precision highp float;
|
|
4
4
|
precision highp int;
|
|
5
|
+
precision highp sampler2D;
|
|
5
6
|
|
|
6
7
|
uniform x3d_PointPropertiesParameters x3d_PointProperties;
|
|
7
8
|
|
|
8
9
|
uniform bool x3d_ColorMaterial; // true if a X3DColorNode is attached, otherwise false
|
|
9
10
|
uniform x3d_UnlitMaterialParameters x3d_Material;
|
|
10
|
-
uniform int x3d_NumTextures;
|
|
11
11
|
|
|
12
12
|
uniform mat4 x3d_ProjectionMatrix;
|
|
13
13
|
uniform mat4 x3d_ModelViewMatrix;
|
|
@@ -25,12 +25,12 @@ out vec3 vertex; // point on geometry
|
|
|
25
25
|
out float depth;
|
|
26
26
|
#endif
|
|
27
27
|
|
|
28
|
+
#pragma X3D include "include/Particle.glsl"
|
|
29
|
+
|
|
28
30
|
void
|
|
29
31
|
main ()
|
|
30
32
|
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
vec4 position = x3d_ModelViewMatrix * x3d_Vertex;
|
|
33
|
+
vec4 position = x3d_ModelViewMatrix * getVertex (x3d_Vertex);
|
|
34
34
|
|
|
35
35
|
fogDepth = x3d_FogDepth;
|
|
36
36
|
vertex = position .xyz;
|
|
@@ -49,10 +49,10 @@ main ()
|
|
|
49
49
|
float dL = length (vertex);
|
|
50
50
|
|
|
51
51
|
pointSize = x3d_PointProperties .pointSizeScaleFactor;
|
|
52
|
-
pointSize
|
|
52
|
+
pointSize /= pointSizeAttenuation [0] + pointSizeAttenuation [1] * dL + pointSizeAttenuation [2] * (dL * dL);
|
|
53
53
|
pointSize = clamp (pointSize, pointSizeMinValue, pointSizeMaxValue);
|
|
54
54
|
|
|
55
|
-
gl_PointSize = pointSize > 1.0
|
|
55
|
+
gl_PointSize = pointSize > 1.0 ? pointSize + 1.0 : pointSize;
|
|
56
56
|
|
|
57
57
|
// Determine color.
|
|
58
58
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
precision highp float;
|
|
4
4
|
precision highp int;
|
|
5
|
+
precision highp sampler2D;
|
|
5
6
|
|
|
6
7
|
uniform mat3 x3d_NormalMatrix;
|
|
7
8
|
uniform mat4 x3d_ProjectionMatrix;
|
|
@@ -39,10 +40,12 @@ out vec4 texCoord1; // texCoord1
|
|
|
39
40
|
out float depth;
|
|
40
41
|
#endif
|
|
41
42
|
|
|
43
|
+
#pragma X3D include "include/Particle.glsl"
|
|
44
|
+
|
|
42
45
|
void
|
|
43
46
|
main ()
|
|
44
47
|
{
|
|
45
|
-
vec4 position = x3d_ModelViewMatrix * x3d_Vertex;
|
|
48
|
+
vec4 position = x3d_ModelViewMatrix * getVertex (x3d_Vertex);
|
|
46
49
|
|
|
47
50
|
fogDepth = x3d_FogDepth;
|
|
48
51
|
color = x3d_Color;
|
|
@@ -52,11 +55,11 @@ main ()
|
|
|
52
55
|
localVertex = x3d_Vertex .xyz;
|
|
53
56
|
|
|
54
57
|
#if x3d_MaxTextures > 0
|
|
55
|
-
texCoord0 = x3d_TexCoord0;
|
|
58
|
+
texCoord0 = getTexCoord (x3d_TexCoord0);
|
|
56
59
|
#endif
|
|
57
60
|
|
|
58
61
|
#if x3d_MaxTextures > 1
|
|
59
|
-
texCoord1 = x3d_TexCoord1;
|
|
62
|
+
texCoord1 = getTexCoord (x3d_TexCoord1);
|
|
60
63
|
#endif
|
|
61
64
|
|
|
62
65
|
gl_Position = x3d_ProjectionMatrix * position;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
struct Line2
|
|
2
|
+
{
|
|
3
|
+
vec2 point;
|
|
4
|
+
vec2 direction;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
Line2
|
|
8
|
+
line2 (const in vec2 point1, const in vec2 point2)
|
|
9
|
+
{
|
|
10
|
+
return Line2 (point1, normalize (point2 - point1));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
vec2
|
|
14
|
+
closest_point (const in Line2 line, const in vec2 point)
|
|
15
|
+
{
|
|
16
|
+
vec2 r = point - line .point;
|
|
17
|
+
float d = dot (r, line .direction);
|
|
18
|
+
|
|
19
|
+
return line .direction * d + line .point;
|
|
20
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
in vec4 x3d_Particle;
|
|
2
|
+
in mat4 x3d_ParticleMatrix;
|
|
3
|
+
|
|
4
|
+
uniform sampler2D x3d_TexCoordRamp;
|
|
5
|
+
|
|
6
|
+
vec4
|
|
7
|
+
texelFetch (const in sampler2D sampler, const in int index, const in int lod)
|
|
8
|
+
{
|
|
9
|
+
int x = textureSize (sampler, lod) .x;
|
|
10
|
+
ivec2 p = ivec2 (index % x, index / x);
|
|
11
|
+
vec4 t = texelFetch (sampler, p, lod);
|
|
12
|
+
|
|
13
|
+
return t;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
vec4
|
|
17
|
+
getVertex (const in vec4 vertex)
|
|
18
|
+
{
|
|
19
|
+
if (x3d_Particle [0] == 0.0)
|
|
20
|
+
return vertex;
|
|
21
|
+
|
|
22
|
+
return x3d_ParticleMatrix * vertex;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
vec4
|
|
26
|
+
getTexCoord (const in vec4 texCoord)
|
|
27
|
+
{
|
|
28
|
+
int index0 = int (x3d_Particle [3]);
|
|
29
|
+
|
|
30
|
+
if (x3d_Particle [0] == 0.0 || index0 == -1)
|
|
31
|
+
return texCoord;
|
|
32
|
+
|
|
33
|
+
const int map [6] = int [6] (0, 1, 2, 0, 2, 3);
|
|
34
|
+
|
|
35
|
+
return texelFetch (x3d_TexCoordRamp, index0 + map [gl_VertexID % 6], 0);
|
|
36
|
+
}
|
package/src/example.html
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8"/>
|
|
5
|
-
<
|
|
6
|
-
<script type="text/javascript" src="https://create3000.github.io/code/x_ite/latest/dist/x_ite.min.js"></script>
|
|
5
|
+
<script type="text/javascript" src="x_ite.min.js"></script>
|
|
6
|
+
<!-- <script type="text/javascript" src="https://create3000.github.io/code/x_ite/latest/dist/x_ite.min.js"></script> -->
|
|
7
7
|
<style>
|
|
8
|
-
|
|
8
|
+
x3d-canvas {
|
|
9
9
|
width: 1000px;
|
|
10
10
|
height: 563px;
|
|
11
11
|
}
|
|
12
12
|
</style>
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
15
|
-
<
|
|
15
|
+
<x3d-canvas src="https://create3000.github.io/media/x_ite/info/info.x3d">
|
|
16
16
|
<p>Your browser may not support all features required by X_ITE!</p>
|
|
17
|
-
</
|
|
18
|
-
<p>If
|
|
17
|
+
</x3d-canvas>
|
|
18
|
+
<p>If local files are not loaded <a href="https://create3000.github.io/x_ite/#using-firefox-chrome-and-opera-with-local-files">consider setup a localhost server</a>.</p>
|
|
19
19
|
</body>
|
|
20
20
|
</html>
|
|
@@ -70,7 +70,7 @@ define (function ()
|
|
|
70
70
|
},
|
|
71
71
|
fract: function (value)
|
|
72
72
|
{
|
|
73
|
-
return value
|
|
73
|
+
return value % 1;
|
|
74
74
|
},
|
|
75
75
|
clamp: function (value, min, max)
|
|
76
76
|
{
|
|
@@ -96,23 +96,21 @@ define (function ()
|
|
|
96
96
|
{
|
|
97
97
|
let cosom = source .dot (destination);
|
|
98
98
|
|
|
99
|
-
if (cosom <= -1)
|
|
100
|
-
throw new Error ("slerp is not possible: vectors are inverse collinear.");
|
|
99
|
+
// if (cosom <= -1) ... vectors are inverse colinear.
|
|
101
100
|
|
|
102
|
-
if (cosom >= 1) //
|
|
101
|
+
if (cosom >= 1) // Both normal vectors are equal.
|
|
103
102
|
return source;
|
|
104
103
|
|
|
105
104
|
if (cosom < 0)
|
|
106
105
|
{
|
|
107
|
-
// Reverse signs so we travel the short way round
|
|
106
|
+
// Reverse signs so we travel the short way round.
|
|
108
107
|
cosom = -cosom;
|
|
109
108
|
destination .negate ();
|
|
110
109
|
}
|
|
111
110
|
|
|
112
111
|
const
|
|
113
|
-
omega
|
|
114
|
-
sinom
|
|
115
|
-
|
|
112
|
+
omega = Math .acos (cosom),
|
|
113
|
+
sinom = Math .sin (omega),
|
|
116
114
|
scale0 = Math .sin ((1 - t) * omega) / sinom,
|
|
117
115
|
scale1 = Math .sin (t * omega) / sinom;
|
|
118
116
|
|
|
@@ -127,16 +125,14 @@ define (function ()
|
|
|
127
125
|
{
|
|
128
126
|
const cosom = source .dot (destination);
|
|
129
127
|
|
|
130
|
-
if (cosom <= -1)
|
|
131
|
-
throw new Error ("slerp is not possible: vectors are inverse collinear.");
|
|
128
|
+
// if (cosom <= -1) ... vectors are inverse colinear.
|
|
132
129
|
|
|
133
|
-
if (cosom >= 1) //
|
|
130
|
+
if (cosom >= 1) // Both normal vectors are equal.
|
|
134
131
|
return source;
|
|
135
132
|
|
|
136
133
|
const
|
|
137
|
-
omega
|
|
138
|
-
sinom
|
|
139
|
-
|
|
134
|
+
omega = Math .acos (cosom),
|
|
135
|
+
sinom = Math .sin (omega),
|
|
140
136
|
scale0 = Math .sin ((1 - t) * omega) / sinom,
|
|
141
137
|
scale1 = Math .sin (t * omega) / sinom;
|
|
142
138
|
|
|
@@ -172,7 +168,7 @@ define (function ()
|
|
|
172
168
|
{
|
|
173
169
|
return lhs > rhs;
|
|
174
170
|
},
|
|
175
|
-
lowerBound: function (array, first, last, value, comp)
|
|
171
|
+
lowerBound: function (array, first, last, value, comp = this .less)
|
|
176
172
|
{
|
|
177
173
|
// http://en.cppreference.com/w/cpp/algorithm/lower_bound
|
|
178
174
|
|
|
@@ -197,7 +193,7 @@ define (function ()
|
|
|
197
193
|
|
|
198
194
|
return first;
|
|
199
195
|
},
|
|
200
|
-
upperBound: function (array, first, last, value, comp)
|
|
196
|
+
upperBound: function (array, first, last, value, comp = this .less)
|
|
201
197
|
{
|
|
202
198
|
// http://en.cppreference.com/w/cpp/algorithm/upper_bound
|
|
203
199
|
|
|
@@ -233,18 +229,6 @@ define (function ()
|
|
|
233
229
|
result .add (key);
|
|
234
230
|
}
|
|
235
231
|
|
|
236
|
-
return result;
|
|
237
|
-
},
|
|
238
|
-
map_difference: function (lhs, rhs, result)
|
|
239
|
-
{
|
|
240
|
-
for (const [key, value] of lhs)
|
|
241
|
-
{
|
|
242
|
-
if (rhs .has (key))
|
|
243
|
-
continue;
|
|
244
|
-
|
|
245
|
-
result .set (key, value);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
232
|
return result;
|
|
249
233
|
},
|
|
250
234
|
};
|
|
@@ -90,7 +90,6 @@ function (Vector3,
|
|
|
90
90
|
return this;
|
|
91
91
|
},
|
|
92
92
|
multRight: function (matrix)
|
|
93
|
-
//throw
|
|
94
93
|
{
|
|
95
94
|
// Taken from Inventor:
|
|
96
95
|
|
|
@@ -116,7 +115,6 @@ function (Vector3,
|
|
|
116
115
|
return this;
|
|
117
116
|
},
|
|
118
117
|
multLeft: function (matrix)
|
|
119
|
-
//throw
|
|
120
118
|
{
|
|
121
119
|
// Taken from Inventor:
|
|
122
120
|
|
|
@@ -136,66 +136,57 @@ function (Plane3,
|
|
|
136
136
|
|
|
137
137
|
return function (projectionMatrix, viewport, scissor)
|
|
138
138
|
{
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
this .edges .tainted = true;
|
|
192
|
-
this .valid = true;
|
|
193
|
-
}
|
|
194
|
-
catch (error)
|
|
195
|
-
{
|
|
196
|
-
this .valid = false;
|
|
197
|
-
//console .log (error);
|
|
198
|
-
}
|
|
139
|
+
this .viewport .assign (viewport);
|
|
140
|
+
this .scissor .assign (scissor);
|
|
141
|
+
|
|
142
|
+
const points = this .points;
|
|
143
|
+
|
|
144
|
+
const
|
|
145
|
+
p0 = points [0],
|
|
146
|
+
p1 = points [1],
|
|
147
|
+
p2 = points [2],
|
|
148
|
+
p3 = points [3],
|
|
149
|
+
p4 = points [4],
|
|
150
|
+
p5 = points [5],
|
|
151
|
+
p6 = points [6],
|
|
152
|
+
p7 = points [7];
|
|
153
|
+
|
|
154
|
+
const
|
|
155
|
+
x1 = scissor [0],
|
|
156
|
+
x2 = x1 + scissor [2],
|
|
157
|
+
y1 = scissor [1],
|
|
158
|
+
y2 = y1 + scissor [3];
|
|
159
|
+
|
|
160
|
+
matrix .assign (projectionMatrix) .inverse ();
|
|
161
|
+
|
|
162
|
+
ViewVolume .unProjectPointMatrix (x1, y1, 0, matrix, viewport, p0),
|
|
163
|
+
ViewVolume .unProjectPointMatrix (x2, y1, 0, matrix, viewport, p1),
|
|
164
|
+
ViewVolume .unProjectPointMatrix (x2, y2, 0, matrix, viewport, p2),
|
|
165
|
+
ViewVolume .unProjectPointMatrix (x1, y2, 0, matrix, viewport, p3),
|
|
166
|
+
ViewVolume .unProjectPointMatrix (x1, y1, 1, matrix, viewport, p4),
|
|
167
|
+
ViewVolume .unProjectPointMatrix (x2, y1, 1, matrix, viewport, p5);
|
|
168
|
+
ViewVolume .unProjectPointMatrix (x2, y2, 1, matrix, viewport, p6);
|
|
169
|
+
ViewVolume .unProjectPointMatrix (x1, y2, 1, matrix, viewport, p7);
|
|
170
|
+
|
|
171
|
+
const normals = this .normals;
|
|
172
|
+
|
|
173
|
+
Triangle3 .normal (p0, p1, p2, normals [0]); // front
|
|
174
|
+
Triangle3 .normal (p7, p4, p0, normals [1]); // left
|
|
175
|
+
Triangle3 .normal (p6, p2, p1, normals [2]); // right
|
|
176
|
+
Triangle3 .normal (p2, p6, p7, normals [3]); // top
|
|
177
|
+
Triangle3 .normal (p1, p0, p4, normals [4]); // bottom
|
|
178
|
+
Triangle3 .normal (p4, p7, p6, normals [5]); // back
|
|
179
|
+
|
|
180
|
+
const planes = this .planes;
|
|
181
|
+
|
|
182
|
+
planes [0] .set (p1, normals [0]); // front
|
|
183
|
+
planes [1] .set (p4, normals [1]); // left
|
|
184
|
+
planes [2] .set (p2, normals [2]); // right
|
|
185
|
+
planes [3] .set (p6, normals [3]); // top
|
|
186
|
+
planes [4] .set (p0, normals [4]); // bottom
|
|
187
|
+
planes [5] .set (p7, normals [5]); // back
|
|
188
|
+
|
|
189
|
+
this .edges .tainted = true;
|
|
199
190
|
|
|
200
191
|
return this;
|
|
201
192
|
};
|
|
@@ -237,28 +228,25 @@ function (Plane3,
|
|
|
237
228
|
},
|
|
238
229
|
intersectsSphere: function (radius, center)
|
|
239
230
|
{
|
|
240
|
-
|
|
241
|
-
{
|
|
242
|
-
const planes = this .planes;
|
|
231
|
+
const planes = this .planes;
|
|
243
232
|
|
|
244
|
-
|
|
245
|
-
|
|
233
|
+
if (planes [0] .getDistanceToPoint (center) > radius)
|
|
234
|
+
return false;
|
|
246
235
|
|
|
247
|
-
|
|
248
|
-
|
|
236
|
+
if (planes [1] .getDistanceToPoint (center) > radius)
|
|
237
|
+
return false;
|
|
249
238
|
|
|
250
|
-
|
|
251
|
-
|
|
239
|
+
if (planes [2] .getDistanceToPoint (center) > radius)
|
|
240
|
+
return false;
|
|
252
241
|
|
|
253
|
-
|
|
254
|
-
|
|
242
|
+
if (planes [3] .getDistanceToPoint (center) > radius)
|
|
243
|
+
return false;
|
|
255
244
|
|
|
256
|
-
|
|
257
|
-
|
|
245
|
+
if (planes [4] .getDistanceToPoint (center) > radius)
|
|
246
|
+
return false;
|
|
258
247
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
248
|
+
if (planes [5] .getDistanceToPoint (center) > radius)
|
|
249
|
+
return false;
|
|
262
250
|
|
|
263
251
|
return true;
|
|
264
252
|
},
|
|
@@ -361,12 +349,9 @@ function (Plane3,
|
|
|
361
349
|
//Objects coordinates
|
|
362
350
|
invModelViewProjection .multVecMatrix (vin);
|
|
363
351
|
|
|
364
|
-
if (vin .w === 0)
|
|
365
|
-
throw new Error ("Couldn't unproject point: divisor is 0.");
|
|
366
|
-
|
|
367
352
|
const d = 1 / vin .w;
|
|
368
353
|
|
|
369
|
-
return point .set (vin .x * d, vin .y * d, vin .z * d);
|
|
354
|
+
return point .set (vin .x * d, vin .y * d, vin .z * d, 1);
|
|
370
355
|
};
|
|
371
356
|
})(),
|
|
372
357
|
unProjectRay: (function ()
|
|
@@ -392,12 +377,32 @@ function (Plane3,
|
|
|
392
377
|
|
|
393
378
|
return function (point, modelViewMatrix, projectionMatrix, viewport, vout)
|
|
394
379
|
{
|
|
395
|
-
|
|
380
|
+
if (point .length === 4)
|
|
381
|
+
vin .assign (point);
|
|
382
|
+
else
|
|
383
|
+
vin .set (point .x, point .y, point .z, 1);
|
|
396
384
|
|
|
397
385
|
projectionMatrix .multVecMatrix (modelViewMatrix .multVecMatrix (vin));
|
|
398
386
|
|
|
399
|
-
|
|
400
|
-
|
|
387
|
+
const d = 1 / (2 * vin .w);
|
|
388
|
+
|
|
389
|
+
return vout .set ((vin .x * d + 0.5) * viewport [2] + viewport [0],
|
|
390
|
+
(vin .y * d + 0.5) * viewport [3] + viewport [1],
|
|
391
|
+
(vin .z * d + 0.5));
|
|
392
|
+
};
|
|
393
|
+
})(),
|
|
394
|
+
projectPointMatrix: (function ()
|
|
395
|
+
{
|
|
396
|
+
const vin = new Vector4 (0, 0, 0, 0);
|
|
397
|
+
|
|
398
|
+
return function (point, modelViewProjectionMatrix, viewport, vout)
|
|
399
|
+
{
|
|
400
|
+
if (point .length === 4)
|
|
401
|
+
vin .assign (point);
|
|
402
|
+
else
|
|
403
|
+
vin .set (point .x, point .y, point .z, 1);
|
|
404
|
+
|
|
405
|
+
modelViewProjectionMatrix .multVecMatrix (vin);
|
|
401
406
|
|
|
402
407
|
const d = 1 / (2 * vin .w);
|
|
403
408
|
|
|
@@ -85,6 +85,13 @@ function (Color3, Algorithm)
|
|
|
85
85
|
{
|
|
86
86
|
constructor: Color4,
|
|
87
87
|
length: 4,
|
|
88
|
+
[Symbol .iterator]: function* ()
|
|
89
|
+
{
|
|
90
|
+
yield this [_r];
|
|
91
|
+
yield this [_g];
|
|
92
|
+
yield this [_b];
|
|
93
|
+
yield this [_a];
|
|
94
|
+
},
|
|
88
95
|
copy: function ()
|
|
89
96
|
{
|
|
90
97
|
const copy = Object .create (Color4 .prototype);
|
|
@@ -76,6 +76,13 @@ function (Vector2,
|
|
|
76
76
|
constructor: Matrix2,
|
|
77
77
|
order: 2,
|
|
78
78
|
length: 4,
|
|
79
|
+
[Symbol .iterator]: function* ()
|
|
80
|
+
{
|
|
81
|
+
const length = this .length;
|
|
82
|
+
|
|
83
|
+
for (let i = 0; i < length; ++ i)
|
|
84
|
+
yield this [i];
|
|
85
|
+
},
|
|
79
86
|
copy: function ()
|
|
80
87
|
{
|
|
81
88
|
const copy = Object .create (Matrix2 .prototype);
|
|
@@ -154,8 +161,7 @@ function (Vector2,
|
|
|
154
161
|
D = this [3],
|
|
155
162
|
d = A * D - B * C;
|
|
156
163
|
|
|
157
|
-
if (d === 0)
|
|
158
|
-
throw new Error ("Matrix2 .inverse: determinant is 0.");
|
|
164
|
+
// if (d === 0) ... determinant is zero.
|
|
159
165
|
|
|
160
166
|
this [0] = D / d;
|
|
161
167
|
this [1] = -B / d;
|
|
@@ -220,6 +226,18 @@ function (Vector2,
|
|
|
220
226
|
configurable: false
|
|
221
227
|
});
|
|
222
228
|
|
|
229
|
+
Object .defineProperty (Matrix2 .prototype, "y",
|
|
230
|
+
{
|
|
231
|
+
get: (function ()
|
|
232
|
+
{
|
|
233
|
+
const vector = new Vector2 (0, 0);
|
|
234
|
+
|
|
235
|
+
return function () { return vector .set (this [2], this [3]); };
|
|
236
|
+
})(),
|
|
237
|
+
enumerable: false,
|
|
238
|
+
configurable: false
|
|
239
|
+
});
|
|
240
|
+
|
|
223
241
|
Object .defineProperty (Matrix2 .prototype, "xAxis",
|
|
224
242
|
{
|
|
225
243
|
get: function () { return this [0]; },
|