lythreeframe 1.0.5 → 1.0.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 (136) hide show
  1. package/dist/bundle.cjs.js +2782 -0
  2. package/dist/bundle.esm.js +2747 -0
  3. package/dist/index.d.ts +42 -0
  4. package/dist/lythreeframe/AssetManagement/AssetDefines.d.ts +6 -0
  5. package/dist/lythreeframe/AssetManagement/AssetManager.d.ts +23 -0
  6. package/dist/lythreeframe/AssetManagement/AssetPointer/AssetPointer.d.ts +9 -0
  7. package/dist/lythreeframe/AssetManagement/Task/Task.d.ts +7 -0
  8. package/dist/lythreeframe/Container/SmartPointer.d.ts +10 -0
  9. package/dist/lythreeframe/Defines.d.ts +4 -0
  10. package/dist/lythreeframe/Delegate.d.ts +8 -0
  11. package/dist/lythreeframe/Factory/CameraFactory.d.ts +20 -0
  12. package/dist/lythreeframe/Factory/RendererFactory.d.ts +2 -0
  13. package/dist/lythreeframe/Frame/Controller.d.ts +40 -0
  14. package/dist/lythreeframe/Frame/Viewport.d.ts +50 -0
  15. package/dist/lythreeframe/Frame/World.d.ts +18 -0
  16. package/dist/lythreeframe/Geometry/PlaneGeometry.d.ts +3 -0
  17. package/dist/lythreeframe/Geometry/TriangleGeometry.d.ts +3 -0
  18. package/dist/lythreeframe/Library/ContainerLibrary.d.ts +3 -0
  19. package/dist/lythreeframe/Library/Math.d.ts +27 -0
  20. package/dist/lythreeframe/Library/ResourceLibrary.d.ts +6 -0
  21. package/dist/lythreeframe/Object/Actor.d.ts +86 -0
  22. package/dist/lythreeframe/Object/Actors/Camera/CameraActor.d.ts +4 -0
  23. package/dist/lythreeframe/Object/Actors/Light/DirectionalLightActor.d.ts +7 -0
  24. package/dist/lythreeframe/Object/Actors/Shape/BoxActor.d.ts +5 -0
  25. package/dist/lythreeframe/Object/Actors/Shape/PlaneActor.d.ts +9 -0
  26. package/dist/lythreeframe/Object/BaseObject.d.ts +10 -0
  27. package/dist/lythreeframe/Object/Components/2D/2DComponent.d.ts +13 -0
  28. package/dist/lythreeframe/Object/Components/Camera/CameraComponent.d.ts +26 -0
  29. package/dist/lythreeframe/Object/Components/Component.d.ts +17 -0
  30. package/dist/lythreeframe/Object/Components/Light/DirectionalLight/DirectionalLightComponent.d.ts +15 -0
  31. package/dist/lythreeframe/Object/Components/Light/LightComponent.d.ts +12 -0
  32. package/dist/lythreeframe/Object/Components/Mesh/InstanceMesh/InstanceMeshComponent.d.ts +7 -0
  33. package/dist/lythreeframe/Object/Components/Mesh/InstanceMesh/MultiInstanceMeshComponent.d.ts +13 -0
  34. package/dist/lythreeframe/Object/Components/Mesh/MeshComponent.d.ts +22 -0
  35. package/dist/lythreeframe/Object/Components/Mesh/Shape/BoxComponent.d.ts +5 -0
  36. package/dist/lythreeframe/Object/Components/Mesh/Shape/PlaneComponent.d.ts +5 -0
  37. package/dist/lythreeframe/Object/Components/Mesh/Shape/SphereComponent.d.ts +5 -0
  38. package/dist/lythreeframe/Object/Components/Mesh/Sprite/SpriteComponent.d.ts +8 -0
  39. package/dist/lythreeframe/Object/Components/SceneComponent.d.ts +66 -0
  40. package/dist/lythreeframe/Object/PawnV2/FirstPerson.d.ts +5 -0
  41. package/dist/lythreeframe/Object/PawnV2/Oribital.d.ts +12 -0
  42. package/dist/lythreeframe/Object/PawnV2/Pawn.d.ts +14 -0
  43. package/dist/lythreeframe/Object/PawnV2/TransformControl.d.ts +46 -0
  44. package/dist/lythreeframe/PostProcess/Param/Bloom.d.ts +6 -0
  45. package/dist/lythreeframe/PostProcess/Param/DOF.d.ts +6 -0
  46. package/dist/lythreeframe/PostProcess/Param/Denoise.d.ts +7 -0
  47. package/dist/lythreeframe/PostProcess/Param/GTAO.d.ts +11 -0
  48. package/dist/lythreeframe/PostProcess/Param/LensFlare.d.ts +6 -0
  49. package/dist/lythreeframe/PostProcess/Param/MotionBlur.d.ts +4 -0
  50. package/dist/lythreeframe/PostProcess/Param/Outline.d.ts +17 -0
  51. package/dist/lythreeframe/PostProcess/Param/SSR.d.ts +6 -0
  52. package/dist/lythreeframe/PostProcess/Param/ToneMapping.d.ts +9 -0
  53. package/dist/lythreeframe/PostProcess/PostProcessParam.d.ts +16 -0
  54. package/dist/lythreeframe/PostProcess/WebGPUPostProcessFactory.d.ts +43 -0
  55. package/dist/lythreeframe/Shader/Postprocess/ColorShader.d.ts +29 -0
  56. package/dist/lythreeframe/ThreeJsApp.d.ts +35 -0
  57. package/package.json +26 -14
  58. package/dist/index.ts +0 -80
  59. package/rollup.config.js +0 -31
  60. package/src/draco/README.md +0 -32
  61. package/src/draco/draco_decoder.js +0 -34
  62. package/src/draco/draco_decoder.wasm +0 -0
  63. package/src/draco/draco_encoder.js +0 -33
  64. package/src/draco/draco_wasm_wrapper.js +0 -117
  65. package/src/draco/gltf/draco_decoder.js +0 -33
  66. package/src/draco/gltf/draco_decoder.wasm +0 -0
  67. package/src/draco/gltf/draco_encoder.js +0 -33
  68. package/src/draco/gltf/draco_wasm_wrapper.js +0 -116
  69. package/src/index.ts +0 -44
  70. package/src/lythreeframe/AssetManagement/AssetDefines.ts +0 -8
  71. package/src/lythreeframe/AssetManagement/AssetManager.ts +0 -288
  72. package/src/lythreeframe/AssetManagement/AssetPointer/AssetPointer.ts +0 -41
  73. package/src/lythreeframe/AssetManagement/Task/Task.ts +0 -24
  74. package/src/lythreeframe/Container/SmartPointer.ts +0 -54
  75. package/src/lythreeframe/Defines.ts +0 -11
  76. package/src/lythreeframe/Delegate.ts +0 -37
  77. package/src/lythreeframe/Factory/CameraFactory.ts +0 -81
  78. package/src/lythreeframe/Factory/RendererFactory.ts +0 -7
  79. package/src/lythreeframe/Frame/Controller.ts +0 -261
  80. package/src/lythreeframe/Frame/Viewport.ts +0 -516
  81. package/src/lythreeframe/Frame/World.ts +0 -59
  82. package/src/lythreeframe/Frame.ts +0 -511
  83. package/src/lythreeframe/Geometry/PlaneGeometry.ts +0 -53
  84. package/src/lythreeframe/Geometry/TriangleGeometry.ts +0 -50
  85. package/src/lythreeframe/Library/ContainerLibrary.ts +0 -21
  86. package/src/lythreeframe/Library/MaterialLibrary.ts +0 -292
  87. package/src/lythreeframe/Library/Math.ts +0 -154
  88. package/src/lythreeframe/Library/ResourceLibrary.ts +0 -21
  89. package/src/lythreeframe/Object/Actor.ts +0 -571
  90. package/src/lythreeframe/Object/Actors/Camera/CameraActor.ts +0 -11
  91. package/src/lythreeframe/Object/Actors/Light/DirectionalLightActor.ts +0 -18
  92. package/src/lythreeframe/Object/Actors/Shape/BoxActor.ts +0 -20
  93. package/src/lythreeframe/Object/Actors/Shape/CurveActor.ts +0 -11
  94. package/src/lythreeframe/Object/Actors/Shape/PlaneActor.ts +0 -27
  95. package/src/lythreeframe/Object/Actors/Shape/TubeActor.ts +0 -37
  96. package/src/lythreeframe/Object/BaseObject.ts +0 -45
  97. package/src/lythreeframe/Object/Components/2D/2DComponent.ts +0 -64
  98. package/src/lythreeframe/Object/Components/Camera/CameraComponent.ts +0 -113
  99. package/src/lythreeframe/Object/Components/Component.ts +0 -67
  100. package/src/lythreeframe/Object/Components/Light/DirectionalLight/DirectionalLightComponent.ts +0 -78
  101. package/src/lythreeframe/Object/Components/Light/LightComponent.ts +0 -54
  102. package/src/lythreeframe/Object/Components/Mesh/InstanceMesh/InstanceMeshComponent.ts +0 -39
  103. package/src/lythreeframe/Object/Components/Mesh/InstanceMesh/MultiInstanceMeshComponent.ts +0 -115
  104. package/src/lythreeframe/Object/Components/Mesh/Line/CurveComponent.ts +0 -221
  105. package/src/lythreeframe/Object/Components/Mesh/MeshComponent.ts +0 -162
  106. package/src/lythreeframe/Object/Components/Mesh/Shape/BoxComponent.ts +0 -17
  107. package/src/lythreeframe/Object/Components/Mesh/Shape/PlaneComponent.ts +0 -10
  108. package/src/lythreeframe/Object/Components/Mesh/Shape/SphereComponent.ts +0 -10
  109. package/src/lythreeframe/Object/Components/Mesh/Sprite/SpriteComponent.ts +0 -32
  110. package/src/lythreeframe/Object/Components/SceneComponent.ts +0 -811
  111. package/src/lythreeframe/Object/Controller/Controller.ts +0 -764
  112. package/src/lythreeframe/Object/Pawn/CameraStatus.ts +0 -262
  113. package/src/lythreeframe/Object/Pawn/FirstPerson.ts +0 -230
  114. package/src/lythreeframe/Object/Pawn/Oribital.ts +0 -276
  115. package/src/lythreeframe/Object/Pawn/PawnBase.ts +0 -189
  116. package/src/lythreeframe/Object/Pawn/TopView.ts +0 -205
  117. package/src/lythreeframe/Object/Pawn/TransformControl.ts +0 -215
  118. package/src/lythreeframe/Object/Pawn/staticCamera.ts +0 -80
  119. package/src/lythreeframe/Object/PawnV2/FirstPerson.ts +0 -12
  120. package/src/lythreeframe/Object/PawnV2/Oribital.ts +0 -45
  121. package/src/lythreeframe/Object/PawnV2/Pawn.ts +0 -50
  122. package/src/lythreeframe/Object/PawnV2/TransformControl.ts +0 -202
  123. package/src/lythreeframe/PostProcess/Param/Bloom.ts +0 -12
  124. package/src/lythreeframe/PostProcess/Param/DOF.ts +0 -13
  125. package/src/lythreeframe/PostProcess/Param/Denoise.ts +0 -14
  126. package/src/lythreeframe/PostProcess/Param/GTAO.ts +0 -21
  127. package/src/lythreeframe/PostProcess/Param/LensFlare.ts +0 -11
  128. package/src/lythreeframe/PostProcess/Param/MotionBlur.ts +0 -8
  129. package/src/lythreeframe/PostProcess/Param/Outline.ts +0 -20
  130. package/src/lythreeframe/PostProcess/Param/SSR.ts +0 -11
  131. package/src/lythreeframe/PostProcess/Param/ToneMapping.ts +0 -31
  132. package/src/lythreeframe/PostProcess/PostProcessParam.ts +0 -26
  133. package/src/lythreeframe/PostProcess/WebGPUPostProcessFactory.ts +0 -217
  134. package/src/lythreeframe/Shader/Postprocess/ColorShader.ts +0 -49
  135. package/src/lythreeframe/ThreeJsApp.ts +0 -124
  136. package/tsconfig.json +0 -105
@@ -1,20 +0,0 @@
1
- import { ColorRepresentation} from "three";
2
-
3
- export interface OutlineParams
4
- {
5
- edgeStrength : number;
6
- edgeGlow : number;
7
- edgeThickness : number;
8
- pulsePeriod : number;
9
- visibleEdgeColor: ColorRepresentation;
10
- hiddenEdgeColor : ColorRepresentation;
11
- }
12
-
13
- export const DefaultOutlineParams = {
14
- edgeStrength : 3.0,
15
- edgeGlow : 1.0,
16
- edgeThickness : 1.0,
17
- pulsePeriod : 0.0,
18
- visibleEdgeColor: 0xffffff,
19
- hiddenEdgeColor : 0xffffff ,
20
- }
@@ -1,11 +0,0 @@
1
- export interface SSRParam {
2
- maxDistance: number;
3
- opacity : number;
4
- thickness : number;
5
- }
6
-
7
- export const DefaultSSRParam: SSRParam = {
8
- maxDistance: 0.5,
9
- opacity : 1,
10
- thickness : 0.015,
11
- };
@@ -1,31 +0,0 @@
1
- import {
2
- ACESFilmicToneMapping,
3
- AgXToneMapping,
4
- CineonToneMapping,
5
- LinearToneMapping, NeutralToneMapping,
6
- NoToneMapping,
7
- ReinhardToneMapping
8
- } from "three";
9
-
10
- export interface ToneMappingParams
11
- {
12
- exposure:number,
13
- toneMapping:string
14
- }
15
-
16
- export const DefaultToneMappingParams = {
17
- exposure: 1.0,
18
- toneMapping: 'AgX',
19
- }
20
-
21
- export const ToneMappingOptions = new Map([
22
- ["None", NoToneMapping],
23
- ["Linear", LinearToneMapping],
24
- ["Reinhard", ReinhardToneMapping],
25
- ["Cineon", CineonToneMapping],
26
- ["ACESFilmic", ACESFilmicToneMapping],
27
- ["AgX", AgXToneMapping],
28
- ["Neutral", NeutralToneMapping]
29
- ])
30
-
31
-
@@ -1,26 +0,0 @@
1
- 
2
- import { SSRParam } from './Param/SSR';
3
- import {GTAOParam} from "./Param/GTAO";
4
- import {BloomParam} from "./Param/Bloom";
5
- import {ToneMappingParams} from "./Param/ToneMapping";
6
- import {DOFParam} from "./Param/DOF";
7
- import { OutlineParams } from './Param/Outline';
8
-
9
- export interface PostProcessParam
10
- {
11
- toneMapping?: ToneMappingParams,
12
- bloom ?: BloomParam|null,
13
- dof ?: DOFParam|null,
14
- // motionBlur ?: MotionBlurParam,
15
- ssr ?: SSRParam|null,
16
- gtao ?: GTAOParam|null,
17
- outline ?: OutlineParams|null,
18
- aa ?: "fxaa"|"smaa"|null
19
- }
20
-
21
- export const DefaultPostProcessParam:PostProcessParam = {
22
- toneMapping: {
23
- exposure: 1,
24
- toneMapping:"AgX"
25
- }
26
- }
@@ -1,217 +0,0 @@
1
- import { OutlineParams } from './Param/Outline';
2
- import { Scene, Camera, Object3D } from "three";
3
- import BloomNode, { bloom } from "three/examples/jsm/tsl/display/BloomNode.js";
4
- import DenoiseNode, { denoise } from "three/examples/jsm/tsl/display/DenoiseNode.js";
5
- import DepthOfFieldNode, { dof } from "three/examples/jsm/tsl/display/DepthOfFieldNode.js";
6
- import GTAONode, { ao } from "three/examples/jsm/tsl/display/GTAONode.js";
7
- import { ShaderNodeObject, pass, mrt, output, uniform, metalness, transformedNormalView, NodeRepresentation, normalView, depth, velocity } from "three/tsl";
8
- import { PassNode, Node } from "three/webgpu";
9
- import { BloomParam } from "./Param/Bloom";
10
- import { DOFParam } from "./Param/DOF";
11
- import { GTAOParam } from "./Param/GTAO";
12
-
13
- import SSRNode, { ssr } from "three/examples/jsm/tsl/display/SSRNode.js";
14
- import { SSRParam } from "./Param/SSR";
15
- import { LensFlareParam } from "./Param/LensFlare";
16
- import LensflareNode, { lensflare } from "three/examples/jsm/tsl/display/LensflareNode.js";
17
- import OutlineNode, { outline } from "three/examples/jsm/tsl/display/OutlineNode.js";
18
- import { motionBlur } from 'three/examples/jsm/tsl/display/MotionBlur.js';
19
- import { MotionBlurParam } from './Param/MotionBlur';
20
- import { fxaa } from 'three/examples/jsm/tsl/display/FXAANode.js';
21
- import { smaa } from 'three/examples/jsm/tsl/display/SMAANode.js';
22
- import { DenoiseParam } from './Param/Denoise';
23
-
24
- export class WebGPUPostProcessFactory
25
- {
26
- // scene pass
27
- static constructScenePass(scene: Scene, camera: Camera): ShaderNodeObject<PassNode>
28
- {
29
- const scenePass = pass(scene, camera);
30
- scenePass.setMRT(mrt({
31
- output: output,
32
- }));
33
- return scenePass;
34
- }
35
-
36
- static updateScenePass(scenePass: ShaderNodeObject<PassNode>, outputNodes: { [name: string]: Node })
37
- {
38
-
39
- let oldMRT = scenePass.getMRT();
40
- let newMRT = mrt(outputNodes)
41
- if (oldMRT)
42
- {
43
- scenePass.setMRT(oldMRT.merge(newMRT));
44
- }
45
- else
46
- {
47
- scenePass.setMRT(newMRT);
48
- }
49
- console.log(scenePass.getMRT(), "MRTTTTTTT");
50
- }
51
-
52
- // bloom pass
53
- static constructBloomPass(scenePass: ShaderNodeObject<PassNode>, params: BloomParam): ShaderNodeObject<BloomNode>
54
- {
55
- const scenePassColor = scenePass.getTextureNode('output');
56
- const bloomPass = bloom(scenePassColor);
57
- WebGPUPostProcessFactory.updateBloomPass(bloomPass, params);
58
- return bloomPass;
59
- }
60
-
61
- static updateBloomPass(bloomPass: ShaderNodeObject<BloomNode>, params: BloomParam)
62
- {
63
- bloomPass.threshold.value = params.threshold;
64
- bloomPass.strength.value = params.strength;
65
- bloomPass.radius.value = params.radius;
66
- }
67
-
68
- // DOF pass
69
- static constructDOFPass(scenePass: ShaderNodeObject<PassNode>, params: DOFParam): ShaderNodeObject<DepthOfFieldNode>
70
- {
71
- const scenePassColor = scenePass.getTextureNode('output');
72
- const scenePassViewZ = scenePass.getViewZNode();
73
- return dof(scenePassColor, scenePassViewZ, uniform(params.focus), uniform(params.aperture).mul(0.00001), uniform(params.maxblur));
74
- }
75
-
76
- static updateDOFPass(dofPass: ShaderNodeObject<DepthOfFieldNode>, params: DOFParam)
77
- {
78
- dofPass.focus.value = params.focus;
79
- dofPass.aperture.value = params.aperture * 0.00001;
80
- dofPass.maxblur.value = params.maxblur;
81
- }
82
-
83
- // motion blur
84
- static constructMotionBlurPass(lastNode:NodeRepresentation, scenePass: ShaderNodeObject<PassNode>, param:MotionBlurParam): ShaderNodeObject<Node>
85
- {
86
- WebGPUPostProcessFactory.updateScenePass(scenePass, {velocity})
87
- const scenePassVelocity = scenePass.getTextureNode( 'velocity' ).mul( param.blurAmount );
88
- const scenePassColor = scenePass.getTextureNode('output');
89
- const motionBlurPass = motionBlur( scenePassColor, scenePassVelocity );
90
- return motionBlurPass
91
- }
92
-
93
- // ssr
94
- static constructSSRPass(scenePass: ShaderNodeObject<PassNode>, param: SSRParam): ShaderNodeObject<SSRNode>
95
- {
96
- WebGPUPostProcessFactory.updateScenePass(scenePass, {
97
- normal : transformedNormalView,
98
- metalness: metalness,
99
- })
100
- const scenePassColor = scenePass.getTextureNode('output');
101
- const scenePassNormal = scenePass.getTextureNode('normal');
102
- const scenePassDepth = scenePass.getTextureNode('depth');
103
- const scenePassMetalness = scenePass.getTextureNode('metalness');
104
- const ssrPass = ssr(scenePassColor, scenePassDepth, scenePassNormal, scenePassMetalness, scenePass.camera)
105
- ssrPass.resolutionScale = 1.0;
106
- WebGPUPostProcessFactory.updateSSRPass(ssrPass, param);
107
- return ssrPass;
108
- }
109
-
110
- static updateSSRPass(ssrPass: ShaderNodeObject<SSRNode>, params: SSRParam)
111
- {
112
- ssrPass.maxDistance.value = params.maxDistance;
113
- ssrPass.opacity.value = params.opacity;
114
- ssrPass.thickness.value = params.thickness;
115
- }
116
-
117
- // GTAO
118
- static constructGTAOPass(scenePass: ShaderNodeObject<PassNode>, params: GTAOParam): ShaderNodeObject<GTAONode>
119
- {
120
- WebGPUPostProcessFactory.updateScenePass(scenePass, {
121
- normal: transformedNormalView,
122
- })
123
- const scenePassNormal = scenePass.getTextureNode('normal');
124
- const scenePassDepth = scenePass.getTextureNode('depth');
125
- const aoPass = ao(scenePassDepth, scenePassNormal, scenePass.camera);
126
- aoPass.resolutionScale = 0.5;
127
- WebGPUPostProcessFactory.updateGTAOPass(aoPass, params);
128
- return aoPass;
129
- }
130
-
131
- static updateGTAOPass(gtaoPass: ShaderNodeObject<GTAONode>, params: GTAOParam)
132
- {
133
- gtaoPass.distanceExponent.value = params.distanceExponent;
134
- gtaoPass.distanceFallOff.value = params.distanceFallOff;
135
- gtaoPass.radius.value = params.radius;
136
- gtaoPass.scale.value = params.scale;
137
- gtaoPass.thickness.value = params.thickness;
138
- }
139
-
140
- static constructDenoisePass(scenePass: ShaderNodeObject<PassNode>, inputNode: NodeRepresentation, params: DenoiseParam): ShaderNodeObject<DenoiseNode>
141
- {
142
- WebGPUPostProcessFactory.updateScenePass(scenePass, {
143
- normal: transformedNormalView,
144
- })
145
- const scenePassNormal = scenePass.getTextureNode('normal');
146
- const scenePassDepth = scenePass.getTextureNode('depth');
147
- const denoisePass = denoise(inputNode, scenePassDepth, scenePassNormal, scenePass.camera);
148
- WebGPUPostProcessFactory.updateDenoisePass(denoisePass, params);
149
- return denoisePass
150
-
151
- }
152
- static updateDenoisePass(denoisePass: ShaderNodeObject<DenoiseNode>, params: DenoiseParam)
153
- {
154
- denoisePass.radius.value = params.denoiseRadius;
155
- denoisePass.lumaPhi.value = params.lumaPhi;
156
- denoisePass.depthPhi.value = params.depthPhi;
157
- denoisePass.normalPhi.value = params.normalPhi;
158
- }
159
-
160
- static constructGTAODenoisePass(scenePass: ShaderNodeObject<PassNode>, gtaoPass: ShaderNodeObject<GTAONode>, params: GTAOParam): ShaderNodeObject<DenoiseNode>
161
- {
162
- return WebGPUPostProcessFactory.constructDenoisePass(scenePass, gtaoPass.getTextureNode(), params.denoiseParam);
163
- }
164
-
165
- static updateGTAODenoisePass(denoisePass: ShaderNodeObject<DenoiseNode>, params: GTAOParam)
166
- {
167
- WebGPUPostProcessFactory.updateDenoisePass(denoisePass, params.denoiseParam);
168
- }
169
-
170
- static constructLensFlarePass(inputNode: NodeRepresentation, params: LensFlareParam): ShaderNodeObject<LensflareNode>
171
- {
172
- const lensflarePass = lensflare(inputNode, {
173
- threshold : uniform(params.threshold),
174
- ghostAttenuationFactor: uniform(params.ghostAttenuationFactor),
175
- ghostSpacing : uniform(params.ghostSpacing),
176
- });
177
- return lensflarePass;
178
- }
179
-
180
- static updateLensFlarPass(lensflarePass: ShaderNodeObject<LensflareNode>, params: LensFlareParam)
181
- {
182
- lensflarePass.thresholdNode.value = params.threshold
183
- lensflarePass.ghostSpacingNode.value = params.ghostSpacing
184
- lensflarePass.ghostAttenuationFactorNode.value = params.ghostAttenuationFactor
185
- }
186
-
187
- static constructOutlinePass(scene: Scene, camera: Camera, outlineObjects:Object3D[], param:OutlineParams): ShaderNodeObject<OutlineNode>
188
- {
189
- const outlinePass = outline( scene, camera, {
190
- selectedObjects: outlineObjects,
191
- edgeGlow : param.edgeGlow,
192
- edgeThickness : param.edgeThickness
193
- } );
194
- return outlinePass;
195
- }
196
-
197
- static updateOutlinePass(outlinePass: ShaderNodeObject<OutlineNode>, outlineObjects:Object3D[],params: OutlineParams)
198
- {
199
- outlinePass.edgeGlowNode.value = params.edgeGlow
200
- outlinePass.edgeThicknessNode.value = params.edgeThickness
201
- outlinePass.selectedObjects = outlineObjects
202
- }
203
-
204
- // fxaa
205
- static constructFXAAPass(inputNode: NodeRepresentation)
206
- {
207
- return fxaa(inputNode)
208
- }
209
-
210
- // smaa
211
- static constructSMAAPass(inputNode: NodeRepresentation)
212
- {
213
- return smaa(inputNode)
214
- }
215
-
216
-
217
- }
@@ -1,49 +0,0 @@
1
- /**
2
- * Brightness and contrast adjustment
3
- * https://github.com/evanw/glfx.js
4
- * brightness: -1 to 1 (-1 is solid black, 0 is no change, and 1 is solid white)
5
- * contrast: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast)
6
- */
7
-
8
- const ColorShader = {
9
-
10
- name: 'ColorShader',
11
-
12
- uniforms: {
13
- 'tDiffuse' : {value: null},
14
- 'brightness': {value: 0.0},
15
- 'contrast' : {value: 0},
16
- 'saturation': {value: 1},
17
- 'exposure' : {value: 1.0} // 新增的曝光uniform
18
- },
19
-
20
- vertexShader: /* glsl */`
21
- varying vec2 vUv;
22
- void main() {
23
- vUv = uv;
24
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
25
- }`,
26
-
27
- fragmentShader: /* glsl */`
28
-
29
- uniform sampler2D tDiffuse;
30
- uniform float brightness;
31
- uniform float contrast;
32
- uniform float saturation;
33
- uniform float exposure; // 新增的曝光uniform
34
- varying vec2 vUv;
35
-
36
- void main() {
37
- gl_FragColor = texture2D( tDiffuse, vUv );
38
- gl_FragColor.rgb *= exposure;
39
- gl_FragColor.rgb += brightness;
40
-
41
- gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;
42
- vec3 grey = vec3(0.2126 * gl_FragColor.r + 0.7152 * gl_FragColor.g + 0.0722 * gl_FragColor.b); // 计算亮度(灰度)
43
- gl_FragColor.rgb = mix(grey, gl_FragColor.rgb, saturation);;
44
-
45
- }`
46
-
47
- };
48
-
49
- export {ColorShader};
@@ -1,124 +0,0 @@
1
- 
2
- import { DefaultPostProcessParam, PostProcessParam } from './PostProcess/PostProcessParam';
3
- import {World} from "./Frame/World";
4
- import {Viewport} from "./Frame/Viewport";
5
- import {Controller} from "./Frame/Controller";
6
- import { Clock, OrthographicCamera, PerspectiveCamera} from "three";
7
- import {CameraFactory, CameraParam} from "./Factory/CameraFactory";
8
- import { WebGPURendererParameters } from 'three/src/renderers/webgpu/WebGPURenderer.js';
9
-
10
- export interface AppParam
11
- {
12
- renderParam ?: WebGPURendererParameters,
13
- cameraParam ?: CameraParam,
14
- postProcessParam?: PostProcessParam,
15
- }
16
-
17
- export const DefaultRenderParam:WebGPURendererParameters = {
18
- antialias: true,
19
- }
20
- export const DefaultCameraParam:CameraParam = {
21
- near : 0.1,
22
- far : 1000,
23
- param: {
24
- fov : 50,
25
- aspect: 1,
26
- }
27
- }
28
- export const DefaultAppParam:AppParam = {
29
- renderParam : DefaultRenderParam,
30
- cameraParam : DefaultCameraParam,
31
- postProcessParam: DefaultPostProcessParam,
32
- }
33
- export class ThreeJsApp
34
- {
35
- get camera(): PerspectiveCamera | OrthographicCamera
36
- {
37
- return this._camera;
38
- }
39
- get clock(): Clock
40
- {
41
- return this._clock;
42
- }
43
- get world(): World
44
- {
45
- return this._world;
46
- }
47
- get viewport(): Viewport
48
- {
49
- return this._viewport;
50
- }
51
- get controller(): Controller
52
- {
53
- return this._controller;
54
- }
55
-
56
- get worldClass()
57
- {
58
- return World
59
- }
60
- get viewportClass()
61
- {
62
- return Viewport
63
- }
64
- get controllerClass()
65
- {
66
- return Controller
67
- }
68
- protected _clock : Clock
69
- protected _camera: PerspectiveCamera | OrthographicCamera
70
- protected _world : World;
71
- protected _viewport: Viewport;
72
- protected _controller: Controller;
73
-
74
- constructor(elementId:string, appParam:AppParam = DefaultAppParam)
75
- {
76
- this._clock = new Clock()
77
- this._camera = CameraFactory.createCamera(appParam.cameraParam ? appParam.cameraParam : DefaultCameraParam)
78
- this._world = new this.worldClass(this);
79
- this._viewport = new this.viewportClass(this, elementId, appParam.renderParam ? appParam.renderParam:DefaultRenderParam, appParam.postProcessParam? appParam.postProcessParam:DefaultPostProcessParam);
80
- this._controller = new this.controllerClass(this);
81
-
82
- this.viewport.renderer.setAnimationLoop(()=>{
83
- this.tick();
84
- });
85
-
86
- this.init();
87
- }
88
-
89
- init()
90
- {
91
- this.controller.init();
92
- this.world.init();
93
- this.viewport.init();
94
- }
95
-
96
- tick()
97
- {
98
- const delta = this._clock.getDelta();
99
- this._controller.tick(delta);
100
- this.world.tick(delta);
101
- this.viewport.render();
102
- }
103
-
104
-
105
-
106
- onWindowResize(width:number, height:number)
107
- {
108
- if(this.camera instanceof PerspectiveCamera)
109
- {
110
- this.camera.aspect = width / height;
111
- }
112
- // if(this.camera instanceof OrthographicCamera)
113
- // {
114
- // // to do
115
- // }
116
- this.camera.updateProjectionMatrix();
117
- }
118
- destroy()
119
- {
120
- this.world.destroy();
121
- this.controller.destroy();
122
- this.viewport.destroy();
123
- }
124
- }
package/tsconfig.json DELETED
@@ -1,105 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig to read more about this file */
4
- /* Projects */
5
- // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
6
- // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
7
- // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
8
- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
9
- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
10
- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
11
- /* Language and Environment */
12
- "target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
13
- // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
14
- // "jsx": "preserve", /* Specify what JSX code is generated. */
15
- // "libReplacement": true, /* Enable lib replacement. */
16
- // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
17
- // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
18
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
19
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
20
- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
21
- // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
22
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
23
- // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
24
- // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
25
- /* Modules */
26
- "module": "commonjs", /* Specify what module code is generated. */
27
- // "rootDir": "./", /* Specify the root folder within your source files. */
28
- // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
29
- // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
30
- // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
31
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
32
- // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
33
- // "types": [], /* Specify type package names to be included without being referenced in a source file. */
34
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
35
- // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
36
- // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
37
- // "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */
38
- // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
39
- // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
40
- // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
41
- // "noUncheckedSideEffectImports": true, /* Check side effect imports. */
42
- // "resolveJsonModule": true, /* Enable importing .json files. */
43
- // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
44
- // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
45
- /* JavaScript Support */
46
- // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
47
- // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
48
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
49
- /* Emit */
50
- // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
51
- // "declarationMap": true, /* Create sourcemaps for d.ts files. */
52
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
53
- // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
54
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
55
- // "noEmit": true, /* Disable emitting files from a compilation. */
56
- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
57
- // "outDir": "./", /* Specify an output folder for all emitted files. */
58
- // "removeComments": true, /* Disable emitting comments. */
59
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
60
- // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
61
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
62
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
63
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
64
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
65
- // "newLine": "crlf", /* Set the newline character for emitting files. */
66
- // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
67
- // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
68
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
69
- // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
70
- // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
71
- /* Interop Constraints */
72
- // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
73
- // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
74
- // "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
75
- // "erasableSyntaxOnly": true, /* Do not allow runtime constructs that are not part of ECMAScript. */
76
- // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
77
- "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
78
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
79
- "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
80
- /* Type Checking */
81
- "strict": true, /* Enable all strict type-checking options. */
82
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
83
- // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
84
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
85
- // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
86
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
87
- // "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */
88
- // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
89
- // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
90
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
91
- // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
92
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
93
- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
94
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
95
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
96
- // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
97
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
98
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
99
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
100
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
101
- /* Completeness */
102
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
103
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
104
- }
105
- }