x_ite 4.0.5 → 4.7.5
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/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- package/.vscode/settings.json +15 -0
- package/.vscode/tasks.json +25 -0
- package/Makefile +55 -15
- package/README.md +13 -130
- package/build/bin/dist.pl +156 -0
- package/build/bin/version-number.pl +25 -0
- package/build/{version.pl → bin/version.pl} +64 -21
- package/build/components/annotation.build.js +15 -0
- package/build/components/cad-geometry.build.js +15 -0
- package/build/components/cube-map-texturing.build.js +15 -0
- package/build/components/dis.build.js +15 -0
- package/build/components/event-utilities.build.js +15 -0
- package/build/components/geometry2d.build.js +15 -0
- package/build/components/geospatial.build.js +15 -0
- package/build/components/h-anim.build.js +15 -0
- package/build/components/key-device-sensor.build.js +15 -0
- package/build/components/layout.build.js +15 -0
- package/build/components/nurbs.build.js +15 -0
- package/build/components/particle-systems.build.js +15 -0
- package/build/components/picking.build.js +15 -0
- package/build/components/projective-texture-mapping.build.js +15 -0
- package/build/components/rigid-body-physics.build.js +15 -0
- package/build/components/scripting.build.js +15 -0
- package/build/components/texturing-3d.build.js +15 -0
- package/build/components/volume-rendering.build.js +15 -0
- package/build/components/x_ite.build.js +15 -0
- package/build/parts/default.end.frag +2 -0
- package/build/parts/default.start.frag +6 -0
- package/build/parts/x_ite.end.frag +23 -0
- package/build/parts/x_ite.start.frag +8 -0
- package/build/x_ite.build.js +18 -0
- package/dist/LICENSE.txt +49 -0
- package/dist/assets/components/annotation.js +813 -0
- package/dist/assets/components/annotation.min.js +1 -0
- package/dist/assets/components/cad-geometry.js +1037 -0
- package/dist/assets/components/cad-geometry.min.js +1 -0
- package/dist/assets/components/cube-map-texturing.js +1212 -0
- package/dist/assets/components/cube-map-texturing.min.js +1 -0
- package/dist/assets/components/dis.js +908 -0
- package/dist/assets/components/dis.min.js +1 -0
- package/dist/assets/components/event-utilities.js +1114 -0
- package/dist/assets/components/event-utilities.min.js +1 -0
- package/dist/assets/components/geometry2d.js +2190 -0
- package/dist/assets/components/geometry2d.min.js +1 -0
- package/dist/assets/components/geospatial.js +3850 -0
- package/dist/assets/components/geospatial.min.js +2 -0
- package/dist/assets/components/h-anim.js +1084 -0
- package/dist/assets/components/h-anim.min.js +1 -0
- package/dist/assets/components/key-device-sensor.js +850 -0
- package/dist/assets/components/key-device-sensor.min.js +1 -0
- package/dist/assets/components/layout.js +2008 -0
- package/dist/assets/components/layout.min.js +1 -0
- package/dist/assets/components/nurbs.js +5388 -0
- package/dist/assets/components/nurbs.min.js +2 -0
- package/dist/assets/components/particle-systems.js +4216 -0
- package/dist/assets/components/particle-systems.min.js +2 -0
- package/dist/assets/components/picking.js +2481 -0
- package/dist/assets/components/picking.min.js +1 -0
- package/dist/assets/components/projective-texture-mapping.js +813 -0
- package/dist/assets/components/projective-texture-mapping.min.js +1 -0
- package/dist/assets/components/rigid-body-physics.js +4569 -0
- package/dist/assets/components/rigid-body-physics.min.js +59 -0
- package/dist/assets/components/scripting.js +801 -0
- package/dist/assets/components/scripting.min.js +1 -0
- package/dist/assets/components/texturing-3d.js +10054 -0
- package/dist/assets/components/texturing-3d.min.js +48 -0
- package/dist/assets/components/volume-rendering.js +3966 -0
- package/dist/assets/components/volume-rendering.min.js +3 -0
- package/dist/assets/components/x_ite.js +285 -0
- package/dist/assets/components/x_ite.min.js +1 -0
- package/{fonts → dist/assets/fonts}/DroidSerif-Bold.ttf +0 -0
- package/{fonts → dist/assets/fonts}/DroidSerif-BoldItalic.ttf +0 -0
- package/{fonts → dist/assets/fonts}/DroidSerif-Italic.ttf +0 -0
- package/{fonts → dist/assets/fonts}/DroidSerif-Regular.ttf +0 -0
- package/{fonts → dist/assets/fonts}/Ubuntu-B.ttf +0 -0
- package/{fonts → dist/assets/fonts}/Ubuntu-BI.ttf +0 -0
- package/{fonts → dist/assets/fonts}/Ubuntu-R.ttf +0 -0
- package/{fonts → dist/assets/fonts}/Ubuntu-RI.ttf +0 -0
- package/{fonts → dist/assets/fonts}/UbuntuMono-B.ttf +0 -0
- package/{fonts → dist/assets/fonts}/UbuntuMono-BI.ttf +0 -0
- package/{fonts → dist/assets/fonts}/UbuntuMono-R.ttf +0 -0
- package/{fonts → dist/assets/fonts}/UbuntuMono-RI.ttf +0 -0
- package/dist/assets/hatching/0.png +0 -0
- package/dist/assets/hatching/1.png +0 -0
- package/dist/assets/hatching/10.png +0 -0
- package/dist/assets/hatching/11.png +0 -0
- package/dist/assets/hatching/12.png +0 -0
- package/dist/assets/hatching/13.png +0 -0
- package/dist/assets/hatching/14.png +0 -0
- package/dist/assets/hatching/15.png +0 -0
- package/dist/assets/hatching/16.png +0 -0
- package/dist/assets/hatching/17.png +0 -0
- package/dist/assets/hatching/18.png +0 -0
- package/dist/assets/hatching/19.png +0 -0
- package/dist/assets/hatching/2.png +0 -0
- package/dist/assets/hatching/3.png +0 -0
- package/dist/assets/hatching/4.png +0 -0
- package/dist/assets/hatching/5.png +0 -0
- package/dist/assets/hatching/6.png +0 -0
- package/dist/assets/hatching/7.png +0 -0
- package/dist/assets/hatching/8.png +0 -0
- package/dist/assets/hatching/9.png +0 -0
- package/dist/{images → assets/images}/ExamineViewer.png +0 -0
- package/dist/{images → assets/images}/FlyViewer.png +0 -0
- package/dist/{images → assets/images}/NoneViewer.png +0 -0
- package/dist/{images → assets/images}/PlaneViewer.png +0 -0
- package/dist/{images → assets/images}/PrimitiveQuality.png +0 -0
- package/dist/{images → assets/images}/TextureQuality.png +0 -0
- package/dist/{images → assets/images}/Time.png +0 -0
- package/dist/{images → assets/images}/Viewpoint.png +0 -0
- package/dist/{images → assets/images}/WalkViewer.png +0 -0
- package/dist/assets/images/go-next.png +0 -0
- package/dist/{images → assets/images}/gtk-fullscreen.png +0 -0
- package/dist/{images → assets/images}/gtk-leave-fullscreen.png +0 -0
- package/dist/{images → assets/images}/gtk-zoom-fit.png +0 -0
- package/dist/{images → assets/images}/gtk-zoom-in.png +0 -0
- package/dist/{images → assets/images}/help-about.png +0 -0
- package/dist/{images → assets/images}/icon.bw.png +0 -0
- package/dist/{images → assets/images}/icon.png +0 -0
- package/dist/assets/images/logo.128.png +0 -0
- package/dist/{images → assets/images}/logo.bw.png +0 -0
- package/dist/{images → assets/images}/logo.png +0 -0
- package/dist/assets/linetype/0.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/Background.fs +23 -0
- package/dist/assets/shaders/webgl1/Background.vs +16 -0
- package/dist/assets/shaders/webgl1/Depth.fs +60 -0
- package/dist/assets/shaders/webgl1/Depth.vs +13 -0
- package/dist/assets/shaders/webgl1/Fallback.fs +28 -0
- package/dist/assets/shaders/webgl1/Fallback.vs +24 -0
- package/dist/assets/shaders/webgl1/FallbackUnlit.fs +16 -0
- package/dist/assets/shaders/webgl1/FallbackUnlit.vs +18 -0
- package/dist/assets/shaders/webgl1/Gouraud.fs +529 -0
- package/dist/assets/shaders/webgl1/Gouraud.vs +108 -0
- package/dist/assets/shaders/webgl1/Phong.fs +838 -0
- package/dist/assets/shaders/webgl1/Phong.vs +52 -0
- package/dist/assets/shaders/webgl1/PointSet.fs +541 -0
- package/dist/assets/shaders/webgl1/PointSet.vs +48 -0
- package/dist/assets/shaders/webgl1/Unlit.fs +541 -0
- package/dist/assets/shaders/webgl1/Unlit.vs +52 -0
- package/dist/assets/shaders/webgl1/Wireframe.fs +93 -0
- package/dist/assets/shaders/webgl1/Wireframe.vs +47 -0
- package/dist/assets/shaders/webgl2/Background.fs +25 -0
- package/dist/assets/shaders/webgl2/Background.vs +17 -0
- package/dist/assets/shaders/webgl2/Depth.fs +62 -0
- package/dist/assets/shaders/webgl2/Depth.vs +14 -0
- package/dist/assets/shaders/webgl2/Gouraud.fs +684 -0
- package/dist/assets/shaders/webgl2/Gouraud.vs +109 -0
- package/dist/assets/shaders/webgl2/Phong.fs +1014 -0
- package/dist/assets/shaders/webgl2/Phong.vs +53 -0
- package/dist/assets/shaders/webgl2/PointSet.fs +696 -0
- package/dist/assets/shaders/webgl2/PointSet.vs +49 -0
- package/dist/assets/shaders/webgl2/Unlit.fs +696 -0
- package/dist/assets/shaders/webgl2/Unlit.vs +53 -0
- package/dist/assets/shaders/webgl2/Wireframe.fs +102 -0
- package/dist/assets/shaders/webgl2/Wireframe.vs +48 -0
- package/dist/example.html +8 -7
- package/dist/x_ite.css +180 -59
- package/dist/x_ite.js +74696 -68048
- package/dist/x_ite.min.js +42 -41
- package/dist/x_ite.zip +0 -0
- package/docs/404.md +5 -0
- package/docs/Accessing-the-External-Browser.md +290 -0
- package/docs/Browser-Support.md +47 -0
- package/docs/Custom-Shaders.md +905 -0
- package/docs/Features.md +49 -0
- package/docs/Glossary.md +339 -0
- package/docs/How-To-Configure-Your-Web-Server.md +56 -0
- package/docs/Supported-Nodes.md +370 -0
- package/docs/What's-New.md +1240 -0
- package/docs/XHTML-DOM-Integration.md +82 -0
- package/docs/_config.yml +140 -0
- package/docs/_data/navigation.yml +137 -0
- package/docs/assets/css/main.scss +100 -0
- package/docs/assets/images/logo.png +0 -0
- package/docs/google3696ee938394d7b6.html +1 -0
- package/docs/index.md +1026 -0
- package/docs/reference/Browser-Services.md +333 -0
- package/docs/reference/Constants-Services.md +376 -0
- package/docs/reference/ECMAScript-Object-and-Function-Definitions.md +128 -0
- package/docs/reference/Field-Services-and-Objects.md +1006 -0
- package/docs/reference/Prototype-Services.md +121 -0
- package/docs/reference/Route-Services.md +49 -0
- package/docs/reference/Scene-Services.md +360 -0
- package/docs/reference/Script-Node-Authoring-Interface.md +334 -0
- package/docs/tutorials/Adding-backgrounds.md +268 -0
- package/docs/tutorials/Adding-fog.md +67 -0
- package/docs/tutorials/Adding-sound.md +326 -0
- package/docs/tutorials/Animating-transforms.md +385 -0
- package/docs/tutorials/Basic-Nodes.md +317 -0
- package/docs/tutorials/Building-a-X3D-world.md +152 -0
- package/docs/tutorials/Building-elevation-grids.md +170 -0
- package/docs/tutorials/Building-extruded-shapes.md +145 -0
- package/docs/tutorials/Building-primitive-shapes.md +204 -0
- package/docs/tutorials/Building-shapes-out-of-points,-lines,-and-faces.md +311 -0
- package/docs/tutorials/Controlling-appearance-with-materials.md +186 -0
- package/docs/tutorials/Controlling-color-on-coordinate-based-geometry.md +208 -0
- package/docs/tutorials/Controlling-detail.md +130 -0
- package/docs/tutorials/Controlling-how-textures-are-mapped.md +277 -0
- package/docs/tutorials/Controlling-navigation.md +70 -0
- package/docs/tutorials/Controlling-shading-on-coordinate-based-geometry.md +180 -0
- package/docs/tutorials/Controlling-the-viewpoint.md +49 -0
- package/docs/tutorials/Creating-new-node-types.md +313 -0
- package/docs/tutorials/Grouping-nodes.md +237 -0
- package/docs/tutorials/Hello,-World!.md +204 -0
- package/docs/tutorials/Improving-Performance.md +227 -0
- package/docs/tutorials/Increasing-Rendering-Speed.md +110 -0
- package/docs/tutorials/Introducing-X3D.md +94 -0
- package/docs/tutorials/Introducing-animation.md +211 -0
- package/docs/tutorials/Introducing-script-use.md +127 -0
- package/docs/tutorials/Lighting-your-world.md +139 -0
- package/docs/tutorials/Mapping-textures.md +212 -0
- package/docs/tutorials/Naming-nodes.md +161 -0
- package/docs/tutorials/Providing-information-about-your-world.md +30 -0
- package/docs/tutorials/Sensing-the-viewer.md +205 -0
- package/docs/tutorials/Sensing-viewer-actions.md +214 -0
- package/docs/tutorials/Transforming-Shapes.md +270 -0
- package/docs/tutorials/Writing-program-scripts-with-ECMAScript.md +631 -0
- package/docs/tutorials/index.md +78 -0
- package/meta/logo/logo.png +0 -0
- package/meta/logo/logo.svg +216 -217
- package/meta/web3d.html +76 -54
- package/package.json +41 -24
- package/src/assets/components/annotation.js +87 -0
- package/src/assets/components/cad-geometry.js +88 -0
- package/src/assets/components/cube-map-texturing.js +78 -0
- package/src/assets/components/dis.js +84 -0
- package/src/assets/components/event-utilities.js +93 -0
- package/src/assets/components/geometry2d.js +93 -0
- package/src/assets/components/geospatial.js +102 -0
- package/src/assets/components/h-anim.js +83 -0
- package/src/assets/components/key-device-sensor.js +78 -0
- package/src/assets/components/layout.js +87 -0
- package/src/assets/components/nurbs.js +118 -0
- package/src/assets/components/particle-systems.js +105 -0
- package/src/assets/components/picking.js +87 -0
- package/src/assets/components/projective-texture-mapping.js +75 -0
- package/src/assets/components/rigid-body-physics.js +123 -0
- package/src/assets/components/scripting.js +72 -0
- package/src/assets/components/texturing-3d.js +91 -0
- package/src/assets/components/volume-rendering.js +118 -0
- package/src/assets/components/x_ite.js +69 -0
- package/src/assets/fonts/DroidSerif-Bold.ttf +0 -0
- package/src/assets/fonts/DroidSerif-BoldItalic.ttf +0 -0
- package/src/assets/fonts/DroidSerif-Italic.ttf +0 -0
- package/src/assets/fonts/DroidSerif-Regular.ttf +0 -0
- package/src/assets/fonts/Ubuntu-B.ttf +0 -0
- package/src/assets/fonts/Ubuntu-BI.ttf +0 -0
- package/src/assets/fonts/Ubuntu-R.ttf +0 -0
- package/src/assets/fonts/Ubuntu-RI.ttf +0 -0
- package/src/assets/fonts/UbuntuMono-B.ttf +0 -0
- package/src/assets/fonts/UbuntuMono-BI.ttf +0 -0
- package/src/assets/fonts/UbuntuMono-R.ttf +0 -0
- package/src/assets/fonts/UbuntuMono-RI.ttf +0 -0
- package/src/assets/hatching/0.png +0 -0
- package/src/assets/hatching/1.png +0 -0
- package/src/assets/hatching/10.png +0 -0
- package/src/assets/hatching/11.png +0 -0
- package/src/assets/hatching/12.png +0 -0
- package/src/assets/hatching/13.png +0 -0
- package/src/assets/hatching/14.png +0 -0
- package/src/assets/hatching/15.png +0 -0
- package/src/assets/hatching/16.png +0 -0
- package/src/assets/hatching/17.png +0 -0
- package/src/assets/hatching/18.png +0 -0
- package/src/assets/hatching/19.png +0 -0
- package/src/assets/hatching/2.png +0 -0
- package/src/assets/hatching/3.png +0 -0
- package/src/assets/hatching/4.png +0 -0
- package/src/assets/hatching/5.png +0 -0
- package/src/assets/hatching/6.png +0 -0
- package/src/assets/hatching/7.png +0 -0
- package/src/assets/hatching/8.png +0 -0
- package/src/assets/hatching/9.png +0 -0
- package/src/{images → assets/images}/ExamineViewer.png +0 -0
- package/src/{images → assets/images}/FlyViewer.png +0 -0
- package/src/{images → assets/images}/NoneViewer.png +0 -0
- package/src/{images → assets/images}/PlaneViewer.png +0 -0
- package/src/{images → assets/images}/PrimitiveQuality.png +0 -0
- package/src/{images → assets/images}/TextureQuality.png +0 -0
- package/src/{images → assets/images}/Time.png +0 -0
- package/src/{images → assets/images}/Viewpoint.png +0 -0
- package/src/{images → assets/images}/WalkViewer.png +0 -0
- package/src/assets/images/go-next.png +0 -0
- package/src/{images → assets/images}/gtk-fullscreen.png +0 -0
- package/src/{images → assets/images}/gtk-leave-fullscreen.png +0 -0
- package/src/{images → assets/images}/gtk-zoom-fit.png +0 -0
- package/src/{images → assets/images}/gtk-zoom-in.png +0 -0
- package/src/{images → assets/images}/help-about.png +0 -0
- package/src/{images → assets/images}/icon.bw.png +0 -0
- package/src/{images → assets/images}/icon.png +0 -0
- package/src/assets/images/logo.128.png +0 -0
- package/src/{images → assets/images}/logo.bw.png +0 -0
- package/src/{images → assets/images}/logo.png +0 -0
- package/src/assets/linetype/0.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 +102 -0
- package/src/assets/shaders/webgl1/Background.fs +16 -0
- package/src/assets/shaders/webgl1/Background.vs +22 -0
- package/src/assets/shaders/webgl1/Depth.fs +16 -0
- package/src/assets/shaders/webgl1/Depth.vs +20 -0
- package/src/assets/shaders/webgl1/Fallback.fs +38 -0
- package/src/assets/shaders/webgl1/Fallback.vs +30 -0
- package/src/assets/shaders/webgl1/FallbackUnlit.fs +22 -0
- package/src/assets/shaders/webgl1/FallbackUnlit.vs +24 -0
- package/src/assets/shaders/webgl1/Gouraud.fs +66 -0
- package/src/assets/shaders/webgl1/Gouraud.vs +148 -0
- package/src/assets/shaders/webgl1/Phong.fs +173 -0
- package/src/assets/shaders/webgl1/Phong.vs +67 -0
- package/src/assets/shaders/webgl1/PointSet.fs +100 -0
- package/src/assets/shaders/webgl1/PointSet.vs +70 -0
- package/src/assets/shaders/webgl1/Unlit.fs +89 -0
- package/src/assets/shaders/webgl1/Unlit.vs +67 -0
- package/src/assets/shaders/webgl1/Wireframe.fs +74 -0
- package/src/assets/shaders/webgl1/Wireframe.vs +63 -0
- package/src/assets/shaders/webgl1/include/ClipPlanes.glsl +16 -0
- package/src/assets/shaders/webgl1/include/Fog.glsl +38 -0
- package/src/assets/shaders/webgl1/include/Hatch.glsl +18 -0
- package/src/assets/shaders/webgl1/include/Pack.glsl +51 -0
- package/src/assets/shaders/webgl1/include/Perlin.glsl +40 -0
- package/src/assets/shaders/webgl1/include/Shadow.glsl +310 -0
- package/src/assets/shaders/webgl1/include/Texture.glsl +488 -0
- package/src/assets/shaders/webgl2/Background.fs +19 -0
- package/src/assets/shaders/webgl2/Background.vs +23 -0
- package/src/assets/shaders/webgl2/Depth.fs +19 -0
- package/src/assets/shaders/webgl2/Depth.vs +21 -0
- package/src/assets/shaders/webgl2/Gouraud.fs +64 -0
- package/src/assets/shaders/webgl2/Gouraud.vs +149 -0
- package/src/assets/shaders/webgl2/Phong.fs +171 -0
- package/src/assets/shaders/webgl2/Phong.vs +68 -0
- package/src/assets/shaders/webgl2/PointSet.fs +99 -0
- package/src/assets/shaders/webgl2/PointSet.vs +71 -0
- package/src/assets/shaders/webgl2/Unlit.fs +88 -0
- package/src/assets/shaders/webgl2/Unlit.vs +68 -0
- package/src/assets/shaders/webgl2/Wireframe.fs +73 -0
- package/src/assets/shaders/webgl2/Wireframe.vs +64 -0
- package/src/assets/shaders/webgl2/include/ClipPlanes.glsl +16 -0
- package/src/assets/shaders/webgl2/include/Fog.glsl +46 -0
- package/src/assets/shaders/webgl2/include/Hatch.glsl +18 -0
- package/src/assets/shaders/webgl2/include/Pack.glsl +51 -0
- package/src/assets/shaders/webgl2/include/Perlin.glsl +40 -0
- package/src/assets/shaders/webgl2/include/Shadow.glsl +324 -0
- package/src/assets/shaders/webgl2/include/Texture.glsl +623 -0
- package/src/bookmarks.js +83 -164
- package/src/dummy.js +1 -0
- package/src/example.html +8 -7
- package/src/examples.js +150 -0
- package/src/lib/ammojs/AmmoJS.js +58 -0
- package/src/lib/ammojs/Makefile +26 -0
- package/src/lib/ammojs/ammo.idl +1031 -0
- package/src/lib/ammojs/ammo.js +40 -0
- package/src/lib/jpeg/jpeg.js +1019 -0
- package/src/lib/nurbs/extras/sample.js +242 -0
- package/src/lib/nurbs/nurbs.js +342 -0
- package/src/lib/nurbs/src/evaluate.js +413 -0
- package/src/lib/nurbs/src/numerical-derivative.js +54 -0
- package/src/lib/nurbs/src/support.js +151 -0
- package/src/lib/nurbs/src/transform.js +78 -0
- package/src/lib/nurbs/src/utils/accessor-preamble.js +33 -0
- package/src/lib/nurbs/src/utils/bisection-search.js +28 -0
- package/src/lib/nurbs/src/utils/cache-key.js +57 -0
- package/src/lib/nurbs/src/utils/create-accessors.js +110 -0
- package/src/lib/nurbs/src/utils/infer-type.js +52 -0
- package/src/lib/nurbs/src/utils/is-array-like.js +10 -0
- package/src/lib/nurbs/src/utils/is-ndarray-like.js +18 -0
- package/src/lib/nurbs/src/utils/is-ndarray.js +21 -0
- package/src/lib/nurbs/src/utils/ndloop.js +23 -0
- package/src/lib/nurbs/src/utils/size-getter.js +22 -0
- package/src/lib/nurbs/src/utils/variable.js +31 -0
- package/src/locale/de.po +8 -3
- package/src/locale/fr.po +9 -4
- package/src/locale/gettext.js +3 -3
- package/src/spinner.css +21 -8
- package/src/standard/Geospatial/Geodetic.js +48 -48
- package/src/standard/Geospatial/ReferenceEllipsoids.js +1 -1
- package/src/standard/Geospatial/UniversalTransverseMercator.js +43 -43
- package/src/standard/Math/Algorithm.js +25 -41
- package/src/standard/Math/Algorithms/Bezier.js +147 -0
- package/src/standard/Math/Algorithms/MergeSort.js +2 -2
- package/src/standard/Math/Algorithms/PartialSort.js +97 -0
- package/src/standard/Math/Algorithms/QuickSort.js +8 -6
- package/src/standard/Math/Algorithms/SAT.js +4 -8
- package/src/standard/Math/Algorithms/eigendecomposition.js +37 -33
- package/src/standard/Math/Geometry/Box2.js +84 -56
- package/src/standard/Math/Geometry/Box3.js +457 -284
- package/src/standard/Math/Geometry/Camera.js +24 -15
- package/src/standard/Math/Geometry/Cylinder3.js +13 -13
- package/src/standard/Math/Geometry/Line3.js +61 -53
- package/src/standard/Math/Geometry/Plane3.js +16 -16
- package/src/standard/Math/Geometry/Sphere3.js +122 -105
- package/src/standard/Math/Geometry/Spheroid3.js +1 -1
- package/src/standard/Math/Geometry/Triangle2.js +6 -6
- package/src/standard/Math/Geometry/Triangle3.js +80 -88
- package/src/standard/Math/Geometry/ViewVolume.js +315 -116
- package/src/standard/Math/Numbers/Color3.js +45 -29
- package/src/standard/Math/Numbers/Color4.js +25 -14
- package/src/standard/Math/Numbers/Complex.js +15 -22
- package/src/standard/Math/Numbers/Matrix2.js +37 -17
- package/src/standard/Math/Numbers/Matrix3.js +181 -212
- package/src/standard/Math/Numbers/Matrix4.js +204 -262
- package/src/standard/Math/Numbers/Quaternion.js +60 -147
- package/src/standard/Math/Numbers/Rotation4.js +197 -129
- package/src/standard/Math/Numbers/Vector2.js +53 -109
- package/src/standard/Math/Numbers/Vector3.js +75 -144
- package/src/standard/Math/Numbers/Vector4.js +85 -155
- package/src/standard/Math/Utility/BVH.js +35 -30
- package/src/standard/Math/Utility/MatrixStack.js +6 -9
- package/src/standard/Networking/BinaryTransport.js +8 -8
- package/src/standard/Time/MicroTime.js +79 -0
- package/src/standard/Utility/DataStorage.js +40 -17
- package/src/standard/Utility/MapUtilities.js +69 -0
- package/src/standard/Utility/ObjectCache.js +2 -3
- package/src/standard/Utility/Shuffle.js +5 -6
- package/src/tests.js +386 -0
- package/src/x_ite/Base/Events.js +22 -30
- package/src/x_ite/Base/X3DChildObject.js +35 -19
- package/src/x_ite/Base/X3DEventObject.js +10 -12
- package/src/x_ite/Base/X3DObject.js +63 -43
- package/src/x_ite/Basic/FieldDefinitionArray.js +16 -10
- package/src/x_ite/Basic/X3DArrayField.js +3 -430
- package/src/x_ite/Basic/X3DBaseNode.js +551 -288
- package/src/x_ite/Basic/X3DField.js +133 -96
- package/src/x_ite/Basic/X3DFieldDefinition.js +0 -4
- package/src/x_ite/Basic/X3DObjectArrayField.js +545 -0
- package/src/x_ite/Basic/X3DTypedArrayField.js +839 -0
- package/src/x_ite/Bits/TraverseType.js +2 -5
- package/src/x_ite/Bits/X3DConstants.js +12 -322
- package/src/x_ite/Browser/Core/BrowserOptions.js +205 -77
- package/src/x_ite/Browser/Core/BrowserProperties.js +2 -4
- package/src/x_ite/Browser/Core/BrowserTimings.js +16 -15
- package/src/x_ite/Browser/Core/ContextMenu.js +202 -80
- package/src/x_ite/Browser/Core/Notification.js +14 -6
- package/src/x_ite/Browser/Core/PrimitiveQuality.js +3 -7
- package/src/x_ite/Browser/Core/RenderingProperties.js +10 -11
- package/src/x_ite/Browser/Core/Shading.js +66 -0
- package/src/x_ite/Browser/Core/TextureQuality.js +3 -7
- package/src/x_ite/Browser/Core/X3DCoreContext.js +495 -48
- package/src/x_ite/Browser/Core/X3DCoreContext.js.~1~ +714 -0
- package/src/x_ite/Browser/EnvironmentalEffects/X3DEnvironmentalEffectsContext.js +17 -23
- package/src/x_ite/Browser/Followers/X3DArrayChaserTemplate.js +12 -20
- package/src/x_ite/Browser/Followers/X3DArrayFollowerTemplate.js +82 -34
- package/src/x_ite/Browser/Geometry2D/Arc2DOptions.js +3 -5
- package/src/x_ite/Browser/Geometry2D/ArcClose2DOptions.js +3 -5
- package/src/x_ite/Browser/Geometry2D/Circle2DOptions.js +12 -9
- package/src/x_ite/Browser/Geometry2D/Disk2DOptions.js +60 -42
- package/src/x_ite/Browser/Geometry2D/Rectangle2DOptions.js +16 -20
- package/src/x_ite/Browser/Geometry2D/X3DGeometry2DContext.js +51 -12
- package/src/x_ite/Browser/Geometry3D/BoxOptions.js +17 -21
- package/src/x_ite/Browser/Geometry3D/ConeOptions.js +2 -4
- package/src/x_ite/Browser/Geometry3D/CylinderOptions.js +2 -4
- package/src/x_ite/Browser/Geometry3D/IcoSphereOptions.js +2 -4
- package/src/x_ite/Browser/Geometry3D/QuadSphereOptions.js +3 -5
- package/src/x_ite/Browser/Geometry3D/X3DGeometry3DContext.js +8 -9
- package/src/x_ite/Browser/Grouping/X3DGroupingContext.js +98 -0
- package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator.js +12 -12
- package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator1.js +2 -4
- package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolatorTemplate.js +2 -4
- package/src/x_ite/Browser/KeyDeviceSensor/X3DKeyDeviceSensorContext.js +22 -200
- package/src/x_ite/Browser/Layout/ScreenText.js +287 -295
- package/src/x_ite/Browser/Layout/X3DLayoutContext.js +15 -12
- package/src/x_ite/Browser/Lighting/X3DLightingContext.js +18 -12
- package/src/x_ite/Browser/NURBS/NURBS.js +481 -0
- package/src/x_ite/Browser/Navigation/ExamineViewer.js +587 -127
- package/src/x_ite/Browser/Navigation/FlyViewer.js +23 -5
- package/src/x_ite/Browser/Navigation/LookAtViewer.js +402 -18
- package/src/x_ite/Browser/Navigation/NoneViewer.js +13 -3
- package/src/x_ite/Browser/Navigation/PlaneViewer.js +46 -28
- package/src/x_ite/Browser/Navigation/WalkViewer.js +45 -17
- package/src/x_ite/Browser/Navigation/X3DFlyViewer.js +414 -207
- package/src/x_ite/Browser/Navigation/X3DNavigationContext.js +65 -48
- package/src/x_ite/Browser/Navigation/X3DViewer.js +99 -45
- package/src/x_ite/Browser/Networking/X3DNetworkingContext.js +39 -38
- package/src/x_ite/Browser/Networking/urls.js +34 -5
- package/src/x_ite/Browser/ParticleSystems/X3DParticleSystemsContext.js +7 -9
- package/src/x_ite/Browser/Picking/IntersectionType.js +63 -0
- package/src/x_ite/Browser/Picking/MatchCriterion.js +64 -0
- package/src/x_ite/Browser/Picking/SortOrder.js +65 -0
- package/src/x_ite/Browser/Picking/VolumePicker.js +197 -0
- package/src/x_ite/Browser/Picking/X3DPickingContext.js +130 -0
- package/src/x_ite/Browser/PointingDeviceSensor/PointingDevice.js +89 -30
- package/src/x_ite/Browser/PointingDeviceSensor/PointingDeviceSensorContainer.js +1 -3
- package/src/x_ite/Browser/PointingDeviceSensor/X3DPointingDeviceSensorContext.js +33 -15
- package/src/x_ite/Browser/Rendering/X3DRenderingContext.js +39 -151
- package/src/x_ite/Browser/RigidBodyPhysics/AppliedParametersType.js +70 -0
- package/src/x_ite/Browser/Shaders/Shader.js +150 -50
- package/src/x_ite/Browser/Shaders/ShaderSource.js +140 -0
- package/src/x_ite/Browser/Shaders/ShaderTest.js +94 -77
- package/src/x_ite/Browser/Shaders/X3DShadersContext.js +220 -5
- package/src/x_ite/Browser/Shape/AlphaMode.js +65 -0
- package/src/x_ite/Browser/Shape/LineStipples.xcf +0 -0
- package/src/x_ite/Browser/Shape/X3DShapeContext.js +108 -4
- package/src/x_ite/Browser/Sound/X3DSoundContext.js +1 -20
- package/src/x_ite/Browser/Text/PolygonText.js +165 -359
- package/src/x_ite/Browser/Text/TextAlignment.js +3 -7
- package/src/x_ite/Browser/Text/X3DTextContext.js +38 -30
- package/src/x_ite/Browser/Text/X3DTextGeometry.js +58 -84
- package/src/x_ite/Browser/Texturing/MultiTextureFunctionType.js +64 -0
- package/src/x_ite/Browser/Texturing/MultiTextureModeType.js +81 -0
- package/src/x_ite/Browser/Texturing/MultiTextureSourceType.js +65 -0
- package/src/x_ite/Browser/Texturing/TextureCoordinateGeneratorModeType.js +73 -0
- package/src/x_ite/Browser/Texturing/X3DTexturingContext.js +148 -41
- package/src/x_ite/Browser/Texturing3D/DICOMParser.js +1126 -0
- package/src/x_ite/Browser/Texturing3D/NRRDParser.js +686 -0
- package/src/x_ite/Browser/Time/X3DTimeContext.js +20 -17
- package/src/x_ite/Browser/VERSION.js +2 -2
- package/src/x_ite/Browser/VolumeRendering/VolumeStyle.fs +120 -0
- package/src/x_ite/Browser/VolumeRendering/VolumeStyle.vs +28 -0
- package/src/x_ite/Browser/VolumeRendering/X3DVolumeRenderingContext.js +114 -0
- package/src/x_ite/Browser/X3DBrowser.js +282 -182
- package/src/x_ite/Browser/X3DBrowserContext.js +77 -43
- package/src/x_ite/Components/Annotation/AnnotationLayer.js +108 -0
- package/src/x_ite/Components/Annotation/AnnotationTarget.js +101 -0
- package/src/x_ite/Components/{PointingDeviceSensor/TouchGroup.js → Annotation/GroupAnnotation.js} +30 -24
- package/src/x_ite/Components/Annotation/IconAnnotation.js +110 -0
- package/src/x_ite/Components/Annotation/TextAnnotation.js +102 -0
- package/src/x_ite/Components/Annotation/URLAnnotation.js +101 -0
- package/src/x_ite/Components/Annotation/X3DAnnotationNode.js +76 -0
- package/src/x_ite/Components/CADGeometry/CADAssembly.js +6 -8
- package/src/x_ite/Components/CADGeometry/CADFace.js +137 -33
- package/src/x_ite/Components/CADGeometry/CADLayer.js +5 -18
- package/src/x_ite/Components/CADGeometry/CADPart.js +6 -12
- package/src/x_ite/Components/CADGeometry/IndexedQuadSet.js +20 -36
- package/src/x_ite/Components/CADGeometry/QuadSet.js +11 -24
- package/src/x_ite/Components/CADGeometry/X3DProductStructureChildNode.js +2 -4
- package/src/x_ite/Components/Core/MetadataBoolean.js +2 -4
- package/src/x_ite/Components/Core/MetadataDouble.js +2 -4
- package/src/x_ite/Components/Core/MetadataFloat.js +2 -4
- package/src/x_ite/Components/Core/MetadataInteger.js +2 -4
- package/src/x_ite/Components/Core/MetadataSet.js +2 -4
- package/src/x_ite/Components/Core/MetadataString.js +2 -4
- package/src/x_ite/Components/Core/WorldInfo.js +18 -10
- package/src/x_ite/Components/Core/X3DBindableNode.js +5 -36
- package/src/x_ite/Components/Core/X3DChildNode.js +16 -5
- package/src/x_ite/Components/Core/X3DInfoNode.js +2 -4
- package/src/x_ite/Components/Core/X3DMetadataObject.js +1 -3
- package/src/x_ite/Components/Core/X3DNode.js +2 -64
- package/src/x_ite/Components/Core/X3DPrototypeInstance.js +190 -210
- package/src/x_ite/Components/Core/X3DSensorNode.js +2 -4
- package/src/x_ite/Components/Core.js +111 -0
- package/src/x_ite/Components/CubeMapTexturing/ComposedCubeMapTexture.js +42 -50
- package/src/x_ite/Components/CubeMapTexturing/GeneratedCubeMapTexture.js +41 -42
- package/src/x_ite/Components/CubeMapTexturing/ImageCubeMapTexture.js +44 -59
- package/src/x_ite/Components/CubeMapTexturing/X3DEnvironmentTextureNode.js +48 -46
- package/src/x_ite/Components/DIS/DISEntityManager.js +2 -4
- package/src/x_ite/Components/DIS/DISEntityTypeMapping.js +2 -4
- package/src/x_ite/Components/DIS/EspduTransform.js +13 -9
- package/src/x_ite/Components/DIS/ReceiverPdu.js +13 -9
- package/src/x_ite/Components/DIS/SignalPdu.js +13 -9
- package/src/x_ite/Components/DIS/TransmitterPdu.js +13 -9
- package/src/x_ite/Components/EnvironmentalEffects/Background.js +2 -4
- package/src/x_ite/Components/EnvironmentalEffects/Fog.js +15 -18
- package/src/x_ite/Components/EnvironmentalEffects/FogCoordinate.js +59 -7
- package/src/x_ite/Components/EnvironmentalEffects/LocalFog.js +12 -10
- package/src/x_ite/Components/EnvironmentalEffects/TextureBackground.js +2 -4
- package/src/x_ite/Components/EnvironmentalEffects/X3DBackgroundNode.js +149 -143
- package/src/x_ite/Components/EnvironmentalEffects/X3DFogObject.js +61 -22
- package/src/x_ite/Components/EnvironmentalEffects.js +90 -0
- package/src/x_ite/Components/EnvironmentalSensor/ProximitySensor.js +121 -121
- package/src/x_ite/Components/EnvironmentalSensor/TransformSensor.js +173 -53
- package/src/x_ite/Components/EnvironmentalSensor/VisibilitySensor.js +33 -31
- package/src/x_ite/Components/EnvironmentalSensor/X3DEnvironmentalSensorNode.js +19 -11
- package/src/x_ite/Components/EnvironmentalSensor.js +81 -0
- package/src/x_ite/Components/EventUtilities/BooleanFilter.js +2 -4
- package/src/x_ite/Components/EventUtilities/BooleanSequencer.js +2 -4
- package/src/x_ite/Components/EventUtilities/BooleanToggle.js +2 -4
- package/src/x_ite/Components/EventUtilities/BooleanTrigger.js +2 -4
- package/src/x_ite/Components/EventUtilities/IntegerSequencer.js +2 -4
- package/src/x_ite/Components/EventUtilities/IntegerTrigger.js +2 -4
- package/src/x_ite/Components/EventUtilities/TimeTrigger.js +2 -4
- package/src/x_ite/Components/EventUtilities/X3DSequencerNode.js +2 -4
- package/src/x_ite/Components/EventUtilities/X3DTriggerNode.js +2 -4
- package/src/x_ite/Components/Followers/ColorChaser.js +3 -7
- package/src/x_ite/Components/Followers/ColorDamper.js +3 -7
- package/src/x_ite/Components/Followers/CoordinateChaser.js +3 -11
- package/src/x_ite/Components/Followers/CoordinateDamper.js +2 -10
- package/src/x_ite/Components/Followers/OrientationChaser.js +9 -7
- package/src/x_ite/Components/Followers/OrientationDamper.js +9 -7
- package/src/x_ite/Components/Followers/PositionChaser.js +3 -7
- package/src/x_ite/Components/Followers/PositionChaser2D.js +3 -7
- package/src/x_ite/Components/Followers/PositionDamper.js +3 -7
- package/src/x_ite/Components/Followers/PositionDamper2D.js +3 -7
- package/src/x_ite/Components/Followers/ScalarChaser.js +7 -7
- package/src/x_ite/Components/Followers/ScalarDamper.js +3 -7
- package/src/x_ite/Components/Followers/TexCoordChaser2D.js +3 -11
- package/src/x_ite/Components/Followers/TexCoordDamper2D.js +3 -11
- package/src/x_ite/Components/Followers/X3DChaserNode.js +26 -26
- package/src/x_ite/Components/Followers/X3DDamperNode.js +6 -10
- package/src/x_ite/Components/Followers/X3DFollowerNode.js +11 -11
- package/src/x_ite/Components/Followers.js +120 -0
- package/src/x_ite/Components/Geometry2D/Arc2D.js +28 -30
- package/src/x_ite/Components/Geometry2D/ArcClose2D.js +95 -93
- package/src/x_ite/Components/Geometry2D/Circle2D.js +16 -15
- package/src/x_ite/Components/Geometry2D/Disk2D.js +80 -88
- package/src/x_ite/Components/Geometry2D/Polyline2D.js +13 -19
- package/src/x_ite/Components/Geometry2D/Polypoint2D.js +12 -18
- package/src/x_ite/Components/Geometry2D/Rectangle2D.js +13 -13
- package/src/x_ite/Components/Geometry2D/TriangleSet2D.js +31 -30
- package/src/x_ite/Components/Geometry3D/Box.js +12 -12
- package/src/x_ite/Components/Geometry3D/Cone.js +34 -36
- package/src/x_ite/Components/Geometry3D/Cylinder.js +52 -54
- package/src/x_ite/Components/Geometry3D/ElevationGrid.js +90 -52
- package/src/x_ite/Components/Geometry3D/Extrusion.js +472 -388
- package/src/x_ite/Components/Geometry3D/IndexedFaceSet.js +193 -163
- package/src/x_ite/Components/Geometry3D/Sphere.js +17 -19
- package/src/x_ite/Components/Geometry3D.js +90 -0
- package/src/x_ite/Components/Geospatial/GeoCoordinate.js +124 -61
- package/src/x_ite/Components/Geospatial/GeoElevationGrid.js +54 -36
- package/src/x_ite/Components/Geospatial/GeoLOD.js +190 -98
- package/src/x_ite/Components/Geospatial/GeoLocation.js +8 -10
- package/src/x_ite/Components/Geospatial/GeoMetadata.js +2 -4
- package/src/x_ite/Components/Geospatial/GeoOrigin.js +2 -4
- package/src/x_ite/Components/Geospatial/GeoPositionInterpolator.js +4 -4
- package/src/x_ite/Components/Geospatial/GeoProximitySensor.js +10 -7
- package/src/x_ite/Components/Geospatial/GeoTouchSensor.js +4 -4
- package/src/x_ite/Components/Geospatial/GeoTransform.js +13 -13
- package/src/x_ite/Components/Geospatial/GeoViewpoint.js +131 -78
- package/src/x_ite/Components/Geospatial/X3DGeospatialObject.js +7 -9
- package/src/x_ite/Components/Grouping/Group.js +5 -7
- package/src/x_ite/Components/Grouping/StaticGroup.js +194 -22
- package/src/x_ite/Components/Grouping/Switch.js +174 -25
- package/src/x_ite/Components/Grouping/Transform.js +5 -7
- package/src/x_ite/Components/Grouping/X3DBoundedObject.js +70 -16
- package/src/x_ite/Components/Grouping/X3DGroupingNode.js +442 -151
- package/src/x_ite/Components/Grouping/X3DTransformMatrix3DNode.js +53 -29
- package/src/x_ite/Components/Grouping/X3DTransformNode.js +6 -9
- package/src/x_ite/Components/Grouping.js +93 -0
- package/src/x_ite/Components/{H-Anim → HAnim}/HAnimDisplacer.js +8 -10
- package/src/x_ite/Components/HAnim/HAnimHumanoid.js +360 -0
- package/src/x_ite/Components/{H-Anim → HAnim}/HAnimJoint.js +108 -23
- package/src/x_ite/Components/HAnim/HAnimMotion.js +113 -0
- package/src/x_ite/Components/{H-Anim → HAnim}/HAnimSegment.js +14 -14
- package/src/x_ite/Components/{H-Anim → HAnim}/HAnimSite.js +14 -16
- package/src/x_ite/Components/Interpolation/ColorInterpolator.js +13 -11
- package/src/x_ite/Components/Interpolation/CoordinateInterpolator.js +21 -13
- package/src/x_ite/Components/Interpolation/CoordinateInterpolator2D.js +19 -11
- package/src/x_ite/Components/Interpolation/EaseInEaseOut.js +8 -8
- package/src/x_ite/Components/Interpolation/NormalInterpolator.js +28 -14
- package/src/x_ite/Components/Interpolation/OrientationInterpolator.js +27 -16
- package/src/x_ite/Components/Interpolation/PositionInterpolator.js +10 -8
- package/src/x_ite/Components/Interpolation/PositionInterpolator2D.js +10 -8
- package/src/x_ite/Components/Interpolation/ScalarInterpolator.js +2 -4
- package/src/x_ite/Components/Interpolation/SplinePositionInterpolator.js +7 -9
- package/src/x_ite/Components/Interpolation/SplinePositionInterpolator2D.js +7 -9
- package/src/x_ite/Components/Interpolation/SplineScalarInterpolator.js +7 -9
- package/src/x_ite/Components/Interpolation/SquadOrientationInterpolator.js +10 -11
- package/src/x_ite/Components/Interpolation/X3DInterpolatorNode.js +2 -4
- package/src/x_ite/Components/Interpolation.js +111 -0
- package/src/x_ite/Components/KeyDeviceSensor/KeySensor.js +72 -8
- package/src/x_ite/Components/KeyDeviceSensor/StringSensor.js +65 -4
- package/src/x_ite/Components/KeyDeviceSensor/X3DKeyDeviceSensorNode.js +5 -29
- package/src/x_ite/Components/Layering/Layer.js +14 -6
- package/src/x_ite/Components/Layering/LayerSet.js +6 -10
- package/src/x_ite/Components/Layering/Viewport.js +10 -12
- package/src/x_ite/Components/Layering/X3DLayerNode.js +76 -69
- package/src/x_ite/Components/Layering/X3DViewportNode.js +2 -6
- package/src/x_ite/Components/Layering.js +84 -0
- package/src/x_ite/Components/Layout/Layout.js +163 -173
- package/src/x_ite/Components/Layout/LayoutGroup.js +20 -19
- package/src/x_ite/Components/Layout/LayoutLayer.js +12 -9
- package/src/x_ite/Components/Layout/ScreenFontStyle.js +4 -8
- package/src/x_ite/Components/Layout/ScreenGroup.js +63 -56
- package/src/x_ite/Components/Layout/X3DLayoutNode.js +2 -4
- package/src/x_ite/Components/Lighting/DirectionalLight.js +41 -31
- package/src/x_ite/Components/Lighting/PointLight.js +117 -104
- package/src/x_ite/Components/Lighting/SpotLight.js +77 -53
- package/src/x_ite/Components/Lighting/X3DLightNode.js +90 -68
- package/src/x_ite/Components/Lighting.js +81 -0
- package/src/x_ite/Components/NURBS/Contour2D.js +47 -5
- package/src/x_ite/Components/NURBS/ContourPolyline2D.js +69 -5
- package/src/x_ite/Components/NURBS/CoordinateDouble.js +2 -4
- package/src/x_ite/Components/NURBS/NurbsCurve.js +140 -10
- package/src/x_ite/Components/NURBS/NurbsCurve2D.js +117 -8
- package/src/x_ite/Components/NURBS/NurbsOrientationInterpolator.js +139 -10
- package/src/x_ite/Components/NURBS/NurbsPatchSurface.js +3 -5
- package/src/x_ite/Components/NURBS/NurbsPositionInterpolator.js +125 -10
- package/src/x_ite/Components/NURBS/NurbsSet.js +92 -11
- package/src/x_ite/Components/NURBS/NurbsSurfaceInterpolator.js +96 -12
- package/src/x_ite/Components/NURBS/NurbsSweptSurface.js +88 -7
- package/src/x_ite/Components/NURBS/NurbsSwungSurface.js +88 -7
- package/src/x_ite/Components/NURBS/NurbsTextureCoordinate.js +62 -13
- package/src/x_ite/Components/NURBS/NurbsTrimmedSurface.js +41 -6
- package/src/x_ite/Components/NURBS/X3DNurbsControlCurveNode.js +2 -4
- package/src/x_ite/Components/NURBS/X3DNurbsSurfaceGeometryNode.js +333 -7
- package/src/x_ite/Components/NURBS/X3DParametricGeometryNode.js +9 -5
- package/src/x_ite/Components/Navigation/Billboard.js +14 -15
- package/src/x_ite/Components/Navigation/Collision.js +13 -12
- package/src/x_ite/Components/Navigation/LOD.js +221 -66
- package/src/x_ite/Components/Navigation/NavigationInfo.js +110 -99
- package/src/x_ite/Components/Navigation/OrthoViewpoint.js +138 -45
- package/src/x_ite/Components/Navigation/Viewpoint.js +55 -33
- package/src/x_ite/Components/Navigation/ViewpointGroup.js +18 -10
- package/src/x_ite/Components/Navigation/X3DViewpointNode.js +241 -181
- package/src/x_ite/Components/Navigation.js +93 -0
- package/src/x_ite/Components/Networking/Anchor.js +24 -28
- package/src/x_ite/Components/Networking/Inline.js +68 -50
- package/src/x_ite/Components/Networking/LoadSensor.js +2 -4
- package/src/x_ite/Components/Networking/X3DNetworkSensorNode.js +2 -4
- package/src/x_ite/Components/Networking/X3DUrlObject.js +93 -11
- package/src/x_ite/Components/Networking.js +84 -0
- package/src/x_ite/Components/ParticleSystems/BoundedPhysicsModel.js +6 -8
- package/src/x_ite/Components/ParticleSystems/ConeEmitter.js +8 -4
- package/src/x_ite/Components/ParticleSystems/ExplosionEmitter.js +7 -4
- package/src/x_ite/Components/ParticleSystems/ForcePhysicsModel.js +4 -4
- package/src/x_ite/Components/ParticleSystems/ParticleSystem.js +451 -287
- package/src/x_ite/Components/ParticleSystems/PointEmitter.js +7 -4
- package/src/x_ite/Components/ParticleSystems/PolylineEmitter.js +53 -40
- package/src/x_ite/Components/ParticleSystems/SurfaceEmitter.js +62 -55
- package/src/x_ite/Components/ParticleSystems/VolumeEmitter.js +133 -123
- package/src/x_ite/Components/ParticleSystems/WindPhysicsModel.js +25 -22
- package/src/x_ite/Components/ParticleSystems/X3DParticleEmitterNode.js +28 -27
- package/src/x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode.js +2 -4
- package/src/x_ite/Components/Picking/LinePickSensor.js +253 -10
- package/src/x_ite/Components/Picking/PickableGroup.js +121 -10
- package/src/x_ite/Components/Picking/PointPickSensor.js +262 -12
- package/src/x_ite/Components/Picking/PrimitivePickSensor.js +176 -8
- package/src/x_ite/Components/Picking/VolumePickSensor.js +152 -8
- package/src/x_ite/Components/Picking/X3DPickSensorNode.js +378 -7
- package/src/x_ite/Components/Picking/X3DPickableObject.js +22 -4
- package/src/x_ite/Components/PointingDeviceSensor/CylinderSensor.js +33 -15
- package/src/x_ite/Components/PointingDeviceSensor/PlaneSensor.js +7 -4
- package/src/x_ite/Components/PointingDeviceSensor/SphereSensor.js +2 -4
- package/src/x_ite/Components/PointingDeviceSensor/TouchSensor.js +4 -4
- package/src/x_ite/Components/PointingDeviceSensor/X3DDragSensorNode.js +4 -4
- package/src/x_ite/Components/PointingDeviceSensor/X3DPointingDeviceSensorNode.js +3 -5
- package/src/x_ite/Components/PointingDeviceSensor/X3DTouchSensorNode.js +2 -4
- package/src/x_ite/Components/PointingDeviceSensor.js +90 -0
- package/src/x_ite/Components/ProjectiveTextureMapping/TextureProjectorParallel.js +282 -0
- package/src/x_ite/Components/ProjectiveTextureMapping/TextureProjectorPerspective.js +227 -0
- package/src/x_ite/Components/ProjectiveTextureMapping/X3DTextureProjectorNode.js +217 -0
- package/src/x_ite/Components/Rendering/ClipPlane.js +12 -16
- package/src/x_ite/Components/Rendering/Color.js +62 -17
- package/src/x_ite/Components/Rendering/ColorRGBA.js +65 -17
- package/src/x_ite/Components/Rendering/Coordinate.js +4 -4
- package/src/x_ite/Components/Rendering/IndexedLineSet.js +68 -81
- package/src/x_ite/Components/Rendering/IndexedTriangleFanSet.js +20 -19
- package/src/x_ite/Components/Rendering/IndexedTriangleSet.js +10 -7
- package/src/x_ite/Components/Rendering/IndexedTriangleStripSet.js +21 -23
- package/src/x_ite/Components/Rendering/LineSet.js +54 -37
- package/src/x_ite/Components/Rendering/Normal.js +65 -13
- package/src/x_ite/Components/Rendering/PointSet.js +52 -33
- package/src/x_ite/Components/Rendering/TriangleFanSet.js +10 -14
- package/src/x_ite/Components/Rendering/TriangleSet.js +2 -4
- package/src/x_ite/Components/Rendering/TriangleStripSet.js +9 -13
- package/src/x_ite/Components/Rendering/X3DColorNode.js +13 -12
- package/src/x_ite/Components/Rendering/X3DComposedGeometryNode.js +118 -79
- package/src/x_ite/Components/Rendering/X3DCoordinateNode.js +103 -44
- package/src/x_ite/Components/Rendering/X3DGeometricPropertyNode.js +2 -4
- package/src/x_ite/Components/Rendering/X3DGeometryNode.js +722 -591
- package/src/x_ite/Components/Rendering/X3DLineGeometryNode.js +129 -92
- package/src/x_ite/Components/Rendering/X3DNormalNode.js +2 -4
- package/src/x_ite/Components/Rendering.js +132 -0
- package/src/x_ite/Components/RigidBodyPhysics/BallJoint.js +116 -7
- package/src/x_ite/Components/RigidBodyPhysics/CollidableOffset.js +199 -11
- package/src/x_ite/Components/RigidBodyPhysics/CollidableShape.js +436 -11
- package/src/x_ite/Components/RigidBodyPhysics/CollisionCollection.js +118 -10
- package/src/x_ite/Components/RigidBodyPhysics/CollisionSensor.js +192 -9
- package/src/x_ite/Components/RigidBodyPhysics/CollisionSpace.js +84 -8
- package/src/x_ite/Components/RigidBodyPhysics/Contact.js +20 -14
- package/src/x_ite/Components/RigidBodyPhysics/DoubleAxisHingeJoint.js +200 -12
- package/src/x_ite/Components/RigidBodyPhysics/MotorJoint.js +14 -4
- package/src/x_ite/Components/RigidBodyPhysics/RigidBody.js +424 -17
- package/src/x_ite/Components/RigidBodyPhysics/RigidBodyCollection.js +295 -19
- package/src/x_ite/Components/RigidBodyPhysics/SingleAxisHingeJoint.js +162 -10
- package/src/x_ite/Components/RigidBodyPhysics/SliderJoint.js +135 -8
- package/src/x_ite/Components/RigidBodyPhysics/UniversalJoint.js +10 -6
- package/src/x_ite/Components/RigidBodyPhysics/X3DNBodyCollidableNode.js +93 -9
- package/src/x_ite/Components/RigidBodyPhysics/X3DNBodyCollisionSpaceNode.js +5 -8
- package/src/x_ite/Components/RigidBodyPhysics/X3DRigidJointNode.js +150 -4
- package/src/x_ite/Components/Scripting/Script.js +156 -105
- package/src/x_ite/Components/Scripting/X3DScriptNode.js +3 -7
- package/src/x_ite/Components/Shaders/ComposedShader.js +38 -53
- package/src/x_ite/Components/Shaders/FloatVertexAttribute.js +38 -15
- package/src/x_ite/Components/Shaders/Matrix3VertexAttribute.js +32 -14
- package/src/x_ite/Components/Shaders/Matrix4VertexAttribute.js +32 -14
- package/src/x_ite/Components/Shaders/PackagedShader.js +19 -17
- package/src/x_ite/Components/Shaders/ProgramShader.js +2 -4
- package/src/x_ite/Components/Shaders/ShaderPart.js +38 -26
- package/src/x_ite/Components/Shaders/ShaderProgram.js +16 -14
- package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +836 -699
- package/src/x_ite/Components/Shaders/X3DShaderNode.js +61 -101
- package/src/x_ite/Components/Shaders/X3DVertexAttributeNode.js +2 -4
- package/src/x_ite/Components/Shaders.js +102 -0
- package/src/x_ite/Components/Shape/Appearance.js +179 -69
- package/src/x_ite/Components/Shape/FillProperties.js +65 -8
- package/src/x_ite/Components/Shape/LineProperties.js +29 -9
- package/src/x_ite/Components/Shape/Material.js +50 -64
- package/src/x_ite/Components/Shape/PointProperties.js +162 -0
- package/src/x_ite/Components/Shape/Shape.js +116 -68
- package/src/x_ite/Components/Shape/TwoSidedMaterial.js +56 -62
- package/src/x_ite/Components/Shape/UnlitMaterial.js +109 -0
- package/src/x_ite/Components/Shape/X3DAppearanceChildNode.js +2 -4
- package/src/x_ite/Components/Shape/X3DAppearanceNode.js +14 -11
- package/src/x_ite/Components/Shape/X3DMaterialNode.js +17 -6
- package/src/x_ite/Components/Shape/X3DOneSidedMaterialNode.js +111 -0
- package/src/x_ite/Components/Shape/X3DShapeNode.js +54 -29
- package/src/x_ite/Components/Shape.js +108 -0
- package/src/x_ite/Components/Sound/AudioClip.js +47 -57
- package/src/x_ite/Components/Sound/Sound.js +177 -83
- package/src/x_ite/Components/Sound/X3DSoundNode.js +2 -4
- package/src/x_ite/Components/Sound/X3DSoundSourceNode.js +38 -24
- package/src/x_ite/Components/Sound.js +81 -0
- package/src/x_ite/Components/Text/FontStyle.js +4 -6
- package/src/x_ite/Components/Text/Text.js +21 -18
- package/src/x_ite/Components/Text/X3DFontStyleNode.js +58 -93
- package/src/x_ite/Components/Text.js +78 -0
- package/src/x_ite/Components/Texturing/ImageTexture.js +57 -67
- package/src/x_ite/Components/Texturing/MovieTexture.js +59 -70
- package/src/x_ite/Components/Texturing/MultiTexture.js +238 -15
- package/src/x_ite/Components/Texturing/MultiTextureCoordinate.js +85 -8
- package/src/x_ite/Components/Texturing/MultiTextureTransform.js +47 -8
- package/src/x_ite/Components/Texturing/PixelTexture.js +61 -27
- package/src/x_ite/Components/Texturing/TextureCoordinate.js +72 -22
- package/src/x_ite/Components/Texturing/TextureCoordinateGenerator.js +69 -11
- package/src/x_ite/Components/Texturing/TextureProperties.js +98 -69
- package/src/x_ite/Components/Texturing/TextureTransform.js +58 -52
- package/src/x_ite/Components/Texturing/X3DSingleTextureCoordinateNode.js +91 -0
- package/src/x_ite/Components/Texturing/X3DSingleTextureNode.js +183 -0
- package/src/x_ite/Components/Texturing/X3DSingleTextureTransformNode.js +77 -0
- package/src/x_ite/Components/Texturing/X3DTexture2DNode.js +42 -97
- package/src/x_ite/Components/Texturing/X3DTexture2DNode.js.~1~ +209 -0
- package/src/x_ite/Components/Texturing/X3DTextureCoordinateNode.js +4 -12
- package/src/x_ite/Components/Texturing/X3DTextureNode.js +10 -71
- package/src/x_ite/Components/Texturing/X3DTextureTransformNode.js +5 -14
- package/src/x_ite/Components/Texturing.js +120 -0
- package/src/x_ite/Components/Texturing3D/ComposedTexture3D.js +90 -8
- package/src/x_ite/Components/Texturing3D/ImageTexture3D.js +106 -16
- package/src/x_ite/Components/Texturing3D/PixelTexture3D.js +126 -8
- package/src/x_ite/Components/Texturing3D/TextureCoordinate3D.js +75 -25
- package/src/x_ite/Components/Texturing3D/TextureCoordinate4D.js +74 -24
- package/src/x_ite/Components/Texturing3D/TextureTransform3D.js +42 -36
- package/src/x_ite/Components/Texturing3D/TextureTransformMatrix3D.js +19 -16
- package/src/x_ite/Components/Texturing3D/X3DTexture3DNode.js +110 -8
- package/src/x_ite/Components/Time/TimeSensor.js +68 -38
- package/src/x_ite/Components/Time/X3DTimeDependentNode.js +29 -29
- package/src/x_ite/Components/Time.js +75 -0
- package/src/x_ite/Components/VolumeRendering/BlendedVolumeStyle.js +311 -12
- package/src/x_ite/Components/VolumeRendering/BoundaryEnhancementVolumeStyle.js +60 -8
- package/src/x_ite/Components/VolumeRendering/CartoonVolumeStyle.js +219 -10
- package/src/x_ite/Components/VolumeRendering/ComposedVolumeStyle.js +134 -7
- package/src/x_ite/Components/VolumeRendering/EdgeEnhancementVolumeStyle.js +88 -9
- package/src/x_ite/Components/VolumeRendering/IsoSurfaceVolumeData.js +311 -15
- package/src/x_ite/Components/VolumeRendering/OpacityMapVolumeStyle.js +87 -7
- package/src/x_ite/Components/VolumeRendering/ProjectionVolumeStyle.js +136 -6
- package/src/x_ite/Components/VolumeRendering/SegmentedVolumeData.js +224 -13
- package/src/x_ite/Components/VolumeRendering/ShadedVolumeStyle.js +193 -12
- package/src/x_ite/Components/VolumeRendering/SilhouetteEnhancementVolumeStyle.js +87 -10
- package/src/x_ite/Components/VolumeRendering/ToneMappedVolumeStyle.js +97 -9
- package/src/x_ite/Components/VolumeRendering/VolumeData.js +155 -12
- package/src/x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode.js +2 -4
- package/src/x_ite/Components/VolumeRendering/X3DVolumeDataNode.js +155 -5
- package/src/x_ite/Components/VolumeRendering/X3DVolumeRenderStyleNode.js +64 -4
- package/src/x_ite/Components/X_ITE/BlendMode.js +206 -0
- package/src/x_ite/Components.js +110 -0
- package/src/x_ite/Configuration/ComponentInfo.js +21 -15
- package/src/x_ite/Configuration/ComponentInfoArray.js +11 -16
- package/src/x_ite/Configuration/ProfileInfo.js +10 -10
- package/src/x_ite/Configuration/ProfileInfoArray.js +10 -3
- package/src/x_ite/Configuration/SupportedComponents.js +312 -303
- package/src/x_ite/Configuration/SupportedNodes.js +44 -716
- package/src/x_ite/Configuration/SupportedProfiles.js +196 -168
- package/src/x_ite/Configuration/UnitInfo.js +22 -8
- package/src/x_ite/Configuration/UnitInfoArray.js +2 -3
- package/src/x_ite/Configuration/X3DInfoArray.js +46 -26
- package/src/x_ite/DEBUG.js +4 -5
- package/src/x_ite/Execution/BindableList.js +99 -34
- package/src/x_ite/Execution/BindableStack.js +65 -74
- package/src/x_ite/Execution/ExportedNode.js +32 -9
- package/src/x_ite/Execution/ImportedNode.js +144 -63
- package/src/x_ite/Execution/Scene.js +33 -35
- package/src/x_ite/Execution/World.js +31 -29
- package/src/x_ite/Execution/X3DExecutionContext.js +452 -194
- package/src/x_ite/Execution/X3DScene.js +303 -74
- package/src/x_ite/{Error.js → Fallback.js} +25 -24
- package/src/x_ite/Fields/ArrayFields.js +315 -112
- package/src/x_ite/Fields/SFBool.js +11 -10
- package/src/x_ite/Fields/SFColor.js +43 -19
- package/src/x_ite/Fields/SFColorRGBA.js +40 -18
- package/src/x_ite/Fields/SFDouble.js +17 -10
- package/src/x_ite/Fields/SFFloat.js +18 -11
- package/src/x_ite/Fields/SFImage.js +47 -38
- package/src/x_ite/Fields/SFInt32.js +10 -9
- package/src/x_ite/Fields/SFMatrix3.js +24 -17
- package/src/x_ite/Fields/SFMatrix4.js +24 -17
- package/src/x_ite/Fields/SFMatrixPrototypeTemplate.js +15 -8
- package/src/x_ite/Fields/SFNode.js +119 -39
- package/src/x_ite/Fields/SFNodeCache.js +89 -0
- package/src/x_ite/Fields/SFRotation.js +42 -27
- package/src/x_ite/Fields/SFString.js +14 -15
- package/src/x_ite/Fields/SFTime.js +12 -11
- package/src/x_ite/Fields/SFVec2.js +17 -14
- package/src/x_ite/Fields/SFVec3.js +23 -17
- package/src/x_ite/Fields/SFVec4.js +25 -19
- package/src/x_ite/Fields/SFVecPrototypeTemplate.js +51 -19
- package/src/x_ite/Fields.js +3 -9
- package/src/x_ite/InputOutput/FileLoader.js +264 -181
- package/src/x_ite/InputOutput/Generator.js +136 -60
- package/src/x_ite/Parser/HTMLSupport.js +3 -596
- package/src/x_ite/Parser/JSONParser.js +446 -0
- package/src/x_ite/Parser/Parser.js +617 -652
- package/src/x_ite/Parser/X3DParser.js +176 -0
- package/src/x_ite/Parser/XMLParser.js +359 -94
- package/src/x_ite/Prototype/ExternProtoDeclarationArray.js +19 -3
- package/src/x_ite/Prototype/ProtoDeclarationArray.js +19 -3
- package/src/x_ite/Prototype/X3DExternProtoDeclaration.js +120 -61
- package/src/x_ite/Prototype/X3DProtoDeclaration.js +144 -59
- package/src/x_ite/Prototype/X3DProtoDeclarationNode.js +16 -18
- package/src/x_ite/Rendering/DependentRenderer.js +9 -13
- package/src/x_ite/Rendering/{DepthBuffer.js → TextureBuffer.js} +84 -53
- package/src/x_ite/Rendering/X3DRenderObject.js +640 -531
- package/src/x_ite/Routing/RouteArray.js +38 -16
- package/src/x_ite/Routing/X3DRoute.js +67 -68
- package/src/x_ite/Routing/X3DRoutingContext.js +6 -6
- package/src/x_ite/X3D.js +74 -70
- package/src/x_ite.config.js +91 -0
- package/src/x_ite.css +175 -53
- package/src/x_ite.html +128 -439
- package/src/x_ite.js +87 -25
- package/tests/{SEE.txt → README.md} +1 -0
- package/tests/tests.mdproj +1 -1
- package/x_ite.min.html +128 -439
- package/.bzrignore +0 -3
- package/.npmignore +0 -3
- package/AUTHORS.md +0 -6
- package/STYLE_GUIDE.md +0 -51
- package/X_ITE.sln +0 -56
- package/X_ITE.userprefs +0 -13
- package/build/build.mdproj +0 -24
- package/build/dist.pl +0 -97
- package/build/parts/end.frag +0 -10
- package/build/parts/start.frag +0 -7
- package/dist/LICENCES.txt +0 -344
- package/dist/dist.mdproj +0 -45
- package/dist/images/logo.128.png +0 -0
- package/fonts/fonts.mdproj +0 -29
- package/meta/meta.mdproj +0 -35
- package/require.build.js +0 -15
- package/require.build.min.js +0 -15
- package/src/images/logo.128.png +0 -0
- package/src/lib/jquery-contextMenu/README.md +0 -355
- package/src/lib/jquery-contextMenu/dist/images/cut.png +0 -0
- package/src/lib/jquery-contextMenu/dist/images/door.png +0 -0
- package/src/lib/jquery-contextMenu/dist/images/page_white_add.png +0 -0
- package/src/lib/jquery-contextMenu/dist/images/page_white_copy.png +0 -0
- package/src/lib/jquery-contextMenu/dist/images/page_white_delete.png +0 -0
- package/src/lib/jquery-contextMenu/dist/images/page_white_edit.png +0 -0
- package/src/lib/jquery-contextMenu/dist/images/page_white_paste.png +0 -0
- package/src/lib/jquery-contextMenu/dist/jquery.contextMenu.css +0 -155
- package/src/lib/jquery-contextMenu/dist/jquery.contextMenu.js +0 -1811
- package/src/lib/jquery-contextMenu/dist/jquery.contextMenu.min.css +0 -16
- package/src/lib/jquery-contextMenu/dist/jquery.contextMenu.min.css.map +0 -1
- package/src/lib/jquery-contextMenu/dist/jquery.contextMenu.min.js +0 -18
- package/src/lib/jquery-contextMenu/dist/jquery.contextMenu.min.js.map +0 -1
- package/src/lib/jquery-contextMenu/dist/jquery.ui.position.js +0 -517
- package/src/lib/jquery-contextMenu/dist/jquery.ui.position.min.js +0 -4
- package/src/lib/jquery-contextMenu/package.json +0 -99
- package/src/lib/opentype.js/.npmignore +0 -5
- package/src/locale/de.mo +0 -0
- package/src/locale/fr.mo +0 -0
- package/src/require.config.js +0 -51
- package/src/src.mdproj +0 -729
- package/src/standard/Networking/URI.js +0 -687
- package/src/x_ite/Browser/Shaders/BackgroundSphereFragmentShader.fs +0 -29
- package/src/x_ite/Browser/Shaders/BackgroundSphereVertexShader.vs +0 -22
- package/src/x_ite/Browser/Shaders/Bits/Line3.h +0 -14
- package/src/x_ite/Browser/Shaders/Bits/Plane3.h +0 -47
- package/src/x_ite/Browser/Shaders/Bits/Random.h +0 -31
- package/src/x_ite/Browser/Shaders/Depth.fs +0 -51
- package/src/x_ite/Browser/Shaders/Depth.vs +0 -20
- package/src/x_ite/Browser/Shaders/Gouraud.fs +0 -110
- package/src/x_ite/Browser/Shaders/Gouraud.vs +0 -188
- package/src/x_ite/Browser/Shaders/Phong.fs +0 -255
- package/src/x_ite/Browser/Shaders/Phong.vs +0 -38
- package/src/x_ite/Browser/Shaders/PointSet.fs +0 -64
- package/src/x_ite/Browser/Shaders/Wireframe.fs +0 -61
- package/src/x_ite/Browser/Shaders/Wireframe.vs +0 -55
- package/src/x_ite/Components/H-Anim/HAnimHumanoid.js +0 -118
|
@@ -48,62 +48,78 @@
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
define ([
|
|
51
|
-
"jquery",
|
|
52
|
-
"x_ite/Fields",
|
|
53
51
|
"x_ite/Bits/X3DCast",
|
|
54
52
|
"x_ite/Bits/X3DConstants",
|
|
53
|
+
"x_ite/Components/Navigation/OrthoViewpoint",
|
|
55
54
|
"standard/Math/Numbers/Matrix3",
|
|
56
55
|
],
|
|
57
|
-
function (
|
|
58
|
-
Fields,
|
|
59
|
-
X3DCast,
|
|
56
|
+
function (X3DCast,
|
|
60
57
|
X3DConstants,
|
|
58
|
+
OrthoViewpoint,
|
|
61
59
|
Matrix3)
|
|
62
60
|
{
|
|
63
61
|
"use strict";
|
|
64
62
|
|
|
65
|
-
var
|
|
66
|
-
matrix3 = new Matrix3 (),
|
|
67
|
-
NULL = new Fields .SFNode ();
|
|
68
|
-
|
|
69
63
|
function X3DProgrammableShaderObject (executionContext)
|
|
70
64
|
{
|
|
71
65
|
this .addType (X3DConstants .X3DProgrammableShaderObject);
|
|
72
66
|
|
|
73
|
-
this .x3d_ClipPlane
|
|
74
|
-
this .x3d_LightType
|
|
75
|
-
this .x3d_LightOn
|
|
76
|
-
this .x3d_LightColor
|
|
77
|
-
this .x3d_LightIntensity
|
|
78
|
-
this .x3d_LightAmbientIntensity
|
|
79
|
-
this .x3d_LightAttenuation
|
|
80
|
-
this .x3d_LightLocation
|
|
81
|
-
this .x3d_LightDirection
|
|
82
|
-
this .x3d_LightBeamWidth
|
|
83
|
-
this .x3d_LightCutOffAngle
|
|
84
|
-
this .x3d_LightRadius
|
|
85
|
-
this .
|
|
86
|
-
this .
|
|
87
|
-
this .x3d_ShadowColor
|
|
88
|
-
this .
|
|
89
|
-
this .
|
|
67
|
+
this .x3d_ClipPlane = [ ];
|
|
68
|
+
this .x3d_LightType = [ ];
|
|
69
|
+
this .x3d_LightOn = [ ];
|
|
70
|
+
this .x3d_LightColor = [ ];
|
|
71
|
+
this .x3d_LightIntensity = [ ];
|
|
72
|
+
this .x3d_LightAmbientIntensity = [ ];
|
|
73
|
+
this .x3d_LightAttenuation = [ ];
|
|
74
|
+
this .x3d_LightLocation = [ ];
|
|
75
|
+
this .x3d_LightDirection = [ ];
|
|
76
|
+
this .x3d_LightBeamWidth = [ ];
|
|
77
|
+
this .x3d_LightCutOffAngle = [ ];
|
|
78
|
+
this .x3d_LightRadius = [ ];
|
|
79
|
+
this .x3d_LightMatrix = [ ];
|
|
80
|
+
this .x3d_ShadowIntensity = [ ];
|
|
81
|
+
this .x3d_ShadowColor = [ ];
|
|
82
|
+
this .x3d_ShadowBias = [ ];
|
|
83
|
+
this .x3d_ShadowMatrix = [ ];
|
|
84
|
+
this .x3d_ShadowMapSize = [ ];
|
|
85
|
+
this .x3d_ShadowMap = [ ];
|
|
86
|
+
this .x3d_TextureType = [ ];
|
|
87
|
+
this .x3d_Texture2D = [ ];
|
|
88
|
+
this .x3d_Texture3D = [ ];
|
|
89
|
+
this .x3d_CubeMapTexture = [ ];
|
|
90
|
+
this .x3d_MultiTextureMode = [ ];
|
|
91
|
+
this .x3d_MultiTextureAlphaMode = [ ];
|
|
92
|
+
this .x3d_MultiTextureSource = [ ];
|
|
93
|
+
this .x3d_MultiTextureFunction = [ ];
|
|
94
|
+
this .x3d_TextureCoordinateGeneratorMode = [ ];
|
|
95
|
+
this .x3d_TextureCoordinateGeneratorParameter = [ ];
|
|
96
|
+
this .x3d_ProjectiveTexture = [ ];
|
|
97
|
+
this .x3d_ProjectiveTextureMatrix = [ ];
|
|
98
|
+
this .x3d_ProjectiveTextureLocation = [ ];
|
|
99
|
+
this .x3d_TexCoord = [ ];
|
|
100
|
+
this .x3d_TextureMatrix = [ ];
|
|
101
|
+
|
|
102
|
+
this .numClipPlanes = 0;
|
|
103
|
+
this .fogNode = null;
|
|
104
|
+
this .numLights = 0;
|
|
105
|
+
this .numGlobalLights = 0;
|
|
106
|
+
this .lightNodes = [ ];
|
|
107
|
+
this .numProjectiveTextures = 0;
|
|
108
|
+
this .numGlobalProjectiveTextures = 0;
|
|
109
|
+
this .projectiveTextureNodes = [ ];
|
|
110
|
+
this .textures = new Map ();
|
|
90
111
|
}
|
|
91
112
|
|
|
92
113
|
X3DProgrammableShaderObject .prototype =
|
|
93
114
|
{
|
|
94
115
|
constructor: X3DProgrammableShaderObject,
|
|
95
|
-
x3d_NoneClipPlane: new Float32Array ([ 88, 51, 68, 33 ]), // X3D!
|
|
96
|
-
numGlobalLights: 0,
|
|
97
|
-
normalMatrixArray: new Float32Array (9),
|
|
98
116
|
initialize: function ()
|
|
99
117
|
{
|
|
100
|
-
|
|
118
|
+
const browser = this .getBrowser ();
|
|
101
119
|
|
|
102
120
|
this .x3d_MaxClipPlanes = browser .getMaxClipPlanes ();
|
|
103
121
|
this .x3d_MaxLights = browser .getMaxLights ();
|
|
104
122
|
this .x3d_MaxTextures = browser .getMaxTextures ();
|
|
105
|
-
|
|
106
|
-
this .textureTypeArray = new Int32Array (this .x3d_MaxTextures);
|
|
107
123
|
},
|
|
108
124
|
hasUserDefinedFields: function ()
|
|
109
125
|
{
|
|
@@ -111,94 +127,152 @@ function ($,
|
|
|
111
127
|
},
|
|
112
128
|
bindAttributeLocations: function (gl, program)
|
|
113
129
|
{
|
|
114
|
-
gl .bindAttribLocation (program, 3, "x3d_Color");
|
|
115
|
-
gl .bindAttribLocation (program, 2, "x3d_TexCoord");
|
|
116
|
-
gl .bindAttribLocation (program, 1, "x3d_Normal");
|
|
117
130
|
gl .bindAttribLocation (program, 0, "x3d_Vertex");
|
|
118
131
|
},
|
|
119
132
|
getDefaultUniforms: function ()
|
|
120
133
|
{
|
|
121
134
|
// Get uniforms and attributes.
|
|
122
135
|
|
|
123
|
-
|
|
124
|
-
|
|
136
|
+
const
|
|
137
|
+
browser = this .getBrowser (),
|
|
138
|
+
gl = browser .getContext (),
|
|
125
139
|
program = this .getProgram ();
|
|
126
140
|
|
|
127
|
-
this .
|
|
141
|
+
this .x3d_LogarithmicFarFactor1_2 = gl .getUniformLocation (program, "x3d_LogarithmicFarFactor1_2");
|
|
142
|
+
|
|
143
|
+
this .x3d_GeometryType = gl .getUniformLocation (program, "x3d_GeometryType");
|
|
144
|
+
this .x3d_NumClipPlanes = gl .getUniformLocation (program, "x3d_NumClipPlanes");
|
|
145
|
+
|
|
146
|
+
this .x3d_ClipPlanes = gl .getUniformLocation (program, "x3d_ClipPlane");
|
|
147
|
+
|
|
148
|
+
for (let i = 0; i < this .x3d_MaxClipPlanes; ++ i)
|
|
149
|
+
this .x3d_ClipPlane [i] = gl .getUniformLocation (program, "x3d_ClipPlane[" + i + "]");
|
|
150
|
+
|
|
151
|
+
this .x3d_FogType = this .getUniformLocation (gl, program, "x3d_Fog.type", "x3d_FogType");
|
|
152
|
+
this .x3d_FogColor = this .getUniformLocation (gl, program, "x3d_Fog.color", "x3d_FogColor");
|
|
153
|
+
this .x3d_FogVisibilityRange = this .getUniformLocation (gl, program, "x3d_Fog.visibilityRange", "x3d_FogVisibilityRange");
|
|
154
|
+
this .x3d_FogMatrix = this .getUniformLocation (gl, program, "x3d_Fog.matrix", "x3d_FogMatrix");
|
|
155
|
+
this .x3d_FogCoord = this .getUniformLocation (gl, program, "x3d_Fog.fogCoord", "x3d_FogCoord");
|
|
128
156
|
|
|
129
|
-
|
|
130
|
-
this .x3d_ClipPlane [i] = gl .getUniformLocation (program, "x3d_ClipPlane[" + i + "]");
|
|
157
|
+
this .x3d_AlphaCutoff = gl .getUniformLocation (program, "x3d_AlphaCutoff");
|
|
131
158
|
|
|
132
|
-
this .
|
|
133
|
-
this .
|
|
134
|
-
this .
|
|
159
|
+
this .x3d_PointPropertiesPointSizeScaleFactor = gl .getUniformLocation (program, "x3d_PointProperties.pointSizeScaleFactor");
|
|
160
|
+
this .x3d_PointPropertiesPointSizeMinValue = gl .getUniformLocation (program, "x3d_PointProperties.pointSizeMinValue");
|
|
161
|
+
this .x3d_PointPropertiesPointSizeMaxValue = gl .getUniformLocation (program, "x3d_PointProperties.pointSizeMaxValue");
|
|
162
|
+
this .x3d_PointPropertiesPointSizeAttenuation = gl .getUniformLocation (program, "x3d_PointProperties.pointSizeAttenuation");
|
|
163
|
+
this .x3d_PointPropertiesColorMode = gl .getUniformLocation (program, "x3d_PointProperties.colorMode");
|
|
135
164
|
|
|
136
|
-
this .
|
|
165
|
+
this .x3d_LinePropertiesApplied = gl .getUniformLocation (program, "x3d_LineProperties.applied");
|
|
166
|
+
this .x3d_LinePropertiesLinewidthScaleFactor = this .getUniformLocation (gl, program, "x3d_LineProperties.linewidthScaleFactor", "x3d_LinewidthScaleFactor");
|
|
167
|
+
this .x3d_LinePropertiesLinetype = gl .getUniformLocation (program, "x3d_LineProperties.linetype");
|
|
168
|
+
|
|
169
|
+
this .x3d_FillPropertiesFilled = gl .getUniformLocation (program, "x3d_FillProperties.filled");
|
|
170
|
+
this .x3d_FillPropertiesHatched = gl .getUniformLocation (program, "x3d_FillProperties.hatched");
|
|
171
|
+
this .x3d_FillPropertiesHatchColor = gl .getUniformLocation (program, "x3d_FillProperties.hatchColor");
|
|
172
|
+
this .x3d_FillPropertiesHatchStyle = gl .getUniformLocation (program, "x3d_FillProperties.hatchStyle");
|
|
137
173
|
|
|
138
|
-
this .x3d_Lighting = gl .getUniformLocation (program, "x3d_Lighting");
|
|
139
174
|
this .x3d_ColorMaterial = gl .getUniformLocation (program, "x3d_ColorMaterial");
|
|
175
|
+
this .x3d_NumLights = gl .getUniformLocation (program, "x3d_NumLights");
|
|
140
176
|
|
|
141
|
-
for (
|
|
177
|
+
for (let i = 0; i < this .x3d_MaxLights; ++ i)
|
|
142
178
|
{
|
|
143
|
-
this .x3d_LightType [i] =
|
|
144
|
-
this .x3d_LightColor [i] =
|
|
145
|
-
this .x3d_LightAmbientIntensity [i] =
|
|
146
|
-
this .x3d_LightIntensity [i] =
|
|
147
|
-
this .x3d_LightAttenuation [i] =
|
|
148
|
-
this .x3d_LightLocation [i] =
|
|
149
|
-
this .x3d_LightDirection [i] =
|
|
150
|
-
this .x3d_LightBeamWidth [i] =
|
|
151
|
-
this .x3d_LightCutOffAngle [i] =
|
|
152
|
-
this .x3d_LightRadius [i] =
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
this .
|
|
156
|
-
this .x3d_ShadowColor [i] = gl .getUniformLocation (program, "
|
|
157
|
-
this .
|
|
179
|
+
this .x3d_LightType [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].type", "x3d_LightType[" + i + "]");
|
|
180
|
+
this .x3d_LightColor [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].color", "x3d_LightColor[" + i + "]");
|
|
181
|
+
this .x3d_LightAmbientIntensity [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].ambientIntensity", "x3d_LightAmbientIntensity[" + i + "]");
|
|
182
|
+
this .x3d_LightIntensity [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].intensity", "x3d_LightIntensity[" + i + "]");
|
|
183
|
+
this .x3d_LightAttenuation [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].attenuation", "x3d_LightAttenuation[" + i + "]");
|
|
184
|
+
this .x3d_LightLocation [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].location", "x3d_LightLocation[" + i + "]");
|
|
185
|
+
this .x3d_LightDirection [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].direction", "x3d_LightDirection[" + i + "]");
|
|
186
|
+
this .x3d_LightBeamWidth [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].beamWidth", "x3d_LightBeamWidth[" + i + "]");
|
|
187
|
+
this .x3d_LightCutOffAngle [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].cutOffAngle", "x3d_LightCutOffAngle[" + i + "]");
|
|
188
|
+
this .x3d_LightRadius [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].radius", "x3d_LightRadius[" + i + "]");
|
|
189
|
+
this .x3d_LightMatrix [i] = this .getUniformLocation (gl, program, "x3d_LightSource[" + i + "].matrix", "x3d_LightMatrix[" + i + "]");
|
|
190
|
+
|
|
191
|
+
this .x3d_ShadowIntensity [i] = gl .getUniformLocation (program, "x3d_LightSource[" + i + "].shadowIntensity");
|
|
192
|
+
this .x3d_ShadowColor [i] = gl .getUniformLocation (program, "x3d_LightSource[" + i + "].shadowColor");
|
|
193
|
+
this .x3d_ShadowBias [i] = gl .getUniformLocation (program, "x3d_LightSource[" + i + "].shadowBias");
|
|
194
|
+
this .x3d_ShadowMatrix [i] = gl .getUniformLocation (program, "x3d_LightSource[" + i + "].shadowMatrix");
|
|
195
|
+
this .x3d_ShadowMapSize [i] = gl .getUniformLocation (program, "x3d_LightSource[" + i + "].shadowMapSize");
|
|
158
196
|
this .x3d_ShadowMap [i] = gl .getUniformLocation (program, "x3d_ShadowMap[" + i + "]");
|
|
159
197
|
}
|
|
160
198
|
|
|
161
|
-
this .
|
|
162
|
-
|
|
163
|
-
this .
|
|
164
|
-
this .
|
|
165
|
-
this .
|
|
166
|
-
this .
|
|
167
|
-
|
|
168
|
-
this .
|
|
169
|
-
|
|
170
|
-
this .
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
199
|
+
this .x3d_AmbientIntensity = this .getUniformLocation (gl, program, "x3d_Material.ambientIntensity", "x3d_FrontMaterial.ambientIntensity");
|
|
200
|
+
this .x3d_DiffuseColor = this .getUniformLocation (gl, program, "x3d_Material.diffuseColor", "x3d_FrontMaterial.diffuseColor");
|
|
201
|
+
this .x3d_SpecularColor = this .getUniformLocation (gl, program, "x3d_Material.specularColor", "x3d_FrontMaterial.specularColor");
|
|
202
|
+
this .x3d_EmissiveColor = this .getUniformLocation (gl, program, "x3d_Material.emissiveColor", "x3d_FrontMaterial.emissiveColor");
|
|
203
|
+
this .x3d_Shininess = this .getUniformLocation (gl, program, "x3d_Material.shininess", "x3d_FrontMaterial.shininess");
|
|
204
|
+
this .x3d_Transparency = this .getUniformLocation (gl, program, "x3d_Material.transparency", "x3d_FrontMaterial.transparency");
|
|
205
|
+
|
|
206
|
+
this .x3d_NumTextures = gl .getUniformLocation (program, "x3d_NumTextures");
|
|
207
|
+
this .x3d_NumProjectiveTextures = gl .getUniformLocation (program, "x3d_NumProjectiveTextures");
|
|
208
|
+
this .x3d_MultiTextureColor = gl .getUniformLocation (program, "x3d_MultiTextureColor");
|
|
209
|
+
|
|
210
|
+
for (let i = 0; i < this .x3d_MaxTextures; ++ i)
|
|
211
|
+
{
|
|
212
|
+
this .x3d_TextureType [i] = gl .getUniformLocation (program, "x3d_TextureType[" + i + "]");
|
|
213
|
+
this .x3d_Texture2D [i] = gl .getUniformLocation (program, "x3d_Texture2D[" + i + "]");
|
|
214
|
+
this .x3d_Texture3D [i] = gl .getUniformLocation (program, "x3d_Texture3D[" + i + "]");
|
|
215
|
+
this .x3d_CubeMapTexture [i] = gl .getUniformLocation (program, "x3d_CubeMapTexture[" + i + "]");
|
|
216
|
+
|
|
217
|
+
this .x3d_MultiTextureMode [i] = gl .getUniformLocation (program, "x3d_MultiTexture[" + i + "].mode");
|
|
218
|
+
this .x3d_MultiTextureAlphaMode [i] = gl .getUniformLocation (program, "x3d_MultiTexture[" + i + "].alphaMode");
|
|
219
|
+
this .x3d_MultiTextureSource [i] = gl .getUniformLocation (program, "x3d_MultiTexture[" + i + "].source");
|
|
220
|
+
this .x3d_MultiTextureFunction [i] = gl .getUniformLocation (program, "x3d_MultiTexture[" + i + "].function");
|
|
221
|
+
|
|
222
|
+
this .x3d_TextureCoordinateGeneratorMode [i] = gl .getUniformLocation (program, "x3d_TextureCoordinateGenerator[" + i + "].mode");
|
|
223
|
+
this .x3d_TextureCoordinateGeneratorParameter [i] = gl .getUniformLocation (program, "x3d_TextureCoordinateGenerator[" + i + "].parameter");
|
|
224
|
+
|
|
225
|
+
this .x3d_ProjectiveTexture [i] = gl .getUniformLocation (program, "x3d_ProjectiveTexture[" + i + "]");
|
|
226
|
+
this .x3d_ProjectiveTextureMatrix [i] = gl .getUniformLocation (program, "x3d_ProjectiveTextureMatrix[" + i + "]");
|
|
227
|
+
this .x3d_ProjectiveTextureLocation [i] = gl .getUniformLocation (program, "x3d_ProjectiveTextureLocation[" + i + "]");
|
|
228
|
+
|
|
229
|
+
this .x3d_TextureMatrix [i] = gl .getUniformLocation (program, "x3d_TextureMatrix[" + i + "]");
|
|
230
|
+
this .x3d_TexCoord [i] = this .getAttribLocation (gl, program, "x3d_TexCoord" + i, i ? "" : "x3d_TexCoord");
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
this .x3d_Viewport = gl .getUniformLocation (program, "x3d_Viewport");
|
|
234
|
+
this .x3d_ProjectionMatrix = gl .getUniformLocation (program, "x3d_ProjectionMatrix");
|
|
235
|
+
this .x3d_ModelViewMatrix = gl .getUniformLocation (program, "x3d_ModelViewMatrix");
|
|
236
|
+
this .x3d_NormalMatrix = gl .getUniformLocation (program, "x3d_NormalMatrix");
|
|
237
|
+
this .x3d_CameraSpaceMatrix = gl .getUniformLocation (program, "x3d_CameraSpaceMatrix");
|
|
238
|
+
|
|
239
|
+
this .x3d_FogDepth = gl .getAttribLocation (program, "x3d_FogDepth");
|
|
189
240
|
this .x3d_Color = gl .getAttribLocation (program, "x3d_Color");
|
|
190
|
-
this .x3d_TexCoord = gl .getAttribLocation (program, "x3d_TexCoord");
|
|
191
241
|
this .x3d_Normal = gl .getAttribLocation (program, "x3d_Normal");
|
|
192
|
-
this .x3d_Vertex = gl .getAttribLocation (program, "x3d_Vertex");
|
|
242
|
+
this .x3d_Vertex = gl .getAttribLocation (program, "x3d_Vertex");
|
|
243
|
+
|
|
244
|
+
this .x3d_ParticleId = gl .getUniformLocation (program, "x3d_Particle.id");
|
|
245
|
+
this .x3d_ParticleLife = gl .getUniformLocation (program, "x3d_Particle.life");
|
|
246
|
+
this .x3d_ParticleElapsedTime = gl .getUniformLocation (program, "x3d_Particle.elapsedTime");
|
|
247
|
+
|
|
248
|
+
// Fill special uniforms with default values, textures for units are created in X3DTexturingContext.
|
|
193
249
|
|
|
194
|
-
gl .
|
|
195
|
-
gl .
|
|
196
|
-
gl .
|
|
197
|
-
gl .uniform1iv (this .x3d_Texture2D,
|
|
198
|
-
gl .uniform1iv (this .x3d_CubeMapTexture,
|
|
250
|
+
gl .uniform1i (this .x3d_LinePropertiesLinetype, browser .getLinetypeUnit ());
|
|
251
|
+
gl .uniform1i (this .x3d_FillPropertiesHatchStyle, browser .getHatchStyleUnit ());
|
|
252
|
+
gl .uniform1i (this .x3d_NumTextures, 0);
|
|
253
|
+
gl .uniform1iv (this .x3d_Texture2D [0], browser .getTexture2DUnits ());
|
|
254
|
+
gl .uniform1iv (this .x3d_CubeMapTexture [0], browser .getCubeMapTextureUnits ());
|
|
255
|
+
gl .uniform1iv (this .x3d_ShadowMap [0], new Int32Array (this .x3d_MaxLights) .fill (browser .getShadowTextureUnit ()));
|
|
256
|
+
|
|
257
|
+
if (browser .getProjectiveTextureMapping ())
|
|
258
|
+
gl .uniform1iv (this .x3d_ProjectiveTexture [0], browser .getProjectiveTextureUnits ());
|
|
259
|
+
|
|
260
|
+
if (gl .getVersion () >= 2)
|
|
261
|
+
gl .uniform1iv (this .x3d_Texture3D [0], browser .getTexture3DUnits ());
|
|
199
262
|
|
|
200
263
|
// Return true if valid, otherwise false.
|
|
201
264
|
|
|
265
|
+
if (this .x3d_FogDepth < 0)
|
|
266
|
+
{
|
|
267
|
+
this .enableFogDepthAttribute = Function .prototype;
|
|
268
|
+
this .disableFogDepthAttribute = Function .prototype;
|
|
269
|
+
}
|
|
270
|
+
else
|
|
271
|
+
{
|
|
272
|
+
delete this .enableFogDepthAttribute;
|
|
273
|
+
delete this .disableFogDepthAttribute;
|
|
274
|
+
}
|
|
275
|
+
|
|
202
276
|
if (this .x3d_Color < 0)
|
|
203
277
|
{
|
|
204
278
|
this .enableColorAttribute = Function .prototype;
|
|
@@ -210,15 +284,15 @@ function ($,
|
|
|
210
284
|
delete this .disableColorAttribute;
|
|
211
285
|
}
|
|
212
286
|
|
|
213
|
-
if (this .x3d_TexCoord
|
|
287
|
+
if (this .x3d_TexCoord .some (function (location) { return location >= 0; }))
|
|
214
288
|
{
|
|
215
|
-
this .enableTexCoordAttribute
|
|
216
|
-
this .disableTexCoordAttribute
|
|
289
|
+
delete this .enableTexCoordAttribute;
|
|
290
|
+
delete this .disableTexCoordAttribute;
|
|
217
291
|
}
|
|
218
292
|
else
|
|
219
293
|
{
|
|
220
|
-
|
|
221
|
-
|
|
294
|
+
this .enableTexCoordAttribute = Function .prototype;
|
|
295
|
+
this .disableTexCoordAttribute = Function .prototype;
|
|
222
296
|
}
|
|
223
297
|
|
|
224
298
|
if (this .x3d_Normal < 0)
|
|
@@ -233,22 +307,79 @@ function ($,
|
|
|
233
307
|
}
|
|
234
308
|
|
|
235
309
|
if (this .x3d_Vertex < 0)
|
|
310
|
+
{
|
|
311
|
+
if (gl .getVersion () >= 2)
|
|
312
|
+
console .warn ("Missing »in vec4 x3d_Vertex;«.");
|
|
313
|
+
else
|
|
314
|
+
console .warn ("Missing »attribute vec4 x3d_Vertex;«.");
|
|
315
|
+
|
|
236
316
|
return false;
|
|
317
|
+
}
|
|
237
318
|
|
|
238
319
|
return true;
|
|
239
320
|
},
|
|
321
|
+
getUniformLocation: function (gl, program, name, depreciated)
|
|
322
|
+
{
|
|
323
|
+
// Legacy function to get uniform location.
|
|
324
|
+
|
|
325
|
+
let location = gl .getUniformLocation (program, name);
|
|
326
|
+
|
|
327
|
+
if (location)
|
|
328
|
+
return location;
|
|
329
|
+
|
|
330
|
+
// Look for depreciated location.
|
|
331
|
+
|
|
332
|
+
if (depreciated)
|
|
333
|
+
{
|
|
334
|
+
location = gl .getUniformLocation (program, depreciated);
|
|
335
|
+
|
|
336
|
+
if (location)
|
|
337
|
+
{
|
|
338
|
+
console .warn (this .getTypeName (), this .getName (), "Using uniform location name »" + depreciated + "« is depreciated, use »" + name + "«. See https://create3000.github.io/x_ite/Custom-Shaders.html.");
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
return location;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
return 0;
|
|
345
|
+
},
|
|
346
|
+
getAttribLocation: function (gl, program, name, depreciated)
|
|
347
|
+
{
|
|
348
|
+
// Legacy function to get uniform location.
|
|
349
|
+
|
|
350
|
+
let location = gl .getAttribLocation (program, name);
|
|
351
|
+
|
|
352
|
+
if (location >= 0)
|
|
353
|
+
return location;
|
|
354
|
+
|
|
355
|
+
// Look for depreciated location.
|
|
356
|
+
|
|
357
|
+
if (depreciated)
|
|
358
|
+
{
|
|
359
|
+
location = gl .getAttribLocation (program, depreciated);
|
|
360
|
+
|
|
361
|
+
if (location >= 0)
|
|
362
|
+
{
|
|
363
|
+
console .warn (this .getTypeName (), this .getName (), "Using attribute location name »" + depreciated + "« is depreciated, use »" + name + "«. See https://create3000.github.io/x_ite/Custom-Shaders.html.");
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
return location;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
return -1;
|
|
370
|
+
},
|
|
240
371
|
addShaderFields: function ()
|
|
241
372
|
{
|
|
242
|
-
|
|
373
|
+
const
|
|
243
374
|
gl = this .getBrowser () .getContext (),
|
|
244
375
|
program = this .getProgram (),
|
|
245
376
|
userDefinedFields = this .getUserDefinedFields ();
|
|
246
377
|
|
|
247
|
-
|
|
378
|
+
this .textures .clear ();
|
|
379
|
+
|
|
380
|
+
userDefinedFields .forEach (function (field)
|
|
248
381
|
{
|
|
249
|
-
|
|
250
|
-
field = userDefinedFields [name],
|
|
251
|
-
location = gl .getUniformLocation (program, name);
|
|
382
|
+
const location = gl .getUniformLocation (program, field .getName ());
|
|
252
383
|
|
|
253
384
|
if (location)
|
|
254
385
|
{
|
|
@@ -276,6 +407,10 @@ function ($,
|
|
|
276
407
|
location .array = new Float32Array (16);
|
|
277
408
|
break;
|
|
278
409
|
}
|
|
410
|
+
case X3DConstants .SFNode:
|
|
411
|
+
{
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
279
414
|
case X3DConstants .MFBool:
|
|
280
415
|
case X3DConstants .MFInt32:
|
|
281
416
|
{
|
|
@@ -309,16 +444,16 @@ function ($,
|
|
|
309
444
|
}
|
|
310
445
|
case X3DConstants .MFNode:
|
|
311
446
|
{
|
|
312
|
-
|
|
447
|
+
const locations = location .locations = [ ];
|
|
313
448
|
|
|
314
|
-
for (
|
|
449
|
+
for (let i = 0;; ++ i)
|
|
315
450
|
{
|
|
316
|
-
|
|
451
|
+
const l = gl .getUniformLocation (program, field .getName () + "[" + i + "]");
|
|
317
452
|
|
|
318
|
-
if (
|
|
319
|
-
array [i] = location;
|
|
320
|
-
else
|
|
453
|
+
if (! l)
|
|
321
454
|
break;
|
|
455
|
+
|
|
456
|
+
locations .push (l);
|
|
322
457
|
}
|
|
323
458
|
|
|
324
459
|
break;
|
|
@@ -347,523 +482,452 @@ function ($,
|
|
|
347
482
|
|
|
348
483
|
this .set_field__ (field);
|
|
349
484
|
}
|
|
350
|
-
}
|
|
485
|
+
},
|
|
486
|
+
this);
|
|
351
487
|
},
|
|
352
488
|
removeShaderFields: function ()
|
|
353
489
|
{
|
|
354
|
-
|
|
355
|
-
gl = this .getBrowser () .getContext (),
|
|
356
|
-
program = this .getProgram (),
|
|
357
|
-
userDefinedFields = this .getUserDefinedFields ();
|
|
490
|
+
const userDefinedFields = this .getUserDefinedFields ();
|
|
358
491
|
|
|
359
|
-
|
|
492
|
+
userDefinedFields .forEach (function (field)
|
|
360
493
|
{
|
|
361
|
-
var field = userDefinedFields [name];
|
|
362
|
-
|
|
363
494
|
field .removeInterest ("set_field__", this);
|
|
495
|
+
},
|
|
496
|
+
this);
|
|
497
|
+
},
|
|
498
|
+
set_field__: (function ()
|
|
499
|
+
{
|
|
500
|
+
const matrix3 = new Matrix3 ();
|
|
364
501
|
|
|
365
|
-
|
|
502
|
+
return function (field)
|
|
503
|
+
{
|
|
504
|
+
const
|
|
505
|
+
gl = this .getBrowser () .getContext (),
|
|
506
|
+
location = field ._uniformLocation;
|
|
507
|
+
|
|
508
|
+
if (location)
|
|
366
509
|
{
|
|
367
|
-
|
|
368
|
-
{
|
|
369
|
-
this .removeNode (gl, program, field ._uniformLocation);
|
|
370
|
-
break;
|
|
371
|
-
}
|
|
372
|
-
case X3DConstants .MFNode:
|
|
510
|
+
switch (field .getType ())
|
|
373
511
|
{
|
|
374
|
-
|
|
512
|
+
case X3DConstants .SFBool:
|
|
513
|
+
case X3DConstants .SFInt32:
|
|
514
|
+
{
|
|
515
|
+
gl .uniform1i (location, field .getValue ());
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
case X3DConstants .SFColor:
|
|
519
|
+
{
|
|
520
|
+
const value = field .getValue ();
|
|
521
|
+
gl .uniform3f (location, value .r, value .g, value .b);
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
case X3DConstants .SFColorRGBA:
|
|
525
|
+
{
|
|
526
|
+
const value = field .getValue ();
|
|
527
|
+
gl .uniform4f (location, value .r, value .g, value .b, value .a);
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
case X3DConstants .SFDouble:
|
|
531
|
+
case X3DConstants .SFFloat:
|
|
532
|
+
case X3DConstants .SFTime:
|
|
533
|
+
{
|
|
534
|
+
gl .uniform1f (location, field .getValue ());
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
case X3DConstants .SFImage:
|
|
538
|
+
{
|
|
539
|
+
let array = location .array;
|
|
540
|
+
|
|
541
|
+
const
|
|
542
|
+
pixels = field .array,
|
|
543
|
+
length = 3 + pixels .length;
|
|
544
|
+
|
|
545
|
+
if (length !== array .length)
|
|
546
|
+
array = location .array = new Int32Array (length);
|
|
547
|
+
|
|
548
|
+
array [0] = field .width;
|
|
549
|
+
array [1] = field .height;
|
|
550
|
+
array [2] = field .comp;
|
|
551
|
+
|
|
552
|
+
for (let a = 3, p = 0, pl = pixels .length; p < pl; ++ p, ++ a)
|
|
553
|
+
array [a] = pixels [p];
|
|
554
|
+
|
|
555
|
+
gl .uniform1iv (location, array);
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
case X3DConstants .SFMatrix3d:
|
|
559
|
+
case X3DConstants .SFMatrix3f:
|
|
560
|
+
{
|
|
561
|
+
location .array .set (field .getValue ());
|
|
375
562
|
|
|
376
|
-
|
|
563
|
+
gl .uniformMatrix3fv (location, false, location .array);
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
case X3DConstants .SFMatrix4d:
|
|
567
|
+
case X3DConstants .SFMatrix4f:
|
|
377
568
|
{
|
|
378
|
-
|
|
569
|
+
location .array .set (field .getValue ());
|
|
379
570
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
else
|
|
383
|
-
break;
|
|
571
|
+
gl .uniformMatrix4fv (location, false, location .array);
|
|
572
|
+
return;
|
|
384
573
|
}
|
|
574
|
+
case X3DConstants .SFNode:
|
|
575
|
+
{
|
|
576
|
+
const texture = X3DCast (X3DConstants .X3DTextureNode, field);
|
|
385
577
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
578
|
+
if (texture)
|
|
579
|
+
{
|
|
580
|
+
this .textures .set (location, { name: field .getName (), texture: texture, textureUnit: undefined } );
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
391
583
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
gl = this .getBrowser () .getContext (),
|
|
399
|
-
program = this .getProgram (),
|
|
400
|
-
location = field ._uniformLocation;
|
|
584
|
+
this .textures .delete (location);
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
case X3DConstants .SFRotation:
|
|
588
|
+
{
|
|
589
|
+
field .getValue () .getMatrix (location .array);
|
|
401
590
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
591
|
+
gl .uniformMatrix3fv (location, false, location .array);
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
case X3DConstants .SFString:
|
|
595
|
+
{
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
case X3DConstants .SFVec2d:
|
|
599
|
+
case X3DConstants .SFVec2f:
|
|
600
|
+
{
|
|
601
|
+
const value = field .getValue ();
|
|
602
|
+
gl .uniform2f (location, value .x, value .y);
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
case X3DConstants .SFVec3d:
|
|
606
|
+
case X3DConstants .SFVec3f:
|
|
607
|
+
{
|
|
608
|
+
const value = field .getValue ();
|
|
609
|
+
gl .uniform3f (location, value .x, value .y, value .z);
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
case X3DConstants .SFVec4d:
|
|
613
|
+
case X3DConstants .SFVec4f:
|
|
614
|
+
{
|
|
615
|
+
const value = field .getValue ();
|
|
616
|
+
gl .uniform4f (location, value .x, value .y, value .z, value .w);
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
case X3DConstants .MFBool:
|
|
620
|
+
case X3DConstants .MFInt32:
|
|
621
|
+
{
|
|
622
|
+
const array = location .array;
|
|
405
623
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
case X3DConstants .SFBool:
|
|
409
|
-
case X3DConstants .SFInt32:
|
|
410
|
-
{
|
|
411
|
-
gl .uniform1i (location, field .getValue ());
|
|
412
|
-
return;
|
|
413
|
-
}
|
|
414
|
-
case X3DConstants .SFColor:
|
|
415
|
-
{
|
|
416
|
-
var value = field .getValue ();
|
|
417
|
-
gl .uniform3f (location, value .r, value .g, value .b);
|
|
418
|
-
return;
|
|
419
|
-
}
|
|
420
|
-
case X3DConstants .SFColorRGBA:
|
|
421
|
-
{
|
|
422
|
-
var value = field .getValue ();
|
|
423
|
-
gl .uniform4f (location, value .r, value .g, value .b, value .a);
|
|
424
|
-
return;
|
|
425
|
-
}
|
|
426
|
-
case X3DConstants .SFDouble:
|
|
427
|
-
case X3DConstants .SFFloat:
|
|
428
|
-
case X3DConstants .SFTime:
|
|
429
|
-
{
|
|
430
|
-
gl .uniform1f (location, field .getValue ());
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
|
-
case X3DConstants .SFImage:
|
|
434
|
-
{
|
|
435
|
-
var
|
|
436
|
-
array = location .array,
|
|
437
|
-
pixels = field .array .getValue (),
|
|
438
|
-
length = 3 + pixels .length;
|
|
439
|
-
|
|
440
|
-
if (length !== array .length)
|
|
441
|
-
array = location .array = new Int32Array (length);
|
|
442
|
-
|
|
443
|
-
array [0] = field .width;
|
|
444
|
-
array [1] = field .height;
|
|
445
|
-
array [2] = field .comp;
|
|
446
|
-
|
|
447
|
-
for (var a = 3, p = 0, length = pixels .length; p < length; ++ p)
|
|
448
|
-
array [a ++] = pixels [p] .getValue ();
|
|
449
|
-
|
|
450
|
-
gl .uniform1iv (location, array);
|
|
451
|
-
return;
|
|
452
|
-
}
|
|
453
|
-
case X3DConstants .SFMatrix3d:
|
|
454
|
-
case X3DConstants .SFMatrix3f:
|
|
455
|
-
{
|
|
456
|
-
location .array .set (field .getValue ());
|
|
457
|
-
|
|
458
|
-
gl .uniformMatrix3fv (location, false, location .array);
|
|
459
|
-
return;
|
|
460
|
-
}
|
|
461
|
-
case X3DConstants .SFMatrix4d:
|
|
462
|
-
case X3DConstants .SFMatrix4f:
|
|
463
|
-
{
|
|
464
|
-
location .array .set (field .getValue ());
|
|
465
|
-
|
|
466
|
-
gl .uniformMatrix4fv (location, false, location .array);
|
|
467
|
-
return;
|
|
468
|
-
}
|
|
469
|
-
case X3DConstants .SFNode:
|
|
470
|
-
{
|
|
471
|
-
this .setNode (gl, program, location, field);
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
474
|
-
case X3DConstants .SFRotation:
|
|
475
|
-
{
|
|
476
|
-
field .getValue () .getMatrix (location .array);
|
|
624
|
+
for (var i = 0, length = field .length; i < length; ++ i)
|
|
625
|
+
array [i] = field [i];
|
|
477
626
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
case X3DConstants .SFVec2d:
|
|
486
|
-
case X3DConstants .SFVec2f:
|
|
487
|
-
{
|
|
488
|
-
var value = field .getValue ();
|
|
489
|
-
gl .uniform2f (location, value .x, value .y);
|
|
490
|
-
return;
|
|
491
|
-
}
|
|
492
|
-
case X3DConstants .SFVec3d:
|
|
493
|
-
case X3DConstants .SFVec3f:
|
|
494
|
-
{
|
|
495
|
-
var value = field .getValue ();
|
|
496
|
-
gl .uniform3f (location, value .x, value .y, value .z);
|
|
497
|
-
return;
|
|
498
|
-
}
|
|
499
|
-
case X3DConstants .SFVec4d:
|
|
500
|
-
case X3DConstants .SFVec4f:
|
|
501
|
-
{
|
|
502
|
-
var value = field .getValue ();
|
|
503
|
-
gl .uniform4f (location, value .x, value .y, value .z, value .w);
|
|
504
|
-
return;
|
|
505
|
-
}
|
|
506
|
-
case X3DConstants .MFBool:
|
|
507
|
-
case X3DConstants .MFInt32:
|
|
508
|
-
{
|
|
509
|
-
var
|
|
510
|
-
value = field .getValue (),
|
|
511
|
-
array = location .array;
|
|
512
|
-
|
|
513
|
-
for (var i = 0, length = value .length; i < length; ++ i)
|
|
514
|
-
array [i] = value [i] .getValue ();
|
|
515
|
-
|
|
516
|
-
for (var length = array .length; i < length; ++ i)
|
|
517
|
-
array [i] = 0;
|
|
518
|
-
|
|
519
|
-
gl .uniform1iv (location, array);
|
|
520
|
-
return;
|
|
521
|
-
}
|
|
522
|
-
case X3DConstants .MFColor:
|
|
523
|
-
{
|
|
524
|
-
var
|
|
525
|
-
value = field .getValue (),
|
|
526
|
-
array = location .array;
|
|
527
|
-
|
|
528
|
-
for (var i = 0, k = 0, length = value .length; i < length; ++ i)
|
|
627
|
+
for (let length = array .length; i < length; ++ i)
|
|
628
|
+
array [i] = 0;
|
|
629
|
+
|
|
630
|
+
gl .uniform1iv (location, array);
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
case X3DConstants .MFColor:
|
|
529
634
|
{
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
635
|
+
const array = location .array;
|
|
636
|
+
|
|
637
|
+
for (var i = 0, k = 0, length = field .length; i < length; ++ i)
|
|
638
|
+
{
|
|
639
|
+
const color = field [i];
|
|
640
|
+
|
|
641
|
+
array [k++] = color .r;
|
|
642
|
+
array [k++] = color .g;
|
|
643
|
+
array [k++] = color .b;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
for (let length = array .length; k < length; ++ k)
|
|
647
|
+
array [k] = 0;
|
|
648
|
+
|
|
649
|
+
gl .uniform3fv (location, array);
|
|
650
|
+
return;
|
|
535
651
|
}
|
|
536
|
-
|
|
537
|
-
for (var length = array .length; k < length; ++ k)
|
|
538
|
-
array [k] = 0;
|
|
539
|
-
|
|
540
|
-
gl .uniform3fv (location, array);
|
|
541
|
-
return;
|
|
542
|
-
}
|
|
543
|
-
case X3DConstants .MFColorRGBA:
|
|
544
|
-
{
|
|
545
|
-
var
|
|
546
|
-
value = field .getValue (),
|
|
547
|
-
array = location .array;
|
|
548
|
-
|
|
549
|
-
for (var i = 0, k = 0, length = value .length; i < length; ++ i)
|
|
652
|
+
case X3DConstants .MFColorRGBA:
|
|
550
653
|
{
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
654
|
+
const array = location .array;
|
|
655
|
+
|
|
656
|
+
for (var i = 0, k = 0, length = field .length; i < length; ++ i)
|
|
657
|
+
{
|
|
658
|
+
const color = field [i];
|
|
659
|
+
|
|
660
|
+
array [k++] = color .r;
|
|
661
|
+
array [k++] = color .g;
|
|
662
|
+
array [k++] = color .b;
|
|
663
|
+
array [k++] = color .a;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
for (let length = array .length; k < length; ++ k)
|
|
667
|
+
array [k] = 0;
|
|
668
|
+
|
|
669
|
+
gl .uniform4fv (location, array);
|
|
670
|
+
return;
|
|
557
671
|
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
gl .uniform4fv (location, array);
|
|
563
|
-
return;
|
|
564
|
-
}
|
|
565
|
-
case X3DConstants .MFDouble:
|
|
566
|
-
case X3DConstants .MFFloat:
|
|
567
|
-
case X3DConstants .MFTime:
|
|
568
|
-
{
|
|
569
|
-
var
|
|
570
|
-
value = field .getValue (),
|
|
571
|
-
array = location .array;
|
|
572
|
-
|
|
573
|
-
for (var i = 0, length = value .length; i < length; ++ i)
|
|
574
|
-
array [i] = value [i] .getValue ();
|
|
575
|
-
|
|
576
|
-
for (var length = array .length; i < length; ++ i)
|
|
577
|
-
array [i] = 0;
|
|
578
|
-
|
|
579
|
-
gl .uniform1fv (location, array);
|
|
580
|
-
return;
|
|
581
|
-
}
|
|
582
|
-
case X3DConstants .MFImage:
|
|
583
|
-
{
|
|
584
|
-
var
|
|
585
|
-
images = field .getValue (),
|
|
586
|
-
array = location .array,
|
|
587
|
-
length = this .getImagesLength (field);
|
|
588
|
-
|
|
589
|
-
if (length !== array .length)
|
|
590
|
-
array = location .array = new Int32Array (length);
|
|
591
|
-
|
|
592
|
-
for (var i = 0, a = 0, length = images .length; i < length; ++ i)
|
|
672
|
+
case X3DConstants .MFDouble:
|
|
673
|
+
case X3DConstants .MFFloat:
|
|
674
|
+
case X3DConstants .MFTime:
|
|
593
675
|
{
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
676
|
+
const array = location .array;
|
|
677
|
+
|
|
678
|
+
for (var i = 0, length = field .length; i < length; ++ i)
|
|
679
|
+
array [i] = field [i];
|
|
680
|
+
|
|
681
|
+
for (let length = array .length; i < length; ++ i)
|
|
682
|
+
array [i] = 0;
|
|
683
|
+
|
|
684
|
+
gl .uniform1fv (location, array);
|
|
685
|
+
return;
|
|
604
686
|
}
|
|
605
|
-
|
|
606
|
-
gl .uniform1iv (location, array);
|
|
607
|
-
return;
|
|
608
|
-
}
|
|
609
|
-
case X3DConstants .MFMatrix3d:
|
|
610
|
-
case X3DConstants .MFMatrix3f:
|
|
611
|
-
{
|
|
612
|
-
var
|
|
613
|
-
value = field .getValue (),
|
|
614
|
-
array = location .array;
|
|
615
|
-
|
|
616
|
-
for (var i = 0, k = 0, length = value .length; i < length; ++ i)
|
|
687
|
+
case X3DConstants .MFImage:
|
|
617
688
|
{
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
689
|
+
let array = location .array;
|
|
690
|
+
|
|
691
|
+
const numImages = this .getImagesLength (field);
|
|
692
|
+
|
|
693
|
+
if (numImages !== array .length)
|
|
694
|
+
array = location .array = new Int32Array (numImages);
|
|
695
|
+
|
|
696
|
+
for (let i = 0, a = 0, length = field .length; i < length; ++ i)
|
|
697
|
+
{
|
|
698
|
+
const
|
|
699
|
+
value = field [i],
|
|
700
|
+
pixels = value .array;
|
|
701
|
+
|
|
702
|
+
array [a ++] = value .width;
|
|
703
|
+
array [a ++] = value .height;
|
|
704
|
+
array [a ++] = value .comp;
|
|
705
|
+
|
|
706
|
+
for (let p = 0, pl = pixels .length; p < pl; ++ p)
|
|
707
|
+
array [a ++] = pixels [p];
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
gl .uniform1iv (location, array);
|
|
711
|
+
return;
|
|
629
712
|
}
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
array [k] = 0;
|
|
633
|
-
|
|
634
|
-
gl .uniformMatrix3fv (location, false, array);
|
|
635
|
-
return;
|
|
636
|
-
}
|
|
637
|
-
case X3DConstants .MFMatrix4d:
|
|
638
|
-
case X3DConstants .MFMatrix4f:
|
|
639
|
-
{
|
|
640
|
-
var
|
|
641
|
-
value = field .getValue (),
|
|
642
|
-
array = location .array;
|
|
643
|
-
|
|
644
|
-
for (var i = 0, k = 0, length = value .length; i < length; ++ i)
|
|
713
|
+
case X3DConstants .MFMatrix3d:
|
|
714
|
+
case X3DConstants .MFMatrix3f:
|
|
645
715
|
{
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
array
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
array [k++] = matrix [13];
|
|
662
|
-
array [k++] = matrix [14];
|
|
663
|
-
array [k++] = matrix [15];
|
|
716
|
+
const array = location .array;
|
|
717
|
+
|
|
718
|
+
for (var i = 0, k = 0, length = field .length; i < length; ++ i)
|
|
719
|
+
{
|
|
720
|
+
const matrix = field [i];
|
|
721
|
+
|
|
722
|
+
for (let m = 0; m < 9; ++ m)
|
|
723
|
+
array [k++] = matrix [m];
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
for (let length = array .length; k < length; ++ k)
|
|
727
|
+
array [k] = 0;
|
|
728
|
+
|
|
729
|
+
gl .uniformMatrix3fv (location, false, array);
|
|
730
|
+
return;
|
|
664
731
|
}
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
this .setNode (gl, program, location [i], value [i]);
|
|
678
|
-
|
|
679
|
-
for (var length = location .length; i < length; ++ i)
|
|
680
|
-
this .setNode (gl, program, location [i], NULL);
|
|
681
|
-
|
|
682
|
-
return;
|
|
683
|
-
}
|
|
684
|
-
case X3DConstants .MFRotation:
|
|
685
|
-
{
|
|
686
|
-
var
|
|
687
|
-
value = field .getValue (),
|
|
688
|
-
array = location .array;
|
|
732
|
+
case X3DConstants .MFMatrix4d:
|
|
733
|
+
case X3DConstants .MFMatrix4f:
|
|
734
|
+
{
|
|
735
|
+
const array = location .array;
|
|
736
|
+
|
|
737
|
+
for (var i = 0, k = 0, length = field .length; i < length; ++ i)
|
|
738
|
+
{
|
|
739
|
+
const matrix = field [i];
|
|
740
|
+
|
|
741
|
+
for (let m = 0; m < 16; ++ m)
|
|
742
|
+
array [k++] = matrix [m];
|
|
743
|
+
}
|
|
689
744
|
|
|
690
|
-
|
|
745
|
+
for (let length = array .length; k < length; ++ k)
|
|
746
|
+
array [k] = 0;
|
|
747
|
+
|
|
748
|
+
gl .uniformMatrix4fv (location, false, array);
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
case X3DConstants .MFNode:
|
|
691
752
|
{
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
753
|
+
const locations = location .locations;
|
|
754
|
+
|
|
755
|
+
for (let i = 0, length = field .length; i < length; ++ i)
|
|
756
|
+
{
|
|
757
|
+
const texture = X3DCast (X3DConstants .X3DTextureNode, field [i]);
|
|
758
|
+
|
|
759
|
+
if (texture)
|
|
760
|
+
{
|
|
761
|
+
this .textures .set (locations [i], { name: field [i] .getName (), texture: texture, textureUnit: undefined } );
|
|
762
|
+
continue;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
return;
|
|
703
767
|
}
|
|
704
|
-
|
|
705
|
-
for (var length = array .length; k < length; ++ k)
|
|
706
|
-
array [k] = 0;
|
|
707
|
-
|
|
708
|
-
gl .uniformMatrix3fv (location, false, array);
|
|
709
|
-
return;
|
|
710
|
-
}
|
|
711
|
-
case X3DConstants .MFString:
|
|
712
|
-
{
|
|
713
|
-
return;
|
|
714
|
-
}
|
|
715
|
-
case X3DConstants .MFVec2d:
|
|
716
|
-
case X3DConstants .MFVec2f:
|
|
717
|
-
{
|
|
718
|
-
var
|
|
719
|
-
value = field .getValue (),
|
|
720
|
-
array = location .array;
|
|
721
|
-
|
|
722
|
-
for (var i = 0, k = 0, length = value .length; i < length; ++ i)
|
|
768
|
+
case X3DConstants .MFRotation:
|
|
723
769
|
{
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
770
|
+
const array = location .array;
|
|
771
|
+
|
|
772
|
+
for (var i = 0, k = 0, length = field .length; i < length; ++ i)
|
|
773
|
+
{
|
|
774
|
+
const matrix = field [i] .getValue () .getMatrix (matrix3);
|
|
775
|
+
|
|
776
|
+
array [k++] = matrix [0];
|
|
777
|
+
array [k++] = matrix [1];
|
|
778
|
+
array [k++] = matrix [2];
|
|
779
|
+
array [k++] = matrix [3];
|
|
780
|
+
array [k++] = matrix [4];
|
|
781
|
+
array [k++] = matrix [5];
|
|
782
|
+
array [k++] = matrix [6];
|
|
783
|
+
array [k++] = matrix [7];
|
|
784
|
+
array [k++] = matrix [8];
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
for (let length = array .length; k < length; ++ k)
|
|
788
|
+
array [k] = 0;
|
|
789
|
+
|
|
790
|
+
gl .uniformMatrix3fv (location, false, array);
|
|
791
|
+
return;
|
|
728
792
|
}
|
|
729
|
-
|
|
730
|
-
for (var length = array .length; k < length; ++ k)
|
|
731
|
-
array [k] = 0;
|
|
732
|
-
|
|
733
|
-
gl .uniform2fv (location, array);
|
|
734
|
-
return;
|
|
735
|
-
}
|
|
736
|
-
case X3DConstants .MFVec3d:
|
|
737
|
-
case X3DConstants .MFVec3f:
|
|
738
|
-
{
|
|
739
|
-
var
|
|
740
|
-
value = field .getValue (),
|
|
741
|
-
array = location .array;
|
|
742
|
-
|
|
743
|
-
for (var i = 0, k = 0, length = value .length; i < length; ++ i)
|
|
793
|
+
case X3DConstants .MFString:
|
|
744
794
|
{
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
array [k++] = vector .x;
|
|
748
|
-
array [k++] = vector .y;
|
|
749
|
-
array [k++] = vector .z;
|
|
795
|
+
return;
|
|
750
796
|
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
array [k] = 0;
|
|
754
|
-
|
|
755
|
-
gl .uniform3fv (location, array);
|
|
756
|
-
return;
|
|
757
|
-
}
|
|
758
|
-
case X3DConstants .MFVec4d:
|
|
759
|
-
case X3DConstants .MFVec4f:
|
|
760
|
-
{
|
|
761
|
-
var
|
|
762
|
-
value = field .getValue (),
|
|
763
|
-
array = location .array;
|
|
764
|
-
|
|
765
|
-
for (var i = 0, k = 0, length = value .length; i < length; ++ i)
|
|
797
|
+
case X3DConstants .MFVec2d:
|
|
798
|
+
case X3DConstants .MFVec2f:
|
|
766
799
|
{
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
800
|
+
const array = location .array;
|
|
801
|
+
|
|
802
|
+
for (var i = 0, k = 0, length = field .length; i < length; ++ i)
|
|
803
|
+
{
|
|
804
|
+
const vector = field [i];
|
|
805
|
+
|
|
806
|
+
array [k++] = vector .x;
|
|
807
|
+
array [k++] = vector .y;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
for (let length = array .length; k < length; ++ k)
|
|
811
|
+
array [k] = 0;
|
|
812
|
+
|
|
813
|
+
gl .uniform2fv (location, array);
|
|
814
|
+
return;
|
|
773
815
|
}
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
gl .uniform4fv (location, array);
|
|
779
|
-
return;
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
},
|
|
784
|
-
setNode: function (gl, program, location, field)
|
|
785
|
-
{
|
|
786
|
-
if (location)
|
|
787
|
-
{
|
|
788
|
-
var textureUnit = gl .getUniform (program, location);
|
|
816
|
+
case X3DConstants .MFVec3d:
|
|
817
|
+
case X3DConstants .MFVec3f:
|
|
818
|
+
{
|
|
819
|
+
const array = location .array;
|
|
789
820
|
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
{
|
|
794
|
-
textureUnit = this .getBrowser () .getCombinedTextureUnits () .pop ();
|
|
795
|
-
gl .uniform1i (location, textureUnit);
|
|
796
|
-
}
|
|
797
|
-
else
|
|
798
|
-
{
|
|
799
|
-
console .warn ("Not enough combined texture units for uniform variable '", field .getName (), "' available.");
|
|
800
|
-
return;
|
|
801
|
-
}
|
|
802
|
-
}
|
|
821
|
+
for (var i = 0, k = 0, length = field .length; i < length; ++ i)
|
|
822
|
+
{
|
|
823
|
+
const vector = field [i];
|
|
803
824
|
|
|
804
|
-
|
|
825
|
+
array [k++] = vector .x;
|
|
826
|
+
array [k++] = vector .y;
|
|
827
|
+
array [k++] = vector .z;
|
|
828
|
+
}
|
|
805
829
|
|
|
806
|
-
|
|
830
|
+
for (let length = array .length; k < length; ++ k)
|
|
831
|
+
array [k] = 0;
|
|
807
832
|
|
|
808
|
-
|
|
809
|
-
|
|
833
|
+
gl .uniform3fv (location, array);
|
|
834
|
+
return;
|
|
835
|
+
}
|
|
836
|
+
case X3DConstants .MFVec4d:
|
|
837
|
+
case X3DConstants .MFVec4f:
|
|
838
|
+
{
|
|
839
|
+
const array = location .array;
|
|
810
840
|
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
removeNode: function (gl, program, location)
|
|
815
|
-
{
|
|
816
|
-
if (location)
|
|
817
|
-
{
|
|
818
|
-
var textureUnit = gl .getUniform (program, location);
|
|
819
|
-
|
|
820
|
-
if (textureUnit)
|
|
821
|
-
this .getBrowser () .getCombinedTextureUnits () .push (textureUnit);
|
|
841
|
+
for (var i = 0, k = 0, length = field .length; i < length; ++ i)
|
|
842
|
+
{
|
|
843
|
+
const vector = field [i];
|
|
822
844
|
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
845
|
+
array [k++] = vector .x;
|
|
846
|
+
array [k++] = vector .y;
|
|
847
|
+
array [k++] = vector .z;
|
|
848
|
+
array [k++] = vector .w;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
for (let length = array .length; k < length; ++ k)
|
|
852
|
+
array [k] = 0;
|
|
853
|
+
|
|
854
|
+
gl .uniform4fv (location, array);
|
|
855
|
+
return;
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
})(),
|
|
826
861
|
getImagesLength: function (field)
|
|
827
862
|
{
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
863
|
+
const images = field .getValue ();
|
|
864
|
+
|
|
865
|
+
let length = 3 * images .length;
|
|
831
866
|
|
|
832
|
-
for (
|
|
867
|
+
for (let i = 0, l = images .length; i < l; ++ i)
|
|
833
868
|
length += images [i] .array .length;
|
|
834
869
|
|
|
835
870
|
return length;
|
|
836
871
|
},
|
|
837
872
|
getLocationLength: function (gl, program, field)
|
|
838
873
|
{
|
|
839
|
-
|
|
874
|
+
const name = field .getName ();
|
|
840
875
|
|
|
841
|
-
for (
|
|
876
|
+
for (let i = 0; ; ++ i)
|
|
842
877
|
{
|
|
843
|
-
|
|
878
|
+
const location = gl .getUniformLocation (program, name + "[" + i + "]");
|
|
844
879
|
|
|
845
880
|
if (! location)
|
|
846
|
-
|
|
881
|
+
return i;
|
|
847
882
|
}
|
|
883
|
+
},
|
|
884
|
+
hasFog: function (fogNode)
|
|
885
|
+
{
|
|
886
|
+
if (this .fogNode === fogNode)
|
|
887
|
+
return true;
|
|
888
|
+
|
|
889
|
+
this .fogNode = fogNode;
|
|
848
890
|
|
|
849
|
-
return
|
|
891
|
+
return false;
|
|
850
892
|
},
|
|
851
|
-
|
|
893
|
+
hasLight: function (i, lightNode)
|
|
852
894
|
{
|
|
853
|
-
if (
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
895
|
+
if (this .lightNodes [i] === lightNode)
|
|
896
|
+
return true;
|
|
897
|
+
|
|
898
|
+
this .lightNodes [i] = lightNode;
|
|
899
|
+
|
|
900
|
+
return false;
|
|
901
|
+
},
|
|
902
|
+
hasTextureProjector: function (i, textureProjectorNode)
|
|
903
|
+
{
|
|
904
|
+
if (this .projectiveTextureNodes [i] === textureProjectorNode)
|
|
905
|
+
return true;
|
|
906
|
+
|
|
907
|
+
this .projectiveTextureNodes [i] = textureProjectorNode;
|
|
908
|
+
|
|
909
|
+
return false;
|
|
863
910
|
},
|
|
864
|
-
|
|
911
|
+
setLocalObjects: function (gl, localObjects)
|
|
865
912
|
{
|
|
866
|
-
|
|
913
|
+
// Clip planes and local lights
|
|
914
|
+
|
|
915
|
+
this .numClipPlanes = 0;
|
|
916
|
+
this .numLights = 0;
|
|
917
|
+
this .numProjectiveTextures = 0;
|
|
918
|
+
this .lightNodes .length = 0;
|
|
919
|
+
this .projectiveTextureNodes .length = 0;
|
|
920
|
+
|
|
921
|
+
for (const localObject of localObjects)
|
|
922
|
+
localObject .setShaderUniforms (gl, this);
|
|
923
|
+
|
|
924
|
+
gl .uniform1i (this .x3d_NumClipPlanes, Math .min (this .numClipPlanes, this .x3d_MaxClipPlanes));
|
|
925
|
+
gl .uniform1i (this .x3d_NumLights, Math .min (this .numLights, this .x3d_MaxLights));
|
|
926
|
+
gl .uniform1i (this .x3d_NumProjectiveTextures, Math .min (this .numProjectiveTextures, this .x3d_MaxTextures));
|
|
927
|
+
},
|
|
928
|
+
setGlobalUniforms: function (gl, renderObject, cameraSpaceMatrixArray, projectionMatrixArray, viewportArray)
|
|
929
|
+
{
|
|
930
|
+
const globalObjects = renderObject .getGlobalObjects ();
|
|
867
931
|
|
|
868
932
|
// Set viewport
|
|
869
933
|
|
|
@@ -871,160 +935,197 @@ function ($,
|
|
|
871
935
|
|
|
872
936
|
// Set projection matrix
|
|
873
937
|
|
|
874
|
-
gl .uniformMatrix4fv (this .x3d_ProjectionMatrix,
|
|
938
|
+
gl .uniformMatrix4fv (this .x3d_ProjectionMatrix, false, projectionMatrixArray);
|
|
939
|
+
gl .uniformMatrix4fv (this .x3d_CameraSpaceMatrix, false, cameraSpaceMatrixArray);
|
|
940
|
+
|
|
941
|
+
// Fog
|
|
942
|
+
|
|
943
|
+
this .fogNode = null;
|
|
875
944
|
|
|
876
|
-
// Set global lights
|
|
945
|
+
// Set global lights and global texture projectors
|
|
877
946
|
|
|
878
|
-
this .
|
|
947
|
+
this .numLights = 0;
|
|
948
|
+
this .numProjectiveTextures = 0;
|
|
949
|
+
this .lightNodes .length = 0;
|
|
950
|
+
this .projectiveTextureNodes .length = 0;
|
|
879
951
|
|
|
880
|
-
for (
|
|
881
|
-
|
|
952
|
+
for (const globalObject of globalObjects)
|
|
953
|
+
globalObject .setShaderUniforms (gl, this);
|
|
954
|
+
|
|
955
|
+
this .numGlobalLights = this .numLights;
|
|
956
|
+
this .numGlobalProjectiveTextures = this .numProjectiveTextures;
|
|
957
|
+
|
|
958
|
+
// Logarithmic depth buffer support.
|
|
959
|
+
|
|
960
|
+
const
|
|
961
|
+
viewpoint = renderObject .getViewpoint (),
|
|
962
|
+
navigationInfo = renderObject .getNavigationInfo ();
|
|
963
|
+
|
|
964
|
+
if (viewpoint instanceof OrthoViewpoint)
|
|
965
|
+
gl .uniform1f (this .x3d_LogarithmicFarFactor1_2, -1);
|
|
966
|
+
else
|
|
967
|
+
gl .uniform1f (this .x3d_LogarithmicFarFactor1_2, 1 / Math .log2 (navigationInfo .getFarValue (viewpoint) + 1));
|
|
882
968
|
},
|
|
883
|
-
setLocalUniforms: function (gl, context)
|
|
969
|
+
setLocalUniforms: function (gl, context, front = true)
|
|
884
970
|
{
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
971
|
+
const
|
|
972
|
+
shapeNode = context .shapeNode,
|
|
973
|
+
geometryNode = context .geometryContext || shapeNode .getGeometry (),
|
|
974
|
+
geometryType = geometryNode .geometryType,
|
|
975
|
+
textureCoordinateNode = geometryNode .textureCoordinateNode,
|
|
976
|
+
appearanceNode = shapeNode .getAppearance (),
|
|
977
|
+
stylePropertiesNode = appearanceNode .stylePropertiesNode [geometryType],
|
|
978
|
+
materialNode = front ? appearanceNode .materialNode : appearanceNode .backMaterialNode,
|
|
979
|
+
textureNode = context .textureNode || appearanceNode .textureNode,
|
|
980
|
+
textureTransformNode = appearanceNode .textureTransformNode,
|
|
981
|
+
modelViewMatrix = context .modelViewMatrix,
|
|
982
|
+
localObjects = context .localObjects;
|
|
983
|
+
|
|
984
|
+
// Model view matrix
|
|
985
|
+
|
|
986
|
+
gl .uniformMatrix4fv (this .x3d_ModelViewMatrix, false, modelViewMatrix);
|
|
892
987
|
|
|
893
988
|
// Geometry type
|
|
894
989
|
|
|
895
|
-
gl .uniform1i (this .x3d_GeometryType,
|
|
990
|
+
gl .uniform1i (this .x3d_GeometryType, geometryType);
|
|
896
991
|
|
|
897
|
-
// Clip planes
|
|
992
|
+
// Clip planes and local lights
|
|
898
993
|
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
clipPlaneNodes [i] .setShaderUniforms (gl, this, i);
|
|
903
|
-
|
|
904
|
-
if (i < this .x3d_MaxClipPlanes)
|
|
905
|
-
gl .uniform4fv (this .x3d_ClipPlane [i], this .x3d_NoneClipPlane);
|
|
906
|
-
}
|
|
907
|
-
else
|
|
908
|
-
{
|
|
909
|
-
gl .uniform4fv (this .x3d_ClipPlane [0], this .x3d_NoneClipPlane);
|
|
910
|
-
}
|
|
994
|
+
this .numClipPlanes = 0;
|
|
995
|
+
this .numLights = this .numGlobalLights;
|
|
996
|
+
this .numProjectiveTextures = this .numGlobalProjectiveTextures;
|
|
911
997
|
|
|
912
|
-
|
|
998
|
+
for (const localObject of localObjects)
|
|
999
|
+
localObject .setShaderUniforms (gl, this);
|
|
913
1000
|
|
|
914
|
-
|
|
1001
|
+
gl .uniform1i (this .x3d_NumClipPlanes, Math .min (this .numClipPlanes, this .x3d_MaxClipPlanes));
|
|
1002
|
+
gl .uniform1i (this .x3d_NumLights, Math .min (this .numLights, this .x3d_MaxLights));
|
|
1003
|
+
gl .uniform1i (this .x3d_NumProjectiveTextures, Math .min (this .numProjectiveTextures, this .x3d_MaxTextures));
|
|
915
1004
|
|
|
916
|
-
//
|
|
1005
|
+
// Fog, there is always one
|
|
917
1006
|
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
var linewidthScaleFactor = linePropertiesNode .getLinewidthScaleFactor ();
|
|
1007
|
+
context .fogNode .setShaderUniforms (gl, this);
|
|
1008
|
+
gl .uniform1i (this .x3d_FogCoord, geometryNode .fogCoords);
|
|
921
1009
|
|
|
922
|
-
|
|
923
|
-
gl .uniform1f (this .x3d_LinewidthScaleFactor, linewidthScaleFactor);
|
|
924
|
-
}
|
|
925
|
-
else
|
|
926
|
-
{
|
|
927
|
-
gl .lineWidth (1);
|
|
928
|
-
gl .uniform1f (this .x3d_LinewidthScaleFactor, 1);
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
// Material
|
|
1010
|
+
// Alpha
|
|
932
1011
|
|
|
933
|
-
gl .
|
|
1012
|
+
gl .uniform1f (this .x3d_AlphaCutoff, appearanceNode .alphaCutoff);
|
|
934
1013
|
|
|
935
|
-
|
|
936
|
-
{
|
|
937
|
-
// Lights
|
|
1014
|
+
// Style
|
|
938
1015
|
|
|
939
|
-
|
|
1016
|
+
stylePropertiesNode .setShaderUniforms (gl, this);
|
|
940
1017
|
|
|
941
|
-
|
|
942
|
-
localLights = context .localLights,
|
|
943
|
-
numLights = Math .min (this .x3d_MaxLights, this .numGlobalLights + localLights .length);
|
|
1018
|
+
// Material
|
|
944
1019
|
|
|
945
|
-
|
|
946
|
-
|
|
1020
|
+
gl .uniform1i (this .x3d_ColorMaterial, geometryNode .colorMaterial);
|
|
1021
|
+
materialNode .setShaderUniforms (gl, this, front);
|
|
947
1022
|
|
|
948
|
-
|
|
949
|
-
gl .uniform1i (this .x3d_LightType [numLights], 0);
|
|
1023
|
+
// Normal matrix
|
|
950
1024
|
|
|
951
|
-
|
|
1025
|
+
gl .uniformMatrix3fv (this .x3d_NormalMatrix, false, this .getNormalMatrix (modelViewMatrix));
|
|
952
1026
|
|
|
953
|
-
|
|
1027
|
+
// Texture
|
|
954
1028
|
|
|
955
|
-
|
|
1029
|
+
if (textureNode)
|
|
1030
|
+
{
|
|
1031
|
+
textureNode .setShaderUniforms (gl, this, context .renderer);
|
|
1032
|
+
textureTransformNode .setShaderUniforms (gl, this);
|
|
1033
|
+
textureCoordinateNode .setShaderUniforms (gl, this);
|
|
1034
|
+
}
|
|
1035
|
+
else
|
|
1036
|
+
{
|
|
1037
|
+
gl .uniform1i (this .x3d_NumTextures, 0);
|
|
956
1038
|
|
|
1039
|
+
if (this .getCustom ())
|
|
1040
|
+
{
|
|
1041
|
+
textureTransformNode .setShaderUniforms (gl, this);
|
|
1042
|
+
textureCoordinateNode .setShaderUniforms (gl, this);
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
},
|
|
1046
|
+
getNormalMatrix: (function ()
|
|
1047
|
+
{
|
|
1048
|
+
const normalMatrix = new Float32Array (9);
|
|
1049
|
+
|
|
1050
|
+
return function (modelViewMatrix)
|
|
1051
|
+
{
|
|
957
1052
|
try
|
|
958
1053
|
{
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
normalMatrix [
|
|
962
|
-
|
|
963
|
-
normalMatrix [6] = modelViewMatrix [2]; normalMatrix [7] = modelViewMatrix [6]; normalMatrix [8] = modelViewMatrix [10];
|
|
1054
|
+
normalMatrix [0] = modelViewMatrix [0], normalMatrix [3] = modelViewMatrix [1], normalMatrix [6] = modelViewMatrix [ 2],
|
|
1055
|
+
normalMatrix [1] = modelViewMatrix [4], normalMatrix [4] = modelViewMatrix [5], normalMatrix [7] = modelViewMatrix [ 6],
|
|
1056
|
+
normalMatrix [2] = modelViewMatrix [8], normalMatrix [5] = modelViewMatrix [9], normalMatrix [8] = modelViewMatrix [10];
|
|
1057
|
+
|
|
964
1058
|
Matrix3 .prototype .inverse .call (normalMatrix);
|
|
965
|
-
|
|
1059
|
+
|
|
1060
|
+
return normalMatrix;
|
|
966
1061
|
}
|
|
967
1062
|
catch (error)
|
|
968
1063
|
{
|
|
969
|
-
|
|
1064
|
+
normalMatrix .set (Matrix3 .Identity);
|
|
1065
|
+
|
|
1066
|
+
return normalMatrix;
|
|
970
1067
|
}
|
|
971
|
-
}
|
|
972
|
-
|
|
1068
|
+
};
|
|
1069
|
+
})(),
|
|
1070
|
+
enable: function (gl)
|
|
1071
|
+
{
|
|
1072
|
+
const browser = this .getBrowser ();
|
|
1073
|
+
|
|
1074
|
+
//console .log (this .getName ());
|
|
1075
|
+
//console .log (browser .getCombinedTextureUnits () .length);
|
|
1076
|
+
|
|
1077
|
+
this .textures .forEach (function (object, location)
|
|
973
1078
|
{
|
|
974
|
-
|
|
1079
|
+
const
|
|
1080
|
+
name = object .name,
|
|
1081
|
+
texture = object .texture;
|
|
975
1082
|
|
|
976
|
-
if (
|
|
1083
|
+
if (! browser .getCombinedTextureUnits () .length)
|
|
977
1084
|
{
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
// Set normal matrix.
|
|
981
|
-
var normalMatrix = this .normalMatrixArray;
|
|
982
|
-
normalMatrix [0] = modelViewMatrix [0]; normalMatrix [1] = modelViewMatrix [4]; normalMatrix [2] = modelViewMatrix [ 8];
|
|
983
|
-
normalMatrix [3] = modelViewMatrix [1]; normalMatrix [4] = modelViewMatrix [5]; normalMatrix [5] = modelViewMatrix [ 9];
|
|
984
|
-
normalMatrix [6] = modelViewMatrix [2]; normalMatrix [7] = modelViewMatrix [6]; normalMatrix [8] = modelViewMatrix [10];
|
|
985
|
-
Matrix3 .prototype .inverse .call (normalMatrix);
|
|
986
|
-
gl .uniformMatrix3fv (this .x3d_NormalMatrix, false, normalMatrix);
|
|
987
|
-
}
|
|
988
|
-
catch (error)
|
|
989
|
-
{
|
|
990
|
-
gl .uniformMatrix3fv (this .x3d_NormalMatrix, false, new Float32Array (Matrix3 .Identity));
|
|
991
|
-
}
|
|
1085
|
+
console .warn ("Not enough combined texture units for uniform variable '" + name + "' available.");
|
|
1086
|
+
return;
|
|
992
1087
|
}
|
|
993
|
-
}
|
|
994
1088
|
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1089
|
+
const textureUnit = object .textureUnit = browser .getCombinedTextureUnits () .pop ();
|
|
1090
|
+
|
|
1091
|
+
gl .uniform1i (location, textureUnit);
|
|
1092
|
+
gl .activeTexture (gl .TEXTURE0 + textureUnit);
|
|
1093
|
+
gl .bindTexture (texture .getTarget (), texture .getTexture ());
|
|
1094
|
+
});
|
|
1095
|
+
|
|
1096
|
+
gl .activeTexture (gl .TEXTURE0);
|
|
1097
|
+
},
|
|
1098
|
+
disable: function (gl)
|
|
1099
|
+
{
|
|
1100
|
+
const browser = this .getBrowser ();
|
|
1101
|
+
|
|
1102
|
+
this .textures .forEach (function (object)
|
|
1001
1103
|
{
|
|
1002
|
-
|
|
1003
|
-
gl .uniform1iv (this .x3d_TextureType, this .textureTypeArray);
|
|
1104
|
+
const textureUnit = object .textureUnit;
|
|
1004
1105
|
|
|
1005
|
-
if (
|
|
1006
|
-
|
|
1007
|
-
textureTransformNode .setShaderUniforms (gl, this);
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1106
|
+
if (textureUnit !== undefined)
|
|
1107
|
+
browser .getCombinedTextureUnits () .push (textureUnit);
|
|
1010
1108
|
|
|
1011
|
-
|
|
1109
|
+
object .textureUnit = undefined;
|
|
1110
|
+
});
|
|
1111
|
+
|
|
1112
|
+
//console .log (browser .getCombinedTextureUnits () .length);
|
|
1012
1113
|
},
|
|
1013
1114
|
enableFloatAttrib: function (gl, name, buffer, components)
|
|
1014
1115
|
{
|
|
1015
|
-
|
|
1016
|
-
|
|
1116
|
+
const location = gl. getAttribLocation (this .getProgram (), name);
|
|
1117
|
+
|
|
1017
1118
|
if (location === -1)
|
|
1018
1119
|
return;
|
|
1019
|
-
|
|
1120
|
+
|
|
1020
1121
|
gl .enableVertexAttribArray (location);
|
|
1021
|
-
|
|
1122
|
+
|
|
1022
1123
|
gl .bindBuffer (gl .ARRAY_BUFFER, buffer);
|
|
1023
1124
|
gl .vertexAttribPointer (location, components, gl .FLOAT, false, 0, 0);
|
|
1024
1125
|
},
|
|
1025
1126
|
disableFloatAttrib: function (gl, name)
|
|
1026
1127
|
{
|
|
1027
|
-
|
|
1128
|
+
const location = gl .getAttribLocation (this .getProgram (), name);
|
|
1028
1129
|
|
|
1029
1130
|
if (location === -1)
|
|
1030
1131
|
return;
|
|
@@ -1033,63 +1134,73 @@ function ($,
|
|
|
1033
1134
|
},
|
|
1034
1135
|
enableMatrix3Attrib: function (gl, name, buffer)
|
|
1035
1136
|
{
|
|
1036
|
-
|
|
1137
|
+
const location = gl .getAttribLocation (this .getProgram (), name);
|
|
1037
1138
|
|
|
1038
1139
|
if (location === -1)
|
|
1039
1140
|
return;
|
|
1040
1141
|
|
|
1041
|
-
gl .enableVertexAttribArray (location
|
|
1142
|
+
gl .enableVertexAttribArray (location);
|
|
1042
1143
|
gl .enableVertexAttribArray (location + 1);
|
|
1043
1144
|
gl .enableVertexAttribArray (location + 2);
|
|
1044
1145
|
|
|
1045
1146
|
gl .bindBuffer (gl .ARRAY_BUFFER, buffer);
|
|
1046
1147
|
|
|
1047
|
-
gl .vertexAttribPointer (location
|
|
1148
|
+
gl .vertexAttribPointer (location, 3, gl .FLOAT, false, 9 * 4, 3 * 4 * 0);
|
|
1048
1149
|
gl .vertexAttribPointer (location + 1, 3, gl .FLOAT, false, 9 * 4, 3 * 4 * 1);
|
|
1049
1150
|
gl .vertexAttribPointer (location + 2, 3, gl .FLOAT, false, 9 * 4, 3 * 4 * 2);
|
|
1050
1151
|
},
|
|
1051
1152
|
disableMatrix3Attrib: function (gl, name)
|
|
1052
1153
|
{
|
|
1053
|
-
|
|
1154
|
+
const location = gl .getAttribLocation (this .getProgram (), name);
|
|
1054
1155
|
|
|
1055
1156
|
if (location === -1)
|
|
1056
1157
|
return;
|
|
1057
1158
|
|
|
1058
|
-
gl .disableVertexAttribArray (location
|
|
1159
|
+
gl .disableVertexAttribArray (location);
|
|
1059
1160
|
gl .disableVertexAttribArray (location + 1);
|
|
1060
1161
|
gl .disableVertexAttribArray (location + 2);
|
|
1061
1162
|
},
|
|
1062
1163
|
enableMatrix4Attrib: function (gl, name, buffer)
|
|
1063
1164
|
{
|
|
1064
|
-
|
|
1165
|
+
const location = gl .getAttribLocation (this .getProgram (), name);
|
|
1065
1166
|
|
|
1066
1167
|
if (location === -1)
|
|
1067
1168
|
return;
|
|
1068
1169
|
|
|
1069
|
-
gl .enableVertexAttribArray (location
|
|
1170
|
+
gl .enableVertexAttribArray (location);
|
|
1070
1171
|
gl .enableVertexAttribArray (location + 1);
|
|
1071
1172
|
gl .enableVertexAttribArray (location + 2);
|
|
1072
1173
|
gl .enableVertexAttribArray (location + 3);
|
|
1073
1174
|
|
|
1074
1175
|
gl .bindBuffer (gl .ARRAY_BUFFER, buffer);
|
|
1075
1176
|
|
|
1076
|
-
gl .vertexAttribPointer (location
|
|
1177
|
+
gl .vertexAttribPointer (location, 4, gl .FLOAT, false, 16 * 4, 4 * 4 * 0);
|
|
1077
1178
|
gl .vertexAttribPointer (location + 1, 4, gl .FLOAT, false, 16 * 4, 4 * 4 * 1);
|
|
1078
1179
|
gl .vertexAttribPointer (location + 2, 4, gl .FLOAT, false, 16 * 4, 4 * 4 * 2);
|
|
1079
1180
|
gl .vertexAttribPointer (location + 3, 4, gl .FLOAT, false, 16 * 4, 4 * 4 * 3);
|
|
1080
1181
|
},
|
|
1081
1182
|
disableMatrix4Attrib: function (gl, name)
|
|
1082
1183
|
{
|
|
1083
|
-
|
|
1184
|
+
const location = gl .getAttribLocation (this .getProgram (), name);
|
|
1084
1185
|
|
|
1085
1186
|
if (location === -1)
|
|
1086
1187
|
return;
|
|
1087
1188
|
|
|
1088
|
-
gl .disableVertexAttribArray (location
|
|
1189
|
+
gl .disableVertexAttribArray (location);
|
|
1089
1190
|
gl .disableVertexAttribArray (location + 1);
|
|
1090
1191
|
gl .disableVertexAttribArray (location + 2);
|
|
1091
1192
|
gl .disableVertexAttribArray (location + 3);
|
|
1092
1193
|
},
|
|
1194
|
+
enableFogDepthAttribute: function (gl, fogDepthBuffer)
|
|
1195
|
+
{
|
|
1196
|
+
gl .enableVertexAttribArray (this .x3d_FogDepth);
|
|
1197
|
+
gl .bindBuffer (gl .ARRAY_BUFFER, fogDepthBuffer);
|
|
1198
|
+
gl .vertexAttribPointer (this .x3d_FogDepth, 1, gl .FLOAT, false, 0, 0);
|
|
1199
|
+
},
|
|
1200
|
+
disableFogDepthAttribute: function (gl)
|
|
1201
|
+
{
|
|
1202
|
+
gl .disableVertexAttribArray (this .x3d_FogDepth);
|
|
1203
|
+
},
|
|
1093
1204
|
enableColorAttribute: function (gl, colorBuffer)
|
|
1094
1205
|
{
|
|
1095
1206
|
gl .enableVertexAttribArray (this .x3d_Color);
|
|
@@ -1100,15 +1211,33 @@ function ($,
|
|
|
1100
1211
|
{
|
|
1101
1212
|
gl .disableVertexAttribArray (this .x3d_Color);
|
|
1102
1213
|
},
|
|
1103
|
-
enableTexCoordAttribute: function (gl, texCoordBuffers)
|
|
1214
|
+
enableTexCoordAttribute: function (gl, texCoordBuffers, d)
|
|
1104
1215
|
{
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1216
|
+
const length = Math .min (this .x3d_MaxTextures, texCoordBuffers .length);
|
|
1217
|
+
|
|
1218
|
+
for (let i = 0; i < length; ++ i)
|
|
1219
|
+
{
|
|
1220
|
+
const x3d_TexCoord = this .x3d_TexCoord [i];
|
|
1221
|
+
|
|
1222
|
+
if (x3d_TexCoord === -1)
|
|
1223
|
+
continue;
|
|
1224
|
+
|
|
1225
|
+
gl .enableVertexAttribArray (x3d_TexCoord);
|
|
1226
|
+
gl .bindBuffer (gl .ARRAY_BUFFER, texCoordBuffers [i]);
|
|
1227
|
+
gl .vertexAttribPointer (x3d_TexCoord, 4, gl .FLOAT, false, 0, 0);
|
|
1228
|
+
}
|
|
1108
1229
|
},
|
|
1109
1230
|
disableTexCoordAttribute: function (gl)
|
|
1110
1231
|
{
|
|
1111
|
-
|
|
1232
|
+
for (let i = 0, length = this .x3d_MaxTextures; i < length; ++ i)
|
|
1233
|
+
{
|
|
1234
|
+
const x3d_TexCoord = this .x3d_TexCoord [i];
|
|
1235
|
+
|
|
1236
|
+
if (x3d_TexCoord === -1)
|
|
1237
|
+
continue;
|
|
1238
|
+
|
|
1239
|
+
gl .disableVertexAttribArray (x3d_TexCoord);
|
|
1240
|
+
}
|
|
1112
1241
|
},
|
|
1113
1242
|
enableNormalAttribute: function (gl, normalBuffer)
|
|
1114
1243
|
{
|
|
@@ -1130,13 +1259,23 @@ function ($,
|
|
|
1130
1259
|
{
|
|
1131
1260
|
gl .disableVertexAttribArray (this .x3d_Vertex);
|
|
1132
1261
|
},
|
|
1262
|
+
setParticle: function (gl, particle, modelViewMatrix)
|
|
1263
|
+
{
|
|
1264
|
+
gl .uniformMatrix4fv (this .x3d_ModelViewMatrix, false, modelViewMatrix);
|
|
1265
|
+
|
|
1266
|
+
gl .uniform1i (this .x3d_ParticleId, particle .id);
|
|
1267
|
+
gl .uniform1i (this .x3d_ParticleLife, particle .life);
|
|
1268
|
+
gl .uniform1f (this .x3d_ParticleElapsedTime, particle .elapsedTime / particle .lifetime);
|
|
1269
|
+
},
|
|
1133
1270
|
getProgramInfo: function ()
|
|
1134
1271
|
{
|
|
1135
|
-
|
|
1272
|
+
function cmp (lhs, rhs) { return lhs < rhs ? -1 : lhs > rhs ? 1 : 0; }
|
|
1273
|
+
|
|
1274
|
+
const
|
|
1136
1275
|
gl = this .getBrowser () .getContext (),
|
|
1137
1276
|
program = this .getProgram ();
|
|
1138
1277
|
|
|
1139
|
-
|
|
1278
|
+
const
|
|
1140
1279
|
result = {
|
|
1141
1280
|
attributes: [ ],
|
|
1142
1281
|
uniforms: [ ],
|
|
@@ -1148,7 +1287,7 @@ function ($,
|
|
|
1148
1287
|
|
|
1149
1288
|
// Taken from the WebGl spec:
|
|
1150
1289
|
// http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14
|
|
1151
|
-
|
|
1290
|
+
const enums = {
|
|
1152
1291
|
0x8B50: 'vec2',
|
|
1153
1292
|
0x8B51: 'vec3',
|
|
1154
1293
|
0x8B52: 'vec4',
|
|
@@ -1174,31 +1313,31 @@ function ($,
|
|
|
1174
1313
|
};
|
|
1175
1314
|
|
|
1176
1315
|
// Loop through active uniforms
|
|
1177
|
-
for (
|
|
1316
|
+
for (let i = 0; i < activeUniforms; ++ i)
|
|
1178
1317
|
{
|
|
1179
|
-
|
|
1318
|
+
const uniform = gl .getActiveUniform (program, i);
|
|
1180
1319
|
uniform .typeName = enums [uniform.type];
|
|
1181
|
-
result .uniforms .push (
|
|
1320
|
+
result .uniforms .push (Object .assign ({ }, uniform));
|
|
1182
1321
|
result .uniformCount += uniform .size;
|
|
1183
1322
|
}
|
|
1184
1323
|
|
|
1185
1324
|
// Loop through active attributes
|
|
1186
|
-
for (
|
|
1325
|
+
for (let i = 0; i < activeAttributes; ++ i)
|
|
1187
1326
|
{
|
|
1188
|
-
|
|
1327
|
+
const attribute = gl .getActiveAttrib (program, i);
|
|
1189
1328
|
attribute .typeName = enums [attribute .type];
|
|
1190
|
-
result .attributes .push (
|
|
1329
|
+
result .attributes .push (Object .assign ({ }, attribute));
|
|
1191
1330
|
result .attributeCount += attribute .size;
|
|
1192
1331
|
}
|
|
1193
1332
|
|
|
1194
|
-
result .uniforms .sort (function (a, b) { return
|
|
1195
|
-
result .attributes .sort (function (a, b) { return
|
|
1333
|
+
result .uniforms .sort (function (a, b) { return cmp (a .name, b .name); });
|
|
1334
|
+
result .attributes .sort (function (a, b) { return cmp (a .name, b .name); });
|
|
1196
1335
|
|
|
1197
1336
|
return result;
|
|
1198
1337
|
},
|
|
1199
1338
|
printProgramInfo: function ()
|
|
1200
1339
|
{
|
|
1201
|
-
|
|
1340
|
+
const programInfo = this .getProgramInfo ();
|
|
1202
1341
|
|
|
1203
1342
|
console .log (this .getName ());
|
|
1204
1343
|
console .table (programInfo .attributes);
|
|
@@ -1211,5 +1350,3 @@ function ($,
|
|
|
1211
1350
|
|
|
1212
1351
|
return X3DProgrammableShaderObject;
|
|
1213
1352
|
});
|
|
1214
|
-
|
|
1215
|
-
|