@kingsy/viewer 2.25.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/dist/IViewer.d.ts +157 -0
  2. package/dist/helpers/flatten.d.ts +11 -0
  3. package/dist/helpers/typeHelper.d.ts +2 -0
  4. package/dist/index.d.ts +89 -0
  5. package/dist/index.js +42 -0
  6. package/dist/modules/Assets.d.ts +15 -0
  7. package/dist/modules/EventEmitter.d.ts +7 -0
  8. package/dist/modules/Helpers.d.ts +3 -0
  9. package/dist/modules/Intersections.d.ts +20 -0
  10. package/dist/modules/KingSyRenderer.d.ts +168 -0
  11. package/dist/modules/LegacyViewer.d.ts +77 -0
  12. package/dist/modules/Shadowcatcher.d.ts +25 -0
  13. package/dist/modules/ShadowcatcherConfig.d.ts +14 -0
  14. package/dist/modules/UrlHelper.d.ts +1 -0
  15. package/dist/modules/Utils.d.ts +10 -0
  16. package/dist/modules/Viewer.d.ts +74 -0
  17. package/dist/modules/WebXrViewer.d.ts +10 -0
  18. package/dist/modules/World.d.ts +31 -0
  19. package/dist/modules/batching/Batch.d.ts +62 -0
  20. package/dist/modules/batching/BatchObject.d.ts +53 -0
  21. package/dist/modules/batching/Batcher.d.ts +60 -0
  22. package/dist/modules/batching/DrawRanges.d.ts +6 -0
  23. package/dist/modules/batching/InstancedBatchObject.d.ts +8 -0
  24. package/dist/modules/batching/InstancedMeshBatch.d.ts +60 -0
  25. package/dist/modules/batching/LineBatch.d.ts +52 -0
  26. package/dist/modules/batching/MeshBatch.d.ts +35 -0
  27. package/dist/modules/batching/PointBatch.d.ts +29 -0
  28. package/dist/modules/batching/PrimitiveBatch.d.ts +57 -0
  29. package/dist/modules/batching/TextBatch.d.ts +41 -0
  30. package/dist/modules/converter/Geometry.d.ts +38 -0
  31. package/dist/modules/converter/MeshTriangulationHelper.d.ts +50 -0
  32. package/dist/modules/converter/Units.d.ts +12 -0
  33. package/dist/modules/extensions/CameraController.d.ts +95 -0
  34. package/dist/modules/extensions/Controls.d.ts +91 -0
  35. package/dist/modules/extensions/DiffExtension.d.ts +50 -0
  36. package/dist/modules/extensions/ExplodeExtension.d.ts +17 -0
  37. package/dist/modules/extensions/Extension.d.ts +15 -0
  38. package/dist/modules/extensions/FilteringExtension.d.ts +55 -0
  39. package/dist/modules/extensions/HybridCameraController.d.ts +14 -0
  40. package/dist/modules/extensions/SelectionExtension.d.ts +53 -0
  41. package/dist/modules/extensions/TransformControls.d.ts +157 -0
  42. package/dist/modules/extensions/ViewModes.d.ts +32 -0
  43. package/dist/modules/extensions/controls/FlyControls.d.ts +82 -0
  44. package/dist/modules/extensions/controls/KingSyControls.d.ts +25 -0
  45. package/dist/modules/extensions/controls/SmoothOrbitControls.d.ts +222 -0
  46. package/dist/modules/extensions/measurements/AreaMeasurement.d.ts +64 -0
  47. package/dist/modules/extensions/measurements/Measurement.d.ts +34 -0
  48. package/dist/modules/extensions/measurements/MeasurementPointGizmo.d.ts +42 -0
  49. package/dist/modules/extensions/measurements/MeasurementsExtension.d.ts +71 -0
  50. package/dist/modules/extensions/measurements/PerpendicularMeasurement.d.ts +19 -0
  51. package/dist/modules/extensions/measurements/PointMeasurement.d.ts +25 -0
  52. package/dist/modules/extensions/measurements/PointToPointMeasurement.d.ts +15 -0
  53. package/dist/modules/extensions/sections/SectionOutlines.d.ts +45 -0
  54. package/dist/modules/extensions/sections/SectionTool.d.ts +219 -0
  55. package/dist/modules/filtering/PropertyManager.d.ts +55 -0
  56. package/dist/modules/input/Input.d.ts +47 -0
  57. package/dist/modules/loaders/GeometryConverter.d.ts +32 -0
  58. package/dist/modules/loaders/KingSy/KingSyConverter.d.ts +118 -0
  59. package/dist/modules/loaders/KingSy/KingSyGeometryConverter.d.ts +127 -0
  60. package/dist/modules/loaders/KingSy/KingSyLoader.d.ts +18 -0
  61. package/dist/modules/loaders/KingSy/KingSyOfflineLoader.d.ts +8 -0
  62. package/dist/modules/loaders/Loader.d.ts +35 -0
  63. package/dist/modules/loaders/OBJ/ObjConverter.d.ts +18 -0
  64. package/dist/modules/loaders/OBJ/ObjGeometryConverter.d.ts +14 -0
  65. package/dist/modules/loaders/OBJ/ObjLoader.d.ts +16 -0
  66. package/dist/modules/materials/KingSyBasicMaterial.d.ts +26 -0
  67. package/dist/modules/materials/KingSyDepthMaterial.d.ts +22 -0
  68. package/dist/modules/materials/KingSyDepthNormalIdMaterial.d.ts +11 -0
  69. package/dist/modules/materials/KingSyDepthNormalMaterial.d.ts +6 -0
  70. package/dist/modules/materials/KingSyDisplaceMaterial.d.ts +11 -0
  71. package/dist/modules/materials/KingSyGhostMaterial.d.ts +8 -0
  72. package/dist/modules/materials/KingSyLineMaterial.d.ts +20 -0
  73. package/dist/modules/materials/KingSyMatcapMaterial.d.ts +19 -0
  74. package/dist/modules/materials/KingSyMaterial.d.ts +65 -0
  75. package/dist/modules/materials/KingSyNormalMaterial.d.ts +18 -0
  76. package/dist/modules/materials/KingSyPointColouredMaterial.d.ts +12 -0
  77. package/dist/modules/materials/KingSyPointMaterial.d.ts +18 -0
  78. package/dist/modules/materials/KingSyShadowcatcherMaterial.d.ts +10 -0
  79. package/dist/modules/materials/KingSyStandardColoredMaterial.d.ts +11 -0
  80. package/dist/modules/materials/KingSyStandardMaterial.d.ts +22 -0
  81. package/dist/modules/materials/KingSyTextMaterial.d.ts +26 -0
  82. package/dist/modules/materials/KingSyViewportMaterial.d.ts +13 -0
  83. package/dist/modules/materials/MaterialOptions.d.ts +6 -0
  84. package/dist/modules/materials/Materials.d.ts +111 -0
  85. package/dist/modules/materials/shaders/kingsy-apply-ao-frag.d.ts +1 -0
  86. package/dist/modules/materials/shaders/kingsy-apply-ao-vert.d.ts +1 -0
  87. package/dist/modules/materials/shaders/kingsy-basic-frag.d.ts +1 -0
  88. package/dist/modules/materials/shaders/kingsy-basic-vert.d.ts +1 -0
  89. package/dist/modules/materials/shaders/kingsy-copy-output-frag.d.ts +1 -0
  90. package/dist/modules/materials/shaders/kingsy-copy-output-vert.d.ts +1 -0
  91. package/dist/modules/materials/shaders/kingsy-depth-frag.d.ts +1 -0
  92. package/dist/modules/materials/shaders/kingsy-depth-normal-frag.d.ts +1 -0
  93. package/dist/modules/materials/shaders/kingsy-depth-normal-id-frag.d.ts +1 -0
  94. package/dist/modules/materials/shaders/kingsy-depth-normal-id-vert.d.ts +1 -0
  95. package/dist/modules/materials/shaders/kingsy-depth-normal-vert.d.ts +1 -0
  96. package/dist/modules/materials/shaders/kingsy-depth-vert.d.ts +1 -0
  97. package/dist/modules/materials/shaders/kingsy-displace-frag.d.ts +1 -0
  98. package/dist/modules/materials/shaders/kingsy-displace.vert.d.ts +1 -0
  99. package/dist/modules/materials/shaders/kingsy-edges-generator-frag.d.ts +1 -0
  100. package/dist/modules/materials/shaders/kingsy-edges-generator-vert.d.ts +1 -0
  101. package/dist/modules/materials/shaders/kingsy-ghost-frag.d.ts +1 -0
  102. package/dist/modules/materials/shaders/kingsy-ghost-vert.d.ts +1 -0
  103. package/dist/modules/materials/shaders/kingsy-line-frag.d.ts +1 -0
  104. package/dist/modules/materials/shaders/kingsy-line-vert.d.ts +1 -0
  105. package/dist/modules/materials/shaders/kingsy-normal-frag.d.ts +1 -0
  106. package/dist/modules/materials/shaders/kingsy-normal-vert.d.ts +1 -0
  107. package/dist/modules/materials/shaders/kingsy-point-frag.d.ts +1 -0
  108. package/dist/modules/materials/shaders/kingsy-point-vert.d.ts +1 -0
  109. package/dist/modules/materials/shaders/kingsy-sao-frag.d.ts +1 -0
  110. package/dist/modules/materials/shaders/kingsy-sao-vert.d.ts +1 -0
  111. package/dist/modules/materials/shaders/kingsy-shadowcatche-frag.d.ts +1 -0
  112. package/dist/modules/materials/shaders/kingsy-shadowcatcher-vert.d.ts +1 -0
  113. package/dist/modules/materials/shaders/kingsy-standard-colored-frag.d.ts +1 -0
  114. package/dist/modules/materials/shaders/kingsy-standard-colored-vert.d.ts +1 -0
  115. package/dist/modules/materials/shaders/kingsy-standard-frag.d.ts +1 -0
  116. package/dist/modules/materials/shaders/kingsy-standard-vert.d.ts +1 -0
  117. package/dist/modules/materials/shaders/kingsy-static-ao-accumulate-frag.d.ts +1 -0
  118. package/dist/modules/materials/shaders/kingsy-static-ao-accumulate-vert.d.ts +1 -0
  119. package/dist/modules/materials/shaders/kingsy-static-ao-generate-frag.d.ts +1 -0
  120. package/dist/modules/materials/shaders/kingsy-static-ao-generate-vert.d.ts +1 -0
  121. package/dist/modules/materials/shaders/kingsy-temporal-supersampling-frag.d.ts +1 -0
  122. package/dist/modules/materials/shaders/kingsy-temporal-supersampling-vert.d.ts +1 -0
  123. package/dist/modules/materials/shaders/kingsy-text-frag.d.ts +1 -0
  124. package/dist/modules/materials/shaders/kingsy-text-vert.d.ts +1 -0
  125. package/dist/modules/materials/shaders/kingsy-viewport-frag.d.ts +1 -0
  126. package/dist/modules/materials/shaders/kingsy-viewport-vert.d.ts +1 -0
  127. package/dist/modules/objects/AccelerationStructure.d.ts +72 -0
  128. package/dist/modules/objects/ExtendedInstancedMesh.d.ts +6 -0
  129. package/dist/modules/objects/JitterQuad.d.ts +10 -0
  130. package/dist/modules/objects/KingSyCamera.d.ts +31 -0
  131. package/dist/modules/objects/KingSyInstancedMesh.d.ts +44 -0
  132. package/dist/modules/objects/KingSyMesh.d.ts +43 -0
  133. package/dist/modules/objects/KingSyRaycaster.d.ts +42 -0
  134. package/dist/modules/objects/KingSyText.d.ts +39 -0
  135. package/dist/modules/objects/KingSyWebGLRenderer.d.ts +24 -0
  136. package/dist/modules/objects/RotatablePMREMGenerator.d.ts +5 -0
  137. package/dist/modules/objects/TopLevelAccelerationStructure.d.ts +41 -0
  138. package/dist/modules/pipeline/Passes/BlendPass.d.ts +17 -0
  139. package/dist/modules/pipeline/Passes/DepthNormalIdPass.d.ts +12 -0
  140. package/dist/modules/pipeline/Passes/DepthNormalPass.d.ts +25 -0
  141. package/dist/modules/pipeline/Passes/DepthPass.d.ts +23 -0
  142. package/dist/modules/pipeline/Passes/EdgesPass.d.ts +25 -0
  143. package/dist/modules/pipeline/Passes/GPass.d.ts +88 -0
  144. package/dist/modules/pipeline/Passes/GeometryPass.d.ts +7 -0
  145. package/dist/modules/pipeline/Passes/NormalsPass.d.ts +8 -0
  146. package/dist/modules/pipeline/Passes/OutputPass.d.ts +23 -0
  147. package/dist/modules/pipeline/Passes/ProgressiveAOPass.d.ts +30 -0
  148. package/dist/modules/pipeline/Passes/ShadedPass.d.ts +26 -0
  149. package/dist/modules/pipeline/Passes/ShadowcatcherPass.d.ts +43 -0
  150. package/dist/modules/pipeline/Passes/StencilMaskPass.d.ts +9 -0
  151. package/dist/modules/pipeline/Passes/StencilPass.d.ts +9 -0
  152. package/dist/modules/pipeline/Passes/TAAPass.d.ts +15 -0
  153. package/dist/modules/pipeline/Passes/ViewportPass.d.ts +22 -0
  154. package/dist/modules/pipeline/Pipelines/ArcticViewPipeline.d.ts +7 -0
  155. package/dist/modules/pipeline/Pipelines/DefaultPipeline.d.ts +6 -0
  156. package/dist/modules/pipeline/Pipelines/EdgesPipeline.d.ts +28 -0
  157. package/dist/modules/pipeline/Pipelines/PenViewPipeline.d.ts +6 -0
  158. package/dist/modules/pipeline/Pipelines/Pipeline.d.ts +43 -0
  159. package/dist/modules/pipeline/Pipelines/ProgressivePipeline.d.ts +24 -0
  160. package/dist/modules/pipeline/Pipelines/ShadedViewPipeline.d.ts +7 -0
  161. package/dist/modules/pipeline/Pipelines/SolidViewPipeline.d.ts +6 -0
  162. package/dist/modules/pipeline/Pipelines/TAAPipeline.d.ts +7 -0
  163. package/dist/modules/queries/IntersectionQuerySolver.d.ts +11 -0
  164. package/dist/modules/queries/PointQuerySolver.d.ts +9 -0
  165. package/dist/modules/queries/Queries.d.ts +9 -0
  166. package/dist/modules/queries/Query.d.ts +51 -0
  167. package/dist/modules/three/stats.d.ts +4 -0
  168. package/dist/modules/tree/NodeMap.d.ts +20 -0
  169. package/dist/modules/tree/NodeRenderView.d.ts +51 -0
  170. package/dist/modules/tree/RenderTree.d.ts +36 -0
  171. package/dist/modules/tree/WorldTree.d.ts +52 -0
  172. package/dist/modules/utils/AngleDamper.d.ts +18 -0
  173. package/dist/modules/utils/Damper.d.ts +17 -0
  174. package/dist/modules/utils/Logger.d.ts +2 -0
  175. package/dist/type-augmentations/three-extensions.d.ts +1 -0
  176. package/package.json +99 -0
  177. package/readme.md +30 -0
@@ -0,0 +1 @@
1
+ export declare const kingsyStandardVert = "\n#define STANDARD\n#ifdef USE_RTE\n // The high component is stored as the default 'position' attribute buffer\n attribute vec3 position_low;\n uniform vec3 uViewer_high;\n uniform vec3 uViewer_low;\n uniform mat4 rteShadowMatrix;\n uniform vec3 uShadowViewer_high;\n uniform vec3 uShadowViewer_low;\n#endif\n\n#ifdef TRANSFORM_STORAGE\n attribute float objIndex;\n #if TRANSFORM_STORAGE == 0\n #if __VERSION__ == 300\n #define TRANSFORM_STRIDE 4\n #else\n #define TRANSFORM_STRIDE 4.\n #endif\n uniform sampler2D tTransforms;\n uniform float objCount;\n #elif TRANSFORM_STORAGE == 1\n uniform mat4 uTransforms[OBJ_COUNT];\n #endif\n#endif\n\nvarying vec3 vViewPosition;\n\n#ifdef USE_TRANSMISSION\n\n varying vec3 vWorldPosition;\n\n#endif\n\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\n#ifdef TRANSFORM_STORAGE\n void objectTransform(out vec4 quaternion, out vec4 pivotLow, out vec4 pivotHigh, out vec4 translation, out vec4 scale){\n #if TRANSFORM_STORAGE == 0\n #if __VERSION__ == 300\n ivec2 uv = ivec2(int(objIndex) * TRANSFORM_STRIDE, 0); \n vec4 v0 = texelFetch( tTransforms, uv, 0 );\n vec4 v1 = texelFetch( tTransforms, uv + ivec2(1, 0), 0);\n vec4 v2 = texelFetch( tTransforms, uv + ivec2(2, 0), 0);\n vec4 v3 = texelFetch( tTransforms, uv + ivec2(3, 0), 0);\n quaternion = v0;\n pivotLow = vec4(v1.xyz, 1.);\n pivotHigh = vec4(v2.xyz, 1.);\n translation = vec4(v3.xyz, 1.);\n scale = vec4(v1.w, v2.w, v3.w, 1.);\n #else\n float size = objCount * TRANSFORM_STRIDE;\n vec2 cUv = vec2(0.5/size, 0.5);\n vec2 dUv = vec2(1./size, 0.);\n \n vec2 uv = vec2((objIndex * TRANSFORM_STRIDE)/size + cUv.x, cUv.y);\n vec4 v0 = texture2D( tTransforms, uv);\n vec4 v1 = texture2D( tTransforms, uv + dUv);\n vec4 v2 = texture2D( tTransforms, uv + 2. * dUv);\n vec4 v3 = texture2D( tTransforms, uv + 3. * dUv);\n quaternion = v0;\n pivotLow = vec4(v1.xyz, 1.);\n pivotHigh = vec4(v2.xyz, 1.);\n translation = vec4(v3.xyz, 1.);\n scale = vec4(v1.w, v2.w, v3.w, 1.);\n #endif\n #elif TRANSFORM_STORAGE == 1\n mat4 tMatrix = uTransforms[int(objIndex)];\n quaternion = tMatrix[0];\n pivotLow = vec4(tMatrix[1].xyz, 1.);\n pivotHigh = vec4(tMatrix[2].xyz, 1.);\n translation = vec4(tMatrix[3].xyz, 1.);\n scale = vec4(tMatrix[1][3], tMatrix[2][3], tMatrix[3][3], 1.);\n #endif\n }\n\n\n highp vec3 rotate_vertex_position(highp vec3 position, highp vec4 quat)\n { \n return position + 2.0 * cross(quat.xyz, cross(quat.xyz, position) + quat.w * position);\n }\n\n /** Another workaround for Apple's stupid compiler */\n vec4 safeMul(vec4 a, vec4 b) {\n // Prevents constant folding and optimization\n return (a + vec4(0.0)) * (b + vec4(1.0)) - a * vec4(1.0);\n }\n\n highp vec3 rotate_scaled_vertex_position_delta(highp vec4 v0, highp vec4 v1, highp vec4 scale, highp vec4 quat)\n {\n /** !!! WORKAROUND FOR Intel IrisXe CARDS !!! */\n /** The code below will not produce correct results in intel IrisXE integrated GPUs. \n * The geometry will turn mangled, albeit stable\n * I can't know for sure what is going on, but rotating the difference seems to \n * force the result into a lower precision?\n */\n // highp vec4 position = v0 - v1;\n // return position.xyz + 2.0 * cross(quat.xyz, cross(quat.xyz, position.xyz) + quat.w * position.xyz);\n\n /** Subtracting the rotated vectors works. */\n return rotate_vertex_position(safeMul(v0, scale).xyz, quat) - rotate_vertex_position(safeMul(v1, scale).xyz, quat) ;\n\n /** An alternate workaround is\n * highp vec3 position = (v0.xyz * (1. + 1e-7)) - (v1.xyz * (1. + 1e-7));\n return position + 2.0 * cross(quat.xyz, cross(quat.xyz, position) + quat.w * position);\n\n However I'm not such a fan of the (1. + 1e-7) part\n */\n }\n#endif\n\n#ifdef USE_RTE\n highp vec4 computeRelativePosition(in highp vec3 position_low, in highp vec3 position_high, in highp vec3 relativeTo_low, in highp vec3 relativeTo_high){\n /* \n Source https://github.com/virtualglobebook/OpenGlobe/blob/master/Source/Examples/Chapter05/Jitter/GPURelativeToEyeDSFUN90/Shaders/VS.glsl \n Note here, we're storing the high part of the position encoding inside three's default 'position' attribute buffer so we avoid redundancy \n */\n highp vec3 t1 = position_low.xyz - relativeTo_low.xyz;\n highp vec3 e = t1 - position_low.xyz;\n /** This is redunant, but necessary as a workaround for Apple platforms */\n highp float x = position_high.x - relativeTo_high.x;\n highp float y = position_high.y - relativeTo_high.y;\n highp float z = position_high.z - relativeTo_high.z;\n highp vec3 v = vec3(x, y, z);\n /** End of redundant part */\n highp vec3 t2 = ((-relativeTo_low - e) + (position_low.xyz - (t1 - e))) + v;\n highp vec3 highDifference = t1 + t2;\n highp vec3 lowDifference = t2 - (highDifference.xyz - t1.xyz);\n \n highp vec3 position = highDifference.xyz + lowDifference.xyz;\n return vec4(position, 1.);\n }\n#endif\n\n\nvoid main() {\n\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n //#include <project_vertex> // EDITED CHUNK\n \n #ifdef TRANSFORM_STORAGE\n highp vec4 tQuaternion, tPivotLow, tPivotHigh, tTranslation, tScale;\n objectTransform(tQuaternion, tPivotLow, tPivotHigh, tTranslation, tScale);\n #endif\n #ifdef USE_RTE\n vec4 position_lowT = vec4(position_low, 1.);\n vec4 position_highT = vec4(position, 1.);\n const vec3 ZERO3 = vec3(0., 0., 0.);\n\n highp vec4 rteLocalPosition = computeRelativePosition(position_lowT.xyz, position_highT.xyz, uViewer_low, uViewer_high);\n #ifdef TRANSFORM_STORAGE\n highp vec4 rtePivot = computeRelativePosition(tPivotLow.xyz, tPivotHigh.xyz, uViewer_low, uViewer_high);\n rteLocalPosition.xyz = rotate_scaled_vertex_position_delta(rteLocalPosition, rtePivot, tScale, tQuaternion) + rtePivot.xyz + tTranslation.xyz;\n #endif\n #ifdef USE_INSTANCING\n vec4 instancePivot = computeRelativePosition(ZERO3, ZERO3, uViewer_low, uViewer_high);\n rteLocalPosition.xyz = (mat3(instanceMatrix) * (rteLocalPosition - instancePivot).xyz) + instancePivot.xyz + instanceMatrix[3].xyz;\n #endif\n #endif\n\n #ifdef USE_RTE\n vec4 mvPosition = rteLocalPosition;\n #else\n vec4 mvPosition = vec4( transformed, 1.0 );\n #ifdef TRANSFORM_STORAGE\n mvPosition.xyz = rotate_scaled_vertex_position_delta(mvPosition, tPivotHigh, tScale, tQuaternion) + tPivotHigh.xyz + tTranslation.xyz;\n #endif\n #ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n #endif\n #endif\n \n mvPosition = modelViewMatrix * mvPosition;\n\n gl_Position = projectionMatrix * mvPosition;\n\n\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n\n vViewPosition = - mvPosition.xyz;\n\n #include <worldpos_vertex>\n // #include <shadowmap_vertex> COMMENTED CHUNK!!!\n #ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\t// Offsetting the position used for querying occlusion along the world normal can be used to reduce shadow acne.\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n highp vec4 shadowPosition = vec4(transformed, 1.0);\n mat4 shadowMatrix = directionalShadowMatrix[ i ];\n\n #ifdef USE_RTE\n shadowPosition = computeRelativePosition(position_low.xyz, position.xyz, uShadowViewer_low, uShadowViewer_high);\n shadowMatrix = rteShadowMatrix;\n #ifdef TRANSFORM_STORAGE\n highp vec4 rtePivotShadow = computeRelativePosition(tPivotLow.xyz, tPivotHigh.xyz, uShadowViewer_low, uShadowViewer_high);\n shadowPosition.xyz = rotate_scaled_vertex_position_delta(shadowPosition, rtePivotShadow, tScale, tQuaternion) + rtePivotShadow.xyz + tTranslation.xyz;\n #endif\n #ifdef USE_INSTANCING\n vec4 rtePivotShadow = computeRelativePosition(ZERO3, ZERO3, uShadowViewer_low, uShadowViewer_high);\n shadowPosition.xyz = (mat3(instanceMatrix) * (shadowPosition - rtePivotShadow).xyz) + rtePivotShadow.xyz + instanceMatrix[3].xyz;\n #endif\n #else\n #ifdef TRANSFORM_STORAGE\n shadowPosition.xyz = rotate_vertex_position(shadowPosition.xyz * tScale.xyz, tQuaternion) + tTranslation.xyz;\n #endif\n #ifdef USE_INSTANCING\n shadowPosition = instanceMatrix * shadowPosition;\n #endif\n #endif\n shadowWorldPosition = modelMatrix * shadowPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = shadowMatrix * shadowWorldPosition;\n\t}\n \n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\t\t// TODO (abelnation): update vAreaShadowCoord with area light info\n\t#endif\n\t*/\n #endif\n\n #include <fog_vertex>\n\n#ifdef USE_TRANSMISSION\n\n vWorldPosition = worldPosition.xyz;\n\n#endif\n}\n";
@@ -0,0 +1 @@
1
+ export declare const kingsyStaticAoAccumulateFrag = "\n uniform float opacity;\n uniform sampler2D tDiffuse;\n varying vec2 vUv;\n // #define NUM_FRAMES 16\n\n void main() {\n vec4 frameSample = texture2D( tDiffuse, vUv );\n gl_FragColor.xyz = frameSample.rgb * 1./float(NUM_FRAMES);\n gl_FragColor.a = 1.;//*= opacity;\n }";
@@ -0,0 +1 @@
1
+ export declare const kingsyStaticAoAccumulateVert = "\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }";
@@ -0,0 +1 @@
1
+ export declare const kingsyStaticAoGenerateFrag = "\n\t\t#include <common>\n\t\t#define AO_ESTIMATOR 1\n\t\t#define NORMAL_TEXTURE 0\n\t\t#define IMPROVED_NORMAL_RECONSTRUCTION 0\n\t\t#define ACCURATE_NORMAL_RECONSTRUCTION 1\n\n\t\tvarying vec2 vUv;\n\t\tuniform sampler2D tDepth;\n\t\tuniform sampler2D tNormal;\n uniform vec2 size;\n\n\t\tuniform float cameraNear;\n\t\tuniform float cameraFar;\n\t\tuniform mat4 cameraProjectionMatrix;\n\t\tuniform mat4 cameraInverseProjectionMatrix;\n\t\t\n\t\tuniform float intensity;\n\t\tuniform float bias;\n\t\tuniform float kernelRadius;\n\t\t\n\t\t\n\t\t#if AO_ESTIMATOR == 0\n\t\t\t#define NUM_SAMPLES 16\n \t#define SPIRAL_TURNS 2\n\t\t\t#define INV_NUM_SAMPLES 1.0 / float( NUM_SAMPLES )\n \t#define offset PI2 / float(NUM_FRAMES)\n\n\t\t\tuniform float minResolution;\n\t\t\tuniform float frameIndex;\n\t\t\tuniform float scale;\n\t\t#endif\n\n\t\t#if AO_ESTIMATOR == 1\n\t\t\tuniform float tanFov;\n\t\t\tuniform sampler2D tNoise;\n\t\t\tuniform vec3 kernel[ KERNEL_SIZE ];\n\t\t#endif\n\n\t\t// RGBA depth\n\t\t#include <packing>\n\t\tvec4 getDefaultColor( const in vec2 screenPosition ) {\n\t\t\treturn vec4( 1.0 );\n\t\t}\n\n\n\t\tfloat getLinearDepth( const in vec2 screenPosition ) {\n\t\t\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );\n\t\t}\n\n\t\tfloat getPerspectiveDepth(const in vec2 coords) {\n\t\t\tfloat linearDepth = unpackRGBAToDepth( texture2D( tDepth, coords ) );\n\t\t\t#if PERSPECTIVE_CAMERA == 1\n\t\t\t\tfloat viewZ = orthographicDepthToViewZ(linearDepth, cameraNear, cameraFar);\n\t\t\t\tfloat centerDepth = viewZToPerspectiveDepth(viewZ, cameraNear, cameraFar);\n\t\t\t\treturn centerDepth;\n\t\t\t#else\n\t\t\t\treturn linearDepth;\n\t\t\t#endif\n\t\t}\n\n\t\tfloat getViewDepth(const in float linearDepth) {\n\t\t\treturn orthographicDepthToViewZ(linearDepth, cameraNear, cameraFar);\n\t\t}\n\n\t\tfloat getViewZ( const in float depth ) {\n\t\t\t#if PERSPECTIVE_CAMERA == 1\n\t\t\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );\n\t\t\t#else\n\t\t\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );\n\t\t\t#endif\n\t\t}\n\n\t\tvec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {\n\t\t\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];\n\t\t\tvec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );\n\t\t\tclipPosition *= clipW; // unprojection.\n\t\t\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;\n\t\t}\n\n\t\t//https://wickedengine.net/2019/09/22/improved-normal-reconstruction-from-depth/\n\t\tvec3 viewNormalImproved(in vec2 uv, in vec3 origin)\n\t\t{\t\n\t\t\thighp vec2 dd = abs(vec2(1./size.x, 1./size.y));\n\t\t\thighp vec2 ddx = vec2(dd.x, 0.);\n\t\t\thighp vec2 ddy = vec2(0., dd.y);\n\n\t\t\tfloat sampleDepth = getPerspectiveDepth( uv - ddy );\n\t\t\tfloat sampleViewZ = getViewZ( sampleDepth );\n\t\t\thighp vec3 top = getViewPosition( uv - ddy, sampleDepth, sampleViewZ );\n\n\t\t\tsampleDepth = getPerspectiveDepth( uv + ddy );\n\t\t\tsampleViewZ = getViewZ( sampleDepth );\n\t\t\thighp vec3 bottom = getViewPosition( uv + ddy, sampleDepth, sampleViewZ );\n\n\t\t\thighp vec3 center = origin;\n\t\t\t\n\t\t\tsampleDepth = getPerspectiveDepth( uv - ddx );\n\t\t\tsampleViewZ = getViewZ( sampleDepth );\n\t\t\thighp vec3 left = getViewPosition( uv - ddx, sampleDepth, sampleViewZ );\n\n\t\t\tsampleDepth = getPerspectiveDepth( uv + ddx );\n\t\t\tsampleViewZ = getViewZ( sampleDepth );\n\t\t\thighp vec3 right = getViewPosition( uv + ddx, sampleDepth, sampleViewZ );\n\n\t\t\t // get the difference between the current and each offset position\n\t\t\tvec3 l = center - left;\n\t\t\tvec3 r = right - center;\n\t\t\tvec3 d = center - top;\n\t\t\tvec3 u = bottom - center;\n\n\t\t\t// pick horizontal and vertical diff with the smallest z difference\n\t\t\tvec3 hDeriv = abs(l.z) < abs(r.z) ? l : r;\n\t\t\tvec3 vDeriv = abs(d.z) < abs(u.z) ? d : u;\n\n\t\t\t// get view space normal from the cross product of the two smallest offsets\n\t\t\tvec3 viewNormal = normalize(cross(hDeriv, vDeriv));\n\n\t\t\treturn viewNormal;\n\t\t}\n\n\t\tvec3 viewNormalAccurate(in vec2 uv, in vec3 origin, in float centerDepth) {\n\t\t\thighp vec2 dd = abs(vec2(1./size.x, 1./size.y));\n\t\t\thighp vec2 ddx = vec2(dd.x, 0.);\n\t\t\thighp vec2 ddy = vec2(0., dd.y);\n\n\t\t\tfloat sampleDepth = getPerspectiveDepth( uv - ddy );\n\t\t\tfloat sampleViewZ = getViewZ( sampleDepth );\n\t\t\thighp vec3 top = getViewPosition( uv - ddy, sampleDepth, sampleViewZ );\n\n\t\t\tsampleDepth = getPerspectiveDepth( uv + ddy );\n\t\t\tsampleViewZ = getViewZ( sampleDepth );\n\t\t\thighp vec3 bottom = getViewPosition( uv + ddy, sampleDepth, sampleViewZ );\n\n\t\t\thighp vec3 center = origin;\n\t\t\t\n\t\t\tsampleDepth = getPerspectiveDepth( uv - ddx );\n\t\t\tsampleViewZ = getViewZ( sampleDepth );\n\t\t\thighp vec3 left = getViewPosition( uv - ddx, sampleDepth, sampleViewZ );\n\n\t\t\tsampleDepth = getPerspectiveDepth( uv + ddx );\n\t\t\tsampleViewZ = getViewZ( sampleDepth );\n\t\t\thighp vec3 right = getViewPosition( uv + ddx, sampleDepth, sampleViewZ );\n\n\t\t\t // get the difference between the current and each offset position\n\t\t\tvec3 l = center - left;\n\t\t\tvec3 r = right - center;\n\t\t\tvec3 d = center - top;\n\t\t\tvec3 u = bottom - center;\n\n\t\t\t// get depth values at 1 & 2 pixels offsets from current along the horizontal axis\n\t\t\tvec4 H = vec4(\n\t\t\t\tgetLinearDepth(uv - ddx),\n\t\t\t\tgetLinearDepth(uv + ddx),\n\t\t\t\tgetLinearDepth(uv - 2. * ddx),\n\t\t\t\tgetLinearDepth(uv + 2. * ddx)\n\t\t\t);\n\n\t\t\t// get depth values at 1 & 2 pixels offsets from current along the vertical axis\n\t\t\tvec4 V = vec4(\n\t\t\t\tgetLinearDepth(uv - ddy),\n\t\t\t\tgetLinearDepth(uv + ddy),\n\t\t\t\tgetLinearDepth(uv - 2. * ddy),\n\t\t\t\tgetLinearDepth(uv + 2. * ddy)\n\t\t\t);\n\n\t\t\t// current pixel's depth difference from slope of offset depth samples\n\t\t\t// differs from original article because we're using non-linear depth values\n\t\t\t// see article's comments\n\t\t\tvec2 he = abs((2. * H.xy - H.zw) - centerDepth);\n\t\t\tvec2 ve = abs((2. * V.xy - V.zw) - centerDepth);\n\n\t\t\t// pick horizontal and vertical diff with the smallest depth difference from slopes\n\t\t\tvec3 hDeriv = he.x < he.y ? l : r;\n\t\t\tvec3 vDeriv = ve.x < ve.y ? d : u;\n\n\t\t\t// get view space normal from the cross product of the best derivatives\n\t\t\tvec3 viewNormal = normalize(cross(hDeriv, vDeriv));\n\n\t\t\treturn viewNormal;\n\n\t\t}\n\n\t\tvec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPosition, in float centerDepth ) {\n\t\t\t#if NORMAL_TEXTURE == 1\n\t\t\t\treturn unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );\n\t\t\t#elif IMPROVED_NORMAL_RECONSTRUCTION == 1\n\t\t\t\treturn viewNormalImproved(screenPosition, viewPosition);\n\t\t\t#elif ACCURATE_NORMAL_RECONSTRUCTION == 1\n\t\t\t\treturn viewNormalAccurate(screenPosition, viewPosition, centerDepth);\n\t\t\t#else\n\t\t\t\treturn normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );\n\t\t\t#endif\n\t\t}\n\n\n\t\tfloat scaleDividedByCameraFar;\n\t\tfloat minResolutionMultipliedByCameraFar;\n // moving costly divides into consts\n\t\t\n\n\t\tfloat computeKernelSize(float d, float r) {\n\t\t\t#if PERSPECTIVE_CAMERA == 1\n\t\t\t\t// Apparently this is wrong\n\t\t\t\t// return (r * tan(fov) * d) / (size.y * 0.5);\n\t\t\t\t// And this is correct\n\t\t\t\tfloat rp = r / (size.y * 0.5);\n\t\t\t\treturn sqrt((rp*rp*tanFov*tanFov*d*d)/(1. + rp*rp*tanFov*tanFov));\n\t\t\t#else\n\t\t\t\tfloat twoOrthoSize = size.y / (2./ cameraProjectionMatrix[1][1]);\n\t\t\t\treturn r / twoOrthoSize;\n\t\t\t#endif\n\t\t}\n\n\t\tfloat getAmbientOcclusion( const in vec3 centerViewPosition, in float centerDepth ) {\n #if AO_ESTIMATOR == 0\n // precompute some variables require in getOcclusion.\n scaleDividedByCameraFar = scale / cameraFar;\n minResolutionMultipliedByCameraFar = minResolution * cameraFar;\n vec3 centerViewNormal = getViewNormal( centerViewPosition, vUv, centerDepth );\n // jsfiddle that shows sample pattern: https://jsfiddle.net/TenHands/jun67k9y/7/\n float occlusionSum = 0.0;\n float weightSum = 0.0;\n for( int i = 0; i < NUM_SAMPLES; i ++ ) {\n float alpha = ( float(i) + 1. ) / float(NUM_SAMPLES);\n float angle = float(SPIRAL_TURNS) * alpha;\n vec2 radius = (kernelRadius / size) * pow( alpha, 1.1 );\n vec2 sampleUv = vUv + vec2( cos( angle + frameIndex * offset ), sin( angle + frameIndex * offset ) ) * radius;\n\n float sampleDepth = getPerspectiveDepth( sampleUv );\n if( sampleDepth >= ( 1.0 - EPSILON ) ) {\n continue;\n }\n float sampleViewZ = getViewZ( sampleDepth );\n vec3 sampleViewPosition = getViewPosition( sampleUv, sampleDepth, sampleViewZ );\n\n\t\t\t\t\t/** McGuire Estimator*/\n\t\t\t\t\tvec3 v = sampleViewPosition - centerViewPosition;\n\t\t\t\t\tfloat vv = dot(v, v);\n\t\t\t\t\tfloat vn = dot(v, centerViewNormal) - bias;\n\t\t\t\t\t\n\t\t\t\t\t// Note large epsilon to avoid overdarkening within cracks\n\t\t\t\t\tfloat radius2 = 2.;//uSampleRadiusWS * uSampleRadiusWS\n\t\t\t\t\tfloat epsilon = 0.01;\n\t\t\t\t\t\n\t\t\t\t\tfloat f = max(radius2 - vv, 0.0) / radius2;\n\t\t\t\t\tocclusionSum += f * f * f * max(vn / (epsilon + vv), 0.0) / 4.;\n\n\t\t\t\t\t/** Three.js SAO Estimator*/\n // vec3 viewDelta = sampleViewPosition - centerViewPosition;\n // float viewDistance = length( viewDelta );\n // float scaledScreenDistance = scaleDividedByCameraFar * viewDistance;\n // occlusionSum += max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - bias) / (1.0 + pow2( scaledScreenDistance ) );\n weightSum += 1.0;\n }\n if( weightSum == 0.0 ) discard;\n return occlusionSum * ( intensity / weightSum );\n\t\t\t#elif AO_ESTIMATOR == 1\n\t\t\t\tvec3 viewPosition = centerViewPosition;\n\t\t\t\tvec3 viewNormal = getViewNormal( centerViewPosition, vUv, centerDepth );\n\t\t\t\tvec2 noiseScale = vec2( size.x / 4.0, size.y / 4.0 );\n\t\t\t\tvec3 random = vec3( texture2D( tNoise, vUv * noiseScale ).r );\n\t\t\t\t// compute matrix used to reorient a kernel vector\n\t\t\t\tvec3 tangent = normalize( random - viewNormal * dot( random, viewNormal ) );\n\t\t\t\tvec3 bitangent = cross( viewNormal, tangent );\n\t\t\t\tmat3 kernelMatrix = mat3( tangent, bitangent, viewNormal );\n\t\t\t\tfloat occlusion = 0.0;\n\t\t\t\tfloat kernelSize_ws = computeKernelSize(-viewPosition.z, kernelRadius);\n\t\t\t\tfloat div = float( KERNEL_SIZE);\n\t\t\t\tfloat maxDist = kernelSize_ws / (cameraFar - cameraNear);\n\t\t\t\tfor ( int i = 0; i < KERNEL_SIZE; i ++ ) {\n\t\t\t\t\tvec3 sampleVector = kernelMatrix * kernel[ i ]; // reorient sample vector in view space\n\t\t\t\t\tvec3 samplePoint = viewPosition + ( sampleVector * kernelSize_ws ); // calculate sample point\n\t\t\t\t\tvec4 samplePointNDC = cameraProjectionMatrix * vec4( samplePoint, 1.0 ); // project point and calculate NDC\n\t\t\t\t\tsamplePointNDC /= samplePointNDC.w;\n\t\t\t\t\tvec2 samplePointUv = samplePointNDC.xy * 0.5 + 0.5; // compute uv coordinates\n\t\t\t\t\tfloat realDepth = getLinearDepth( samplePointUv ); // get linear depth from depth texture\n\t\t\t\t\tfloat sampleDepth = viewZToOrthographicDepth( samplePoint.z + bias, cameraNear, cameraFar ); // compute linear depth of the sample view Z value\n\t\t\t\t\tfloat delta = sampleDepth - realDepth;\n\t\t\t\t\tif ( delta > 0. && delta < maxDist ) { // if fragment is before sample point, increase occlusion\n\t\t\t\t\t\tocclusion += 1.0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn clamp( occlusion * intensity / div, 0.0, 1.0 );\n\t\t\t#endif\n\t\t\t}\n\t\tvoid main() {\n\t\t\tfloat linearDepth = unpackRGBAToDepth( texture2D( tDepth, vUv ) );\n\t\t\tfloat centerDepth = getPerspectiveDepth(vUv);\n\t\t\tif( centerDepth >= ( 1.0 - EPSILON ) ) {\n\t\t\t\tdiscard;\n\t\t\t}\n\t\t\tfloat centerViewZ = getViewDepth(linearDepth);\n\t\t\tvec3 viewPosition = getViewPosition( vUv, centerDepth, centerViewZ );\n\t\t\tvec3 viewNormal = getViewNormal(viewPosition, vUv, linearDepth);\n\t\t\tfloat ambientOcclusion = getAmbientOcclusion( viewPosition, centerDepth );\n\t\t\tgl_FragColor = getDefaultColor( vUv );\n\t\t\tgl_FragColor.xyz *= ambientOcclusion;\n\t\t\tgl_FragColor.a = 1.;\n\t\t}";
@@ -0,0 +1 @@
1
+ export declare const kingsyStaticAoGenerateVert = "\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}";
@@ -0,0 +1 @@
1
+ export declare const kingsyTemporalSupersamplingFrag = "\n uniform float height;\n uniform float width;\n uniform sampler2D tDiffuse;\n uniform sampler2D tLastFrame;\n varying vec2 Uv;\n\n #define LuminanceEncodeApprox vec3(0.2126, 0.7152, 0.0722)\n float getLuminance(vec3 color) {\n return clamp(dot(color, LuminanceEncodeApprox), 0., 1.);\n }\n \n void main() {\n vec4 texel = texture2D(tDiffuse, Uv);\n vec2 oldPixelUv = Uv;\n vec4 oldTexel = texture2D(tLastFrame, oldPixelUv);\n\n // Use simple neighbor clamping\n vec4 maxNeighbor = vec4(0.0, 0.0, 0.0, 1.0);\n vec4 minNeighbor = vec4(1.0);\n vec4 average = vec4(0.0);\n for (int x = -1; x <= 1; x++) {\n for (int y = -1; y <= 1; y++) {\n vec2 neighborUv = Uv + vec2(float(x) / width, float(y) / height);\n vec4 neighborTexel = texture2D(tDiffuse, neighborUv);\n maxNeighbor = max(maxNeighbor, neighborTexel);\n minNeighbor = min(minNeighbor, neighborTexel);\n average += neighborTexel / 9.0;\n }\n }\n float lum0 = getLuminance(texel.rgb);\n float lum1 = getLuminance(oldTexel.rgb);\n\n float unbiased_diff = abs(lum0 - lum1) / max(lum0, max(lum1, 0.2));\n float unbiased_weight = 1.0 - unbiased_diff;\n float unbiased_weight_sqr = unbiased_weight * unbiased_weight;\n float k_feedback = mix(0.8800, 0.9700, unbiased_weight_sqr);\n \n // UE Method to get rid of flickering. Weight frame mixing amount\n // based on local contrast.\n float contrast = distance(average, texel);\n float weight = 0.05 * contrast;\n\n float blendFactor = mix(1. - weight, k_feedback, 1.);\n vec4 compositeColor = mix(texel, oldTexel, blendFactor);\n \n gl_FragColor = compositeColor;\n }";
@@ -0,0 +1 @@
1
+ export declare const kingsyTemporalSupersamplingVert = "\n varying vec2 Uv;\n \n void main() {\n Uv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }";
@@ -0,0 +1 @@
1
+ export declare const kingsyTextFrag = "\nuniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t// accumulation (baked indirect lighting only)\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t// modulation\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n";
@@ -0,0 +1 @@
1
+ export declare const kingsyTextVert = "\n#include <common>\n#ifdef USE_RTE\n // The high component is stored as the default 'position' attribute buffer\n attribute vec3 position_low;\n uniform vec3 uViewer_high;\n uniform vec3 uViewer_low;\n#endif\n\n#ifdef TRANSFORM_STORAGE\n attribute float objIndex;\n\n #if TRANSFORM_STORAGE == 0\n #if __VERSION__ == 300\n #define TRANSFORM_STRIDE 4\n #else\n #define TRANSFORM_STRIDE 4.\n #endif\n uniform sampler2D tTransforms;\n uniform float objCount;\n #elif TRANSFORM_STORAGE == 1\n uniform mat4 uTransforms[OBJ_COUNT];\n #endif\n#endif\n\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\n#ifdef USE_RTE\n highp vec4 computeRelativePosition(in highp vec3 position_low, in highp vec3 position_high, in highp vec3 relativeTo_low, in highp vec3 relativeTo_high){\n /* \n Source https://github.com/virtualglobebook/OpenGlobe/blob/master/Source/Examples/Chapter05/Jitter/GPURelativeToEyeDSFUN90/Shaders/VS.glsl \n Note here, we're storing the high part of the position encoding inside three's default 'position' attribute buffer so we avoid redundancy \n */\n highp vec3 t1 = position_low.xyz - relativeTo_low.xyz;\n highp vec3 e = t1 - position_low.xyz;\n /** This is redunant, but necessary as a workaround for Apple platforms */\n highp float x = position_high.x - relativeTo_high.x;\n highp float y = position_high.y - relativeTo_high.y;\n highp float z = position_high.z - relativeTo_high.z;\n highp vec3 v = vec3(x, y, z);\n /** End of redundant part */\n highp vec3 t2 = ((-relativeTo_low - e) + (position_low.xyz - (t1 - e))) + v;\n highp vec3 highDifference = t1 + t2;\n highp vec3 lowDifference = t2 - (highDifference.xyz - t1.xyz);\n \n highp vec3 position = highDifference.xyz + lowDifference.xyz;\n return vec4(position, 1.);\n }\n#endif\n\n#ifdef TRANSFORM_STORAGE\n void objectTransform(out vec4 quaternion, out vec4 pivotLow, out vec4 pivotHigh, out vec4 translation, out vec4 scale){\n #if TRANSFORM_STORAGE == 0\n #if __VERSION__ == 300\n ivec2 uv = ivec2(int(objIndex) * TRANSFORM_STRIDE, 0); \n vec4 v0 = texelFetch( tTransforms, uv, 0 );\n vec4 v1 = texelFetch( tTransforms, uv + ivec2(1, 0), 0);\n vec4 v2 = texelFetch( tTransforms, uv + ivec2(2, 0), 0);\n vec4 v3 = texelFetch( tTransforms, uv + ivec2(3, 0), 0);\n quaternion = v0;\n pivotLow = vec4(v1.xyz, 1.);\n pivotHigh = vec4(v2.xyz, 1.);\n translation = vec4(v3.xyz, 1.);\n scale = vec4(v1.w, v2.w, v3.w, 1.);\n #else\n float size = objCount * TRANSFORM_STRIDE;\n vec2 cUv = vec2(0.5/size, 0.5);\n vec2 dUv = vec2(1./size, 0.);\n \n vec2 uv = vec2((objIndex * TRANSFORM_STRIDE)/size + cUv.x, cUv.y);\n vec4 v0 = texture2D( tTransforms, uv);\n vec4 v1 = texture2D( tTransforms, uv + dUv);\n vec4 v2 = texture2D( tTransforms, uv + 2. * dUv);\n vec4 v3 = texture2D( tTransforms, uv + 3. * dUv);\n quaternion = v0;\n pivotLow = vec4(v1.xyz, 1.);\n pivotHigh = vec4(v2.xyz, 1.);\n translation = vec4(v3.xyz, 1.);\n scale = vec4(v1.w, v2.w, v3.w, 1.);\n #endif\n #elif TRANSFORM_STORAGE == 1\n mat4 tMatrix = uTransforms[int(objIndex)];\n quaternion = tMatrix[0];\n pivotLow = vec4(tMatrix[1].xyz, 1.);\n pivotHigh = vec4(tMatrix[2].xyz, 1.);\n translation = vec4(tMatrix[3].xyz, 1.);\n scale = vec4(tMatrix[1][3], tMatrix[2][3], tMatrix[3][3], 1.);\n #endif\n }\n\n vec3 rotate_vertex_position(vec3 position, vec4 quat)\n { \n return position + 2.0 * cross(quat.xyz, cross(quat.xyz, position) + quat.w * position);\n }\n\n /** Another workaround for Apple's stupid compiler */\n vec4 safeMul(vec4 a, vec4 b) {\n // Prevents constant folding and optimization\n return (a + vec4(0.0)) * (b + vec4(1.0)) - a * vec4(1.0);\n }\n\n highp vec3 rotate_scaled_vertex_position_delta(highp vec4 v0, highp vec4 v1, highp vec4 scale, highp vec4 quat)\n {\n /** !!! WORKAROUND FOR Intel IrisXe CARDS !!! */\n /** The code below will not produce correct results in intel IrisXE integrated GPUs. \n * The geometry will turn mangled, albeit stable\n * I can't know for sure what is going on, but rotating the difference seems to \n * force the result into a lower precision?\n */\n // highp vec4 position = v0 - v1;\n // return position.xyz + 2.0 * cross(quat.xyz, cross(quat.xyz, position.xyz) + quat.w * position.xyz);\n\n /** Subtracting the rotated vectors works. */\n return rotate_vertex_position(safeMul(v0, scale).xyz, quat) - rotate_vertex_position(safeMul(v1, scale).xyz, quat) ;\n\n /** An alternate workaround is\n * highp vec3 position = (v0.xyz * (1. + 1e-7)) - (v1.xyz * (1. + 1e-7));\n return position + 2.0 * cross(quat.xyz, cross(quat.xyz, position) + quat.w * position);\n\n However I'm not such a fan of the (1. + 1e-7) part\n */\n }\n\n#endif\n\n#if defined(BILLBOARD) || defined(BILLBOARD_FIXED)\n uniform vec3 billboardPos;\n uniform mat4 invProjection;\n#endif\n#ifdef BILLBOARD_FIXED\n uniform vec2 billboardSize;\n#endif\n\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t// #include <project_vertex> COMMENTED CHUNK\n #ifdef TRANSFORM_STORAGE\n vec4 tQuaternion, tPivotLow, tPivotHigh, tTranslation, tScale;\n objectTransform(tQuaternion, tPivotLow, tPivotHigh, tTranslation, tScale);\n #endif\n #ifdef USE_RTE\n vec4 position_lowT = vec4(position_low, 1.);\n vec4 position_highT = vec4(position, 1.);\n const vec3 ZERO3 = vec3(0., 0., 0.);\n\n highp vec4 rteLocalPosition = computeRelativePosition(position_lowT.xyz, position_highT.xyz, uViewer_low, uViewer_high);\n #ifdef TRANSFORM_STORAGE\n highp vec4 rtePivot = computeRelativePosition(tPivotLow.xyz, tPivotHigh.xyz, uViewer_low, uViewer_high);\n rteLocalPosition.xyz = rotate_scaled_vertex_position_delta(rteLocalPosition, rtePivot, tScale, tQuaternion) + rtePivot.xyz + tTranslation.xyz;\n #endif\n #ifdef USE_INSTANCING\n vec4 instancePivot = computeRelativePosition(ZERO3, ZERO3, uViewer_low, uViewer_high);\n rteLocalPosition.xyz = (mat3(instanceMatrix) * (rteLocalPosition - instancePivot).xyz) + instancePivot.xyz + instanceMatrix[3].xyz;\n #endif\n #endif\n\n #ifdef USE_RTE\n vec4 mvPosition = rteLocalPosition;\n #else\n vec4 mvPosition = vec4( transformed, 1.0 );\n #ifdef TRANSFORM_STORAGE\n mvPosition.xyz = rotate_scaled_vertex_position_delta(mvPosition, tPivotHigh, tScale, tQuaternion) + tPivotHigh.xyz + tTranslation.xyz;\n #endif\n #ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n #endif\n #endif\n \n mvPosition = modelViewMatrix * mvPosition;\n \n #if defined(BILLBOARD)\n float div = 1.;\n gl_Position = projectionMatrix * (viewMatrix * vec4(billboardPos, 1.0) + vec4(position.x, position.y, 0., 0.0));\n #elif defined(BILLBOARD_FIXED)\n gl_Position = projectionMatrix * (viewMatrix * vec4(billboardPos, 1.0));\n float div = gl_Position.w;\n gl_Position /= gl_Position.w;\n gl_Position.xy += position.xy * billboardSize;\n #else\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.);\n #endif\n\t#include <logdepthbuf_vertex>\n\t// #include <clipping_planes_vertex> COMMENTED CHUNK\n #if NUM_CLIPPING_PLANES > 0\n #if defined(BILLBOARD) || defined(BILLBOARD_FIXED)\n vec4 movelViewProjection = gl_Position * div;\n vClipPosition = - (invProjection * movelViewProjection).xyz;\n #else\n\t vClipPosition = - mvPosition.xyz;\n #endif\n #endif\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}\n";
@@ -0,0 +1 @@
1
+ export declare const kingsyViewportFrag = "\nuniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nuniform float minIntensity;\nvarying vec3 vViewPosition;\n\n#ifdef MATCAP_TEXTURE\n\tuniform sampler2D tMatcap;\n#endif\n\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t// accumulation (baked indirect lighting only)\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t// modulation\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t// #include <output_fragment> COMMENTED CHUNK\n\t#ifdef OPAQUE\n\t\tdiffuseColor.a = 1.0;\n\t#endif\n\n\t// https://github.com/mrdoob/three.js/pull/22425\n\t#ifdef USE_TRANSMISSION\n\t\tdiffuseColor.a *= transmissionAlpha + 0.1;\n\t#endif\n\n\tvec3 normal = normalize( vNormal );\n\tvec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\n\tvec3 color = vec3(1.0);\n\t#ifdef MATCAP_TEXTURE\n\t\tcolor = texture2D(tMatcap, uv).rgb;\n\t#else\n\t\tcolor = vec3( mix( minIntensity, 1., uv.y ) );\n\t#endif\n\n\tgl_FragColor = vec4( color.rgb, diffuseColor.a);\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n";
@@ -0,0 +1 @@
1
+ export declare const kingsyViewportVert = "\n#define USE_ENVMAP\n#include <common>\n#ifdef USE_RTE\n // The high component is stored as the default 'position' attribute buffer\n attribute vec3 position_low;\n uniform vec3 uViewer_high;\n uniform vec3 uViewer_low;\n#endif\n\n#ifdef TRANSFORM_STORAGE\n attribute float objIndex;\n\n #if TRANSFORM_STORAGE == 0\n #if __VERSION__ == 300\n #define TRANSFORM_STRIDE 4\n #else\n #define TRANSFORM_STRIDE 4.\n #endif\n uniform sampler2D tTransforms;\n uniform float objCount;\n #elif TRANSFORM_STORAGE == 1\n uniform mat4 uTransforms[OBJ_COUNT];\n #endif\n#endif\nvarying vec3 vNormal;\nvarying vec3 vViewPosition;\n\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\n#ifdef USE_RTE\n highp vec4 computeRelativePosition(in highp vec3 position_low, in highp vec3 position_high, in highp vec3 relativeTo_low, in highp vec3 relativeTo_high){\n /* \n Source https://github.com/virtualglobebook/OpenGlobe/blob/master/Source/Examples/Chapter05/Jitter/GPURelativeToEyeDSFUN90/Shaders/VS.glsl \n Note here, we're storing the high part of the position encoding inside three's default 'position' attribute buffer so we avoid redundancy \n */\n highp vec3 t1 = position_low.xyz - relativeTo_low.xyz;\n highp vec3 e = t1 - position_low.xyz;\n /** This is redunant, but necessary as a workaround for Apple platforms */\n highp float x = position_high.x - relativeTo_high.x;\n highp float y = position_high.y - relativeTo_high.y;\n highp float z = position_high.z - relativeTo_high.z;\n highp vec3 v = vec3(x, y, z);\n /** End of redundant part */\n highp vec3 t2 = ((-relativeTo_low - e) + (position_low.xyz - (t1 - e))) + v;\n highp vec3 highDifference = t1 + t2;\n highp vec3 lowDifference = t2 - (highDifference.xyz - t1.xyz);\n \n highp vec3 position = highDifference.xyz + lowDifference.xyz;\n return vec4(position, 1.);\n }\n#endif\n\n#ifdef TRANSFORM_STORAGE\n void objectTransform(out vec4 quaternion, out vec4 pivotLow, out vec4 pivotHigh, out vec4 translation, out vec4 scale){\n #if TRANSFORM_STORAGE == 0\n #if __VERSION__ == 300\n ivec2 uv = ivec2(int(objIndex) * TRANSFORM_STRIDE, 0); \n vec4 v0 = texelFetch( tTransforms, uv, 0 );\n vec4 v1 = texelFetch( tTransforms, uv + ivec2(1, 0), 0);\n vec4 v2 = texelFetch( tTransforms, uv + ivec2(2, 0), 0);\n vec4 v3 = texelFetch( tTransforms, uv + ivec2(3, 0), 0);\n quaternion = v0;\n pivotLow = vec4(v1.xyz, 1.);\n pivotHigh = vec4(v2.xyz, 1.);\n translation = vec4(v3.xyz, 1.);\n scale = vec4(v1.w, v2.w, v3.w, 1.);\n #else\n float size = objCount * TRANSFORM_STRIDE;\n vec2 cUv = vec2(0.5/size, 0.5);\n vec2 dUv = vec2(1./size, 0.);\n \n vec2 uv = vec2((objIndex * TRANSFORM_STRIDE)/size + cUv.x, cUv.y);\n vec4 v0 = texture2D( tTransforms, uv);\n vec4 v1 = texture2D( tTransforms, uv + dUv);\n vec4 v2 = texture2D( tTransforms, uv + 2. * dUv);\n vec4 v3 = texture2D( tTransforms, uv + 3. * dUv);\n quaternion = v0;\n pivotLow = vec4(v1.xyz, 1.);\n pivotHigh = vec4(v2.xyz, 1.);\n translation = vec4(v3.xyz, 1.);\n scale = vec4(v1.w, v2.w, v3.w, 1.);\n #endif\n #elif TRANSFORM_STORAGE == 1\n mat4 tMatrix = uTransforms[int(objIndex)];\n quaternion = tMatrix[0];\n pivotLow = vec4(tMatrix[1].xyz, 1.);\n pivotHigh = vec4(tMatrix[2].xyz, 1.);\n translation = vec4(tMatrix[3].xyz, 1.);\n scale = vec4(tMatrix[1][3], tMatrix[2][3], tMatrix[3][3], 1.);\n #endif\n }\n\n vec3 rotate_vertex_position(vec3 position, vec4 quat)\n { \n return position + 2.0 * cross(quat.xyz, cross(quat.xyz, position) + quat.w * position);\n }\n\n /** Another workaround for Apple's stupid compiler */\n vec4 safeMul(vec4 a, vec4 b) {\n // Prevents constant folding and optimization\n return (a + vec4(0.0)) * (b + vec4(1.0)) - a * vec4(1.0);\n }\n\n highp vec3 rotate_scaled_vertex_position_delta(highp vec4 v0, highp vec4 v1, highp vec4 scale, highp vec4 quat)\n {\n /** !!! WORKAROUND FOR Intel IrisXe CARDS !!! */\n /** The code below will not produce correct results in intel IrisXE integrated GPUs. \n * The geometry will turn mangled, albeit stable\n * I can't know for sure what is going on, but rotating the difference seems to \n * force the result into a lower precision?\n */\n // highp vec4 position = v0 - v1;\n // return position.xyz + 2.0 * cross(quat.xyz, cross(quat.xyz, position.xyz) + quat.w * position.xyz);\n\n /** Subtracting the rotated vectors works. */\n return rotate_vertex_position(safeMul(v0, scale).xyz, quat) - rotate_vertex_position(safeMul(v1, scale).xyz, quat) ;\n\n /** An alternate workaround is\n * highp vec3 position = (v0.xyz * (1. + 1e-7)) - (v1.xyz * (1. + 1e-7));\n return position + 2.0 * cross(quat.xyz, cross(quat.xyz, position) + quat.w * position);\n\n However I'm not such a fan of the (1. + 1e-7) part\n */\n }\n\n#endif\n\n#if defined(BILLBOARD) || defined(BILLBOARD_FIXED)\n uniform vec3 billboardPos;\n uniform mat4 invProjection;\n#endif\n#ifdef BILLBOARD_FIXED\n uniform vec2 billboardSize;\n#endif\nvarying float dotValue;\n\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t// #include <project_vertex> COMMENTED CHUNK\n #ifdef TRANSFORM_STORAGE\n vec4 tQuaternion, tPivotLow, tPivotHigh, tTranslation, tScale;\n objectTransform(tQuaternion, tPivotLow, tPivotHigh, tTranslation, tScale);\n #endif\n #ifdef USE_RTE\n vec4 position_lowT = vec4(position_low, 1.);\n vec4 position_highT = vec4(position, 1.);\n const vec3 ZERO3 = vec3(0., 0., 0.);\n\n highp vec4 rteLocalPosition = computeRelativePosition(position_lowT.xyz, position_highT.xyz, uViewer_low, uViewer_high);\n #ifdef TRANSFORM_STORAGE\n highp vec4 rtePivot = computeRelativePosition(tPivotLow.xyz, tPivotHigh.xyz, uViewer_low, uViewer_high);\n rteLocalPosition.xyz = rotate_scaled_vertex_position_delta(rteLocalPosition, rtePivot, tScale, tQuaternion) + rtePivot.xyz + tTranslation.xyz;\n #endif\n #ifdef USE_INSTANCING\n vec4 instancePivot = computeRelativePosition(ZERO3, ZERO3, uViewer_low, uViewer_high);\n rteLocalPosition.xyz = (mat3(instanceMatrix) * (rteLocalPosition - instancePivot).xyz) + instancePivot.xyz + instanceMatrix[3].xyz;\n #endif\n #endif\n\n #ifdef USE_RTE\n vec4 mvPosition = rteLocalPosition;\n #else\n vec4 mvPosition = vec4( transformed, 1.0 );\n #ifdef TRANSFORM_STORAGE\n mvPosition.xyz = rotate_scaled_vertex_position_delta(mvPosition, tPivotHigh, tScale, tQuaternion) + tPivotHigh.xyz + tTranslation.xyz;\n #endif\n #ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n #endif\n #endif\n \n mvPosition = modelViewMatrix * mvPosition;\n\n vNormal = normalize( transformedNormal );\n vViewPosition = -mvPosition.xyz;\n\n #if defined(BILLBOARD)\n float div = 1.;\n gl_Position = projectionMatrix * (viewMatrix * vec4(billboardPos, 1.0) + vec4(position.x, position.y, 0., 0.0));\n #elif defined(BILLBOARD_FIXED)\n gl_Position = projectionMatrix * (viewMatrix * vec4(billboardPos, 1.0));\n float div = gl_Position.w;\n gl_Position /= gl_Position.w;\n gl_Position.xy += position.xy * billboardSize;\n #else\n gl_Position = projectionMatrix * mvPosition;\n #endif\n\n\n\t#include <logdepthbuf_vertex>\n\t// #include <clipping_planes_vertex> COMMENTED CHUNK\n #if NUM_CLIPPING_PLANES > 0\n #if defined(BILLBOARD) || defined(BILLBOARD_FIXED)\n vec4 movelViewProjection = gl_Position * div;\n vClipPosition = - (invProjection * movelViewProjection).xyz;\n #else\n\t vClipPosition = - mvPosition.xyz;\n #endif\n #endif\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}\n";
@@ -0,0 +1,72 @@
1
+ import { Box3, BufferGeometry, Material, Matrix4, Ray, Side, Vector3 } from 'three';
2
+ import { ExtendedTriangle, MeshBVH, ShapecastIntersection, SplitStrategy } from 'three-mesh-bvh';
3
+ import { MeshIntersection } from './KingSyRaycaster.js';
4
+ declare const SKIP_GENERATION: unique symbol;
5
+ export interface BVHOptions {
6
+ strategy: SplitStrategy;
7
+ maxDepth: number;
8
+ maxLeafTris: number;
9
+ verbose: boolean;
10
+ useSharedArrayBuffer: boolean;
11
+ setBoundingBox: boolean;
12
+ onProgress?: () => void;
13
+ [SKIP_GENERATION]: boolean;
14
+ }
15
+ export declare const DefaultBVHOptions: {
16
+ strategy: SplitStrategy;
17
+ maxDepth: number;
18
+ maxLeafTris: number;
19
+ verbose: boolean;
20
+ useSharedArrayBuffer: boolean;
21
+ setBoundingBox: boolean;
22
+ [SKIP_GENERATION]: boolean;
23
+ };
24
+ /**
25
+ *
26
+ _____ _ _
27
+ |_ _| | | | |
28
+ | | _ __ ___ _ __ ___ _ __| |_ __ _ _ __ | |_
29
+ | | | '_ ` _ \| '_ \ / _ \| '__| __/ _` | '_ \| __|
30
+ _| |_| | | | | | |_) | (_) | | | || (_| | | | | |_
31
+ |_____|_| |_| |_| .__/ \___/|_| \__\__,_|_| |_|\__|
32
+ | |
33
+ |_|
34
+
35
+ We've made this wrapper around the original implementation to hide the transformations we do behind the scenes
36
+ in order to avoid storing vertex positions as Float64. Instead we store them as Float32, but the whole BVH is
37
+ re-centered around the mesh local origin as (0,0,0). We use the resulting transformations to transform anything that comes
38
+ in or out of the BVH in order to keep this re-centering opaque.
39
+
40
+ We've implemented auto-transformation for raycasting and shapecasting. Other functionalities like bvhcast or geometrycast
41
+ will need to be wrapped around if required.
42
+
43
+ Otherwise, keep in mind that if you use this class for any other purposes, you can use transformInput and transformOutput
44
+ to get the correct values for Vectors, Rays, Boxes, etc
45
+ */
46
+ export declare class AccelerationStructure {
47
+ private static readonly MatBuff;
48
+ private _bvh;
49
+ inputTransform: Matrix4;
50
+ outputTransform: Matrix4;
51
+ inputOriginTransform: Matrix4;
52
+ outputOriginTransfom: Matrix4;
53
+ get geometry(): BufferGeometry;
54
+ get bvh(): MeshBVH;
55
+ static buildBVH(indices: number[] | undefined, position: number[] | undefined, options?: BVHOptions, transform?: Matrix4): MeshBVH;
56
+ constructor(bvh: MeshBVH);
57
+ raycast(ray: Ray, materialOrSide?: Side | Material | Material[]): MeshIntersection[];
58
+ raycastFirst(ray: Ray, materialOrSide?: Side | Material | Material[]): MeshIntersection;
59
+ shapecast(callbacks: {
60
+ intersectsBounds: (box: Box3, isLeaf: boolean, score: number | undefined, depth: number, nodeIndex: number) => ShapecastIntersection | boolean;
61
+ traverseBoundsOrder?: (box: Box3) => number;
62
+ } & ({
63
+ intersectsRange: (triangleOffset: number, triangleCount: number, contained: boolean, depth: number, nodeIndex: number, box: Box3) => boolean;
64
+ } | {
65
+ intersectsTriangle: (triangle: ExtendedTriangle, triangleIndex: number, contained: boolean, depth: number) => boolean | void;
66
+ })): boolean;
67
+ transformInput<T extends Vector3 | Ray | Box3>(input: T): T;
68
+ transformOutput<T extends Vector3 | Ray | Box3>(output: T): T;
69
+ getBoundingBox(target?: Box3): Box3;
70
+ getVertexAtIndex(index: number): Vector3;
71
+ }
72
+ export {};
@@ -0,0 +1,6 @@
1
+ import { BufferGeometry, InstancedMesh, Material } from 'three';
2
+ export declare class ExtendedInstancedMesh extends InstancedMesh<BufferGeometry, Material | Material[]> {
3
+ private _batchIndex;
4
+ constructor(geometry: BufferGeometry | undefined, material: Material | Material[] | undefined, count: number, batchIndex: number);
5
+ get batchIndex(): number;
6
+ }
@@ -0,0 +1,10 @@
1
+ import { Material, OrthographicCamera, WebGLRenderer } from 'three';
2
+ export declare class JitterQuad {
3
+ private _camera;
4
+ private mesh;
5
+ get camera(): OrthographicCamera;
6
+ get material(): Material | Material[];
7
+ set material(value: Material | Material[]);
8
+ constructor(material?: Material);
9
+ render(renderer: WebGLRenderer): void;
10
+ }
@@ -0,0 +1,31 @@
1
+ import { Box3, OrthographicCamera, PerspectiveCamera } from 'three';
2
+ export declare enum CameraEvent {
3
+ Stationary = "stationary",
4
+ Dynamic = "dynamic",
5
+ FrameUpdate = "frame-update",
6
+ LateFrameUpdate = "late-frame-update",
7
+ ProjectionChanged = "projection-changed",
8
+ InteractionStarted = "interaction-started",
9
+ InteractionEnded = "interaction-ended"
10
+ }
11
+ export interface CameraEventPayload {
12
+ [CameraEvent.Stationary]: void;
13
+ [CameraEvent.Dynamic]: void;
14
+ [CameraEvent.FrameUpdate]: boolean;
15
+ [CameraEvent.LateFrameUpdate]: boolean;
16
+ [CameraEvent.ProjectionChanged]: CameraProjection;
17
+ [CameraEvent.InteractionStarted]: void;
18
+ [CameraEvent.InteractionEnded]: void;
19
+ }
20
+ export interface KingSyCamera {
21
+ get renderingCamera(): PerspectiveCamera | OrthographicCamera;
22
+ get fieldOfView(): number;
23
+ set fieldOfView(value: number);
24
+ get aspect(): number;
25
+ on<T extends CameraEvent>(eventType: T, listener: (arg: CameraEventPayload[T]) => void): void;
26
+ updateCameraPlanes(targetVolume?: Box3, offsetScale?: number): void;
27
+ }
28
+ export declare enum CameraProjection {
29
+ PERSPECTIVE = 0,
30
+ ORTHOGRAPHIC = 1
31
+ }
@@ -0,0 +1,44 @@
1
+ import { BufferGeometry, Group, Material, type Intersection } from 'three';
2
+ import { BatchObject } from '../batching/BatchObject.js';
3
+ import { TopLevelAccelerationStructure } from './TopLevelAccelerationStructure.js';
4
+ import { type DrawGroup } from '../batching/Batch.js';
5
+ import { KingSyRaycaster } from './KingSyRaycaster.js';
6
+ export default class KingSyInstancedMesh extends Group {
7
+ static MeshBatchNumber: number;
8
+ private tas;
9
+ private batchMaterial;
10
+ private materialCache;
11
+ private materialStack;
12
+ private batchMaterialStack;
13
+ private materialCacheLUT;
14
+ private _batchObjects;
15
+ private _needsRTE;
16
+ groups: Array<DrawGroup>;
17
+ materials: Material[];
18
+ private instanceGeometry;
19
+ private instances;
20
+ get TAS(): TopLevelAccelerationStructure;
21
+ get batchObjects(): BatchObject[];
22
+ get needsRTE(): boolean;
23
+ constructor(geometry: BufferGeometry, RTE?: boolean);
24
+ setBatchMaterial(material: Material): void;
25
+ setBatchObjects(batchObjects: BatchObject[]): void;
26
+ setOverrideMaterial(material: Material): void;
27
+ setOverrideBatchMaterial(material: Material): void;
28
+ restoreBatchMaterial(): void;
29
+ private lookupMaterial;
30
+ getCachedMaterial(material: Material, copy?: boolean): Material;
31
+ restoreMaterial(): void;
32
+ buildTAS(): void;
33
+ updateDrawGroups(transformBuffer: Float32Array, gradientBuffer: Float32Array, objectIndexBuffer?: Float32Array): void;
34
+ updateTransformsUniform(): void;
35
+ updateMaterialTransformsUniform(material: Material): void;
36
+ getBatchObjectMaterial(batchObject: BatchObject): Material | null;
37
+ /** Three's 'clone' and 'copy' from geometry and buffer attributes
38
+ * create duplicates of arrays and we don't want that. Most of the
39
+ * buffer attributes need to be shared to avoid redundancy
40
+ */
41
+ private getInstanceGeometryShallowCopy;
42
+ private convertRaycastIntersect;
43
+ raycast(raycaster: KingSyRaycaster, intersects: Array<Intersection>): void;
44
+ }
@@ -0,0 +1,43 @@
1
+ import { BufferGeometry, DataTexture, Material, Matrix4, Mesh, type Intersection } from 'three';
2
+ import { BatchObject } from '../batching/BatchObject.js';
3
+ import { TopLevelAccelerationStructure } from './TopLevelAccelerationStructure.js';
4
+ import { KingSyRaycaster } from './KingSyRaycaster.js';
5
+ export declare enum TransformStorage {
6
+ VERTEX_TEXTURE = 0,
7
+ UNIFORM_ARRAY = 1
8
+ }
9
+ export default class KingSyMesh extends Mesh {
10
+ static MeshBatchNumber: number;
11
+ private tas;
12
+ private batchMaterial;
13
+ private materialCache;
14
+ private materialStack;
15
+ private batchMaterialStack;
16
+ private materialCacheLUT;
17
+ private _batchObjects;
18
+ private _batchIndex;
19
+ private _needsRTE;
20
+ private transformsBuffer;
21
+ private transformStorage;
22
+ transformsTextureUniform: DataTexture;
23
+ transformsArrayUniforms: Matrix4[] | null;
24
+ get TAS(): TopLevelAccelerationStructure;
25
+ get batchObjects(): BatchObject[];
26
+ get batchIndex(): number;
27
+ get needsRTE(): boolean;
28
+ constructor(geometry: BufferGeometry, RTE?: boolean);
29
+ setBatchMaterial(material: Material): void;
30
+ setBatchObjects(batchObjects: BatchObject[], transformStorage: TransformStorage): void;
31
+ setOverrideMaterial(material: Material): void;
32
+ setOverrideBatchMaterial(material: Material): void;
33
+ restoreBatchMaterial(): void;
34
+ private lookupMaterial;
35
+ getCachedMaterial(material: Material, copy?: boolean): Material;
36
+ restoreMaterial(): void;
37
+ updateMaterialTransformsUniform(material: Material): void;
38
+ updateTransformsUniform(): void;
39
+ buildTAS(): void;
40
+ getBatchObjectMaterial(batchObject: BatchObject): Material | null;
41
+ private convertRaycastIntersect;
42
+ raycast(raycaster: KingSyRaycaster, intersects: Array<Intersection>): void;
43
+ }
@@ -0,0 +1,42 @@
1
+ import { Box3, type Intersection, Object3D, Raycaster, Vector3, RaycasterParameters, Face } from 'three';
2
+ import { ExtendedTriangle, ShapecastIntersection } from 'three-mesh-bvh';
3
+ import { BatchObject } from '../batching/BatchObject.js';
4
+ import KingSyMesh from './KingSyMesh.js';
5
+ import KingSyInstancedMesh from './KingSyInstancedMesh.js';
6
+ export declare const NOT_INTERSECTED: ShapecastIntersection;
7
+ export declare const INTERSECTED: ShapecastIntersection;
8
+ export declare const CONTAINED: ShapecastIntersection;
9
+ export type ExtendedShapeCastCallbacks = {
10
+ intersectsTAS?: (box: Box3, isLeaf: boolean, score: number | undefined, depth: number, nodeIndex: number) => ShapecastIntersection | boolean;
11
+ intersectTASRange?: (batchObjects: BatchObject) => ShapecastIntersection | boolean;
12
+ intersectsBounds: (box: Box3, isLeaf: boolean, score: number | undefined, depth: number, nodeIndex: number) => ShapecastIntersection | boolean;
13
+ traverseBoundsOrder?: (box: Box3) => number;
14
+ } & ({
15
+ intersectsRange: (triangleOffset: number, triangleCount: number, contained: boolean, depth: number, nodeIndex: number, box: Box3) => boolean;
16
+ } | {
17
+ intersectsTriangle: (triangle: ExtendedTriangle, triangleIndex: number, contained: boolean, depth: number, batchObject?: BatchObject) => boolean | void;
18
+ });
19
+ export interface ExtendedIntersection extends Intersection {
20
+ batchObject?: BatchObject;
21
+ pointOnLine?: Vector3;
22
+ }
23
+ export interface MeshIntersection extends Intersection {
24
+ face: Face;
25
+ faceIndex: number;
26
+ }
27
+ export interface ExtendedMeshIntersection extends MeshIntersection {
28
+ batchObject: BatchObject;
29
+ object: KingSyMesh | KingSyInstancedMesh;
30
+ }
31
+ export interface ExtendedRaycasterParameters extends RaycasterParameters {
32
+ Line2: {
33
+ threshold: number;
34
+ };
35
+ }
36
+ export declare class KingSyRaycaster extends Raycaster {
37
+ intersectTASOnly: boolean;
38
+ onObjectIntersectionTest: ((object: Object3D) => void) | null;
39
+ params: ExtendedRaycasterParameters;
40
+ constructor(origin?: Vector3, direction?: Vector3, near?: number, far?: number);
41
+ intersectObjects(objects: Array<Object3D>, recursive?: boolean, intersects?: never[]): never[];
42
+ }
@@ -0,0 +1,39 @@
1
+ import { BufferGeometry, Color, Mesh, Quaternion, Raycaster, Vector3, type Intersection } from 'three';
2
+ import { ObjectLayers, type KingSyObject } from '../../IViewer.js';
3
+ export interface KingSyTextParams {
4
+ textValue?: string;
5
+ richTextValue?: string;
6
+ height?: number;
7
+ anchorX?: string;
8
+ anchorY?: string;
9
+ }
10
+ export interface KingSyTextStyle {
11
+ backgroundColor?: Color | null;
12
+ backgroundCornerRadius?: number;
13
+ backgroundPixelHeight?: number;
14
+ textColor?: Color;
15
+ billboard?: boolean;
16
+ }
17
+ export declare class KingSyText extends Mesh {
18
+ private _layer;
19
+ private _text;
20
+ private _background;
21
+ private _backgroundSize;
22
+ private _style;
23
+ private _resolution;
24
+ private defaultMaterial;
25
+ private getFlatRaycastMesh;
26
+ private getCurvedRaycastMesh;
27
+ static KingSyTextParamsFromMetadata(metadata: KingSyObject): KingSyTextParams;
28
+ get textMesh(): Text;
29
+ get backgroundMesh(): Mesh<BufferGeometry, import("three").Material | import("three").Material[]> | null;
30
+ set style(value: KingSyTextStyle);
31
+ constructor(uuid: string, layer: ObjectLayers);
32
+ update(params: KingSyTextParams, updateFinished?: () => void): Promise<void>;
33
+ setTransform(position?: Vector3, quaternion?: Quaternion, scale?: Vector3): void;
34
+ raycast(raycaster: Raycaster, intersects: Array<Intersection>): void;
35
+ private updateStyle;
36
+ private updateBackground;
37
+ /** From https://discourse.threejs.org/t/roundedrectangle-squircle/28645 */
38
+ private RectangleRounded;
39
+ }
@@ -0,0 +1,24 @@
1
+ import { Camera, Matrix4, Vector3, WebGLCubeRenderTarget, WebGLMultipleRenderTargets, WebGLRenderer, WebGLRenderTarget } from 'three';
2
+ import { TypedArray } from 'type-fest';
3
+ export declare class RTEBuffers {
4
+ private _cache;
5
+ viewer: Vector3;
6
+ viewerLow: Vector3;
7
+ viewerHigh: Vector3;
8
+ rteViewModelMatrix: Matrix4;
9
+ shadowViewer: Vector3;
10
+ shadowViewerLow: Vector3;
11
+ shadowViewerHigh: Vector3;
12
+ rteShadowViewModelMatrix: Matrix4;
13
+ rteShadowMatrix: Matrix4;
14
+ copy(from: RTEBuffers, to: RTEBuffers): void;
15
+ push(): void;
16
+ pop(): void;
17
+ }
18
+ export declare class KingSyWebGLRenderer extends WebGLRenderer {
19
+ RTEBuffers: RTEBuffers;
20
+ updateRTEViewModel(camera: Camera): void;
21
+ readRenderTargetPixels: (renderTarget: WebGLRenderTarget | WebGLCubeRenderTarget | WebGLMultipleRenderTargets, x: number, y: number, width: number, height: number, buffer: TypedArray, activeCubeFaceIndex?: number) => void;
22
+ /** Taken from three since they hide it, thank you very much */
23
+ private convert;
24
+ }
@@ -0,0 +1,5 @@
1
+ import { Matrix4, PMREMGenerator, WebGLRenderer } from 'three';
2
+ export declare class RotatablePMREMGenerator extends PMREMGenerator {
3
+ constructor(renderer: WebGLRenderer);
4
+ compileProperEquirectShader(rotationMatrix?: Matrix4): void;
5
+ }
@@ -0,0 +1,41 @@
1
+ import { Box3, Material, Ray, Side, Vector3 } from 'three';
2
+ import { MeshBVHVisualizer } from 'three-mesh-bvh';
3
+ import { BatchObject } from '../batching/BatchObject.js';
4
+ import { HitPointInfo } from 'three-mesh-bvh';
5
+ import type { ExtendedMeshIntersection, ExtendedShapeCastCallbacks } from './KingSyRaycaster.js';
6
+ import { AccelerationStructure } from './AccelerationStructure.js';
7
+ /**
8
+ *
9
+ _____ _ _
10
+ |_ _| | | | |
11
+ | | _ __ ___ _ __ ___ _ __| |_ __ _ _ __ | |_
12
+ | | | '_ ` _ \| '_ \ / _ \| '__| __/ _` | '_ \| __|
13
+ _| |_| | | | | | |_) | (_) | | | || (_| | | | | |_
14
+ |_____|_| |_| |_| .__/ \___/|_| \__\__,_|_| |_|\__|
15
+ | |
16
+ |_|
17
+
18
+ Unlike the BVHs for the individual objects, which act as our BAS, the TAS *is not relative to the world origin*!
19
+ All coordinates are the final world coordinates derived from the BAS bounding boxes, after all transformations.
20
+ In theory this might mean the TAS is not 100% accurate for objects far away from origin, but I think it should do
21
+ fine as it is. If we really really really need that 100% accuracy, we'll just make it relative to the origin
22
+ */
23
+ export declare class TopLevelAccelerationStructure {
24
+ private debugBVH;
25
+ private static cubeIndices;
26
+ private static CUBE_VERTS;
27
+ batchObjects: BatchObject[];
28
+ bounds: Box3;
29
+ accelerationStructure: AccelerationStructure;
30
+ bvhHelper: MeshBVHVisualizer;
31
+ constructor(batchObjects: BatchObject[]);
32
+ private buildBVH;
33
+ private updateVertArray;
34
+ refit(): void;
35
+ raycast(ray: Ray, tasOnly?: boolean, materialOrSide?: Side | Material | Material[]): ExtendedMeshIntersection[];
36
+ raycastFirst(ray: Ray, tasOnly?: boolean, materialOrSide?: Side | Material | Material[]): ExtendedMeshIntersection | null;
37
+ shapecast(callbacks: ExtendedShapeCastCallbacks): boolean;
38
+ closestPointToPoint(point: Vector3): HitPointInfo | null;
39
+ closestPointToPointHalfplane(point: Vector3, planeNormal: Vector3, fallback?: number, target?: HitPointInfo, minThreshold?: number, maxThreshold?: number): HitPointInfo | null;
40
+ getBoundingBox(target: Box3): Box3;
41
+ }
@@ -0,0 +1,17 @@
1
+ import { ShaderMaterial, Texture, WebGLRenderer } from 'three';
2
+ import { PassOptions, ProgressiveGPass } from './GPass.js';
3
+ export interface BlendPassOptions extends PassOptions {
4
+ blendAO?: boolean;
5
+ blendEdges?: boolean;
6
+ }
7
+ export declare const DefaultBlendPassOptions: Required<BlendPassOptions>;
8
+ export declare class BlendPass extends ProgressiveGPass {
9
+ private fsQuad;
10
+ materialCopy: ShaderMaterial;
11
+ _options: Required<BlendPassOptions>;
12
+ set options(value: BlendPassOptions);
13
+ constructor();
14
+ setTexture(uName: string, texture: Texture | undefined): void;
15
+ get displayName(): string;
16
+ render(renderer: WebGLRenderer): boolean;
17
+ }
@@ -0,0 +1,12 @@
1
+ import { Texture } from 'three';
2
+ import { DepthNormalPass, DepthNormalPassOptions } from './DepthNormalPass.js';
3
+ export interface DepthNormalIdPassOptions extends DepthNormalPassOptions {
4
+ }
5
+ export declare const DefaultDepthNormalIdPassOptions: Required<DepthNormalIdPassOptions>;
6
+ export declare class DepthNormalIdPass extends DepthNormalPass {
7
+ _options: Required<DepthNormalPassOptions>;
8
+ get displayName(): string;
9
+ get idTexture(): Texture;
10
+ set options(value: DepthNormalIdPassOptions);
11
+ constructor();
12
+ }
@@ -0,0 +1,25 @@
1
+ import { Material, OrthographicCamera, PerspectiveCamera, Plane, Scene, Texture, WebGLMultipleRenderTargets, WebGLRenderer, WebGLRenderTarget } from 'three';
2
+ import { BaseGPass } from './GPass.js';
3
+ import { DepthPassOptions, DepthType } from './DepthPass.js';
4
+ import KingSyDepthNormalMaterial from '../../materials/KingSyDepthNormalMaterial.js';
5
+ export interface DepthNormalPassOptions extends DepthPassOptions {
6
+ }
7
+ export declare const DefaultDepthNormalPassOptions: Required<DepthNormalPassOptions>;
8
+ export declare class DepthNormalPass extends BaseGPass {
9
+ protected mrtMaterial: KingSyDepthNormalMaterial;
10
+ protected mrt: WebGLMultipleRenderTargets;
11
+ _options: Required<DepthNormalPassOptions>;
12
+ get displayName(): string;
13
+ get overrideMaterial(): Material;
14
+ get depthTexture(): Texture;
15
+ get normalTexture(): Texture;
16
+ get outputTarget(): WebGLRenderTarget | null;
17
+ set outputTarget(target: WebGLMultipleRenderTargets);
18
+ set options(value: DepthNormalPassOptions);
19
+ protected set depthType(value: DepthType);
20
+ constructor();
21
+ setClippingPlanes(planes: Plane[]): void;
22
+ update(camera: PerspectiveCamera | OrthographicCamera): void;
23
+ render(renderer: WebGLRenderer, camera: PerspectiveCamera | OrthographicCamera | null, scene?: Scene): boolean;
24
+ setSize(width: number, height: number): void;
25
+ }
@@ -0,0 +1,23 @@
1
+ import { Material, OrthographicCamera, PerspectiveCamera, Side, Texture } from 'three';
2
+ import { PassOptions } from './GPass.js';
3
+ import { GeometryPass } from './GeometryPass.js';
4
+ export declare enum DepthType {
5
+ PERSPECTIVE_DEPTH = 0,
6
+ LINEAR_DEPTH = 1
7
+ }
8
+ export interface DepthPassOptions extends PassOptions {
9
+ depthType?: DepthType;
10
+ }
11
+ export declare const DefaultDepthPassOptions: Required<DepthPassOptions>;
12
+ export declare class DepthPass extends GeometryPass {
13
+ private depthMaterial;
14
+ _options: Required<DepthPassOptions>;
15
+ get displayName(): string;
16
+ get depthTexture(): Texture | undefined;
17
+ get overrideMaterial(): Material;
18
+ set options(value: DepthPassOptions);
19
+ protected set depthType(value: DepthType);
20
+ set depthSide(value: Side);
21
+ constructor();
22
+ update(camera: PerspectiveCamera | OrthographicCamera): void;
23
+ }
@@ -0,0 +1,25 @@
1
+ import { OrthographicCamera, PerspectiveCamera, ShaderMaterial, Texture, WebGLRenderer } from 'three';
2
+ import { BaseGPass, PassOptions } from './GPass.js';
3
+ export interface EdgesPassOptions extends PassOptions {
4
+ depthMultiplier?: number;
5
+ depthBias?: number;
6
+ normalMultiplier?: number;
7
+ normalBias?: number;
8
+ outlineThickness?: number;
9
+ outlineOpacity?: number;
10
+ outlineColor?: number;
11
+ backgroundColor?: number;
12
+ }
13
+ export declare const DefaultEdgesPassOptions: Required<EdgesPassOptions>;
14
+ export declare class EdgesPass extends BaseGPass {
15
+ edgesMaterial: ShaderMaterial;
16
+ private fsQuad;
17
+ _options: Required<EdgesPassOptions>;
18
+ set options(value: EdgesPassOptions);
19
+ constructor();
20
+ setTexture(uName: string, texture: Texture | undefined): void;
21
+ get displayName(): string;
22
+ update(camera: PerspectiveCamera | OrthographicCamera): void;
23
+ render(renderer: WebGLRenderer): boolean;
24
+ setSize(width: number, height: number): void;
25
+ }