@xort/cga 0.0.71
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/FUNDING.yml +12 -0
- package/LICENSE +21 -0
- package/build/cga.js +14564 -0
- package/cga/1./347/202/271/344/270/216/347/272/277/346/200/247/345/205/203/347/264/240/347/232/204/350/267/235/347/246/273.html +601 -0
- package/cga/1./347/202/271/344/270/216/347/272/277/346/200/247/345/205/203/347/264/240/347/232/204/350/267/235/347/246/273.md +111 -0
- package/cga/2./347/202/271/344/270/216/351/235/242/346/200/247/345/205/203/347/264/240.md +4 -0
- package/cga/img//347/202/271/344/270/216/345/260/204/347/272/277.png +0 -0
- package/cga/img//347/202/271/344/270/216/347/233/264/347/272/277.png +0 -0
- package/cga/img//347/202/271/344/270/216/347/272/277/346/256/265.png +0 -0
- package/cga/img//347/233/264/347/272/277/347/232/204/350/241/250/350/276/276/345/274/217.png +0 -0
- package/deploy.sh +27 -0
- package/dist/IKanimation/Bone.d.ts +9 -0
- package/dist/IKanimation/Bone.js +38 -0
- package/dist/IKanimation/CCDSolver.d.ts +37 -0
- package/dist/IKanimation/CCDSolver.js +93 -0
- package/dist/IKanimation/Joint.d.ts +3 -0
- package/dist/IKanimation/Joint.js +17 -0
- package/dist/IKanimation/constaint/constraint.d.ts +10 -0
- package/dist/IKanimation/constaint/constraint.js +25 -0
- package/dist/IKanimation/constaint/hinge.d.ts +12 -0
- package/dist/IKanimation/constaint/hinge.js +44 -0
- package/dist/IKanimation/constaint/slider.d.ts +12 -0
- package/dist/IKanimation/constaint/slider.js +42 -0
- package/dist/IKanimation/index.d.ts +0 -0
- package/dist/IKanimation/index.js +9 -0
- package/dist/IKanimation/isolver.d.ts +4 -0
- package/dist/IKanimation/isolver.js +10 -0
- package/dist/IKanimation/skeleton.d.ts +13 -0
- package/dist/IKanimation/skeleton.js +31 -0
- package/dist/alg/common.d.ts +114 -0
- package/dist/alg/common.js +302 -0
- package/dist/alg/curve.d.ts +4 -0
- package/dist/alg/curve.js +11 -0
- package/dist/alg/delaunator.d.ts +29 -0
- package/dist/alg/delaunator.js +442 -0
- package/dist/alg/delaunay.d.ts +20 -0
- package/dist/alg/delaunay.js +199 -0
- package/dist/alg/delaunayslow.d.ts +18 -0
- package/dist/alg/delaunayslow.js +140 -0
- package/dist/alg/extrude/extrude.d.ts +3 -0
- package/dist/alg/extrude/extrude.js +17 -0
- package/dist/alg/extrude.d.ts +199 -0
- package/dist/alg/extrude.js +729 -0
- package/dist/alg/offset/index.d.ts +0 -0
- package/dist/alg/offset/index.js +9 -0
- package/dist/alg/offset.d.ts +0 -0
- package/dist/alg/offset.js +472 -0
- package/dist/alg/pointset.d.ts +94 -0
- package/dist/alg/pointset.js +223 -0
- package/dist/alg/recognition.d.ts +14 -0
- package/dist/alg/recognition.js +37 -0
- package/dist/alg/result.d.ts +22 -0
- package/dist/alg/result.js +2 -0
- package/dist/alg/segmentset.d.ts +11 -0
- package/dist/alg/segmentset.js +45 -0
- package/dist/alg/sort.d.ts +2 -0
- package/dist/alg/sort.js +14 -0
- package/dist/alg/split.d.ts +8 -0
- package/dist/alg/split.js +10 -0
- package/dist/alg/trianglution.d.ts +20 -0
- package/dist/alg/trianglution.js +75 -0
- package/dist/alg/vol.d.ts +6 -0
- package/dist/alg/vol.js +18 -0
- package/dist/alg/voronoi.d.ts +31 -0
- package/dist/alg/voronoi.js +418 -0
- package/dist/app.d.ts +1 -0
- package/dist/app.js +241 -0
- package/dist/basic/distance.d.ts +12 -0
- package/dist/basic/distance.js +42 -0
- package/dist/csg/bsp.d.ts +9 -0
- package/dist/csg/bsp.js +22 -0
- package/dist/csg/node.d.ts +12 -0
- package/dist/csg/node.js +75 -0
- package/dist/csg/polygon.d.ts +43 -0
- package/dist/csg/polygon.js +161 -0
- package/dist/diamondMaterialShader.d.ts +92 -0
- package/dist/diamondMaterialShader.js +114 -0
- package/dist/effect/breath-light.d.ts +4 -0
- package/dist/effect/breath-light.js +37 -0
- package/dist/extends/geometryaid.d.ts +28 -0
- package/dist/extends/geometryaid.js +80 -0
- package/dist/extends/split.d.ts +3 -0
- package/dist/extends/split.js +13 -0
- package/dist/glview.d.ts +112 -0
- package/dist/glview.js +564 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +50 -0
- package/dist/math/Euler.d.ts +47 -0
- package/dist/math/Euler.js +243 -0
- package/dist/math/HVec3.d.ts +44 -0
- package/dist/math/HVec3.js +193 -0
- package/dist/math/Mat3.d.ts +29 -0
- package/dist/math/Mat3.js +244 -0
- package/dist/math/Mat4.d.ts +85 -0
- package/dist/math/Mat4.js +791 -0
- package/dist/math/Math.d.ts +130 -0
- package/dist/math/Math.js +198 -0
- package/dist/math/Quat.d.ts +83 -0
- package/dist/math/Quat.js +438 -0
- package/dist/math/Vec.d.ts +7 -0
- package/dist/math/Vec.js +41 -0
- package/dist/math/Vec2.d.ts +68 -0
- package/dist/math/Vec2.js +345 -0
- package/dist/math/Vec3.d.ts +232 -0
- package/dist/math/Vec3.js +1087 -0
- package/dist/math/Vec4.d.ts +81 -0
- package/dist/math/Vec4.js +492 -0
- package/dist/math/vector.d.ts +114 -0
- package/dist/math/vector.js +371 -0
- package/dist/render/buffer-attribute.d.ts +100 -0
- package/dist/render/buffer-attribute.js +356 -0
- package/dist/render/eventhandler.d.ts +78 -0
- package/dist/render/eventhandler.js +187 -0
- package/dist/render/geometry.d.ts +89 -0
- package/dist/render/geometry.js +775 -0
- package/dist/render/mesh.d.ts +25 -0
- package/dist/render/mesh.js +80 -0
- package/dist/render/thing.d.ts +34 -0
- package/dist/render/thing.js +194 -0
- package/dist/render/types.d.ts +2 -0
- package/dist/render/types.js +7 -0
- package/dist/robust/plane.d.ts +7 -0
- package/dist/robust/plane.js +17 -0
- package/dist/robust/vec.d.ts +15 -0
- package/dist/robust/vec.js +71 -0
- package/dist/shape/arc.d.ts +2 -0
- package/dist/shape/arc.js +14 -0
- package/dist/src/IKanimation/Bone.d.ts +9 -0
- package/dist/src/IKanimation/Bone.js +40 -0
- package/dist/src/IKanimation/CCDSolver.d.ts +37 -0
- package/dist/src/IKanimation/CCDSolver.js +93 -0
- package/dist/src/IKanimation/Joint.d.ts +3 -0
- package/dist/src/IKanimation/Joint.js +17 -0
- package/dist/src/IKanimation/constaint/constraint.d.ts +10 -0
- package/dist/src/IKanimation/constaint/constraint.js +25 -0
- package/dist/src/IKanimation/constaint/hinge.d.ts +12 -0
- package/dist/src/IKanimation/constaint/hinge.js +46 -0
- package/dist/src/IKanimation/constaint/slider.d.ts +12 -0
- package/dist/src/IKanimation/constaint/slider.js +44 -0
- package/dist/src/IKanimation/index.d.ts +0 -0
- package/dist/src/IKanimation/index.js +9 -0
- package/dist/src/IKanimation/isolver.d.ts +4 -0
- package/dist/src/IKanimation/isolver.js +10 -0
- package/dist/src/IKanimation/skeleton.d.ts +13 -0
- package/dist/src/IKanimation/skeleton.js +31 -0
- package/dist/src/alg/common.d.ts +114 -0
- package/dist/src/alg/common.js +302 -0
- package/dist/src/alg/curve.d.ts +4 -0
- package/dist/src/alg/curve.js +11 -0
- package/dist/src/alg/delaunator.d.ts +29 -0
- package/dist/src/alg/delaunator.js +442 -0
- package/dist/src/alg/delaunay.d.ts +20 -0
- package/dist/src/alg/delaunay.js +199 -0
- package/dist/src/alg/delaunayslow.d.ts +18 -0
- package/dist/src/alg/delaunayslow.js +140 -0
- package/dist/src/alg/extrude/extrude.d.ts +3 -0
- package/dist/src/alg/extrude/extrude.js +17 -0
- package/dist/src/alg/extrude.d.ts +199 -0
- package/dist/src/alg/extrude.js +731 -0
- package/dist/src/alg/offset/index.d.ts +0 -0
- package/dist/src/alg/offset/index.js +9 -0
- package/dist/src/alg/offset.d.ts +0 -0
- package/dist/src/alg/offset.js +472 -0
- package/dist/src/alg/pointset.d.ts +94 -0
- package/dist/src/alg/pointset.js +223 -0
- package/dist/src/alg/recognition.d.ts +14 -0
- package/dist/src/alg/recognition.js +37 -0
- package/dist/src/alg/result.d.ts +22 -0
- package/dist/src/alg/result.js +2 -0
- package/dist/src/alg/segmentset.d.ts +11 -0
- package/dist/src/alg/segmentset.js +45 -0
- package/dist/src/alg/sort.d.ts +2 -0
- package/dist/src/alg/sort.js +14 -0
- package/dist/src/alg/split.d.ts +8 -0
- package/dist/src/alg/split.js +10 -0
- package/dist/src/alg/trianglution.d.ts +20 -0
- package/dist/src/alg/trianglution.js +77 -0
- package/dist/src/alg/vol.d.ts +6 -0
- package/dist/src/alg/vol.js +18 -0
- package/dist/src/alg/voronoi.d.ts +31 -0
- package/dist/src/alg/voronoi.js +418 -0
- package/dist/src/app.d.ts +1 -0
- package/dist/src/app.js +245 -0
- package/dist/src/basic/distance.d.ts +12 -0
- package/dist/src/basic/distance.js +42 -0
- package/dist/src/csg/bsp.d.ts +9 -0
- package/dist/src/csg/bsp.js +22 -0
- package/dist/src/csg/node.d.ts +12 -0
- package/dist/src/csg/node.js +75 -0
- package/dist/src/csg/polygon.d.ts +43 -0
- package/dist/src/csg/polygon.js +161 -0
- package/dist/src/diamondMaterialShader.d.ts +92 -0
- package/dist/src/diamondMaterialShader.js +118 -0
- package/dist/src/effect/breath-light.d.ts +4 -0
- package/dist/src/effect/breath-light.js +39 -0
- package/dist/src/extends/geometryaid.d.ts +28 -0
- package/dist/src/extends/geometryaid.js +80 -0
- package/dist/src/extends/split.d.ts +3 -0
- package/dist/src/extends/split.js +13 -0
- package/dist/src/glview.d.ts +112 -0
- package/dist/src/glview.js +564 -0
- package/dist/src/index.d.ts +36 -0
- package/dist/src/index.js +54 -0
- package/dist/src/math/Euler.d.ts +47 -0
- package/dist/src/math/Euler.js +245 -0
- package/dist/src/math/HVec3.d.ts +44 -0
- package/dist/src/math/HVec3.js +195 -0
- package/dist/src/math/Mat3.d.ts +29 -0
- package/dist/src/math/Mat3.js +244 -0
- package/dist/src/math/Mat4.d.ts +85 -0
- package/dist/src/math/Mat4.js +791 -0
- package/dist/src/math/Math.d.ts +130 -0
- package/dist/src/math/Math.js +198 -0
- package/dist/src/math/Quat.d.ts +83 -0
- package/dist/src/math/Quat.js +440 -0
- package/dist/src/math/Vec.d.ts +7 -0
- package/dist/src/math/Vec.js +43 -0
- package/dist/src/math/Vec2.d.ts +68 -0
- package/dist/src/math/Vec2.js +347 -0
- package/dist/src/math/Vec3.d.ts +232 -0
- package/dist/src/math/Vec3.js +1089 -0
- package/dist/src/math/Vec4.d.ts +81 -0
- package/dist/src/math/Vec4.js +494 -0
- package/dist/src/math/vector.d.ts +114 -0
- package/dist/src/math/vector.js +373 -0
- package/dist/src/render/buffer-attribute.d.ts +100 -0
- package/dist/src/render/buffer-attribute.js +340 -0
- package/dist/src/render/eventhandler.d.ts +78 -0
- package/dist/src/render/eventhandler.js +189 -0
- package/dist/src/render/geometry.d.ts +89 -0
- package/dist/src/render/geometry.js +775 -0
- package/dist/src/render/mesh.d.ts +25 -0
- package/dist/src/render/mesh.js +82 -0
- package/dist/src/render/thing.d.ts +34 -0
- package/dist/src/render/thing.js +196 -0
- package/dist/src/render/types.d.ts +2 -0
- package/dist/src/render/types.js +8 -0
- package/dist/src/robust/plane.d.ts +7 -0
- package/dist/src/robust/plane.js +17 -0
- package/dist/src/robust/vec.d.ts +15 -0
- package/dist/src/robust/vec.js +71 -0
- package/dist/src/shape/arc.d.ts +2 -0
- package/dist/src/shape/arc.js +14 -0
- package/dist/src/struct/3d/Box.d.ts +23 -0
- package/dist/src/struct/3d/Box.js +109 -0
- package/dist/src/struct/3d/Capsule.d.ts +12 -0
- package/dist/src/struct/3d/Capsule.js +36 -0
- package/dist/src/struct/3d/Circle.d.ts +34 -0
- package/dist/src/struct/3d/Circle.js +80 -0
- package/dist/src/struct/3d/Disk.d.ts +10 -0
- package/dist/src/struct/3d/Disk.js +22 -0
- package/dist/src/struct/3d/Frustum.d.ts +35 -0
- package/dist/src/struct/3d/Frustum.js +159 -0
- package/dist/src/struct/3d/Line.d.ts +40 -0
- package/dist/src/struct/3d/Line.js +339 -0
- package/dist/src/struct/3d/Path.d.ts +75 -0
- package/dist/src/struct/3d/Path.js +308 -0
- package/dist/src/struct/3d/Plane.d.ts +74 -0
- package/dist/src/struct/3d/Plane.js +295 -0
- package/dist/src/struct/3d/Point.d.ts +4 -0
- package/dist/src/struct/3d/Point.js +30 -0
- package/dist/src/struct/3d/Polygon.d.ts +8 -0
- package/dist/src/struct/3d/Polygon.js +55 -0
- package/dist/src/struct/3d/Polyline.d.ts +25 -0
- package/dist/src/struct/3d/Polyline.js +109 -0
- package/dist/src/struct/3d/Ray.d.ts +21 -0
- package/dist/src/struct/3d/Ray.js +262 -0
- package/dist/src/struct/3d/Rectangle.d.ts +7 -0
- package/dist/src/struct/3d/Rectangle.js +35 -0
- package/dist/src/struct/3d/Segment.d.ts +32 -0
- package/dist/src/struct/3d/Segment.js +334 -0
- package/dist/src/struct/3d/Shape.d.ts +4 -0
- package/dist/src/struct/3d/Shape.js +27 -0
- package/dist/src/struct/3d/Sphere.d.ts +11 -0
- package/dist/src/struct/3d/Sphere.js +30 -0
- package/dist/src/struct/3d/Triangle.d.ts +8 -0
- package/dist/src/struct/3d/Triangle.js +53 -0
- package/dist/src/struct/data/ArrayList.d.ts +42 -0
- package/dist/src/struct/data/ArrayList.js +172 -0
- package/dist/src/struct/data/ArrayObject.d.ts +30 -0
- package/dist/src/struct/data/ArrayObject.js +131 -0
- package/dist/src/struct/data/type.d.ts +13 -0
- package/dist/src/struct/data/type.js +18 -0
- package/dist/src/utils/array.d.ts +24 -0
- package/dist/src/utils/array.js +89 -0
- package/dist/src/utils/types.d.ts +24 -0
- package/dist/src/utils/types.js +20 -0
- package/dist/src-gis/app.d.ts +1 -0
- package/dist/src-gis/app.js +4 -0
- package/dist/src-gis/core/Cartographic.d.ts +20 -0
- package/dist/src-gis/core/Cartographic.js +52 -0
- package/dist/src-gis/core/EllipsoidGeodesic.d.ts +14 -0
- package/dist/src-gis/core/EllipsoidGeodesic.js +51 -0
- package/dist/src-gis/core/EllipsoidTerrainProvider.d.ts +10 -0
- package/dist/src-gis/core/EllipsoidTerrainProvider.js +29 -0
- package/dist/src-gis/core/HeightmapTerrainData.d.ts +3 -0
- package/dist/src-gis/core/HeightmapTerrainData.js +9 -0
- package/dist/src-gis/core/Rectangle.d.ts +45 -0
- package/dist/src-gis/core/Rectangle.js +127 -0
- package/dist/src-gis/core/TaskProcessor.d.ts +35 -0
- package/dist/src-gis/core/TaskProcessor.js +183 -0
- package/dist/src-gis/gis.d.ts +5 -0
- package/dist/src-gis/gis.js +12 -0
- package/dist/src-gis/globe.d.ts +12 -0
- package/dist/src-gis/globe.js +61 -0
- package/dist/src-gis/math/Cartographic.d.ts +8 -0
- package/dist/src-gis/math/Cartographic.js +26 -0
- package/dist/src-gis/math/GVec3.d.ts +12 -0
- package/dist/src-gis/math/GVec3.js +69 -0
- package/dist/src-gis/math/ellipsoid.d.ts +8 -0
- package/dist/src-gis/math/ellipsoid.js +14 -0
- package/dist/src-gis/provider/DcTerrainProvider.d.ts +15 -0
- package/dist/src-gis/provider/DcTerrainProvider.js +19 -0
- package/dist/src-gis/provider/TerrainProvider.d.ts +3 -0
- package/dist/src-gis/provider/TerrainProvider.js +17 -0
- package/dist/src-gis/scene/DcImageryProvider.d.ts +6 -0
- package/dist/src-gis/scene/DcImageryProvider.js +35 -0
- package/dist/src-gis/scene/GeographicTilingScheme.d.ts +21 -0
- package/dist/src-gis/scene/GeographicTilingScheme.js +46 -0
- package/dist/src-gis/scene/Globe.d.ts +34 -0
- package/dist/src-gis/scene/Globe.js +62 -0
- package/dist/src-gis/scene/GlobeSurfaceShaderSet.d.ts +6 -0
- package/dist/src-gis/scene/GlobeSurfaceShaderSet.js +11 -0
- package/dist/src-gis/scene/GlobeSurfaceTileProvider.d.ts +21 -0
- package/dist/src-gis/scene/GlobeSurfaceTileProvider.js +15 -0
- package/dist/src-gis/scene/ImageryLayerCollection.d.ts +21 -0
- package/dist/src-gis/scene/ImageryLayerCollection.js +87 -0
- package/dist/src-gis/scene/ImageryProvider.d.ts +4 -0
- package/dist/src-gis/scene/ImageryProvider.js +28 -0
- package/dist/src-gis/scene/QuadtreeTile.d.ts +48 -0
- package/dist/src-gis/scene/QuadtreeTile.js +137 -0
- package/dist/src-gis/scene/UrlTemplateImageryProvider.d.ts +9 -0
- package/dist/src-gis/scene/UrlTemplateImageryProvider.js +29 -0
- package/dist/src-gis/scene/quadtree_primitive.d.ts +14 -0
- package/dist/src-gis/scene/quadtree_primitive.js +50 -0
- package/dist/struct/3d/Box.d.ts +23 -0
- package/dist/struct/3d/Box.js +109 -0
- package/dist/struct/3d/Capsule.d.ts +12 -0
- package/dist/struct/3d/Capsule.js +34 -0
- package/dist/struct/3d/Circle.d.ts +34 -0
- package/dist/struct/3d/Circle.js +80 -0
- package/dist/struct/3d/Disk.d.ts +10 -0
- package/dist/struct/3d/Disk.js +22 -0
- package/dist/struct/3d/Frustum.d.ts +35 -0
- package/dist/struct/3d/Frustum.js +159 -0
- package/dist/struct/3d/Line.d.ts +40 -0
- package/dist/struct/3d/Line.js +339 -0
- package/dist/struct/3d/Path.d.ts +75 -0
- package/dist/struct/3d/Path.js +306 -0
- package/dist/struct/3d/Plane.d.ts +74 -0
- package/dist/struct/3d/Plane.js +293 -0
- package/dist/struct/3d/Point.d.ts +4 -0
- package/dist/struct/3d/Point.js +28 -0
- package/dist/struct/3d/Polygon.d.ts +8 -0
- package/dist/struct/3d/Polygon.js +53 -0
- package/dist/struct/3d/Polyline.d.ts +25 -0
- package/dist/struct/3d/Polyline.js +107 -0
- package/dist/struct/3d/Ray.d.ts +21 -0
- package/dist/struct/3d/Ray.js +262 -0
- package/dist/struct/3d/Rectangle.d.ts +7 -0
- package/dist/struct/3d/Rectangle.js +33 -0
- package/dist/struct/3d/Segment.d.ts +32 -0
- package/dist/struct/3d/Segment.js +332 -0
- package/dist/struct/3d/Shape.d.ts +4 -0
- package/dist/struct/3d/Shape.js +25 -0
- package/dist/struct/3d/Sphere.d.ts +11 -0
- package/dist/struct/3d/Sphere.js +30 -0
- package/dist/struct/3d/Triangle.d.ts +8 -0
- package/dist/struct/3d/Triangle.js +51 -0
- package/dist/struct/data/ArrayList.d.ts +42 -0
- package/dist/struct/data/ArrayList.js +170 -0
- package/dist/struct/data/ArrayObject.d.ts +30 -0
- package/dist/struct/data/ArrayObject.js +129 -0
- package/dist/struct/data/type.d.ts +13 -0
- package/dist/struct/data/type.js +18 -0
- package/dist/utils/array.d.ts +24 -0
- package/dist/utils/array.js +89 -0
- package/dist/utils/types.d.ts +24 -0
- package/dist/utils/types.js +20 -0
- package/docs/.vuepress/components/distance.vue +125 -0
- package/docs/.vuepress/components/intersect.vue +0 -0
- package/docs/.vuepress/components/trianglution.vue +121 -0
- package/docs/.vuepress/components/utils.js +314 -0
- package/docs/.vuepress/config.js +99 -0
- package/docs/.vuepress/enhanceApp.js +13 -0
- package/docs/.vuepress/public/delaunay.png +0 -0
- package/docs/.vuepress/public/logo.png +0 -0
- package/docs/.vuepress/public/plane-set-convex.png +0 -0
- package/docs/.vuepress/public/sponsor/alipay.jpg +0 -0
- package/docs/.vuepress/public/sponsor/wechat.png +0 -0
- package/docs/README.md +14 -0
- package/docs/demo/README.md +9 -0
- package/docs/guide/README.md +94 -0
- package/docs/guide/array.md +10 -0
- package/docs/guide/cy/trianglution.html +2 -0
- package/docs/guide/distLineAll.md +85 -0
- package/docs/guide/distPointAll.md +137 -0
- package/docs/guide/distRayAll.md +69 -0
- package/docs/guide/distSegmentAll.md +19 -0
- package/docs/guide/point.vue +12 -0
- package/docs/guide/vector.md +10 -0
- package/docs/guide//345/270/270/347/224/250.md +156 -0
- package/docs/sponsor/README.md +15 -0
- package/docs//345/274/200/345/217/221/346/227/245/345/277/227/2020/345/271/2643/346/234/21013/346/227/245.md +6 -0
- package/effect/common.glsl +34 -0
- package/effect/drawing.glsl +36 -0
- package/effect/shape.arc.glsl +13 -0
- package/effect/shape.circle.glsl +13 -0
- package/effect/shape.grid.glsl +42 -0
- package/effect/shape.line.glsl +18 -0
- package/effect/shape.pie.glsl +18 -0
- package/effect/shape.plot.glsl +10 -0
- package/effect/shape.poly.glsl +15 -0
- package/effect/shape.rect.glsl +14 -0
- package/effect/shape.rectround.glsl +15 -0
- package/effect/shape.segment.glsl +10 -0
- package/effect/shape.spiral.glsl +12 -0
- package/effect/shape.star.glsl +16 -0
- package/examples/index.html +31 -0
- package/git.sh +12 -0
- package/image/readme/1640758500266.png +0 -0
- package/image/readme/1640758513361.png +0 -0
- package/index.html +14 -0
- package/linear algorithm//346/225/260/345/255/246/350/241/250/350/276/276/345/274/217.md" +122 -0
- package/linear algorithm//347/237/251/351/230/265.md" +91 -0
- package/package.json +72 -0
- package/readme.md +247 -0
- package/rollup.config.js +71 -0
- package/scripttest.html +23 -0
- package/src/IKanimation/Bone.ts +24 -0
- package/src/IKanimation/CCDSolver.ts +114 -0
- package/src/IKanimation/Joint.ts +13 -0
- package/src/IKanimation/constaint/constraint.ts +23 -0
- package/src/IKanimation/constaint/hinge.ts +29 -0
- package/src/IKanimation/constaint/slider.ts +25 -0
- package/src/IKanimation/index.ts +8 -0
- package/src/IKanimation/isolver.ts +13 -0
- package/src/IKanimation/skeleton.ts +30 -0
- package/src/alg/common.ts +304 -0
- package/src/alg/curve.ts +9 -0
- package/src/alg/delaunator.ts +519 -0
- package/src/alg/delaunay.ts +163 -0
- package/src/alg/delaunayslow.ts +183 -0
- package/src/alg/extrude/extrude.ts +19 -0
- package/src/alg/extrude.ts +941 -0
- package/src/alg/offset/index.ts +8 -0
- package/src/alg/offset.ts +501 -0
- package/src/alg/pointset.ts +219 -0
- package/src/alg/recognition.ts +43 -0
- package/src/alg/result.ts +24 -0
- package/src/alg/segmentset.ts +44 -0
- package/src/alg/sort.ts +11 -0
- package/src/alg/split.ts +15 -0
- package/src/alg/trianglution.ts +58 -0
- package/src/alg/vol.ts +18 -0
- package/src/alg/voronoi.ts +303 -0
- package/src/app.css +12 -0
- package/src/app.ts +290 -0
- package/src/assets/color.jpg +0 -0
- package/src/basic/distance.ts +40 -0
- package/src/clipper/clipper.d.ts +323 -0
- package/src/clipper/clipper.js +7626 -0
- package/src/clipper/clipper_float.js +185 -0
- package/src/clipper/clipper_float_unminified.js +5639 -0
- package/src/clipper/clipperint.js +7626 -0
- package/src/csg/bsp.ts +24 -0
- package/src/csg/csg.js +583 -0
- package/src/csg/node.ts +91 -0
- package/src/csg/polygon.ts +177 -0
- package/src/diamondMaterialShader.ts +93 -0
- package/src/effect/breath-light.ts +24 -0
- package/src/extends/geometryaid.ts +89 -0
- package/src/extends/split.ts +15 -0
- package/src/glview.ts +570 -0
- package/src/index.ts +44 -0
- package/src/math/Euler.ts +239 -0
- package/src/math/HVec3.ts +1146 -0
- package/src/math/Mat3.ts +365 -0
- package/src/math/Mat4.ts +1134 -0
- package/src/math/Math.ts +213 -0
- package/src/math/Quat.ts +541 -0
- package/src/math/Vec.ts +26 -0
- package/src/math/Vec2.ts +408 -0
- package/src/math/Vec3.ts +1294 -0
- package/src/math/Vec4.ts +587 -0
- package/src/math/vector.ts +378 -0
- package/src/render/buffer-attribute.ts +484 -0
- package/src/render/eventhandler.ts +193 -0
- package/src/render/geometry.ts +1326 -0
- package/src/render/mesh.ts +80 -0
- package/src/render/thing.ts +204 -0
- package/src/render/types.ts +15 -0
- package/src/robust/plane.ts +12 -0
- package/src/robust/readme.md +1 -0
- package/src/robust/vec.ts +61 -0
- package/src/shader/cga.glsl +202 -0
- package/src/shader/common.glsl +87 -0
- package/src/shader/noise/GLSL-Noise.md +1108 -0
- package/src/shader/noise/cellular2D.glsl +69 -0
- package/src/shader/noise/cellular2x2.glsl +64 -0
- package/src/shader/noise/cellular2x2x2.glsl +88 -0
- package/src/shader/noise/cellular3D.glsl +187 -0
- package/src/shader/noise/classicnoise2D.glsl +113 -0
- package/src/shader/noise/classicnoise3D.glsl +177 -0
- package/src/shader/noise/classicnoise4D.glsl +302 -0
- package/src/shader/noise/noise2D.glsl +71 -0
- package/src/shader/noise/noise3D.glsl +103 -0
- package/src/shader/noise/noise3Dgrad.glsl +111 -0
- package/src/shader/noise/noise4D.glsl +129 -0
- package/src/shader/noise/psrdnoise2D.glsl +462 -0
- package/src/shape/arc.ts +14 -0
- package/src/struct/3d/Box.ts +124 -0
- package/src/struct/3d/Capsule.ts +18 -0
- package/src/struct/3d/Circle.ts +78 -0
- package/src/struct/3d/Disk.ts +22 -0
- package/src/struct/3d/Frustum.ts +189 -0
- package/src/struct/3d/Line.ts +378 -0
- package/src/struct/3d/Path.ts +314 -0
- package/src/struct/3d/Plane.ts +339 -0
- package/src/struct/3d/Point.ts +7 -0
- package/src/struct/3d/PolyLine.ts +98 -0
- package/src/struct/3d/Polygon.ts +44 -0
- package/src/struct/3d/Ray.ts +285 -0
- package/src/struct/3d/Rectangle.ts +18 -0
- package/src/struct/3d/Segment.ts +330 -0
- package/src/struct/3d/Shape.ts +7 -0
- package/src/struct/3d/Sphere.ts +31 -0
- package/src/struct/3d/Triangle.ts +28 -0
- package/src/struct/data/ArrayList.ts +144 -0
- package/src/struct/data/ArrayObject.ts +105 -0
- package/src/struct/data/type.ts +14 -0
- package/src/utils/array.ts +106 -0
- package/src/utils/types.ts +42 -0
- package/src-gis/app.ts +7 -0
- package/src-gis/core/Cartographic.ts +48 -0
- package/src-gis/core/EllipsoidGeodesic.ts +56 -0
- package/src-gis/core/EllipsoidTerrainProvider.ts +35 -0
- package/src-gis/core/HeightmapTerrainData.ts +5 -0
- package/src-gis/core/Rectangle.ts +112 -0
- package/src-gis/core/TaskProcessor.ts +222 -0
- package/src-gis/gis.ts +25 -0
- package/src-gis/globe.ts +54 -0
- package/src-gis/math/Cartographic.ts +24 -0
- package/src-gis/math/GVec3.ts +55 -0
- package/src-gis/math/ellipsoid.ts +13 -0
- package/src-gis/provider/DcTerrainProvider.ts +36 -0
- package/src-gis/provider/TerrainProvider.ts +12 -0
- package/src-gis/scene/DcImageryProvider.ts +36 -0
- package/src-gis/scene/GeographicTilingScheme.ts +65 -0
- package/src-gis/scene/Globe.ts +76 -0
- package/src-gis/scene/GlobeSurfaceShaderSet.ts +9 -0
- package/src-gis/scene/GlobeSurfaceTileProvider.ts +25 -0
- package/src-gis/scene/ImageryLayerCollection.ts +75 -0
- package/src-gis/scene/ImageryProvider.ts +28 -0
- package/src-gis/scene/QuadtreeTile.ts +162 -0
- package/src-gis/scene/UrlTemplateImageryProvider.ts +32 -0
- package/src-gis/scene/quadtree_primitive.ts +58 -0
- package/tsconfig.json +75 -0
- package/webpack.config.js +112 -0
- package//350/256/241/347/256/227/345/207/240/344/275/225/351/227/256/351/242/230.md +26 -0
package/dist/glview.js
ADDED
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GLView = void 0;
|
|
4
|
+
var three_1 = require("three");
|
|
5
|
+
// import { OrbitControls } from "three/examples/jsm/controls/OrbitControls"
|
|
6
|
+
var TransformControls_1 = require("three/examples/jsm/controls/TransformControls");
|
|
7
|
+
var EffectComposer_1 = require("three/examples/jsm/postprocessing/EffectComposer");
|
|
8
|
+
var RenderPass_1 = require("three/examples/jsm/postprocessing/RenderPass");
|
|
9
|
+
var UnrealBloomPass_1 = require("three/examples/jsm/postprocessing/UnrealBloomPass");
|
|
10
|
+
var OrbitControls_1 = require("three/examples/jsm/controls/OrbitControls");
|
|
11
|
+
var raycaster = new three_1.Raycaster();
|
|
12
|
+
var mouse = new three_1.Vector2();
|
|
13
|
+
var selectMaterial = new three_1.MeshPhongMaterial({ color: 0xaa3366 });
|
|
14
|
+
var PMREM = {
|
|
15
|
+
Scene: 0,
|
|
16
|
+
Equirectangular: 1,
|
|
17
|
+
CubeMap: 2
|
|
18
|
+
};
|
|
19
|
+
var GLView = /** @class */ (function () {
|
|
20
|
+
function GLView(settings) {
|
|
21
|
+
if (settings === void 0) { settings = {}; }
|
|
22
|
+
this.allowSelected = true;
|
|
23
|
+
this.renderer = new three_1.WebGLRenderer({
|
|
24
|
+
antialias: true
|
|
25
|
+
});
|
|
26
|
+
this.container = settings.container;
|
|
27
|
+
if (this.container)
|
|
28
|
+
this.container.appendChild(this.renderer.domElement);
|
|
29
|
+
this._scene = settings.scene || new three_1.Scene();
|
|
30
|
+
this._scene.name = "默认场景";
|
|
31
|
+
this._modelScene = new three_1.Object3D();
|
|
32
|
+
this._modelScene.name = "模型场景";
|
|
33
|
+
this._scene.add(this._modelScene);
|
|
34
|
+
this._helperScene = new three_1.Object3D();
|
|
35
|
+
this._helperScene.add(new three_1.AxesHelper(1000000));
|
|
36
|
+
this._scene.add(this._helperScene);
|
|
37
|
+
this.clearColor = settings.clearColor;
|
|
38
|
+
this.selectedObject = new three_1.Object3D();
|
|
39
|
+
this.selectedObject.parent = this._scene;
|
|
40
|
+
this.selecteds = this.selectedObject.children;
|
|
41
|
+
this.updates = [];
|
|
42
|
+
// Prefiltered, Mipmapped Radiance Environment Map
|
|
43
|
+
this._pmremGenerator = null;
|
|
44
|
+
this._enablePostProcessing = settings._enablePostProcessing || false;
|
|
45
|
+
this.effectComposer = new EffectComposer_1.EffectComposer(this.renderer);
|
|
46
|
+
this.init(settings);
|
|
47
|
+
this.onResize();
|
|
48
|
+
this.domElement.addEventListener("mousedown", this.onMousedown.bind(this));
|
|
49
|
+
window.addEventListener("resize", this.onResize.bind(this));
|
|
50
|
+
}
|
|
51
|
+
GLView.prototype.init = function (settings) {
|
|
52
|
+
this._camera = settings.camera || new three_1.PerspectiveCamera(45, 1, 0.1, 20000);
|
|
53
|
+
this._camera.position.set(16, 4, -30);
|
|
54
|
+
this._camera.name = "默认相机";
|
|
55
|
+
this._controls = new OrbitControls_1.OrbitControls(this._camera, this.domElement);
|
|
56
|
+
this._controls.addEventListener("change", function (e) {
|
|
57
|
+
// console.log(e);
|
|
58
|
+
var oc = e.target;
|
|
59
|
+
console.log(oc.target);
|
|
60
|
+
console.log(oc.object.position);
|
|
61
|
+
});
|
|
62
|
+
this._controls.minDistance = 10;
|
|
63
|
+
this._transfromControl = new TransformControls_1.TransformControls(this._camera, this.domElement);
|
|
64
|
+
this.scene.add(this._transfromControl);
|
|
65
|
+
this.scene.add(this._camera);
|
|
66
|
+
var light = new three_1.DirectionalLight();
|
|
67
|
+
light.name = "默认方向光";
|
|
68
|
+
light.position.set(1, 1, 1);
|
|
69
|
+
this.scene.add(light);
|
|
70
|
+
var pl = new three_1.PointLight();
|
|
71
|
+
pl.distance = 1000;
|
|
72
|
+
this._camera.add(pl);
|
|
73
|
+
this.scene.add(this._camera);
|
|
74
|
+
this.scene.add(new three_1.AxesHelper(10000));
|
|
75
|
+
this.scene.add(new three_1.GridHelper(100, 20, 0xff0000, 0xaaaaaa));
|
|
76
|
+
//添加一个地板
|
|
77
|
+
// var gdGeo = new PlaneBufferGeometry(1000000, 1000000);
|
|
78
|
+
// gdGeo.rotateX(-Math.PI / 2)
|
|
79
|
+
// var mesh = new Mesh(gdGeo, new MeshPhysicalMaterial({
|
|
80
|
+
// color: 0xffffff,
|
|
81
|
+
// transparency: 0.7,
|
|
82
|
+
// transparent: true,
|
|
83
|
+
// metalness: 0.0,
|
|
84
|
+
// roughness: 0.7,
|
|
85
|
+
// polygonOffset: true,
|
|
86
|
+
// polygonOffsetFactor: -1,
|
|
87
|
+
// polygonOffsetUnits: -1
|
|
88
|
+
// // side: DoubleSide
|
|
89
|
+
// } as any));
|
|
90
|
+
// (<any>mesh).isHelper = true;
|
|
91
|
+
// mesh.position.set(0, -1, 0)
|
|
92
|
+
// this.add(mesh);
|
|
93
|
+
//添加一个环境光
|
|
94
|
+
// new RGBELoader()
|
|
95
|
+
// .setDataType(UnsignedByteType)
|
|
96
|
+
// .load('../../assets/textures/env/quarry_01_1k.hdr', (texture) => {
|
|
97
|
+
// this.pmrenvMap(texture)
|
|
98
|
+
// })
|
|
99
|
+
};
|
|
100
|
+
Object.defineProperty(GLView.prototype, "modelScene", {
|
|
101
|
+
get: function () {
|
|
102
|
+
return this._modelScene;
|
|
103
|
+
},
|
|
104
|
+
set: function (val) {
|
|
105
|
+
this._modelScene = val;
|
|
106
|
+
this.add(val);
|
|
107
|
+
},
|
|
108
|
+
enumerable: false,
|
|
109
|
+
configurable: true
|
|
110
|
+
});
|
|
111
|
+
Object.defineProperty(GLView.prototype, "helperScene", {
|
|
112
|
+
get: function () {
|
|
113
|
+
return this._helperScene;
|
|
114
|
+
},
|
|
115
|
+
set: function (val) {
|
|
116
|
+
this._helperScene = val;
|
|
117
|
+
this.add(val);
|
|
118
|
+
},
|
|
119
|
+
enumerable: false,
|
|
120
|
+
configurable: true
|
|
121
|
+
});
|
|
122
|
+
Object.defineProperty(GLView.prototype, "clearColor", {
|
|
123
|
+
set: function (val) {
|
|
124
|
+
val = val || 0xaaeeff;
|
|
125
|
+
this.renderer.setClearColor(val);
|
|
126
|
+
},
|
|
127
|
+
enumerable: false,
|
|
128
|
+
configurable: true
|
|
129
|
+
});
|
|
130
|
+
GLView.prototype.setTransfromMode = function (mode) {
|
|
131
|
+
this._transfromControl.setMode(mode);
|
|
132
|
+
};
|
|
133
|
+
GLView.prototype.attach = function (model) {
|
|
134
|
+
if (!model) {
|
|
135
|
+
this.detach(model);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
this._transfromControl.attach(model);
|
|
139
|
+
this._controls.enabled = false;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
GLView.prototype.detach = function (model) {
|
|
143
|
+
this._transfromControl.detach(model);
|
|
144
|
+
this._controls.enabled = true;
|
|
145
|
+
};
|
|
146
|
+
GLView.prototype.pmrenvMap = function (texture, type) {
|
|
147
|
+
if (type === void 0) { type = PMREM.Equirectangular; }
|
|
148
|
+
texture.mapping = three_1.EquirectangularReflectionMapping;
|
|
149
|
+
if (!this._pmremGenerator)
|
|
150
|
+
this._pmremGenerator = new three_1.PMREMGenerator(this.renderer);
|
|
151
|
+
var renderTarget;
|
|
152
|
+
switch (type) {
|
|
153
|
+
case PMREM.CubeMap:
|
|
154
|
+
this._pmremGenerator.compileCubemapShader();
|
|
155
|
+
renderTarget = this._pmremGenerator.fromCubemap(texture);
|
|
156
|
+
break;
|
|
157
|
+
case PMREM.Equirectangular:
|
|
158
|
+
renderTarget = this._pmremGenerator.fromEquirectangular(texture);
|
|
159
|
+
this._pmremGenerator.compileEquirectangularShader();
|
|
160
|
+
break;
|
|
161
|
+
default:
|
|
162
|
+
throw ("pmrem error");
|
|
163
|
+
}
|
|
164
|
+
// this.scene.background = renderTarget.texture;
|
|
165
|
+
this.scene.environment = renderTarget.texture;
|
|
166
|
+
};
|
|
167
|
+
Object.defineProperty(GLView.prototype, "toneExposure", {
|
|
168
|
+
set: function (val) {
|
|
169
|
+
this.renderer.toneMappingExposure = val;
|
|
170
|
+
},
|
|
171
|
+
enumerable: false,
|
|
172
|
+
configurable: true
|
|
173
|
+
});
|
|
174
|
+
Object.defineProperty(GLView.prototype, "camera", {
|
|
175
|
+
get: function () {
|
|
176
|
+
return this._camera;
|
|
177
|
+
},
|
|
178
|
+
set: function (value) {
|
|
179
|
+
this._camera = value;
|
|
180
|
+
this._controls.object = value;
|
|
181
|
+
},
|
|
182
|
+
enumerable: false,
|
|
183
|
+
configurable: true
|
|
184
|
+
});
|
|
185
|
+
Object.defineProperty(GLView.prototype, "scene", {
|
|
186
|
+
get: function () {
|
|
187
|
+
return this._scene;
|
|
188
|
+
},
|
|
189
|
+
set: function (value) {
|
|
190
|
+
this._scene = value;
|
|
191
|
+
},
|
|
192
|
+
enumerable: false,
|
|
193
|
+
configurable: true
|
|
194
|
+
});
|
|
195
|
+
Object.defineProperty(GLView.prototype, "width", {
|
|
196
|
+
get: function () {
|
|
197
|
+
return this.domElement.width;
|
|
198
|
+
},
|
|
199
|
+
enumerable: false,
|
|
200
|
+
configurable: true
|
|
201
|
+
});
|
|
202
|
+
Object.defineProperty(GLView.prototype, "height", {
|
|
203
|
+
get: function () {
|
|
204
|
+
return this.domElement.height;
|
|
205
|
+
},
|
|
206
|
+
enumerable: false,
|
|
207
|
+
configurable: true
|
|
208
|
+
});
|
|
209
|
+
Object.defineProperty(GLView.prototype, "domElement", {
|
|
210
|
+
get: function () {
|
|
211
|
+
return this.renderer.domElement;
|
|
212
|
+
},
|
|
213
|
+
enumerable: false,
|
|
214
|
+
configurable: true
|
|
215
|
+
});
|
|
216
|
+
Object.defineProperty(GLView.prototype, "enablePostProcessing", {
|
|
217
|
+
get: function () { return this._enablePostProcessing; },
|
|
218
|
+
set: function (value) {
|
|
219
|
+
this._enablePostProcessing = value;
|
|
220
|
+
if (!value)
|
|
221
|
+
return;
|
|
222
|
+
if (!this.renderPass) {
|
|
223
|
+
this.renderPass = new RenderPass_1.RenderPass(this._scene, this._camera);
|
|
224
|
+
this.effectComposer.addPass(this.renderPass);
|
|
225
|
+
this.effectComposer.setSize(this.width, this.height);
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
enumerable: false,
|
|
229
|
+
configurable: true
|
|
230
|
+
});
|
|
231
|
+
GLView.prototype.addPass = function (pass) {
|
|
232
|
+
this.effectComposer.addPass(pass);
|
|
233
|
+
};
|
|
234
|
+
GLView.prototype.addPassEx = function (name, params) {
|
|
235
|
+
if (params === void 0) { params = { threshold: 0.01, strength: 0.1, radius: 0.4 }; }
|
|
236
|
+
if (name === "Bloom") {
|
|
237
|
+
var bloomPass = new UnrealBloomPass_1.UnrealBloomPass(new three_1.Vector2(this.width, this.height), 1.5, 0.4, 0.85);
|
|
238
|
+
bloomPass.threshold = params.threshold;
|
|
239
|
+
bloomPass.strength = params.strength;
|
|
240
|
+
bloomPass.radius = params.radius;
|
|
241
|
+
this.effectComposer.addPass(bloomPass);
|
|
242
|
+
return bloomPass;
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* 向场景添加模型
|
|
247
|
+
* @param {Object3D} object 模型
|
|
248
|
+
*/
|
|
249
|
+
GLView.prototype.add = function () {
|
|
250
|
+
var object = [];
|
|
251
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
252
|
+
object[_i] = arguments[_i];
|
|
253
|
+
}
|
|
254
|
+
for (var i = 0; i < object.length; i++) {
|
|
255
|
+
var object_i = object[i];
|
|
256
|
+
if (object_i.isSequence) {
|
|
257
|
+
this._modelScene.add(object_i.renderObject);
|
|
258
|
+
this.addUpdates(object_i);
|
|
259
|
+
}
|
|
260
|
+
if (object_i.isBody) {
|
|
261
|
+
this._modelScene.add(object_i.renderObject);
|
|
262
|
+
}
|
|
263
|
+
else if (object_i.isHelper) {
|
|
264
|
+
this._helperScene.add(object_i);
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
this._modelScene.add(object_i);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return this;
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* 场景移除模型
|
|
274
|
+
* @param {Object3D} object 模型
|
|
275
|
+
*/
|
|
276
|
+
GLView.prototype.remove = function () {
|
|
277
|
+
var object = [];
|
|
278
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
279
|
+
object[_i] = arguments[_i];
|
|
280
|
+
}
|
|
281
|
+
for (var i = 0; i < object.length; i++) {
|
|
282
|
+
var object_i = object[i];
|
|
283
|
+
if (object_i.isSequence) {
|
|
284
|
+
this._modelScene.remove(object_i.renderObject);
|
|
285
|
+
this.removeUpdates(object_i);
|
|
286
|
+
}
|
|
287
|
+
if (object_i.isBody) {
|
|
288
|
+
this._modelScene.remove(object_i.renderObject);
|
|
289
|
+
}
|
|
290
|
+
else if (object_i.isHelper) {
|
|
291
|
+
this._helperScene.remove(object_i);
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
this._modelScene.remove(object_i);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return this;
|
|
298
|
+
};
|
|
299
|
+
/**
|
|
300
|
+
* 设置渲染DOM的宽高 更新相机
|
|
301
|
+
* @param {} width
|
|
302
|
+
* @param {} height
|
|
303
|
+
*/
|
|
304
|
+
GLView.prototype.size = function (width, height) {
|
|
305
|
+
this.camera.aspect = width / height;
|
|
306
|
+
this.camera.updateProjectionMatrix();
|
|
307
|
+
this.renderer.setSize(width, height);
|
|
308
|
+
if (this._enablePostProcessing)
|
|
309
|
+
this.effectComposer.setSize(width, height);
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* 添加更新函数
|
|
313
|
+
* @param {} ...updates
|
|
314
|
+
*/
|
|
315
|
+
GLView.prototype.addUpdates = function () {
|
|
316
|
+
var _a;
|
|
317
|
+
var updates = [];
|
|
318
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
319
|
+
updates[_i] = arguments[_i];
|
|
320
|
+
}
|
|
321
|
+
(_a = this.updates).push.apply(_a, updates);
|
|
322
|
+
};
|
|
323
|
+
GLView.prototype.removeUpdates = function () {
|
|
324
|
+
var updates = [];
|
|
325
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
326
|
+
updates[_i] = arguments[_i];
|
|
327
|
+
}
|
|
328
|
+
for (var i = 0; i < updates.length; i++) {
|
|
329
|
+
var upm = updates[i];
|
|
330
|
+
var upos = this.updates.indexOf(upm);
|
|
331
|
+
if (upos >= 0)
|
|
332
|
+
this.updates.splice(upos, 1);
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
GLView.prototype.onMousedown = function (event) {
|
|
336
|
+
var rect = this.domElement.getBoundingClientRect();
|
|
337
|
+
mouse.x = ((event.clientX - rect.left) / this.width) * 2 - 1;
|
|
338
|
+
mouse.y = -((event.clientY - rect.top) / this.height) * 2 + 1;
|
|
339
|
+
if (event.button === 0) {
|
|
340
|
+
var intersect = this.getSelect(mouse, false);
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
GLView.prototype.onResize = function () {
|
|
344
|
+
this.size(window.innerWidth, window.innerHeight);
|
|
345
|
+
};
|
|
346
|
+
/**
|
|
347
|
+
* 世界坐标投影到屏幕坐标
|
|
348
|
+
* @param {Vector3} v3 世界坐标
|
|
349
|
+
*/
|
|
350
|
+
GLView.prototype.project = function (v3) {
|
|
351
|
+
return v3.project(this.camera);
|
|
352
|
+
};
|
|
353
|
+
/**
|
|
354
|
+
* 世界坐标中的点对应document坐标
|
|
355
|
+
* @param {} v3
|
|
356
|
+
*/
|
|
357
|
+
GLView.prototype.getScreenPosition = function (v3) {
|
|
358
|
+
v3 = this.project(v3);
|
|
359
|
+
var rect = this.domElement.getBoundingClientRect();
|
|
360
|
+
var x = ((v3.x + 1) / 2) * this.width + rect.left;
|
|
361
|
+
var y = -((v3.y - 1) / 2) * this.height + rect.top;
|
|
362
|
+
return new three_1.Vector2(x, y);
|
|
363
|
+
};
|
|
364
|
+
/**
|
|
365
|
+
* 从一个坐标点获取模型
|
|
366
|
+
* @param {} v2
|
|
367
|
+
* @param {} first=true
|
|
368
|
+
*/
|
|
369
|
+
GLView.prototype.getSelect = function (v2, isMousePos, first) {
|
|
370
|
+
if (isMousePos === void 0) { isMousePos = true; }
|
|
371
|
+
if (first === void 0) { first = true; }
|
|
372
|
+
if (isMousePos) {
|
|
373
|
+
var rect = this.domElement.getBoundingClientRect();
|
|
374
|
+
v2.x = ((v2.x - rect.left) / this.width) * 2 - 1;
|
|
375
|
+
v2.y = -((v2.y - rect.top) / this.height) * 2 + 1;
|
|
376
|
+
}
|
|
377
|
+
//渲染区域之外
|
|
378
|
+
if (v2.x < -1 || v2.x > 1 || v2.y < -1 || v2.y > 1)
|
|
379
|
+
return null;
|
|
380
|
+
raycaster.setFromCamera(v2, this.camera);
|
|
381
|
+
var intersects = raycaster.intersectObject(this.modelScene, true);
|
|
382
|
+
if (intersects.length > 0) {
|
|
383
|
+
if (first)
|
|
384
|
+
return intersects[0];
|
|
385
|
+
else
|
|
386
|
+
return intersects;
|
|
387
|
+
}
|
|
388
|
+
return null;
|
|
389
|
+
};
|
|
390
|
+
/**
|
|
391
|
+
* 将屏幕点反投影到世界坐标
|
|
392
|
+
* @param {} v3
|
|
393
|
+
*/
|
|
394
|
+
GLView.prototype.unproject = function (v3) {
|
|
395
|
+
return v3.unproject(this.camera);
|
|
396
|
+
};
|
|
397
|
+
GLView.prototype.selectMD = function (mulSelected) {
|
|
398
|
+
if (mulSelected === void 0) { mulSelected = false; }
|
|
399
|
+
if (!this.allowSelected)
|
|
400
|
+
return null;
|
|
401
|
+
raycaster.setFromCamera(mouse, this.camera);
|
|
402
|
+
var intersects = raycaster.intersectObject(this.modelScene, true);
|
|
403
|
+
if (intersects.length > 0) {
|
|
404
|
+
var intersect = intersects[0];
|
|
405
|
+
var itrObj = this.getUserParent(intersect.object);
|
|
406
|
+
console.log(intersect.point);
|
|
407
|
+
if (!mulSelected) {
|
|
408
|
+
// 不允许多选
|
|
409
|
+
this.unselect();
|
|
410
|
+
}
|
|
411
|
+
if (!itrObj.selected) {
|
|
412
|
+
this.select(itrObj);
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
itrObj.selected = false;
|
|
416
|
+
var idx = this.selecteds.indexOf(itrObj);
|
|
417
|
+
this.selecteds.splice(idx, 1);
|
|
418
|
+
itrObj.material = itrObj.orgMaterial;
|
|
419
|
+
}
|
|
420
|
+
return itrObj;
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
this.unselect();
|
|
424
|
+
}
|
|
425
|
+
return null;
|
|
426
|
+
};
|
|
427
|
+
/**
|
|
428
|
+
* 设置要选中的模型为选中状态
|
|
429
|
+
* @param {} models
|
|
430
|
+
*/
|
|
431
|
+
GLView.prototype.selectModels = function (models) {
|
|
432
|
+
var ary = Array.isArray(models) ? models : [models];
|
|
433
|
+
//unselected
|
|
434
|
+
this.unselect();
|
|
435
|
+
//selected
|
|
436
|
+
this.select(ary);
|
|
437
|
+
};
|
|
438
|
+
GLView.prototype.select = function (models) {
|
|
439
|
+
var _a;
|
|
440
|
+
var _this = this;
|
|
441
|
+
if (!this.allowSelected)
|
|
442
|
+
return;
|
|
443
|
+
if (models && !Array.isArray(models))
|
|
444
|
+
this._modelControl.attach(this.getUserParent(models));
|
|
445
|
+
var ary;
|
|
446
|
+
if (models === undefined)
|
|
447
|
+
ary = this.selecteds;
|
|
448
|
+
else
|
|
449
|
+
ary = Array.isArray(models) ? models : [models];
|
|
450
|
+
ary = ary.map(function (o) { return _this.getUserParent(o); });
|
|
451
|
+
(_a = this.selecteds).push.apply(_a, ary);
|
|
452
|
+
for (var i = 0; i < ary.length; i++) {
|
|
453
|
+
var model = ary[i];
|
|
454
|
+
//显示开始和结束的控制点
|
|
455
|
+
var model_bone;
|
|
456
|
+
model.children.forEach(function (cm) {
|
|
457
|
+
if (cm.name.indexOf("bone_start") !== -1) {
|
|
458
|
+
model_bone = cm;
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
if (model_bone) {
|
|
463
|
+
this.startControl.attach(model_bone);
|
|
464
|
+
}
|
|
465
|
+
//End----------------------------------------------
|
|
466
|
+
for (var j = 0; j < model.children.length; j++) {
|
|
467
|
+
var m = model.children[j];
|
|
468
|
+
//当前层级的选中
|
|
469
|
+
if (m.name.indexOf("hide_node") !== -1) {
|
|
470
|
+
m.traverse(function (obj) {
|
|
471
|
+
if (!obj.orgMaterial)
|
|
472
|
+
obj.orgMaterial = obj.material;
|
|
473
|
+
obj.selected = true;
|
|
474
|
+
obj.material = selectMaterial;
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
//显示骨骼操作点
|
|
478
|
+
if (m.name.indexOf("bone") !== -1)
|
|
479
|
+
m.visible = true;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
/**
|
|
484
|
+
* 取消模型的选中状态
|
|
485
|
+
* @param {} models
|
|
486
|
+
*/
|
|
487
|
+
GLView.prototype.unselect = function (models) {
|
|
488
|
+
this._modelControl.detach();
|
|
489
|
+
var ary;
|
|
490
|
+
if (models === undefined)
|
|
491
|
+
ary = this.selecteds;
|
|
492
|
+
else
|
|
493
|
+
ary = Array.isArray(models) ? models : [models];
|
|
494
|
+
for (var i = 0; i < ary.length; i++) {
|
|
495
|
+
var model = ary[i];
|
|
496
|
+
for (var j = 0; j < model.children.length; j++) {
|
|
497
|
+
var m = model.children[j];
|
|
498
|
+
//当前层级的选中
|
|
499
|
+
if (m.name.indexOf("hide_node") !== -1) {
|
|
500
|
+
if (m.orgMaterial && m.selected)
|
|
501
|
+
m.material = m.orgMaterial;
|
|
502
|
+
}
|
|
503
|
+
//显示骨骼操作点
|
|
504
|
+
if (m.name.indexOf("bone") !== -1)
|
|
505
|
+
m.visible = false;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
// this.selectedObject.remove(...ary);
|
|
509
|
+
while (ary.length > 0) {
|
|
510
|
+
var objs = ary.pop();
|
|
511
|
+
objs.traverse(function (obj) {
|
|
512
|
+
if (obj.orgMaterial && obj.selected)
|
|
513
|
+
obj.material = obj.orgMaterial;
|
|
514
|
+
obj.selected = false;
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
this.startControl.detach();
|
|
518
|
+
this.endControl.detach();
|
|
519
|
+
};
|
|
520
|
+
/**
|
|
521
|
+
* 判断点是否在渲染区域(是否可见)
|
|
522
|
+
* @param {} v3
|
|
523
|
+
*/
|
|
524
|
+
GLView.prototype.inRendererArea = function (v3) {
|
|
525
|
+
v3 = this.project(v3);
|
|
526
|
+
return !(v3.x > 1 || v3.x < -1 || v3.y > 1 || v3.y < -1);
|
|
527
|
+
};
|
|
528
|
+
GLView.prototype.render = function () {
|
|
529
|
+
if (this._enablePostProcessing)
|
|
530
|
+
this.effectComposer.render();
|
|
531
|
+
else
|
|
532
|
+
this.renderer.render(this._scene, this._camera);
|
|
533
|
+
};
|
|
534
|
+
GLView.prototype.run = function () {
|
|
535
|
+
for (var i = 0; i < this.updates.length; i++) {
|
|
536
|
+
this.updates[i]();
|
|
537
|
+
}
|
|
538
|
+
this.render();
|
|
539
|
+
requestAnimationFrame(this.run.bind(this));
|
|
540
|
+
};
|
|
541
|
+
GLView.prototype.hide = function (obj) {
|
|
542
|
+
obj.visible = false;
|
|
543
|
+
};
|
|
544
|
+
GLView.prototype.hideOther = function (obj) {
|
|
545
|
+
this.modelScene.traverse(function (e) {
|
|
546
|
+
e.visible = false;
|
|
547
|
+
});
|
|
548
|
+
obj.traverse(function (e) {
|
|
549
|
+
e.visible = true;
|
|
550
|
+
});
|
|
551
|
+
this.modelScene.visible = true;
|
|
552
|
+
while (obj !== this.modelScene) {
|
|
553
|
+
obj.visible = true;
|
|
554
|
+
obj = obj.parent;
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
GLView.prototype.showAll = function () {
|
|
558
|
+
this.modelScene.traverse(function (e) {
|
|
559
|
+
e.visible = true;
|
|
560
|
+
});
|
|
561
|
+
};
|
|
562
|
+
return GLView;
|
|
563
|
+
}());
|
|
564
|
+
exports.GLView = GLView;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export * from "./utils/array";
|
|
2
|
+
export * from "./math/Vec2";
|
|
3
|
+
export * from "./math/Vec3";
|
|
4
|
+
export * from "./math/Vec4";
|
|
5
|
+
export * from "./math/Mat3";
|
|
6
|
+
export * from "./math/Mat4";
|
|
7
|
+
export * from "./math/Quat";
|
|
8
|
+
export * from "./math/Math";
|
|
9
|
+
export * from "./math/Euler";
|
|
10
|
+
export * from "./math/vector";
|
|
11
|
+
export * from "./alg/common";
|
|
12
|
+
export * from "./alg/result";
|
|
13
|
+
export * from "./alg/extrude";
|
|
14
|
+
export * from "./alg/delaunay";
|
|
15
|
+
export * from "./render/mesh";
|
|
16
|
+
export * from "./struct/3d/Box";
|
|
17
|
+
export * from "./struct/3d/Capsule";
|
|
18
|
+
export * from "./struct/3d/Circle";
|
|
19
|
+
export * from "./struct/3d/Disk";
|
|
20
|
+
export * from "./struct/3d/Line";
|
|
21
|
+
export * from "./struct/3d/Path";
|
|
22
|
+
export * from "./struct/3d/Plane";
|
|
23
|
+
export * from "./struct/3d/Point";
|
|
24
|
+
export * from "./struct/3d/Polyline";
|
|
25
|
+
export * from "./struct/3d/Polygon";
|
|
26
|
+
export * from "./struct/3d/Ray";
|
|
27
|
+
export * from "./struct/3d/Segment";
|
|
28
|
+
export * from "./struct/3d/Triangle";
|
|
29
|
+
export * from "./struct/3d/Frustum";
|
|
30
|
+
export * from "./struct/3d/Sphere";
|
|
31
|
+
export * from "./alg/delaunator";
|
|
32
|
+
export * from "./alg/voronoi";
|
|
33
|
+
export * from "./extends/geometryaid";
|
|
34
|
+
export * from "./render/buffer-attribute";
|
|
35
|
+
export * from "./render/geometry";
|
|
36
|
+
export * from "./render/mesh";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./utils/array"), exports);
|
|
14
|
+
__exportStar(require("./math/Vec2"), exports);
|
|
15
|
+
__exportStar(require("./math/Vec3"), exports);
|
|
16
|
+
__exportStar(require("./math/Vec4"), exports);
|
|
17
|
+
__exportStar(require("./math/Mat3"), exports);
|
|
18
|
+
__exportStar(require("./math/Mat4"), exports);
|
|
19
|
+
__exportStar(require("./math/Quat"), exports);
|
|
20
|
+
__exportStar(require("./math/Math"), exports);
|
|
21
|
+
__exportStar(require("./math/Euler"), exports);
|
|
22
|
+
//common
|
|
23
|
+
__exportStar(require("./math/vector"), exports);
|
|
24
|
+
__exportStar(require("./alg/common"), exports);
|
|
25
|
+
__exportStar(require("./alg/result"), exports);
|
|
26
|
+
__exportStar(require("./alg/extrude"), exports);
|
|
27
|
+
__exportStar(require("./alg/delaunay"), exports);
|
|
28
|
+
__exportStar(require("./render/mesh"), exports);
|
|
29
|
+
__exportStar(require("./struct/3d/Box"), exports);
|
|
30
|
+
__exportStar(require("./struct/3d/Capsule"), exports);
|
|
31
|
+
__exportStar(require("./struct/3d/Circle"), exports);
|
|
32
|
+
__exportStar(require("./struct/3d/Disk"), exports);
|
|
33
|
+
__exportStar(require("./struct/3d/Line"), exports);
|
|
34
|
+
__exportStar(require("./struct/3d/Path"), exports);
|
|
35
|
+
__exportStar(require("./struct/3d/Plane"), exports);
|
|
36
|
+
__exportStar(require("./struct/3d/Point"), exports);
|
|
37
|
+
__exportStar(require("./struct/3d/Polyline"), exports);
|
|
38
|
+
__exportStar(require("./struct/3d/Polygon"), exports);
|
|
39
|
+
__exportStar(require("./struct/3d/Ray"), exports);
|
|
40
|
+
__exportStar(require("./struct/3d/Segment"), exports);
|
|
41
|
+
__exportStar(require("./struct/3d/Triangle"), exports);
|
|
42
|
+
__exportStar(require("./struct/3d/Frustum"), exports);
|
|
43
|
+
__exportStar(require("./struct/3d/Sphere"), exports);
|
|
44
|
+
__exportStar(require("./alg/delaunator"), exports);
|
|
45
|
+
__exportStar(require("./alg/voronoi"), exports);
|
|
46
|
+
__exportStar(require("./extends/geometryaid"), exports);
|
|
47
|
+
//Geometry
|
|
48
|
+
__exportStar(require("./render/buffer-attribute"), exports);
|
|
49
|
+
__exportStar(require("./render/geometry"), exports);
|
|
50
|
+
__exportStar(require("./render/mesh"), exports);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Mat4 } from "./Mat4";
|
|
2
|
+
import { Quat } from './Quat';
|
|
3
|
+
import { EventHandler } from "../render/eventhandler";
|
|
4
|
+
export declare class Euler extends EventHandler {
|
|
5
|
+
_x: number;
|
|
6
|
+
_y: number;
|
|
7
|
+
_z: number;
|
|
8
|
+
_order: string;
|
|
9
|
+
isEuler: boolean;
|
|
10
|
+
constructor(_x?: number, _y?: number, _z?: number, _order?: string);
|
|
11
|
+
get x(): number;
|
|
12
|
+
set x(value: number);
|
|
13
|
+
get y(): number;
|
|
14
|
+
set y(value: number);
|
|
15
|
+
get z(): number;
|
|
16
|
+
set z(value: number);
|
|
17
|
+
get order(): string;
|
|
18
|
+
set order(value: string);
|
|
19
|
+
set(x: number, y: number, z: number, order: string): this;
|
|
20
|
+
clone(): Euler;
|
|
21
|
+
copy(Euler: {
|
|
22
|
+
_x: number;
|
|
23
|
+
_y: number;
|
|
24
|
+
_z: number;
|
|
25
|
+
_order: string;
|
|
26
|
+
}): this;
|
|
27
|
+
setFromRotationMat(m: Mat4, order: string, update: boolean | undefined): this;
|
|
28
|
+
setFromQuat(q: Quat, order?: any, update?: boolean): this;
|
|
29
|
+
setFromVec3(v: {
|
|
30
|
+
x: any;
|
|
31
|
+
y: any;
|
|
32
|
+
z: any;
|
|
33
|
+
}, order: any): this;
|
|
34
|
+
reorder(newOrder: any): this;
|
|
35
|
+
equals(Euler: {
|
|
36
|
+
_x: number;
|
|
37
|
+
_y: number;
|
|
38
|
+
_z: number;
|
|
39
|
+
_order: string;
|
|
40
|
+
}): boolean;
|
|
41
|
+
fromArray(array: any[]): this;
|
|
42
|
+
toArray(array?: any[], offset?: number): any[];
|
|
43
|
+
toVec3(optionalResult: {
|
|
44
|
+
set: (arg0: number, arg1: number, arg2: number) => any;
|
|
45
|
+
}): any;
|
|
46
|
+
}
|
|
47
|
+
export declare function euler(x?: number, y?: number, z?: number): Euler;
|