csyjk 1.1.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- package/.babelrc +7 -0
- package/.idea/modules.xml +8 -0
- package/.idea/xx.iml +12 -0
- package/dist/app.js +43 -0
- package/{index.html → dist/index.html} +0 -0
- package/{style.css → dist/style.css} +1 -1
- package/package.json +40 -5
- package/public/gltf.js +2241 -0
- package/public/index.html +10 -0
- package/src/index.js +3 -0
- package/src/lib/gltf/assets/check.jpg +0 -0
- package/src/lib/gltf/assets/iconfont/iconfont.css +358 -0
- package/src/lib/gltf/assets/iconfont/iconfont.eot +0 -0
- package/src/lib/gltf/assets/iconfont/iconfont.js +1 -0
- package/src/lib/gltf/assets/iconfont/iconfont.json +604 -0
- package/src/lib/gltf/assets/iconfont/iconfont.svg +189 -0
- package/src/lib/gltf/assets/iconfont/iconfont.ttf +0 -0
- package/src/lib/gltf/assets/iconfont/iconfont.woff +0 -0
- package/src/lib/gltf/assets/iconfont/iconfont.woff2 +0 -0
- package/src/lib/gltf/assets/yjkkit-sdk/index.js +0 -0
- package/src/lib/gltf/assets/yjkkit-sdk/package.json +15 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/extras/ContextMenu/ContextMenu.js +863 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/extras/ContextMenu/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/extras/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/index.js +3 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurement.js +462 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js +279 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js +262 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/Annotation.js +362 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/AnnotationsPlugin.js +575 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js +333 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AxisGizmoPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js +777 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/BCFViewpointsPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js +525 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js +242 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js +297 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/FastNavPlugin/FastNavPlugin.js +345 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/FastNavPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js +122 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js +462 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFPerformanceModelLoader.js +508 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFSceneGraphLoader.js +922 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/index.js +2 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/CubeTextureCanvas.js +273 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/NavCubePlugin.js +687 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js +145 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js +777 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLDefaultDataSource.js +33 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLLoaderPlugin.js +273 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js +313 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/index.js +2 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Control.js +1328 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Overview.js +249 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Plane.js +169 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js +403 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SkyboxesPlugin/SkyboxesPlugin.js +134 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SkyboxesPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/IFCStoreyPlanObjectStates.js +77 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/Storey.js +61 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/StoreyMap.js +57 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js +822 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/ModelTreeView.js +888 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/TreeViewNode.js +88 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/TreeViewPlugin.js +624 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/modelValidation.js +87 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/ViewCullPlugin/ViewCullPlugin.js +295 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/ViewCullPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js +78 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +847 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/index.js +2 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV1.js +167 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV2.js +228 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV3.js +220 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV4.js +279 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV5.js +244 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV6.js +301 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV7.js +426 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV8.js +479 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/lib/pako.js +6818 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js +238 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js +1279 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/.jshintrc +11 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/deflate.js +2060 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/inflate.js +2155 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/mime-types.js +1002 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/pako/codecs.js +64 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/z-worker.js +153 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip-ext.js +267 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip-fs.js +553 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip.js +991 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zlib-asm/codecs.js +49 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/index.js +17 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/culling/ObjectCullStates.js +205 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Dot.js +78 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Label.js +97 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Wire.js +95 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/Plugin.js +112 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/Viewer.js +372 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/index.js +3 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/IFCObjectDefaultColors.js +162 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/IFCObjectDefaults.js +39 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaModel.js +145 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaObject.js +215 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaScene.js +311 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/CameraControl.js +1669 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/cc.js +0 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/CameraUpdater.js +312 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PanController.js +112 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PickController.js +193 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PivotController.js +289 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/cu.js +0 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js +122 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js +186 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js +68 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js +439 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js +361 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js +258 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js +197 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/mouspan.js +498 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/Component.js +908 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/Entity.js +475 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/ImagePlane/ImagePlane.js +570 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/ImagePlane/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/PerformanceModel.js +2623 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/ENTITY_FLAGS.js +21 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/PerformanceMesh.js +262 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/PerformanceNode.js +697 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/RENDER_PASSES.js +34 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/ScratchMemory.js +63 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/compression.js +183 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingBuffer.js +33 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingLayer.js +736 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingRenderers.js +68 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/renderers/LinesBatchingColorRenderer.js +295 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/renderers/LinesBatchingSilhouetteRenderer.js +327 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/LinesInstancingLayer.js +698 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/LinesInstancingRenderers.js +68 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/renderers/LinesInstancingColorRenderer.js +364 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/renderers/LinesInstancingSilhouetteRenderer.js +356 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingBuffer.js +33 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingLayer.js +776 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingRenderers.js +113 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingColorRenderer.js +340 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingOcclusionRenderer.js +312 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingPickDepthRenderer.js +343 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingPickMeshRenderer.js +331 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingShadowRenderer.js +242 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingSilhouetteRenderer.js +348 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/PointsInstancingLayer.js +737 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/PointsInstancingRenderers.js +143 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingColorRenderer.js +373 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingDepthRenderer.js +366 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingOcclusionRenderer.js +370 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingPickDepthRenderer.js +386 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingPickMeshRenderer.js +376 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingShadowRenderer.js +293 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingSilhouetteRenderer.js +382 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingBuffer.js +37 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingLayer.js +1017 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingRenderers.js +246 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingColorQualityRenderer.js +809 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingColorRenderer.js +504 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingDepthRenderer.js +297 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingEdgesColorRenderer.js +300 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingEdgesRenderer.js +322 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingNormalsRenderer.js +311 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingOcclusionRenderer.js +291 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickDepthRenderer.js +319 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickMeshRenderer.js +305 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickNormalsRenderer.js +300 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingShadowRenderer.js +242 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingSilhouetteRenderer.js +323 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/TrianglesInstancingLayer.js +969 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/TrianglesInstancingRenderers.js +246 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingColorQualityRenderer.js +859 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingColorRenderer.js +557 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingDepthRenderer.js +341 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingEdgesColorRenderer.js +338 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingEdgesRenderer.js +356 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingNormalsRenderer.js +354 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingOcclusionRenderer.js +329 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickDepthRenderer.js +358 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickMeshRenderer.js +349 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickNormalsRenderer.js +363 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingShadowRenderer.js +284 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingSilhouetteRenderer.js +354 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Camera.js +880 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraFlightAnimation.js +669 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraPath.js +194 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraPathAnimation.js +326 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CustomProjection.js +149 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Frustum.js +316 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Ortho.js +286 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Perspective.js +302 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/index.js +2 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/canvas/Canvas.js +464 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/canvas/Spinner.js +323 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/core.js +234 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/Geometry.js +33 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/ReadableGeometry.js +689 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/VBOGeometry.js +327 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildBoxGeometry.js +238 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildBoxLinesGeometry.js +106 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildCylinderGeometry.js +271 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildGridGeometry.js +102 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildPlaneGeometry.js +168 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildSphereGeometry.js +161 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildTorusGeometry.js +172 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildVectorTextGeometry.js +1721 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/index.js +8 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/index.js +4 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/index.js +2 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/load3DSGeometry.js +103 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/loadOBJGeometry.js +130 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/index.js +18 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/input/Input.js +1475 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/libs/canvas2image.js +218 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/libs/k3d.js +1032 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/AmbientLight.js +175 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/CubeTexture.js +156 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/DirLight.js +314 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/Light.js +29 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/LightMap.js +77 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/PointLight.js +395 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/ReflectionMap.js +79 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/Shadow.js +138 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/index.js +5 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/marker/Marker.js +382 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/marker/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/EdgeMaterial.js +359 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/EmphasisMaterial.js +577 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Fresnel.js +222 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/LambertMaterial.js +378 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/LinesMaterial.js +169 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Material.js +39 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/MetallicMaterial.js +820 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/PhongMaterial.js +860 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/PointsMaterial.js +320 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/SpecularMaterial.js +807 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Texture.js +522 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/index.js +8 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/Frustum.js +118 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/buildEdgeIndices.js +162 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/geometryCompressionUtils.js +353 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/math.js +5302 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/rtcCoords.js +132 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/CameraMemento.js +200 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/ModelMemento.js +272 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/ObjectsMemento.js +259 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/index.js +3 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/Mesh.js +2165 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/draw/DrawRenderer.js +978 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/draw/DrawShaderSource.js +1566 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js +249 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js +163 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js +276 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js +269 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/occlusion/OcclusionRenderer.js +207 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js +156 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickMeshRenderer.js +210 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickMeshShaderSource.js +146 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickTriangleRenderer.js +186 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickTriangleShaderSource.js +120 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/shadow/ShadowRenderer.js +214 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/shadow/ShadowShaderSource.js +96 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/metriqs/Metriqs.js +259 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/nodes/Node.js +1356 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/nodes/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/CubicBezierCurve.js +194 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/Curve.js +183 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/Path.js +239 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/QuadraticBezierCurve.js +161 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/SplineCurve.js +133 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/index.js +5 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/postfx/SAO.js +547 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/scene/Scene.js +2481 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/sectionPlane/SectionPlane.js +194 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/sectionPlane/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/skybox/Skybox.js +119 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/skybox/index.js +1 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/stats.js +45 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/Map.js +45 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/Queue.js +56 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/index.js +2 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils.js +452 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/viewport/Viewport.js +212 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/ArrayBuf.js +121 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Attribute.js +23 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Drawable.js +270 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/FrameContext.js +259 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/PickResult.js +317 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Pickable.js +69 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Program.js +179 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderBuffer.js +315 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderFlags.js +203 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderState.js +40 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Renderer.js +1300 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Sampler.js +18 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Shader.js +49 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Texture2D.js +217 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/occlusion/OcclusionLayer.js +214 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/occlusion/OcclusionTester.js +432 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js +326 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js +375 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/webglEnums.js +61 -0
- package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webglInfo.js +48 -0
- package/src/lib/gltf/gltf.css +392 -0
- package/src/lib/gltf/gltf.js +2241 -0
- package/webpack.config.js +70 -0
- package/app.js +0 -43
package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildCylinderGeometry.js
ADDED
@@ -0,0 +1,271 @@
|
|
1
|
+
import {utils} from '../../utils.js';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @desc Creates a cylinder-shaped {@link Geometry}.
|
5
|
+
*
|
6
|
+
* ## Usage
|
7
|
+
*
|
8
|
+
* Creating a {@link Mesh} with a cylinder-shaped {@link ReadableGeometry} :
|
9
|
+
*
|
10
|
+
* [[Run this example](http://yjkkit.github.io/yjkkit-sdk/examples/#geometry_builders_buildCylinderGeometry)]
|
11
|
+
*
|
12
|
+
* ````javascript
|
13
|
+
*
|
14
|
+
* import {Viewer, Mesh, buildCylinderGeometry, ReadableGeometry, PhongMaterial, Texture} from "yjkkit-sdk.es.js";
|
15
|
+
*
|
16
|
+
* const viewer = new Viewer({
|
17
|
+
* canvasId: "myCanvas"
|
18
|
+
* });
|
19
|
+
*
|
20
|
+
* viewer.camera.eye = [0, 0, 5];
|
21
|
+
* viewer.camera.look = [0, 0, 0];
|
22
|
+
* viewer.camera.up = [0, 1, 0];
|
23
|
+
*
|
24
|
+
* new Mesh(viewer.scene, {
|
25
|
+
* geometry: new ReadableGeometry(viewer.scene, buildCylinderGeometry({
|
26
|
+
* center: [0,0,0],
|
27
|
+
* radiusTop: 2.0,
|
28
|
+
* radiusBottom: 2.0,
|
29
|
+
* height: 5.0,
|
30
|
+
* radialSegments: 20,
|
31
|
+
* heightSegments: 1,
|
32
|
+
* openEnded: false
|
33
|
+
* }),
|
34
|
+
* material: new PhongMaterial(viewer.scene, {
|
35
|
+
* diffuseMap: new Texture(viewer.scene, {
|
36
|
+
* src: "textures/diffuse/uvGrid2.jpg"
|
37
|
+
* })
|
38
|
+
* })
|
39
|
+
* });
|
40
|
+
* ````
|
41
|
+
*
|
42
|
+
* @function buildCylinderGeometry
|
43
|
+
* @param {*} [cfg] Configs
|
44
|
+
* @param {String} [cfg.id] Optional ID for the {@link Geometry}, unique among all components in the parent {@link Scene}, generated automatically when omitted.
|
45
|
+
* @param {Number[]} [cfg.center] 3D point indicating the center position.
|
46
|
+
* @param {Number} [cfg.radiusTop=1] Radius of top.
|
47
|
+
* @param {Number} [cfg.radiusBottom=1] Radius of bottom.
|
48
|
+
* @param {Number} [cfg.height=1] Height.
|
49
|
+
* @param {Number} [cfg.radialSegments=60] Number of horizontal segments.
|
50
|
+
* @param {Number} [cfg.heightSegments=1] Number of vertical segments.
|
51
|
+
* @param {Boolean} [cfg.openEnded=false] Whether or not the cylinder has solid caps on the ends.
|
52
|
+
* @returns {Object} Configuration for a {@link Geometry} subtype.
|
53
|
+
*/
|
54
|
+
function buildCylinderGeometry(cfg = {}) {
|
55
|
+
|
56
|
+
let radiusTop = cfg.radiusTop || 1;
|
57
|
+
if (radiusTop < 0) {
|
58
|
+
console.error("negative radiusTop not allowed - will invert");
|
59
|
+
radiusTop *= -1;
|
60
|
+
}
|
61
|
+
|
62
|
+
let radiusBottom = cfg.radiusBottom || 1;
|
63
|
+
if (radiusBottom < 0) {
|
64
|
+
console.error("negative radiusBottom not allowed - will invert");
|
65
|
+
radiusBottom *= -1;
|
66
|
+
}
|
67
|
+
|
68
|
+
let height = cfg.height || 1;
|
69
|
+
if (height < 0) {
|
70
|
+
console.error("negative height not allowed - will invert");
|
71
|
+
height *= -1;
|
72
|
+
}
|
73
|
+
|
74
|
+
let radialSegments = cfg.radialSegments || 32;
|
75
|
+
if (radialSegments < 0) {
|
76
|
+
console.error("negative radialSegments not allowed - will invert");
|
77
|
+
radialSegments *= -1;
|
78
|
+
}
|
79
|
+
if (radialSegments < 3) {
|
80
|
+
radialSegments = 3;
|
81
|
+
}
|
82
|
+
|
83
|
+
let heightSegments = cfg.heightSegments || 1;
|
84
|
+
if (heightSegments < 0) {
|
85
|
+
console.error("negative heightSegments not allowed - will invert");
|
86
|
+
heightSegments *= -1;
|
87
|
+
}
|
88
|
+
if (heightSegments < 1) {
|
89
|
+
heightSegments = 1;
|
90
|
+
}
|
91
|
+
|
92
|
+
const openEnded = !!cfg.openEnded;
|
93
|
+
|
94
|
+
let center = cfg.center;
|
95
|
+
const centerX = center ? center[0] : 0;
|
96
|
+
const centerY = center ? center[1] : 0;
|
97
|
+
const centerZ = center ? center[2] : 0;
|
98
|
+
|
99
|
+
const heightHalf = height / 2;
|
100
|
+
const heightLength = height / heightSegments;
|
101
|
+
const radialAngle = (2.0 * Math.PI / radialSegments);
|
102
|
+
const radialLength = 1.0 / radialSegments;
|
103
|
+
//var nextRadius = this._radiusBottom;
|
104
|
+
const radiusChange = (radiusTop - radiusBottom) / heightSegments;
|
105
|
+
|
106
|
+
const positions = [];
|
107
|
+
const normals = [];
|
108
|
+
const uvs = [];
|
109
|
+
const indices = [];
|
110
|
+
|
111
|
+
let h;
|
112
|
+
let i;
|
113
|
+
|
114
|
+
let x;
|
115
|
+
let z;
|
116
|
+
|
117
|
+
let currentRadius;
|
118
|
+
let currentHeight;
|
119
|
+
|
120
|
+
let first;
|
121
|
+
let second;
|
122
|
+
|
123
|
+
let startIndex;
|
124
|
+
let tu;
|
125
|
+
let tv;
|
126
|
+
|
127
|
+
// create vertices
|
128
|
+
const normalY = (90.0 - (Math.atan(height / (radiusBottom - radiusTop))) * 180 / Math.PI) / 90.0;
|
129
|
+
|
130
|
+
for (h = 0; h <= heightSegments; h++) {
|
131
|
+
currentRadius = radiusTop - h * radiusChange;
|
132
|
+
currentHeight = heightHalf - h * heightLength;
|
133
|
+
|
134
|
+
for (i = 0; i <= radialSegments; i++) {
|
135
|
+
x = Math.sin(i * radialAngle);
|
136
|
+
z = Math.cos(i * radialAngle);
|
137
|
+
|
138
|
+
normals.push(currentRadius * x);
|
139
|
+
normals.push(normalY); //todo
|
140
|
+
normals.push(currentRadius * z);
|
141
|
+
|
142
|
+
uvs.push((i * radialLength));
|
143
|
+
uvs.push(h * 1 / heightSegments);
|
144
|
+
|
145
|
+
positions.push((currentRadius * x) + centerX);
|
146
|
+
positions.push((currentHeight) + centerY);
|
147
|
+
positions.push((currentRadius * z) + centerZ);
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
// create faces
|
152
|
+
for (h = 0; h < heightSegments; h++) {
|
153
|
+
for (i = 0; i <= radialSegments; i++) {
|
154
|
+
|
155
|
+
first = h * (radialSegments + 1) + i;
|
156
|
+
second = first + radialSegments;
|
157
|
+
|
158
|
+
indices.push(first);
|
159
|
+
indices.push(second);
|
160
|
+
indices.push(second + 1);
|
161
|
+
|
162
|
+
indices.push(first);
|
163
|
+
indices.push(second + 1);
|
164
|
+
indices.push(first + 1);
|
165
|
+
}
|
166
|
+
}
|
167
|
+
|
168
|
+
// create top cap
|
169
|
+
if (!openEnded && radiusTop > 0) {
|
170
|
+
startIndex = (positions.length / 3);
|
171
|
+
|
172
|
+
// top center
|
173
|
+
normals.push(0.0);
|
174
|
+
normals.push(1.0);
|
175
|
+
normals.push(0.0);
|
176
|
+
|
177
|
+
uvs.push(0.5);
|
178
|
+
uvs.push(0.5);
|
179
|
+
|
180
|
+
positions.push(0 + centerX);
|
181
|
+
positions.push(heightHalf + centerY);
|
182
|
+
positions.push(0 + centerZ);
|
183
|
+
|
184
|
+
// top triangle fan
|
185
|
+
for (i = 0; i <= radialSegments; i++) {
|
186
|
+
x = Math.sin(i * radialAngle);
|
187
|
+
z = Math.cos(i * radialAngle);
|
188
|
+
tu = (0.5 * Math.sin(i * radialAngle)) + 0.5;
|
189
|
+
tv = (0.5 * Math.cos(i * radialAngle)) + 0.5;
|
190
|
+
|
191
|
+
normals.push(radiusTop * x);
|
192
|
+
normals.push(1.0);
|
193
|
+
normals.push(radiusTop * z);
|
194
|
+
|
195
|
+
uvs.push(tu);
|
196
|
+
uvs.push(tv);
|
197
|
+
|
198
|
+
positions.push((radiusTop * x) + centerX);
|
199
|
+
positions.push((heightHalf) + centerY);
|
200
|
+
positions.push((radiusTop * z) + centerZ);
|
201
|
+
}
|
202
|
+
|
203
|
+
for (i = 0; i < radialSegments; i++) {
|
204
|
+
center = startIndex;
|
205
|
+
first = startIndex + 1 + i;
|
206
|
+
|
207
|
+
indices.push(first);
|
208
|
+
indices.push(first + 1);
|
209
|
+
indices.push(center);
|
210
|
+
}
|
211
|
+
}
|
212
|
+
|
213
|
+
// create bottom cap
|
214
|
+
if (!openEnded && radiusBottom > 0) {
|
215
|
+
|
216
|
+
startIndex = (positions.length / 3);
|
217
|
+
|
218
|
+
// top center
|
219
|
+
normals.push(0.0);
|
220
|
+
normals.push(-1.0);
|
221
|
+
normals.push(0.0);
|
222
|
+
|
223
|
+
uvs.push(0.5);
|
224
|
+
uvs.push(0.5);
|
225
|
+
|
226
|
+
positions.push(0 + centerX);
|
227
|
+
positions.push(0 - heightHalf + centerY);
|
228
|
+
positions.push(0 + centerZ);
|
229
|
+
|
230
|
+
// top triangle fan
|
231
|
+
for (i = 0; i <= radialSegments; i++) {
|
232
|
+
|
233
|
+
x = Math.sin(i * radialAngle);
|
234
|
+
z = Math.cos(i * radialAngle);
|
235
|
+
|
236
|
+
tu = (0.5 * Math.sin(i * radialAngle)) + 0.5;
|
237
|
+
tv = (0.5 * Math.cos(i * radialAngle)) + 0.5;
|
238
|
+
|
239
|
+
normals.push(radiusBottom * x);
|
240
|
+
normals.push(-1.0);
|
241
|
+
normals.push(radiusBottom * z);
|
242
|
+
|
243
|
+
uvs.push(tu);
|
244
|
+
uvs.push(tv);
|
245
|
+
|
246
|
+
positions.push((radiusBottom * x) + centerX);
|
247
|
+
positions.push((0 - heightHalf) + centerY);
|
248
|
+
positions.push((radiusBottom * z) + centerZ);
|
249
|
+
}
|
250
|
+
|
251
|
+
for (i = 0; i < radialSegments; i++) {
|
252
|
+
|
253
|
+
center = startIndex;
|
254
|
+
first = startIndex + 1 + i;
|
255
|
+
|
256
|
+
indices.push(center);
|
257
|
+
indices.push(first + 1);
|
258
|
+
indices.push(first);
|
259
|
+
}
|
260
|
+
}
|
261
|
+
|
262
|
+
return utils.apply(cfg, {
|
263
|
+
positions: positions,
|
264
|
+
normals: normals,
|
265
|
+
uv: uvs,
|
266
|
+
indices: indices
|
267
|
+
});
|
268
|
+
}
|
269
|
+
|
270
|
+
|
271
|
+
export {buildCylinderGeometry};
|
package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildGridGeometry.js
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
import {utils} from '../../utils.js';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @desc Creates a grid-shaped {@link Geometry}.
|
5
|
+
*
|
6
|
+
* ## Usage
|
7
|
+
*
|
8
|
+
* Creating a {@link Mesh} with a GridGeometry and a {@link PhongMaterial}:
|
9
|
+
*
|
10
|
+
* [[Run this example](http://yjkkit.github.io/yjkkit-sdk/examples/#geometry_builders_buildGridGeometry)]
|
11
|
+
*
|
12
|
+
* ````javascript
|
13
|
+
* import {Viewer, Mesh, buildGridGeometry, VBOGeometry, PhongMaterial, Texture} from "yjkkit-sdk.es.js";
|
14
|
+
*
|
15
|
+
* const viewer = new Viewer({
|
16
|
+
* canvasId: "myCanvas"
|
17
|
+
* });
|
18
|
+
*
|
19
|
+
* viewer.camera.eye = [0, 0, 5];
|
20
|
+
* viewer.camera.look = [0, 0, 0];
|
21
|
+
* viewer.camera.up = [0, 1, 0];
|
22
|
+
*
|
23
|
+
* new Mesh(viewer.scene, {
|
24
|
+
* geometry: new VBOGeometry(viewer.scene, buildGridGeometry({
|
25
|
+
* size: 1000,
|
26
|
+
* divisions: 500
|
27
|
+
* })),
|
28
|
+
* material: new PhongMaterial(viewer.scene, {
|
29
|
+
* color: [0.0, 0.0, 0.0],
|
30
|
+
* emissive: [0.4, 0.4, 0.4]
|
31
|
+
* }),
|
32
|
+
* position: [0, -1.6, 0]
|
33
|
+
* });
|
34
|
+
* ````
|
35
|
+
*
|
36
|
+
* @function buildGridGeometry
|
37
|
+
* @param {*} [cfg] Configs
|
38
|
+
* @param {String} [cfg.id] Optional ID for the {@link Geometry}, unique among all components in the parent {@link Scene}, generated automatically when omitted.
|
39
|
+
* @param {Number} [cfg.size=1] Dimension on the X and Z-axis.
|
40
|
+
* @param {Number} [cfg.divisions=1] Number of divisions on X and Z axis..
|
41
|
+
* @returns {Object} Configuration for a {@link Geometry} subtype.
|
42
|
+
*/
|
43
|
+
function buildGridGeometry(cfg = {}) {
|
44
|
+
|
45
|
+
let size = cfg.size || 1;
|
46
|
+
if (size < 0) {
|
47
|
+
console.error("negative size not allowed - will invert");
|
48
|
+
size *= -1;
|
49
|
+
}
|
50
|
+
|
51
|
+
let divisions = cfg.divisions || 1;
|
52
|
+
if (divisions < 0) {
|
53
|
+
console.error("negative divisions not allowed - will invert");
|
54
|
+
divisions *= -1;
|
55
|
+
}
|
56
|
+
if (divisions < 1) {
|
57
|
+
divisions = 1;
|
58
|
+
}
|
59
|
+
|
60
|
+
size = size || 10;
|
61
|
+
divisions = divisions || 10;
|
62
|
+
|
63
|
+
const step = size / divisions;
|
64
|
+
const halfSize = size / 2;
|
65
|
+
|
66
|
+
const positions = [];
|
67
|
+
const indices = [];
|
68
|
+
let l = 0;
|
69
|
+
|
70
|
+
for (let i = 0, j = 0, k = -halfSize; i <= divisions; i++, k += step) {
|
71
|
+
|
72
|
+
positions.push(-halfSize);
|
73
|
+
positions.push(0);
|
74
|
+
positions.push(k);
|
75
|
+
|
76
|
+
positions.push(halfSize);
|
77
|
+
positions.push(0);
|
78
|
+
positions.push(k);
|
79
|
+
|
80
|
+
positions.push(k);
|
81
|
+
positions.push(0);
|
82
|
+
positions.push(-halfSize);
|
83
|
+
|
84
|
+
positions.push(k);
|
85
|
+
positions.push(0);
|
86
|
+
positions.push(halfSize);
|
87
|
+
|
88
|
+
indices.push(l++);
|
89
|
+
indices.push(l++);
|
90
|
+
indices.push(l++);
|
91
|
+
indices.push(l++);
|
92
|
+
}
|
93
|
+
|
94
|
+
return utils.apply(cfg, {
|
95
|
+
primitive: "lines",
|
96
|
+
positions: positions,
|
97
|
+
indices: indices
|
98
|
+
});
|
99
|
+
}
|
100
|
+
|
101
|
+
|
102
|
+
export {buildGridGeometry};
|
package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildPlaneGeometry.js
ADDED
@@ -0,0 +1,168 @@
|
|
1
|
+
import {utils} from '../../utils.js';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @desc Creates a plane-shaped {@link Geometry}.
|
5
|
+
*
|
6
|
+
* ## Usage
|
7
|
+
*
|
8
|
+
* Creating a {@link Mesh} with a PlaneGeometry and a {@link PhongMaterial} with diffuse {@link Texture}:
|
9
|
+
*
|
10
|
+
* [[Run this example](http://yjkkit.github.io/yjkkit-sdk/examples/#geometry_builders_buildPlaneGeometry)]
|
11
|
+
*
|
12
|
+
* ````javascript
|
13
|
+
* import {Viewer, Mesh, buildPlaneGeometry, ReadableGeometry, PhongMaterial, Texture} from "yjkkit-sdk.es.js";
|
14
|
+
*
|
15
|
+
* const viewer = new Viewer({
|
16
|
+
* canvasId: "myCanvas"
|
17
|
+
* });
|
18
|
+
*
|
19
|
+
* viewer.camera.eye = [0, 0, 5];
|
20
|
+
* viewer.camera.look = [0, 0, 0];
|
21
|
+
* viewer.camera.up = [0, 1, 0];
|
22
|
+
|
23
|
+
* new Mesh(viewer.scene, {
|
24
|
+
* geometry: new ReadableGeometry(viewer.scene, buildPlaneGeometry({
|
25
|
+
* center: [0,0,0],
|
26
|
+
* xSize: 2,
|
27
|
+
* zSize: 2,
|
28
|
+
* xSegments: 10,
|
29
|
+
* zSegments: 10
|
30
|
+
* }),
|
31
|
+
* material: new PhongMaterial(viewer.scene, {
|
32
|
+
* diffuseMap: new Texture(viewer.scene, {
|
33
|
+
* src: "textures/diffuse/uvGrid2.jpg"
|
34
|
+
* })
|
35
|
+
* })
|
36
|
+
* });
|
37
|
+
* ````
|
38
|
+
*
|
39
|
+
* @function buildPlaneGeometry
|
40
|
+
* @param {*} [cfg] Configs
|
41
|
+
* @param {Number[]} [cfg.center] 3D point indicating the center position.
|
42
|
+
* @param {String} [cfg.id] Optional ID for the {@link Geometry}, unique among all components in the parent {@link Scene}, generated automatically when omitted.
|
43
|
+
* @param {Number} [cfg.xSize=1] Dimension on the X-axis.
|
44
|
+
* @param {Number} [cfg.zSize=1] Dimension on the Z-axis.
|
45
|
+
* @param {Number} [cfg.xSegments=1] Number of segments on the X-axis.
|
46
|
+
* @param {Number} [cfg.zSegments=1] Number of segments on the Z-axis.
|
47
|
+
* @returns {Object} Configuration for a {@link Geometry} subtype.
|
48
|
+
*/
|
49
|
+
function buildPlaneGeometry(cfg = {}) {
|
50
|
+
|
51
|
+
let xSize = cfg.xSize || 1;
|
52
|
+
if (xSize < 0) {
|
53
|
+
console.error("negative xSize not allowed - will invert");
|
54
|
+
xSize *= -1;
|
55
|
+
}
|
56
|
+
|
57
|
+
let zSize = cfg.zSize || 1;
|
58
|
+
if (zSize < 0) {
|
59
|
+
console.error("negative zSize not allowed - will invert");
|
60
|
+
zSize *= -1;
|
61
|
+
}
|
62
|
+
|
63
|
+
let xSegments = cfg.xSegments || 1;
|
64
|
+
if (xSegments < 0) {
|
65
|
+
console.error("negative xSegments not allowed - will invert");
|
66
|
+
xSegments *= -1;
|
67
|
+
}
|
68
|
+
if (xSegments < 1) {
|
69
|
+
xSegments = 1;
|
70
|
+
}
|
71
|
+
|
72
|
+
let zSegments = cfg.xSegments || 1;
|
73
|
+
if (zSegments < 0) {
|
74
|
+
console.error("negative zSegments not allowed - will invert");
|
75
|
+
zSegments *= -1;
|
76
|
+
}
|
77
|
+
if (zSegments < 1) {
|
78
|
+
zSegments = 1;
|
79
|
+
}
|
80
|
+
|
81
|
+
const center = cfg.center;
|
82
|
+
const centerX = center ? center[0] : 0;
|
83
|
+
const centerY = center ? center[1] : 0;
|
84
|
+
const centerZ = center ? center[2] : 0;
|
85
|
+
|
86
|
+
const halfWidth = xSize / 2;
|
87
|
+
const halfHeight = zSize / 2;
|
88
|
+
|
89
|
+
const planeX = Math.floor(xSegments) || 1;
|
90
|
+
const planeZ = Math.floor(zSegments) || 1;
|
91
|
+
|
92
|
+
const planeX1 = planeX + 1;
|
93
|
+
const planeZ1 = planeZ + 1;
|
94
|
+
|
95
|
+
const segmentWidth = xSize / planeX;
|
96
|
+
const segmentHeight = zSize / planeZ;
|
97
|
+
|
98
|
+
const positions = new Float32Array(planeX1 * planeZ1 * 3);
|
99
|
+
const normals = new Float32Array(planeX1 * planeZ1 * 3);
|
100
|
+
const uvs = new Float32Array(planeX1 * planeZ1 * 2);
|
101
|
+
|
102
|
+
let offset = 0;
|
103
|
+
let offset2 = 0;
|
104
|
+
|
105
|
+
let iz;
|
106
|
+
let ix;
|
107
|
+
let x;
|
108
|
+
let a;
|
109
|
+
let b;
|
110
|
+
let c;
|
111
|
+
let d;
|
112
|
+
|
113
|
+
for (iz = 0; iz < planeZ1; iz++) {
|
114
|
+
|
115
|
+
const z = iz * segmentHeight - halfHeight;
|
116
|
+
|
117
|
+
for (ix = 0; ix < planeX1; ix++) {
|
118
|
+
|
119
|
+
x = ix * segmentWidth - halfWidth;
|
120
|
+
|
121
|
+
positions[offset] = x + centerX;
|
122
|
+
positions[offset + 1] = centerY;
|
123
|
+
positions[offset + 2] = -z + centerZ;
|
124
|
+
|
125
|
+
normals[offset + 2] = -1;
|
126
|
+
|
127
|
+
uvs[offset2] = (ix) / planeX;
|
128
|
+
uvs[offset2 + 1] = ((planeZ - iz) / planeZ);
|
129
|
+
|
130
|
+
offset += 3;
|
131
|
+
offset2 += 2;
|
132
|
+
}
|
133
|
+
}
|
134
|
+
|
135
|
+
offset = 0;
|
136
|
+
|
137
|
+
const indices = new ((positions.length / 3) > 65535 ? Uint32Array : Uint16Array)(planeX * planeZ * 6);
|
138
|
+
|
139
|
+
for (iz = 0; iz < planeZ; iz++) {
|
140
|
+
|
141
|
+
for (ix = 0; ix < planeX; ix++) {
|
142
|
+
|
143
|
+
a = ix + planeX1 * iz;
|
144
|
+
b = ix + planeX1 * (iz + 1);
|
145
|
+
c = (ix + 1) + planeX1 * (iz + 1);
|
146
|
+
d = (ix + 1) + planeX1 * iz;
|
147
|
+
|
148
|
+
indices[offset] = d;
|
149
|
+
indices[offset + 1] = b;
|
150
|
+
indices[offset + 2] = a;
|
151
|
+
|
152
|
+
indices[offset + 3] = d;
|
153
|
+
indices[offset + 4] = c;
|
154
|
+
indices[offset + 5] = b;
|
155
|
+
|
156
|
+
offset += 6;
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
return utils.apply(cfg, {
|
161
|
+
positions: positions,
|
162
|
+
normals: normals,
|
163
|
+
uv: uvs,
|
164
|
+
indices: indices
|
165
|
+
});
|
166
|
+
}
|
167
|
+
|
168
|
+
export {buildPlaneGeometry};
|
package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildSphereGeometry.js
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
import {utils} from '../../utils.js';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @desc Creates a sphere-shaped {@link Geometry}.
|
5
|
+
*
|
6
|
+
* ## Usage
|
7
|
+
*
|
8
|
+
* Creating a {@link Mesh} with a sphere-shaped {@link ReadableGeometry} :
|
9
|
+
*
|
10
|
+
* [[Run this example](http://yjkkit.github.io/yjkkit-sdk/examples/#geometry_builders_buildSphereGeometry)]
|
11
|
+
*
|
12
|
+
* ````javascript
|
13
|
+
* import {Viewer, Mesh, buildSphereGeometry, ReadableGeometry, PhongMaterial, Texture} from "yjkkit-sdk.es.js";
|
14
|
+
*
|
15
|
+
* const viewer = new Viewer({
|
16
|
+
* canvasId: "myCanvas"
|
17
|
+
* });
|
18
|
+
*
|
19
|
+
* viewer.camera.eye = [0, 0, 5];
|
20
|
+
* viewer.camera.look = [0, 0, 0];
|
21
|
+
* viewer.camera.up = [0, 1, 0];
|
22
|
+
*
|
23
|
+
* new Mesh(viewer.scene, {
|
24
|
+
* geometry: new ReadableGeometry(viewer.scene, buildSphereGeometry({
|
25
|
+
* center: [0,0,0],
|
26
|
+
* radius: 1.5,
|
27
|
+
* heightSegments: 60,
|
28
|
+
* widthSegments: 60
|
29
|
+
* }),
|
30
|
+
* material: new PhongMaterial(viewer.scene, {
|
31
|
+
* diffuseMap: new Texture(viewer.scene, {
|
32
|
+
* src: "textures/diffuse/uvGrid2.jpg"
|
33
|
+
* })
|
34
|
+
* })
|
35
|
+
* });
|
36
|
+
* ````
|
37
|
+
*
|
38
|
+
* @function buildSphereGeometry
|
39
|
+
* @param {*} [cfg] Configs
|
40
|
+
* @param {String} [cfg.id] Optional ID for the {@link Geometry}, unique among all components in the parent {@link Scene}, generated automatically when omitted.
|
41
|
+
* @param {Number[]} [cfg.center] 3D point indicating the center position.
|
42
|
+
* @param {Number} [cfg.radius=1] Radius.
|
43
|
+
* @param {Number} [cfg.heightSegments=24] Number of latitudinal bands.
|
44
|
+
* @param {Number} [cfg.widthSegments=18] Number of longitudinal bands.
|
45
|
+
* @returns {Object} Configuration for a {@link Geometry} subtype.
|
46
|
+
*/
|
47
|
+
function buildSphereGeometry(cfg = {}) {
|
48
|
+
|
49
|
+
const lod = cfg.lod || 1;
|
50
|
+
|
51
|
+
const centerX = cfg.center ? cfg.center[0] : 0;
|
52
|
+
const centerY = cfg.center ? cfg.center[1] : 0;
|
53
|
+
const centerZ = cfg.center ? cfg.center[2] : 0;
|
54
|
+
|
55
|
+
let radius = cfg.radius || 1;
|
56
|
+
if (radius < 0) {
|
57
|
+
console.error("negative radius not allowed - will invert");
|
58
|
+
radius *= -1;
|
59
|
+
}
|
60
|
+
|
61
|
+
let heightSegments = cfg.heightSegments || 18;
|
62
|
+
if (heightSegments < 0) {
|
63
|
+
console.error("negative heightSegments not allowed - will invert");
|
64
|
+
heightSegments *= -1;
|
65
|
+
}
|
66
|
+
heightSegments = Math.floor(lod * heightSegments);
|
67
|
+
if (heightSegments < 18) {
|
68
|
+
heightSegments = 18;
|
69
|
+
}
|
70
|
+
|
71
|
+
let widthSegments = cfg.widthSegments || 18;
|
72
|
+
if (widthSegments < 0) {
|
73
|
+
console.error("negative widthSegments not allowed - will invert");
|
74
|
+
widthSegments *= -1;
|
75
|
+
}
|
76
|
+
widthSegments = Math.floor(lod * widthSegments);
|
77
|
+
if (widthSegments < 18) {
|
78
|
+
widthSegments = 18;
|
79
|
+
}
|
80
|
+
|
81
|
+
const positions = [];
|
82
|
+
const normals = [];
|
83
|
+
const uvs = [];
|
84
|
+
const indices = [];
|
85
|
+
|
86
|
+
let i;
|
87
|
+
let j;
|
88
|
+
|
89
|
+
let theta;
|
90
|
+
let sinTheta;
|
91
|
+
let cosTheta;
|
92
|
+
|
93
|
+
let phi;
|
94
|
+
let sinPhi;
|
95
|
+
let cosPhi;
|
96
|
+
|
97
|
+
let x;
|
98
|
+
let y;
|
99
|
+
let z;
|
100
|
+
|
101
|
+
let u;
|
102
|
+
let v;
|
103
|
+
|
104
|
+
let first;
|
105
|
+
let second;
|
106
|
+
|
107
|
+
for (i = 0; i <= heightSegments; i++) {
|
108
|
+
|
109
|
+
theta = i * Math.PI / heightSegments;
|
110
|
+
sinTheta = Math.sin(theta);
|
111
|
+
cosTheta = Math.cos(theta);
|
112
|
+
|
113
|
+
for (j = 0; j <= widthSegments; j++) {
|
114
|
+
|
115
|
+
phi = j * 2 * Math.PI / widthSegments;
|
116
|
+
sinPhi = Math.sin(phi);
|
117
|
+
cosPhi = Math.cos(phi);
|
118
|
+
|
119
|
+
x = cosPhi * sinTheta;
|
120
|
+
y = cosTheta;
|
121
|
+
z = sinPhi * sinTheta;
|
122
|
+
u = 1.0 - j / widthSegments;
|
123
|
+
v = i / heightSegments;
|
124
|
+
|
125
|
+
normals.push(x);
|
126
|
+
normals.push(y);
|
127
|
+
normals.push(z);
|
128
|
+
|
129
|
+
uvs.push(u);
|
130
|
+
uvs.push(v);
|
131
|
+
|
132
|
+
positions.push(centerX + radius * x);
|
133
|
+
positions.push(centerY + radius * y);
|
134
|
+
positions.push(centerZ + radius * z);
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
for (i = 0; i < heightSegments; i++) {
|
139
|
+
for (j = 0; j < widthSegments; j++) {
|
140
|
+
|
141
|
+
first = (i * (widthSegments + 1)) + j;
|
142
|
+
second = first + widthSegments + 1;
|
143
|
+
|
144
|
+
indices.push(first + 1);
|
145
|
+
indices.push(second + 1);
|
146
|
+
indices.push(second);
|
147
|
+
indices.push(first + 1);
|
148
|
+
indices.push(second);
|
149
|
+
indices.push(first);
|
150
|
+
}
|
151
|
+
}
|
152
|
+
|
153
|
+
return utils.apply(cfg, {
|
154
|
+
positions: positions,
|
155
|
+
normals: normals,
|
156
|
+
uv: uvs,
|
157
|
+
indices: indices
|
158
|
+
});
|
159
|
+
}
|
160
|
+
|
161
|
+
export {buildSphereGeometry};
|