csyjk 1.1.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (323) hide show
  1. package/.babelrc +7 -0
  2. package/.idea/modules.xml +8 -0
  3. package/.idea/xx.iml +12 -0
  4. package/dist/app.js +43 -0
  5. package/{index.html → dist/index.html} +0 -0
  6. package/{style.css → dist/style.css} +1 -1
  7. package/package.json +40 -5
  8. package/public/gltf.js +2241 -0
  9. package/public/index.html +10 -0
  10. package/src/index.js +3 -0
  11. package/src/lib/gltf/assets/check.jpg +0 -0
  12. package/src/lib/gltf/assets/iconfont/iconfont.css +358 -0
  13. package/src/lib/gltf/assets/iconfont/iconfont.eot +0 -0
  14. package/src/lib/gltf/assets/iconfont/iconfont.js +1 -0
  15. package/src/lib/gltf/assets/iconfont/iconfont.json +604 -0
  16. package/src/lib/gltf/assets/iconfont/iconfont.svg +189 -0
  17. package/src/lib/gltf/assets/iconfont/iconfont.ttf +0 -0
  18. package/src/lib/gltf/assets/iconfont/iconfont.woff +0 -0
  19. package/src/lib/gltf/assets/iconfont/iconfont.woff2 +0 -0
  20. package/src/lib/gltf/assets/yjkkit-sdk/index.js +0 -0
  21. package/src/lib/gltf/assets/yjkkit-sdk/package.json +15 -0
  22. package/src/lib/gltf/assets/yjkkit-sdk/src/extras/ContextMenu/ContextMenu.js +863 -0
  23. package/src/lib/gltf/assets/yjkkit-sdk/src/extras/ContextMenu/index.js +1 -0
  24. package/src/lib/gltf/assets/yjkkit-sdk/src/extras/index.js +1 -0
  25. package/src/lib/gltf/assets/yjkkit-sdk/src/index.js +3 -0
  26. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurement.js +462 -0
  27. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.js +279 -0
  28. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js +262 -0
  29. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AngleMeasurementsPlugin/index.js +1 -0
  30. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/Annotation.js +362 -0
  31. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/AnnotationsPlugin.js +575 -0
  32. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AnnotationsPlugin/index.js +1 -0
  33. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AxisGizmoPlugin/AxisGizmoPlugin.js +333 -0
  34. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/AxisGizmoPlugin/index.js +1 -0
  35. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js +777 -0
  36. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/BCFViewpointsPlugin/index.js +1 -0
  37. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js +525 -0
  38. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.js +242 -0
  39. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js +297 -0
  40. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/DistanceMeasurementsPlugin/index.js +1 -0
  41. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/FastNavPlugin/FastNavPlugin.js +345 -0
  42. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/FastNavPlugin/index.js +1 -0
  43. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFDefaultDataSource.js +122 -0
  44. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js +462 -0
  45. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFPerformanceModelLoader.js +508 -0
  46. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/GLTFSceneGraphLoader.js +922 -0
  47. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/GLTFLoaderPlugin/index.js +2 -0
  48. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/CubeTextureCanvas.js +273 -0
  49. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/NavCubePlugin.js +687 -0
  50. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/NavCubePlugin/index.js +1 -0
  51. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/OBJLoaderPlugin.js +145 -0
  52. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/OBJSceneGraphLoader.js +777 -0
  53. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/OBJLoaderPlugin/index.js +1 -0
  54. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLDefaultDataSource.js +33 -0
  55. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLLoaderPlugin.js +273 -0
  56. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/STLSceneGraphLoader.js +313 -0
  57. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/STLLoaderPlugin/index.js +2 -0
  58. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Control.js +1328 -0
  59. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Overview.js +249 -0
  60. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/Plane.js +169 -0
  61. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/SectionPlanesPlugin.js +403 -0
  62. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SectionPlanesPlugin/index.js +1 -0
  63. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SkyboxesPlugin/SkyboxesPlugin.js +134 -0
  64. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/SkyboxesPlugin/index.js +1 -0
  65. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/IFCStoreyPlanObjectStates.js +77 -0
  66. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/Storey.js +61 -0
  67. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/StoreyMap.js +57 -0
  68. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js +822 -0
  69. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/StoreyViewsPlugin/index.js +1 -0
  70. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/ModelTreeView.js +888 -0
  71. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/TreeViewNode.js +88 -0
  72. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/TreeViewPlugin.js +624 -0
  73. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/index.js +1 -0
  74. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/TreeViewPlugin/modelValidation.js +87 -0
  75. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/ViewCullPlugin/ViewCullPlugin.js +295 -0
  76. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/ViewCullPlugin/index.js +1 -0
  77. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/XKTDefaultDataSource.js +78 -0
  78. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +847 -0
  79. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/index.js +2 -0
  80. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV1.js +167 -0
  81. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV2.js +228 -0
  82. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV3.js +220 -0
  83. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV4.js +279 -0
  84. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV5.js +244 -0
  85. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV6.js +301 -0
  86. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV7.js +426 -0
  87. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/ParserV8.js +479 -0
  88. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XKTLoaderPlugin/parsers/lib/pako.js +6818 -0
  89. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/XML3DLoaderPlugin.js +238 -0
  90. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/XML3DSceneGraphLoader.js +1279 -0
  91. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/index.js +1 -0
  92. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/.jshintrc +11 -0
  93. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/deflate.js +2060 -0
  94. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/inflate.js +2155 -0
  95. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/mime-types.js +1002 -0
  96. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/pako/codecs.js +64 -0
  97. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/z-worker.js +153 -0
  98. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip-ext.js +267 -0
  99. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip-fs.js +553 -0
  100. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zip.js +991 -0
  101. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/XML3DLoaderPlugin/zipjs/zlib-asm/codecs.js +49 -0
  102. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/index.js +17 -0
  103. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/culling/ObjectCullStates.js +205 -0
  104. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Dot.js +78 -0
  105. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Label.js +97 -0
  106. package/src/lib/gltf/assets/yjkkit-sdk/src/plugins/lib/html/Wire.js +95 -0
  107. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/Plugin.js +112 -0
  108. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/Viewer.js +372 -0
  109. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/index.js +3 -0
  110. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/IFCObjectDefaultColors.js +162 -0
  111. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/IFCObjectDefaults.js +39 -0
  112. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaModel.js +145 -0
  113. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaObject.js +215 -0
  114. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/metadata/MetaScene.js +311 -0
  115. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/CameraControl.js +1669 -0
  116. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/cc.js +0 -0
  117. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/CameraUpdater.js +312 -0
  118. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PanController.js +112 -0
  119. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PickController.js +193 -0
  120. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/controllers/PivotController.js +289 -0
  121. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/cu.js +0 -0
  122. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/KeyboardAxisViewHandler.js +122 -0
  123. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/KeyboardPanRotateDollyHandler.js +186 -0
  124. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js +68 -0
  125. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MousePanRotateDollyHandler.js +439 -0
  126. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js +361 -0
  127. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/TouchPanRotateAndDollyHandler.js +258 -0
  128. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/TouchPickHandler.js +197 -0
  129. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/CameraControl/lib/handlers/mouspan.js +498 -0
  130. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/Component.js +908 -0
  131. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/Entity.js +475 -0
  132. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/ImagePlane/ImagePlane.js +570 -0
  133. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/ImagePlane/index.js +1 -0
  134. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/PerformanceModel.js +2623 -0
  135. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/index.js +1 -0
  136. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/ENTITY_FLAGS.js +21 -0
  137. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/PerformanceMesh.js +262 -0
  138. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/PerformanceNode.js +697 -0
  139. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/RENDER_PASSES.js +34 -0
  140. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/ScratchMemory.js +63 -0
  141. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/compression.js +183 -0
  142. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingBuffer.js +33 -0
  143. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingLayer.js +736 -0
  144. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/LinesBatchingRenderers.js +68 -0
  145. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/renderers/LinesBatchingColorRenderer.js +295 -0
  146. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesBatching/renderers/LinesBatchingSilhouetteRenderer.js +327 -0
  147. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/LinesInstancingLayer.js +698 -0
  148. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/LinesInstancingRenderers.js +68 -0
  149. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/renderers/LinesInstancingColorRenderer.js +364 -0
  150. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/linesInstancing/renderers/LinesInstancingSilhouetteRenderer.js +356 -0
  151. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingBuffer.js +33 -0
  152. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingLayer.js +776 -0
  153. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/PointsBatchingRenderers.js +113 -0
  154. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingColorRenderer.js +340 -0
  155. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingOcclusionRenderer.js +312 -0
  156. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingPickDepthRenderer.js +343 -0
  157. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingPickMeshRenderer.js +331 -0
  158. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingShadowRenderer.js +242 -0
  159. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsBatching/renderers/PointsBatchingSilhouetteRenderer.js +348 -0
  160. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/PointsInstancingLayer.js +737 -0
  161. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/PointsInstancingRenderers.js +143 -0
  162. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingColorRenderer.js +373 -0
  163. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingDepthRenderer.js +366 -0
  164. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingOcclusionRenderer.js +370 -0
  165. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingPickDepthRenderer.js +386 -0
  166. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingPickMeshRenderer.js +376 -0
  167. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingShadowRenderer.js +293 -0
  168. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/pointsInstancing/renderers/PointsInstancingSilhouetteRenderer.js +382 -0
  169. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingBuffer.js +37 -0
  170. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingLayer.js +1017 -0
  171. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/TrianglesBatchingRenderers.js +246 -0
  172. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingColorQualityRenderer.js +809 -0
  173. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingColorRenderer.js +504 -0
  174. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingDepthRenderer.js +297 -0
  175. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingEdgesColorRenderer.js +300 -0
  176. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingEdgesRenderer.js +322 -0
  177. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingNormalsRenderer.js +311 -0
  178. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingOcclusionRenderer.js +291 -0
  179. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickDepthRenderer.js +319 -0
  180. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickMeshRenderer.js +305 -0
  181. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingPickNormalsRenderer.js +300 -0
  182. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingShadowRenderer.js +242 -0
  183. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesBatching/renderers/TrianglesBatchingSilhouetteRenderer.js +323 -0
  184. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/TrianglesInstancingLayer.js +969 -0
  185. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/TrianglesInstancingRenderers.js +246 -0
  186. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingColorQualityRenderer.js +859 -0
  187. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingColorRenderer.js +557 -0
  188. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingDepthRenderer.js +341 -0
  189. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingEdgesColorRenderer.js +338 -0
  190. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingEdgesRenderer.js +356 -0
  191. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingNormalsRenderer.js +354 -0
  192. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingOcclusionRenderer.js +329 -0
  193. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickDepthRenderer.js +358 -0
  194. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickMeshRenderer.js +349 -0
  195. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingPickNormalsRenderer.js +363 -0
  196. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingShadowRenderer.js +284 -0
  197. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/PerformanceModel/lib/layers/trianglesInstancing/renderers/TrianglesInstancingSilhouetteRenderer.js +354 -0
  198. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Camera.js +880 -0
  199. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraFlightAnimation.js +669 -0
  200. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraPath.js +194 -0
  201. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CameraPathAnimation.js +326 -0
  202. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/CustomProjection.js +149 -0
  203. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Frustum.js +316 -0
  204. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Ortho.js +286 -0
  205. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/Perspective.js +302 -0
  206. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/camera/index.js +2 -0
  207. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/canvas/Canvas.js +464 -0
  208. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/canvas/Spinner.js +323 -0
  209. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/core.js +234 -0
  210. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/Geometry.js +33 -0
  211. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/ReadableGeometry.js +689 -0
  212. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/VBOGeometry.js +327 -0
  213. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildBoxGeometry.js +238 -0
  214. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildBoxLinesGeometry.js +106 -0
  215. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildCylinderGeometry.js +271 -0
  216. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildGridGeometry.js +102 -0
  217. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildPlaneGeometry.js +168 -0
  218. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildSphereGeometry.js +161 -0
  219. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildTorusGeometry.js +172 -0
  220. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/buildVectorTextGeometry.js +1721 -0
  221. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/builders/index.js +8 -0
  222. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/index.js +4 -0
  223. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/index.js +2 -0
  224. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/load3DSGeometry.js +103 -0
  225. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/geometry/loaders/loadOBJGeometry.js +130 -0
  226. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/index.js +18 -0
  227. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/input/Input.js +1475 -0
  228. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/libs/canvas2image.js +218 -0
  229. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/libs/k3d.js +1032 -0
  230. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/AmbientLight.js +175 -0
  231. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/CubeTexture.js +156 -0
  232. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/DirLight.js +314 -0
  233. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/Light.js +29 -0
  234. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/LightMap.js +77 -0
  235. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/PointLight.js +395 -0
  236. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/ReflectionMap.js +79 -0
  237. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/Shadow.js +138 -0
  238. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/lights/index.js +5 -0
  239. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/marker/Marker.js +382 -0
  240. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/marker/index.js +1 -0
  241. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/EdgeMaterial.js +359 -0
  242. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/EmphasisMaterial.js +577 -0
  243. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Fresnel.js +222 -0
  244. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/LambertMaterial.js +378 -0
  245. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/LinesMaterial.js +169 -0
  246. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Material.js +39 -0
  247. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/MetallicMaterial.js +820 -0
  248. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/PhongMaterial.js +860 -0
  249. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/PointsMaterial.js +320 -0
  250. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/SpecularMaterial.js +807 -0
  251. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/Texture.js +522 -0
  252. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/materials/index.js +8 -0
  253. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/Frustum.js +118 -0
  254. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/buildEdgeIndices.js +162 -0
  255. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/geometryCompressionUtils.js +353 -0
  256. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/index.js +1 -0
  257. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/math.js +5302 -0
  258. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/math/rtcCoords.js +132 -0
  259. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/CameraMemento.js +200 -0
  260. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/ModelMemento.js +272 -0
  261. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/ObjectsMemento.js +259 -0
  262. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mementos/index.js +3 -0
  263. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/Mesh.js +2165 -0
  264. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/draw/DrawRenderer.js +978 -0
  265. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/draw/DrawShaderSource.js +1566 -0
  266. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js +249 -0
  267. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js +163 -0
  268. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js +276 -0
  269. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js +269 -0
  270. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/index.js +1 -0
  271. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/occlusion/OcclusionRenderer.js +207 -0
  272. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js +156 -0
  273. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickMeshRenderer.js +210 -0
  274. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickMeshShaderSource.js +146 -0
  275. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickTriangleRenderer.js +186 -0
  276. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/pick/PickTriangleShaderSource.js +120 -0
  277. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/shadow/ShadowRenderer.js +214 -0
  278. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/mesh/shadow/ShadowShaderSource.js +96 -0
  279. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/metriqs/Metriqs.js +259 -0
  280. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/nodes/Node.js +1356 -0
  281. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/nodes/index.js +1 -0
  282. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/CubicBezierCurve.js +194 -0
  283. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/Curve.js +183 -0
  284. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/Path.js +239 -0
  285. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/QuadraticBezierCurve.js +161 -0
  286. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/SplineCurve.js +133 -0
  287. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/paths/index.js +5 -0
  288. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/postfx/SAO.js +547 -0
  289. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/scene/Scene.js +2481 -0
  290. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/sectionPlane/SectionPlane.js +194 -0
  291. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/sectionPlane/index.js +1 -0
  292. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/skybox/Skybox.js +119 -0
  293. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/skybox/index.js +1 -0
  294. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/stats.js +45 -0
  295. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/Map.js +45 -0
  296. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/Queue.js +56 -0
  297. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils/index.js +2 -0
  298. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/utils.js +452 -0
  299. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/viewport/Viewport.js +212 -0
  300. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/ArrayBuf.js +121 -0
  301. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Attribute.js +23 -0
  302. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Drawable.js +270 -0
  303. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/FrameContext.js +259 -0
  304. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/PickResult.js +317 -0
  305. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Pickable.js +69 -0
  306. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Program.js +179 -0
  307. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderBuffer.js +315 -0
  308. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderFlags.js +203 -0
  309. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/RenderState.js +40 -0
  310. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Renderer.js +1300 -0
  311. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Sampler.js +18 -0
  312. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Shader.js +49 -0
  313. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/Texture2D.js +217 -0
  314. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/occlusion/OcclusionLayer.js +214 -0
  315. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/occlusion/OcclusionTester.js +432 -0
  316. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/sao/SAODepthLimitedBlurRenderer.js +326 -0
  317. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/sao/SAOOcclusionRenderer.js +375 -0
  318. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webgl/webglEnums.js +61 -0
  319. package/src/lib/gltf/assets/yjkkit-sdk/src/viewer/scene/webglInfo.js +48 -0
  320. package/src/lib/gltf/gltf.css +392 -0
  321. package/src/lib/gltf/gltf.js +2241 -0
  322. package/webpack.config.js +70 -0
  323. package/app.js +0 -43
@@ -0,0 +1,880 @@
1
+ import {math} from '../math/math.js';
2
+ import {Component} from '../Component.js';
3
+ import {RenderState} from '../webgl/RenderState.js';
4
+ import {Perspective} from './Perspective.js';
5
+ import {Ortho} from './Ortho.js';
6
+ import {Frustum} from './Frustum.js';
7
+ import {CustomProjection} from './CustomProjection.js';
8
+
9
+ const tempVec3 = math.vec3();
10
+ const tempVec3b = math.vec3();
11
+ const tempVec3c = math.vec3();
12
+ const tempVec3d = math.vec3();
13
+ const tempVec3e = math.vec3();
14
+ const tempVec3f = math.vec3();
15
+ const tempMat = math.mat4();
16
+ const tempMatb = math.mat4();
17
+ const eyeLookVec = math.vec3();
18
+ const eyeLookVecNorm = math.vec3();
19
+ const eyeLookOffset = math.vec3();
20
+ const offsetEye = math.vec3();
21
+
22
+ /**
23
+ * @desc Manages viewing and projection transforms for its {@link Scene}.
24
+ *
25
+ * * One Camera per {@link Scene}
26
+ * * Scene is located at {@link Viewer#scene} and Camera is located at {@link Scene#camera}
27
+ * * Controls viewing and projection transforms
28
+ * * Has methods to pan, zoom and orbit (or first-person rotation)
29
+ * * Dynamically configurable World-space axis
30
+ * * Has {@link Perspective}, {@link Ortho} and {@link Frustum} and {@link CustomProjection}, which you can dynamically switch it between
31
+ * * Switchable gimbal lock
32
+ * * Can be "flown" to look at targets using a {@link CameraFlightAnimation}
33
+ * * Can be animated along a path using a {@link CameraPathAnimation}
34
+ *
35
+ * ## Getting the Camera
36
+ *
37
+ * There is exactly one Camera per {@link Scene}:
38
+ *
39
+ * ````javascript
40
+ * import {Viewer} from "yjkkit-sdk.es.js";
41
+ *
42
+ * var camera = viewer.scene.camera;
43
+ *
44
+ * ````
45
+ *
46
+ * ## Setting the Camera Position
47
+ *
48
+ * Get and set the Camera's absolute position via {@link Camera#eye}, {@link Camera#look} and {@link Camera#up}:
49
+ *
50
+ * ````javascript
51
+ * camera.eye = [-10,0,0];
52
+ * camera.look = [-10,0,0];
53
+ * camera.up = [0,1,0];
54
+ * ````
55
+ *
56
+ * ## Camera View and Projection Matrices
57
+ *
58
+ * The Camera's view matrix transforms coordinates from World-space to View-space.
59
+ *
60
+ * Getting the view matrix:
61
+ *
62
+ * ````javascript
63
+ * var viewMatrix = camera.viewMatrix;
64
+ * var viewNormalMatrix = camera.normalMatrix;
65
+ * ````
66
+ *
67
+ * The Camera's view normal matrix transforms normal vectors from World-space to View-space.
68
+ *
69
+ * Getting the view normal matrix:
70
+ *
71
+ * ````javascript
72
+ * var viewNormalMatrix = camera.normalMatrix;
73
+ * ````
74
+ *
75
+ * The Camera fires a ````"viewMatrix"```` event whenever the {@link Camera#viewMatrix} and {@link Camera#viewNormalMatrix} updates.
76
+ *
77
+ * Listen for view matrix updates:
78
+ *
79
+ * ````javascript
80
+ * camera.on("viewMatrix", function(matrix) { ... });
81
+ * ````
82
+ *
83
+ * ## Rotating the Camera
84
+ *
85
+ * Orbiting the {@link Camera#look} position:
86
+ *
87
+ * ````javascript
88
+ * camera.orbitYaw(20.0);
89
+ * camera.orbitPitch(10.0);
90
+ * ````
91
+ *
92
+ * First-person rotation, rotates {@link Camera#look} and {@link Camera#up} about {@link Camera#eye}:
93
+ *
94
+ * ````javascript
95
+ * camera.yaw(5.0);
96
+ * camera.pitch(-10.0);
97
+ * ````
98
+ *
99
+ * ## Panning the Camera
100
+ *
101
+ * Panning along the Camera's local axis (ie. left/right, up/down, forward/backward):
102
+ *
103
+ * ````javascript
104
+ * camera.pan([-20, 0, 10]);
105
+ * ````
106
+ *
107
+ * ## Zooming the Camera
108
+ *
109
+ * Zoom to vary distance between {@link Camera#eye} and {@link Camera#look}:
110
+ *
111
+ * ````javascript
112
+ * camera.zoom(-5); // Move five units closer
113
+ * ````
114
+ *
115
+ * Get the current distance between {@link Camera#eye} and {@link Camera#look}:
116
+ *
117
+ * ````javascript
118
+ * var distance = camera.eyeLookDist;
119
+ * ````
120
+ *
121
+ * ## Projection
122
+ *
123
+ * The Camera has a Component to manage each projection type, which are: {@link Perspective}, {@link Ortho}
124
+ * and {@link Frustum} and {@link CustomProjection}.
125
+ *
126
+ * You can configure those components at any time, regardless of which is currently active:
127
+ *
128
+ * The Camera has a {@link Perspective} to manage perspective
129
+ * ````javascript
130
+ *
131
+ * // Set some properties on Perspective
132
+ * camera.perspective.near = 0.4;
133
+ * camera.perspective.fov = 45;
134
+ *
135
+ * // Set some properties on Ortho
136
+ * camera.ortho.near = 0.8;
137
+ * camera.ortho.far = 1000;
138
+ *
139
+ * // Set some properties on Frustum
140
+ * camera.frustum.left = -1.0;
141
+ * camera.frustum.right = 1.0;
142
+ * camera.frustum.far = 1000.0;
143
+ *
144
+ * // Set the matrix property on CustomProjection
145
+ * camera.customProjection.matrix = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
146
+ *
147
+ * // Switch between the projection types
148
+ * camera.projection = "perspective"; // Switch to perspective
149
+ * camera.projection = "frustum"; // Switch to frustum
150
+ * camera.projection = "ortho"; // Switch to ortho
151
+ * camera.projection = "customProjection"; // Switch to custom
152
+ * ````
153
+ *
154
+ * Camera provides the projection matrix for the currently active projection in {@link Camera#projMatrix}.
155
+ *
156
+ * Get the projection matrix:
157
+ *
158
+ * ````javascript
159
+ * var projMatrix = camera.projMatrix;
160
+ * ````
161
+ *
162
+ * Listen for projection matrix updates:
163
+ *
164
+ * ````javascript
165
+ * camera.on("projMatrix", function(matrix) { ... });
166
+ * ````
167
+ *
168
+ * ## Configuring World up direction
169
+ *
170
+ * We can dynamically configure the directions of the World-space coordinate system.
171
+ *
172
+ * Setting the +Y axis as World "up", +X as right and -Z as forwards (convention in some modeling software):
173
+ *
174
+ * ````javascript
175
+ * camera.worldAxis = [
176
+ * 1, 0, 0, // Right
177
+ * 0, 1, 0, // Up
178
+ * 0, 0,-1 // Forward
179
+ * ];
180
+ * ````
181
+ *
182
+ * Setting the +Z axis as World "up", +X as right and -Y as "up" (convention in most CAD and BIM viewers):
183
+ *
184
+ * ````javascript
185
+ * camera.worldAxis = [
186
+ * 1, 0, 0, // Right
187
+ * 0, 0, 1, // Up
188
+ * 0,-1, 0 // Forward
189
+ * ];
190
+ * ````
191
+ *
192
+ * The Camera has read-only convenience properties that provide each axis individually:
193
+ *
194
+ * ````javascript
195
+ * var worldRight = camera.worldRight;
196
+ * var worldForward = camera.worldForward;
197
+ * var worldUp = camera.worldUp;
198
+ * ````
199
+ *
200
+ * ### Gimbal locking
201
+ *
202
+ * By default, the Camera locks yaw rotation to pivot about the World-space "up" axis. We can dynamically lock and unlock that at any time:
203
+ *
204
+ * ````javascript
205
+ * camera.gimbalLock = false; // Yaw rotation now happens about Camera's local Y-axis
206
+ * camera.gimbalLock = true; // Yaw rotation now happens about World's "up" axis
207
+ * ````
208
+ *
209
+ * See: <a href="https://en.wikipedia.org/wiki/Gimbal_lock">https://en.wikipedia.org/wiki/Gimbal_lock</a>
210
+ */
211
+ class Camera extends Component {
212
+
213
+ /**
214
+ @private
215
+ */
216
+ get type() {
217
+ return "Camera";
218
+ }
219
+
220
+ /**
221
+ * @constructor
222
+ * @private
223
+ */
224
+ constructor(owner, cfg = {}) {
225
+
226
+ super(owner, cfg);
227
+
228
+ this._state = new RenderState({
229
+ deviceMatrix: math.mat4(),
230
+ hasDeviceMatrix: false, // True when deviceMatrix set to other than identity
231
+ matrix: math.mat4(),
232
+ normalMatrix: math.mat4(),
233
+ inverseMatrix: math.mat4()
234
+ });
235
+
236
+ this._perspective = new Perspective(this);
237
+ this._ortho = new Ortho(this);
238
+ this._frustum = new Frustum(this);
239
+ this._customProjection = new CustomProjection(this);
240
+ this._project = this._perspective;
241
+
242
+ this._eye = math.vec3([0, 0, 10.0]);
243
+ this._look = math.vec3([0, 0, 0]);
244
+ this._up = math.vec3([0, 1, 0]);
245
+
246
+ this._worldUp = math.vec3([ 0, 1, 0,]);
247
+ this._worldRight = math.vec3([1, 0, 0,]);
248
+ this._worldForward = math.vec3([0, 0,-1]);
249
+
250
+ this.deviceMatrix = cfg.deviceMatrix;
251
+ this.eye = cfg.eye;
252
+ this.look = cfg.look;
253
+ this.up = cfg.up;
254
+ this.worldAxis = cfg.worldAxis;
255
+ this.gimbalLock = cfg.gimbalLock;
256
+ this.constrainPitch = cfg.constrainPitch;
257
+
258
+ this.projection = cfg.projection;
259
+
260
+ this._perspective.on("matrix", () => {
261
+ if (this._projectionType === "perspective") {
262
+ this.fire("projMatrix", this._perspective.matrix);
263
+ }
264
+ });
265
+ this._ortho.on("matrix", () => {
266
+ if (this._projectionType === "ortho") {
267
+ this.fire("projMatrix", this._ortho.matrix);
268
+ }
269
+ });
270
+ this._frustum.on("matrix", () => {
271
+ if (this._projectionType === "frustum") {
272
+ this.fire("projMatrix", this._frustum.matrix);
273
+ }
274
+ });
275
+ this._customProjection.on("matrix", () => {
276
+ if (this._projectionType === "customProjection") {
277
+ this.fire("projMatrix", this._customProjection.matrix);
278
+ }
279
+ });
280
+ }
281
+
282
+ _update() {
283
+ const state = this._state;
284
+ // In ortho mode, build the view matrix with an eye position that's translated
285
+ // well back from look, so that the front sectionPlane plane doesn't unexpectedly cut
286
+ // the front off the view (not a problem with perspective, since objects close enough
287
+ // to be clipped by the front plane are usually too big to see anything of their cross-sections).
288
+ let eye;
289
+ if (this.projection === "ortho") {
290
+ math.subVec3(this._eye, this._look, eyeLookVec);
291
+ math.normalizeVec3(eyeLookVec, eyeLookVecNorm);
292
+ math.mulVec3Scalar(eyeLookVecNorm, 1000.0, eyeLookOffset);
293
+ math.addVec3(this._look, eyeLookOffset, offsetEye);
294
+ eye = offsetEye;
295
+ } else {
296
+ eye = this._eye;
297
+ }
298
+ if (state.hasDeviceMatrix) {
299
+ math.lookAtMat4v(eye, this._look, this._up, tempMatb);
300
+ math.mulMat4(state.deviceMatrix, tempMatb, state.matrix);
301
+ //state.matrix.set(state.deviceMatrix);
302
+ } else {
303
+ math.lookAtMat4v(eye, this._look, this._up, state.matrix);
304
+ }
305
+ math.inverseMat4(this._state.matrix, this._state.inverseMatrix);
306
+ math.transposeMat4(this._state.inverseMatrix, this._state.normalMatrix);
307
+ this.glRedraw();
308
+ this.fire("matrix", this._state.matrix);
309
+ this.fire("viewMatrix", this._state.matrix);
310
+ }
311
+
312
+ /**
313
+ * Rotates {@link Camera#eye} about {@link Camera#look}, around the {@link Camera#up} vector
314
+ *
315
+ * @param {Number} angleInc Angle of rotation in degrees
316
+ */
317
+ orbitYaw(angleInc) {
318
+ let lookEyeVec = math.subVec3(this._eye, this._look, tempVec3);
319
+ math.rotationMat4v(angleInc * 0.0174532925, this._gimbalLock ? this._worldUp : this._up, tempMat);
320
+ lookEyeVec = math.transformPoint3(tempMat, lookEyeVec, tempVec3b);
321
+ this.eye = math.addVec3(this._look, lookEyeVec, tempVec3c); // Set eye position as 'look' plus 'eye' vector
322
+ this.up = math.transformPoint3(tempMat, this._up, tempVec3d); // Rotate 'up' vector
323
+ }
324
+
325
+ /**
326
+ * Rotates {@link Camera#eye} about {@link Camera#look} around the right axis (orthogonal to {@link Camera#up} and "look").
327
+ *
328
+ * @param {Number} angleInc Angle of rotation in degrees
329
+ */
330
+ orbitPitch(angleInc) {
331
+ if (this._constrainPitch) {
332
+ angleInc = math.dotVec3(this._up, this._worldUp) / math.DEGTORAD;
333
+ if (angleInc < 1) {
334
+ return;
335
+ }
336
+ }
337
+ let eye2 = math.subVec3(this._eye, this._look, tempVec3);
338
+ const left = math.cross3Vec3(math.normalizeVec3(eye2, tempVec3b), math.normalizeVec3(this._up, tempVec3c));
339
+ math.rotationMat4v(angleInc * 0.0174532925, left, tempMat);
340
+ eye2 = math.transformPoint3(tempMat, eye2, tempVec3d);
341
+ this.up = math.transformPoint3(tempMat, this._up, tempVec3e);
342
+ this.eye = math.addVec3(eye2, this._look, tempVec3f);
343
+ }
344
+
345
+ /**
346
+ * Rotates {@link Camera#look} about {@link Camera#eye}, around the {@link Camera#up} vector.
347
+ *
348
+ * @param {Number} angleInc Angle of rotation in degrees
349
+ */
350
+ yaw(angleInc) {
351
+ let look2 = math.subVec3(this._look, this._eye, tempVec3);
352
+ math.rotationMat4v(angleInc * 0.0174532925, this._gimbalLock ? this._worldUp : this._up, tempMat);
353
+ look2 = math.transformPoint3(tempMat, look2, tempVec3b);
354
+ this.look = math.addVec3(look2, this._eye, tempVec3c);
355
+ if (this._gimbalLock) {
356
+ this.up = math.transformPoint3(tempMat, this._up, tempVec3d);
357
+ }
358
+ }
359
+
360
+ /**
361
+ * Rotates {@link Camera#look} about {@link Camera#eye}, around the right axis (orthogonal to {@link Camera#up} and "look").
362
+
363
+ * @param {Number} angleInc Angle of rotation in degrees
364
+ */
365
+ pitch(angleInc) {
366
+ if (this._constrainPitch) {
367
+ angleInc = math.dotVec3(this._up, this._worldUp) / math.DEGTORAD;
368
+ if (angleInc < 1) {
369
+ return;
370
+ }
371
+ }
372
+ let look2 = math.subVec3(this._look, this._eye, tempVec3);
373
+ const left = math.cross3Vec3(math.normalizeVec3(look2, tempVec3b), math.normalizeVec3(this._up, tempVec3c));
374
+ math.rotationMat4v(angleInc * 0.0174532925, left, tempMat);
375
+ this.up = math.transformPoint3(tempMat, this._up, tempVec3f);
376
+ look2 = math.transformPoint3(tempMat, look2, tempVec3d);
377
+ this.look = math.addVec3(look2, this._eye, tempVec3e);
378
+ }
379
+
380
+ /**
381
+ * Pans the Camera along its local X, Y and Z axis.
382
+ *
383
+ * @param pan The pan vector
384
+ */
385
+ pan(pan) {
386
+ const eye2 = math.subVec3(this._eye, this._look, tempVec3);
387
+ const vec = [0, 0, 0];
388
+ let v;
389
+ if (pan[0] !== 0) {
390
+ const left = math.cross3Vec3(math.normalizeVec3(eye2, []), math.normalizeVec3(this._up, tempVec3b));
391
+ v = math.mulVec3Scalar(left, pan[0]);
392
+ vec[0] += v[0];
393
+ vec[1] += v[1];
394
+ vec[2] += v[2];
395
+ }
396
+ if (pan[1] !== 0) {
397
+ v = math.mulVec3Scalar(math.normalizeVec3(this._up, tempVec3c), pan[1]);
398
+ vec[0] += v[0];
399
+ vec[1] += v[1];
400
+ vec[2] += v[2];
401
+ }
402
+ if (pan[2] !== 0) {
403
+ v = math.mulVec3Scalar(math.normalizeVec3(eye2, tempVec3d), pan[2]);
404
+ vec[0] += v[0];
405
+ vec[1] += v[1];
406
+ vec[2] += v[2];
407
+ }
408
+ this.eye = math.addVec3(this._eye, vec, tempVec3e);
409
+ this.look = math.addVec3(this._look, vec, tempVec3f);
410
+ }
411
+
412
+ /**
413
+ * Increments/decrements the Camera's zoom factor, which is the distance between {@link Camera#eye} and {@link Camera#look}.
414
+ *
415
+ * @param {Number} delta Zoom factor increment.
416
+ */
417
+ zoom(delta) {
418
+ const vec = math.subVec3(this._eye, this._look, tempVec3);
419
+ const lenLook = Math.abs(math.lenVec3(vec, tempVec3b));
420
+ const newLenLook = Math.abs(lenLook + delta);
421
+ if (newLenLook < 0.5) {
422
+ return;
423
+ }
424
+ const dir = math.normalizeVec3(vec, tempVec3c);
425
+ this.eye = math.addVec3(this._look, math.mulVec3Scalar(dir, newLenLook), tempVec3d);
426
+ }
427
+
428
+ /**
429
+ * Sets the position of the Camera's eye.
430
+ *
431
+ * Default value is ````[0,0,10]````.
432
+ *
433
+ * @emits "eye" event on change, with the value of this property.
434
+ * @type {Number[]} New eye position.
435
+ */
436
+ set eye(eye) {
437
+ this._eye.set(eye || [0, 0, 10]);
438
+ this._needUpdate(0); // Ensure matrix built on next "tick"
439
+ this.fire("eye", this._eye);
440
+ }
441
+
442
+ /**
443
+ * Gets the position of the Camera's eye.
444
+ *
445
+ * Default vale is ````[0,0,10]````.
446
+ *
447
+ * @type {Number[]} New eye position.
448
+ */
449
+ get eye() {
450
+ return this._eye;
451
+ }
452
+
453
+ /**
454
+ * Sets the position of this Camera's point-of-interest.
455
+ *
456
+ * Default value is ````[0,0,0]````.
457
+ *
458
+ * @emits "look" event on change, with the value of this property.
459
+ *
460
+ * @param {Number[]} look Camera look position.
461
+ */
462
+ set look(look) {
463
+ this._look.set(look || [0, 0, 0]);
464
+ this._needUpdate(0); // Ensure matrix built on next "tick"
465
+ this.fire("look", this._look);
466
+ }
467
+
468
+ /**
469
+ * Gets the position of this Camera's point-of-interest.
470
+ *
471
+ * Default value is ````[0,0,0]````.
472
+ *
473
+ * @returns {Number[]} Camera look position.
474
+ */
475
+ get look() {
476
+ return this._look;
477
+ }
478
+
479
+ /**
480
+ * Sets the direction of this Camera's {@link Camera#up} vector.
481
+ *
482
+ * @emits "up" event on change, with the value of this property.
483
+ *
484
+ * @param {Number[]} up Direction of "up".
485
+ */
486
+ set up(up) {
487
+ this._up.set(up || [0, 1, 0]);
488
+ this._needUpdate(0);
489
+ this.fire("up", this._up);
490
+ }
491
+
492
+ /**
493
+ * Gets the direction of this Camera's {@link Camera#up} vector.
494
+ *
495
+ * @returns {Number[]} Direction of "up".
496
+ */
497
+ get up() {
498
+ return this._up;
499
+ }
500
+
501
+ /**
502
+ * Sets an optional matrix to premultiply into {@link Camera#matrix} matrix.
503
+ *
504
+ * This is intended to be used for stereo rendering with WebVR etc.
505
+ *
506
+ * @param {Number[]} matrix The matrix.
507
+ */
508
+ set deviceMatrix(matrix) {
509
+ this._state.deviceMatrix.set(matrix || [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
510
+ this._state.hasDeviceMatrix = !!matrix;
511
+ this._needUpdate(0);
512
+ this.fire("deviceMatrix", this._state.deviceMatrix);
513
+ }
514
+
515
+ /**
516
+ * Gets an optional matrix to premultiply into {@link Camera#matrix} matrix.
517
+ *
518
+ * @returns {Number[]} The matrix.
519
+ */
520
+ get deviceMatrix() {
521
+ return this._state.deviceMatrix;
522
+ }
523
+
524
+ /**
525
+ * Sets the up, right and forward axis of the World coordinate system.
526
+ *
527
+ * Has format: ````[rightX, rightY, rightZ, upX, upY, upZ, forwardX, forwardY, forwardZ]````
528
+ *
529
+ * Default axis is ````[1, 0, 0, 0, 1, 0, 0, 0, 1]````
530
+ *
531
+ * @param {Number[]} axis The new Wworld coordinate axis.
532
+ */
533
+ set worldAxis(axis) {
534
+ axis = axis || [1, 0, 0, 0, 1, 0, 0, 0, 1];
535
+ if (!this._worldAxis) {
536
+ this._worldAxis = math.vec3(axis);
537
+ } else {
538
+ this._worldAxis.set(axis);
539
+ }
540
+ this._worldRight[0] = this._worldAxis[0];
541
+ this._worldRight[1] = this._worldAxis[1];
542
+ this._worldRight[2] = this._worldAxis[2];
543
+ this._worldUp[0] = this._worldAxis[3];
544
+ this._worldUp[1] = this._worldAxis[4];
545
+ this._worldUp[2] = this._worldAxis[5];
546
+ this._worldForward[0] = this._worldAxis[6];
547
+ this._worldForward[1] = this._worldAxis[7];
548
+ this._worldForward[2] = this._worldAxis[8];
549
+ this.fire("worldAxis", this._worldAxis);
550
+ }
551
+
552
+ /**
553
+ * Gets the up, right and forward axis of the World coordinate system.
554
+ *
555
+ * Has format: ````[rightX, rightY, rightZ, upX, upY, upZ, forwardX, forwardY, forwardZ]````
556
+ *
557
+ * Default axis is ````[1, 0, 0, 0, 1, 0, 0, 0, 1]````
558
+ *
559
+ * @returns {Number[]} The current World coordinate axis.
560
+ */
561
+ get worldAxis() {
562
+ return this._worldAxis;
563
+ }
564
+
565
+ /**
566
+ * Gets the direction of World-space "up".
567
+ *
568
+ * This is set by {@link Camera#worldAxis}.
569
+ *
570
+ * Default value is ````[0,1,0]````.
571
+ *
572
+ * @returns {Number[]} The "up" vector.
573
+ */
574
+ get worldUp() {
575
+ return this._worldUp;
576
+ }
577
+
578
+ /**
579
+ * Gets if the World-space X-axis is "up".
580
+ * @returns {boolean}
581
+ */
582
+ get xUp() {
583
+ return this._worldUp[0] > this._worldUp[1] && this._worldUp[0] > this._worldUp[2];
584
+ }
585
+
586
+ /**
587
+ * Gets if the World-space Y-axis is "up".
588
+ * @returns {boolean}
589
+ */
590
+ get yUp() {
591
+ return this._worldUp[1] > this._worldUp[0] && this._worldUp[1] > this._worldUp[2];
592
+ }
593
+
594
+ /**
595
+ * Gets if the World-space Z-axis is "up".
596
+ * @returns {boolean}
597
+ */
598
+ get zUp() {
599
+ return this._worldUp[2] > this._worldUp[0] && this._worldUp[2] > this._worldUp[1];
600
+ }
601
+
602
+ /**
603
+ * Gets the direction of World-space "right".
604
+ *
605
+ * This is set by {@link Camera#worldAxis}.
606
+ *
607
+ * Default value is ````[1,0,0]````.
608
+ *
609
+ * @returns {Number[]} The "up" vector.
610
+ */
611
+ get worldRight() {
612
+ return this._worldRight;
613
+ }
614
+
615
+ /**
616
+ * Gets the direction of World-space "forwards".
617
+ *
618
+ * This is set by {@link Camera#worldAxis}.
619
+ *
620
+ * Default value is ````[0,0,1]````.
621
+ *
622
+ * @returns {Number[]} The "up" vector.
623
+ */
624
+ get worldForward() {
625
+ return this._worldForward;
626
+ }
627
+
628
+ /**
629
+ * Sets whether to lock yaw rotation to pivot about the World-space "up" axis.
630
+ *
631
+ * Fires a {@link Camera#gimbalLock:event} event on change.
632
+ *
633
+ * @params {Boolean} gimbalLock Set true to lock gimbal.
634
+ */
635
+ set gimbalLock(value) {
636
+ this._gimbalLock = value !== false;
637
+ this.fire("gimbalLock", this._gimbalLock);
638
+ }
639
+
640
+ /**
641
+ * Gets whether to lock yaw rotation to pivot about the World-space "up" axis.
642
+ *
643
+ * @returns {Boolean} Returns ````true```` if gimbal is locked.
644
+ */
645
+ get gimbalLock() {
646
+ return this._gimbalLock;
647
+ }
648
+
649
+ /**
650
+ * Sets whether to prevent camera from being pitched upside down.
651
+ *
652
+ * The camera is upside down when the angle between {@link Camera#up} and {@link Camera#worldUp} is less than one degree.
653
+ *
654
+ * Fires a {@link Camera#constrainPitch:event} event on change.
655
+ *
656
+ * Default value is ````false````.
657
+ *
658
+ * @param {Boolean} value Set ````true```` to contrain pitch rotation.
659
+ */
660
+ set constrainPitch(value) {
661
+ this._constrainPitch = !!value;
662
+ this.fire("constrainPitch", this._constrainPitch);
663
+ }
664
+
665
+ /**
666
+ * Gets whether to prevent camera from being pitched upside down.
667
+ *
668
+ * The camera is upside down when the angle between {@link Camera#up} and {@link Camera#worldUp} is less than one degree.
669
+ *
670
+ * Default value is ````false````.
671
+ *
672
+ * @returns {Boolean} ````true```` if pitch rotation is currently constrained.
673
+ get constrainPitch() {
674
+ return this._constrainPitch;
675
+ }
676
+
677
+ /**
678
+ * Gets distance from {@link Camera#look} to {@link Camera#eye}.
679
+ *
680
+ * @returns {Number} The distance.
681
+ */
682
+ get eyeLookDist() {
683
+ return math.lenVec3(math.subVec3(this._look, this._eye, tempVec3));
684
+ }
685
+
686
+ /**
687
+ * Gets the Camera's viewing transformation matrix.
688
+ *
689
+ * Fires a {@link Camera#matrix:event} event on change.
690
+ *
691
+ * @returns {Number[]} The viewing transform matrix.
692
+ */
693
+ get matrix() {
694
+ if (this._updateScheduled) {
695
+ this._doUpdate();
696
+ }
697
+ return this._state.matrix;
698
+ }
699
+
700
+ /**
701
+ * Gets the Camera's viewing transformation matrix.
702
+ *
703
+ * Fires a {@link Camera#matrix:event} event on change.
704
+ *
705
+ * @returns {Number[]} The viewing transform matrix.
706
+ */
707
+ get viewMatrix() {
708
+ if (this._updateScheduled) {
709
+ this._doUpdate();
710
+ }
711
+ return this._state.matrix;
712
+ }
713
+
714
+ /**
715
+ * The Camera's viewing normal transformation matrix.
716
+ *
717
+ * Fires a {@link Camera#matrix:event} event on change.
718
+ *
719
+ * @returns {Number[]} The viewing normal transform matrix.
720
+ */
721
+ get normalMatrix() {
722
+ if (this._updateScheduled) {
723
+ this._doUpdate();
724
+ }
725
+ return this._state.normalMatrix;
726
+ }
727
+
728
+ /**
729
+ * The Camera's viewing normal transformation matrix.
730
+ *
731
+ * Fires a {@link Camera#matrix:event} event on change.
732
+ *
733
+ * @returns {Number[]} The viewing normal transform matrix.
734
+ */
735
+ get viewNormalMatrix() {
736
+ if (this._updateScheduled) {
737
+ this._doUpdate();
738
+ }
739
+ return this._state.normalMatrix;
740
+ }
741
+
742
+ /**
743
+ * Gets the inverse of the Camera's viewing transform matrix.
744
+ *
745
+ * This has the same value as {@link Camera#normalMatrix}.
746
+ *
747
+ * @returns {Number[]} The inverse viewing transform matrix.
748
+ */
749
+ get inverseViewMatrix() {
750
+ if (this._updateScheduled) {
751
+ this._doUpdate();
752
+ }
753
+ return this._state.inverseMatrix;
754
+ }
755
+
756
+ /**
757
+ * Gets the Camera's projection transformation projMatrix.
758
+ *
759
+ * Fires a {@link Camera#projMatrix:event} event on change.
760
+ *
761
+ * @returns {Number[]} The projection matrix.
762
+ */
763
+ get projMatrix() {
764
+ return this[this.projection].matrix;
765
+ }
766
+
767
+ /**
768
+ * Gets the Camera's perspective projection.
769
+ *
770
+ * The Camera uses this while {@link Camera#projection} equals ````perspective````.
771
+ *
772
+ * @returns {Perspective} The Perspective component.
773
+ */
774
+ get perspective() {
775
+ return this._perspective;
776
+ }
777
+
778
+ /**
779
+ * Gets the Camera's orthographic projection.
780
+ *
781
+ * The Camera uses this while {@link Camera#projection} equals ````ortho````.
782
+ *
783
+ * @returns {Ortho} The Ortho component.
784
+ */
785
+ get ortho() {
786
+ return this._ortho;
787
+ }
788
+
789
+ /**
790
+ * Gets the Camera's frustum projection.
791
+ *
792
+ * The Camera uses this while {@link Camera#projection} equals ````frustum````.
793
+ *
794
+ * @returns {Frustum} The Ortho component.
795
+ */
796
+ get frustum() {
797
+ return this._frustum;
798
+ }
799
+
800
+ /**
801
+ * Gets the Camera's custom projection.
802
+ *
803
+ * This is used while {@link Camera#projection} equals "customProjection".
804
+ *
805
+ * @returns {CustomProjection} The custom projection.
806
+ */
807
+ get customProjection() {
808
+ return this._customProjection;
809
+ }
810
+
811
+ /**
812
+ * Sets the active projection type.
813
+ *
814
+ * Accepted values are ````"perspective"````, ````"ortho"````, ````"frustum"```` and ````"customProjection"````.
815
+ *
816
+ * Default value is ````"perspective"````.
817
+ *
818
+ * @param {String} value Identifies the active projection type.
819
+ */
820
+ set projection(value) {
821
+ value = value || "perspective";
822
+ if (this._projectionType === value) {
823
+ return;
824
+ }
825
+ if (value === "perspective") {
826
+ this._project = this._perspective;
827
+ } else if (value === "ortho") {
828
+ this._project = this._ortho;
829
+ } else if (value === "frustum") {
830
+ this._project = this._frustum;
831
+ } else if (value === "customProjection") {
832
+ this._project = this._customProjection;
833
+ } else {
834
+ this.error("Unsupported value for 'projection': " + value + " defaulting to 'perspective'");
835
+ this._project = this._perspective;
836
+ value = "perspective";
837
+ }
838
+ this._project._update();
839
+ this._projectionType = value;
840
+ this.glRedraw();
841
+ this._update(); // Need to rebuild lookat matrix with full eye, look & up
842
+ this.fire("dirty");
843
+ this.fire("projection", this._projectionType);
844
+ this.fire("projMatrix", this._project.matrix);
845
+ }
846
+
847
+ /**
848
+ * Gets the active projection type.
849
+ *
850
+ * Possible values are ````"perspective"````, ````"ortho"````, ````"frustum"```` and ````"customProjection"````.
851
+ *
852
+ * Default value is ````"perspective"````.
853
+ *
854
+ * @returns {String} Identifies the active projection type.
855
+ */
856
+ get projection() {
857
+ return this._projectionType;
858
+ }
859
+
860
+ /**
861
+ * Gets the currently active projection for this Camera.
862
+ *
863
+ * The currently active project is selected with {@link Camera#projection}.
864
+ *
865
+ * @returns {Perspective|Ortho|Frustum|CustomProjection} The currently active projection is active.
866
+ */
867
+ get project() {
868
+ return this._project;
869
+ }
870
+
871
+ /**
872
+ * Destroys this Camera.
873
+ */
874
+ destroy() {
875
+ super.destroy();
876
+ this._state.destroy();
877
+ }
878
+ }
879
+
880
+ export {Camera};