three-stdlib 2.8.10 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- package/index.cjs.js +1 -1
- package/index.d.ts +2 -52
- package/index.js +53 -52
- package/lines/LineMaterial.d.ts +7 -6
- package/modifiers/CurveModifier.cjs.js +1 -1
- package/modifiers/CurveModifier.d.ts +13 -9
- package/modifiers/CurveModifier.js +27 -30
- package/objects/Lensflare.cjs.js +1 -1
- package/objects/Lensflare.js +11 -3
- package/package.json +3 -3
- package/postprocessing/AfterimagePass.d.ts +2 -30
- package/postprocessing/RenderPixelatedPass.cjs.js +1 -0
- package/postprocessing/RenderPixelatedPass.js +213 -0
- package/shaders/ACESFilmicToneMappingShader.cjs.js +1 -1
- package/shaders/ACESFilmicToneMappingShader.d.ts +9 -0
- package/shaders/ACESFilmicToneMappingShader.js +1 -1
- package/shaders/AfterimageShader.d.ts +9 -15
- package/shaders/BasicShader.cjs.js +1 -1
- package/shaders/BasicShader.d.ts +5 -5
- package/shaders/BasicShader.js +1 -1
- package/shaders/BleachBypassShader.cjs.js +1 -1
- package/shaders/BleachBypassShader.d.ts +8 -9
- package/shaders/BleachBypassShader.js +1 -1
- package/shaders/BlendShader.cjs.js +1 -1
- package/shaders/BlendShader.d.ts +13 -7
- package/shaders/BlendShader.js +1 -1
- package/shaders/BokehShader.cjs.js +1 -1
- package/shaders/BokehShader.d.ts +18 -19
- package/shaders/BokehShader.js +1 -1
- package/shaders/BokehShader2.cjs.js +1 -1
- package/shaders/BokehShader2.d.ts +80 -34
- package/shaders/BokehShader2.js +2 -2
- package/shaders/BrightnessContrastShader.cjs.js +1 -1
- package/shaders/BrightnessContrastShader.d.ts +10 -6
- package/shaders/BrightnessContrastShader.js +1 -1
- package/shaders/ColorCorrectionShader.cjs.js +1 -1
- package/shaders/ColorCorrectionShader.d.ts +14 -7
- package/shaders/ColorCorrectionShader.js +1 -1
- package/shaders/ColorifyShader.cjs.js +1 -1
- package/shaders/ColorifyShader.d.ts +8 -5
- package/shaders/ColorifyShader.js +1 -1
- package/shaders/ConvolutionShader.cjs.js +1 -1
- package/shaders/ConvolutionShader.d.ts +15 -16
- package/shaders/ConvolutionShader.js +9 -14
- package/shaders/CopyShader.d.ts +8 -12
- package/shaders/DOFMipMapShader.cjs.js +1 -1
- package/shaders/DOFMipMapShader.d.ts +13 -7
- package/shaders/DOFMipMapShader.js +1 -1
- package/shaders/DepthLimitedBlurShader.cjs.js +1 -1
- package/shaders/DepthLimitedBlurShader.d.ts +26 -25
- package/shaders/DepthLimitedBlurShader.js +12 -16
- package/shaders/DigitalGlitch.cjs.js +1 -1
- package/shaders/DigitalGlitch.d.ts +34 -14
- package/shaders/DigitalGlitch.js +1 -10
- package/shaders/DotScreenShader.cjs.js +1 -1
- package/shaders/DotScreenShader.d.ts +17 -8
- package/shaders/DotScreenShader.js +1 -1
- package/shaders/FXAAShader.cjs.js +1 -1
- package/shaders/FXAAShader.d.ts +8 -5
- package/shaders/FXAAShader.js +1 -1
- package/shaders/FilmShader.cjs.js +1 -1
- package/shaders/FilmShader.d.ts +19 -9
- package/shaders/FilmShader.js +1 -1
- package/shaders/FocusShader.cjs.js +1 -1
- package/shaders/FocusShader.d.ts +16 -8
- package/shaders/FocusShader.js +1 -1
- package/shaders/FreiChenShader.cjs.js +1 -1
- package/shaders/FreiChenShader.d.ts +8 -5
- package/shaders/FreiChenShader.js +1 -1
- package/shaders/FresnelShader.cjs.js +1 -1
- package/shaders/FresnelShader.d.ts +21 -0
- package/shaders/FresnelShader.js +1 -1
- package/shaders/GammaCorrectionShader.d.ts +7 -7
- package/shaders/GodRaysShader.cjs.js +1 -1
- package/shaders/GodRaysShader.d.ts +38 -20
- package/shaders/GodRaysShader.js +4 -4
- package/shaders/HalftoneShader.cjs.js +1 -1
- package/shaders/HalftoneShader.d.ts +40 -16
- package/shaders/HalftoneShader.js +1 -1
- package/shaders/HorizontalBlurShader.d.ts +8 -8
- package/shaders/HorizontalTiltShiftShader.cjs.js +1 -1
- package/shaders/HorizontalTiltShiftShader.d.ts +10 -6
- package/shaders/HorizontalTiltShiftShader.js +1 -1
- package/shaders/HueSaturationShader.cjs.js +1 -1
- package/shaders/HueSaturationShader.d.ts +10 -6
- package/shaders/HueSaturationShader.js +1 -1
- package/shaders/KaleidoShader.cjs.js +1 -1
- package/shaders/KaleidoShader.d.ts +10 -6
- package/shaders/KaleidoShader.js +1 -1
- package/shaders/LuminosityHighPassShader.cjs.js +1 -1
- package/shaders/LuminosityHighPassShader.d.ts +17 -8
- package/shaders/LuminosityHighPassShader.js +1 -1
- package/shaders/LuminosityShader.cjs.js +1 -1
- package/shaders/LuminosityShader.d.ts +4 -4
- package/shaders/LuminosityShader.js +1 -1
- package/shaders/MirrorShader.cjs.js +1 -1
- package/shaders/MirrorShader.d.ts +7 -5
- package/shaders/MirrorShader.js +1 -1
- package/shaders/NormalMapShader.cjs.js +1 -1
- package/shaders/NormalMapShader.d.ts +14 -7
- package/shaders/NormalMapShader.js +1 -1
- package/shaders/ParallaxShader.cjs.js +1 -1
- package/shaders/ParallaxShader.d.ts +28 -0
- package/shaders/ParallaxShader.js +1 -1
- package/shaders/PixelShader.cjs.js +1 -1
- package/shaders/PixelShader.d.ts +10 -6
- package/shaders/PixelShader.js +1 -1
- package/shaders/RGBShiftShader.cjs.js +1 -1
- package/shaders/RGBShiftShader.d.ts +10 -6
- package/shaders/RGBShiftShader.js +1 -1
- package/shaders/SAOShader.cjs.js +1 -1
- package/shaders/SAOShader.d.ts +24 -29
- package/shaders/SAOShader.js +1 -5
- package/shaders/SMAAShader.cjs.js +1 -1
- package/shaders/SMAAShader.d.ts +31 -16
- package/shaders/SMAAShader.js +3 -3
- package/shaders/SSAOShader.cjs.js +1 -1
- package/shaders/SSAOShader.d.ts +58 -25
- package/shaders/SSAOShader.js +3 -3
- package/shaders/SSRShader.cjs.js +1 -1
- package/shaders/SSRShader.d.ts +67 -36
- package/shaders/SSRShader.js +3 -3
- package/shaders/SepiaShader.cjs.js +1 -1
- package/shaders/SepiaShader.d.ts +7 -5
- package/shaders/SepiaShader.js +1 -1
- package/shaders/SobelOperatorShader.cjs.js +1 -1
- package/shaders/SobelOperatorShader.d.ts +8 -5
- package/shaders/SobelOperatorShader.js +1 -1
- package/shaders/SubsurfaceScatteringShader.cjs.js +1 -1
- package/shaders/SubsurfaceScatteringShader.d.ts +2 -34
- package/shaders/SubsurfaceScatteringShader.js +3 -3
- package/shaders/TechnicolorShader.cjs.js +1 -1
- package/shaders/TechnicolorShader.d.ts +4 -4
- package/shaders/TechnicolorShader.js +1 -1
- package/shaders/ToneMapShader.cjs.js +1 -1
- package/shaders/ToneMapShader.d.ts +19 -9
- package/shaders/ToneMapShader.js +1 -1
- package/shaders/ToonShader.cjs.js +1 -1
- package/shaders/ToonShader.d.ts +80 -34
- package/shaders/ToonShader.js +4 -4
- package/shaders/TriangleBlurShader.cjs.js +1 -1
- package/shaders/TriangleBlurShader.d.ts +8 -5
- package/shaders/TriangleBlurShader.js +1 -1
- package/shaders/UnpackDepthRGBAShader.cjs.js +1 -1
- package/shaders/UnpackDepthRGBAShader.d.ts +7 -5
- package/shaders/UnpackDepthRGBAShader.js +1 -1
- package/shaders/VerticalBlurShader.cjs.js +1 -1
- package/shaders/VerticalBlurShader.d.ts +8 -8
- package/shaders/VerticalBlurShader.js +1 -1
- package/shaders/VerticalTiltShiftShader.cjs.js +1 -1
- package/shaders/VerticalTiltShiftShader.d.ts +10 -6
- package/shaders/VerticalTiltShiftShader.js +1 -1
- package/shaders/VignetteShader.cjs.js +1 -1
- package/shaders/VignetteShader.d.ts +10 -6
- package/shaders/VignetteShader.js +1 -1
- package/shaders/VolumeShader.cjs.js +1 -1
- package/shaders/VolumeShader.d.ts +20 -9
- package/shaders/VolumeShader.js +1 -1
- package/shaders/WaterRefractionShader.cjs.js +1 -1
- package/shaders/WaterRefractionShader.d.ts +16 -8
- package/shaders/WaterRefractionShader.js +1 -1
- package/shaders/index.cjs.js +1 -0
- package/shaders/index.d.ts +53 -0
- package/shaders/index.js +53 -0
- package/shaders/types.cjs.js +1 -0
- package/shaders/types.d.ts +14 -0
- package/shaders/types.js +1 -0
- package/types/shared.d.ts +0 -20
package/index.d.ts
CHANGED
@@ -157,6 +157,7 @@ export * from './postprocessing/TAARenderPass';
|
|
157
157
|
export * from './postprocessing/ShaderPass';
|
158
158
|
export * from './postprocessing/SSAARenderPass';
|
159
159
|
export * from './postprocessing/RenderPass';
|
160
|
+
export * from './postprocessing/RenderPixelatedPass';
|
160
161
|
export * from './postprocessing/BloomPass';
|
161
162
|
export * from './webxr/ARButton';
|
162
163
|
export * from './webxr/OculusHandModel';
|
@@ -180,58 +181,7 @@ export * from './csm/CSM';
|
|
180
181
|
export * from './csm/Shader';
|
181
182
|
export * from './csm/CSMHelper';
|
182
183
|
export * from './csm/Frustum';
|
183
|
-
export * from './shaders
|
184
|
-
export * from './shaders/HalftoneShader';
|
185
|
-
export * from './shaders/ConvolutionShader';
|
186
|
-
export * from './shaders/SAOShader';
|
187
|
-
export * from './shaders/GodRaysShader';
|
188
|
-
export * from './shaders/LuminosityShader';
|
189
|
-
export * from './shaders/MirrorShader';
|
190
|
-
export * from './shaders/ToneMapShader';
|
191
|
-
export * from './shaders/BleachBypassShader';
|
192
|
-
export * from './shaders/BlendShader';
|
193
|
-
export * from './shaders/KaleidoShader';
|
194
|
-
export * from './shaders/ACESFilmicToneMappingShader';
|
195
|
-
export * from './shaders/ParallaxShader';
|
196
|
-
export * from './shaders/VerticalBlurShader';
|
197
|
-
export * from './shaders/ColorCorrectionShader';
|
198
|
-
export * from './shaders/PixelShader';
|
199
|
-
export * from './shaders/BokehShader2';
|
200
|
-
export * from './shaders/FocusShader';
|
201
|
-
export * from './shaders/WaterRefractionShader';
|
202
|
-
export * from './shaders/RGBShiftShader';
|
203
|
-
export * from './shaders/TriangleBlurShader';
|
204
|
-
export * from './shaders/FilmShader';
|
205
|
-
export * from './shaders/SepiaShader';
|
206
|
-
export * from './shaders/BokehShader';
|
207
|
-
export * from './shaders/FXAAShader';
|
208
|
-
export * from './shaders/AfterimageShader';
|
209
|
-
export * from './shaders/DotScreenShader';
|
210
|
-
export * from './shaders/SubsurfaceScatteringShader';
|
211
|
-
export * from './shaders/ToonShader';
|
212
|
-
export * from './shaders/DepthLimitedBlurShader';
|
213
|
-
export * from './shaders/NormalMapShader';
|
214
|
-
export * from './shaders/FreiChenShader';
|
215
|
-
export * from './shaders/VolumeShader';
|
216
|
-
export * from './shaders/HorizontalTiltShiftShader';
|
217
|
-
export * from './shaders/VerticalTiltShiftShader';
|
218
|
-
export * from './shaders/BrightnessContrastShader';
|
219
|
-
export * from './shaders/SobelOperatorShader';
|
220
|
-
export * from './shaders/SSAOShader';
|
221
|
-
export * from './shaders/GammaCorrectionShader';
|
222
|
-
export * from './shaders/VignetteShader';
|
223
|
-
export * from './shaders/HorizontalBlurShader';
|
224
|
-
export * from './shaders/UnpackDepthRGBAShader';
|
225
|
-
export * from './shaders/FresnelShader';
|
226
|
-
export * from './shaders/HueSaturationShader';
|
227
|
-
export * from './shaders/DigitalGlitch';
|
228
|
-
export * from './shaders/BasicShader';
|
229
|
-
export * from './shaders/CopyShader';
|
230
|
-
export * from './shaders/LuminosityHighPassShader';
|
231
|
-
export * from './shaders/DOFMipMapShader';
|
232
|
-
export * from './shaders/SSRShader';
|
233
|
-
export * from './shaders/TechnicolorShader';
|
234
|
-
export * from './shaders/ColorifyShader';
|
184
|
+
export * from './shaders';
|
235
185
|
export * from './interactive/SelectionHelper';
|
236
186
|
export * from './interactive/SelectionBox';
|
237
187
|
export * from './physics/AmmoPhysics';
|
package/index.js
CHANGED
@@ -103,6 +103,7 @@ export { TAARenderPass } from './postprocessing/TAARenderPass.js';
|
|
103
103
|
export { ShaderPass } from './postprocessing/ShaderPass.js';
|
104
104
|
export { SSAARenderPass } from './postprocessing/SSAARenderPass.js';
|
105
105
|
export { RenderPass } from './postprocessing/RenderPass.js';
|
106
|
+
export { RenderPixelatedPass } from './postprocessing/RenderPixelatedPass.js';
|
106
107
|
export { BloomPass } from './postprocessing/BloomPass.js';
|
107
108
|
export { ARButton } from './webxr/ARButton.js';
|
108
109
|
export { OculusHandModel } from './webxr/OculusHandModel.js';
|
@@ -124,58 +125,6 @@ export { TeapotGeometry } from './geometries/TeapotGeometry.js';
|
|
124
125
|
export { TextGeometry as TextBufferGeometry, TextGeometry } from './geometries/TextGeometry.js';
|
125
126
|
export { CSM } from './csm/CSM.js';
|
126
127
|
export { CSMHelper } from './csm/CSMHelper.js';
|
127
|
-
export { SMAABlendShader, SMAAEdgesShader, SMAAWeightsShader } from './shaders/SMAAShader.js';
|
128
|
-
export { HalftoneShader } from './shaders/HalftoneShader.js';
|
129
|
-
export { ConvolutionShader } from './shaders/ConvolutionShader.js';
|
130
|
-
export { SAOShader } from './shaders/SAOShader.js';
|
131
|
-
export { GodRaysCombineShader, GodRaysDepthMaskShader, GodRaysFakeSunShader, GodRaysGenerateShader } from './shaders/GodRaysShader.js';
|
132
|
-
export { LuminosityShader } from './shaders/LuminosityShader.js';
|
133
|
-
export { MirrorShader } from './shaders/MirrorShader.js';
|
134
|
-
export { ToneMapShader } from './shaders/ToneMapShader.js';
|
135
|
-
export { BleachBypassShader } from './shaders/BleachBypassShader.js';
|
136
|
-
export { BlendShader } from './shaders/BlendShader.js';
|
137
|
-
export { KaleidoShader } from './shaders/KaleidoShader.js';
|
138
|
-
export { ACESFilmicToneMappingShader } from './shaders/ACESFilmicToneMappingShader.js';
|
139
|
-
export { ParallaxShader } from './shaders/ParallaxShader.js';
|
140
|
-
export { VerticalBlurShader } from './shaders/VerticalBlurShader.js';
|
141
|
-
export { ColorCorrectionShader } from './shaders/ColorCorrectionShader.js';
|
142
|
-
export { PixelShader } from './shaders/PixelShader.js';
|
143
|
-
export { BokehDepthShader, BokehShader2 } from './shaders/BokehShader2.js';
|
144
|
-
export { FocusShader } from './shaders/FocusShader.js';
|
145
|
-
export { WaterRefractionShader } from './shaders/WaterRefractionShader.js';
|
146
|
-
export { RGBShiftShader } from './shaders/RGBShiftShader.js';
|
147
|
-
export { TriangleBlurShader } from './shaders/TriangleBlurShader.js';
|
148
|
-
export { FilmShader } from './shaders/FilmShader.js';
|
149
|
-
export { SepiaShader } from './shaders/SepiaShader.js';
|
150
|
-
export { BokehShader } from './shaders/BokehShader.js';
|
151
|
-
export { FXAAShader } from './shaders/FXAAShader.js';
|
152
|
-
export { AfterimageShader } from './shaders/AfterimageShader.js';
|
153
|
-
export { DotScreenShader } from './shaders/DotScreenShader.js';
|
154
|
-
export { SubsurfaceScatteringShader } from './shaders/SubsurfaceScatteringShader.js';
|
155
|
-
export { ToonShader1, ToonShader2, ToonShaderDotted, ToonShaderHatching } from './shaders/ToonShader.js';
|
156
|
-
export { BlurShaderUtils, DepthLimitedBlurShader } from './shaders/DepthLimitedBlurShader.js';
|
157
|
-
export { NormalMapShader } from './shaders/NormalMapShader.js';
|
158
|
-
export { FreiChenShader } from './shaders/FreiChenShader.js';
|
159
|
-
export { VolumeRenderShader1 } from './shaders/VolumeShader.js';
|
160
|
-
export { HorizontalTiltShiftShader } from './shaders/HorizontalTiltShiftShader.js';
|
161
|
-
export { VerticalTiltShiftShader } from './shaders/VerticalTiltShiftShader.js';
|
162
|
-
export { BrightnessContrastShader } from './shaders/BrightnessContrastShader.js';
|
163
|
-
export { SobelOperatorShader } from './shaders/SobelOperatorShader.js';
|
164
|
-
export { SSAOBlurShader, SSAODepthShader, SSAOShader } from './shaders/SSAOShader.js';
|
165
|
-
export { GammaCorrectionShader } from './shaders/GammaCorrectionShader.js';
|
166
|
-
export { VignetteShader } from './shaders/VignetteShader.js';
|
167
|
-
export { HorizontalBlurShader } from './shaders/HorizontalBlurShader.js';
|
168
|
-
export { UnpackDepthRGBAShader } from './shaders/UnpackDepthRGBAShader.js';
|
169
|
-
export { FresnelShader } from './shaders/FresnelShader.js';
|
170
|
-
export { HueSaturationShader } from './shaders/HueSaturationShader.js';
|
171
|
-
export { DigitalGlitch } from './shaders/DigitalGlitch.js';
|
172
|
-
export { BasicShader } from './shaders/BasicShader.js';
|
173
|
-
export { CopyShader } from './shaders/CopyShader.js';
|
174
|
-
export { LuminosityHighPassShader } from './shaders/LuminosityHighPassShader.js';
|
175
|
-
export { DOFMipMapShader } from './shaders/DOFMipMapShader.js';
|
176
|
-
export { SSRBlurShader, SSRDepthShader, SSRShader } from './shaders/SSRShader.js';
|
177
|
-
export { TechnicolorShader } from './shaders/TechnicolorShader.js';
|
178
|
-
export { ColorifyShader } from './shaders/ColorifyShader.js';
|
179
128
|
export { SelectionHelper } from './interactive/SelectionHelper.js';
|
180
129
|
export { SelectionBox } from './interactive/SelectionBox.js';
|
181
130
|
export { AmmoPhysics } from './physics/AmmoPhysics.js';
|
@@ -326,3 +275,55 @@ export { default as NodeObjectLoader } from './nodes/loaders/NodeObjectLoader.js
|
|
326
275
|
export { default as NodeMaterialLoader } from './nodes/loaders/NodeMaterialLoader.js';
|
327
276
|
export { BRDF_GGX, BRDF_Lambert, D_GGX, F_Schlick, PhysicalLightingModel, RE_Direct_Physical, V_GGX_SmithCorrelated, getDistanceAttenuation } from './nodes/functions/BSDFs.js';
|
328
277
|
export { EPSILON, INFINITY, ShaderNode, abs, acos, add, addTo, alphaTest, and, asin, assign, atan, attribute, bitAnd, bitOr, bitXor, bmat3, bmat4, bool, buffer, bvec2, bvec3, bvec4, cameraPosition, ceil, clamp, color, cond, cos, cross, dFdx, dFdy, degrees, diffuseColor, distance, div, dot, element, equal, exp, exp2, faceforward, float, floor, fract, greaterThan, greaterThanEqual, imat3, imat4, int, inversesqrt, invert, ivec2, ivec3, ivec4, join, label, length, lessThan, lessThanEqual, log, log2, mat3, mat4, max, metalness, min, mix, mod, mul, negate, nodeObject, normalGeometry, normalLocal, normalView, normalWorld, normalize, or, positionLocal, positionView, positionViewDirection, positionWorld, pow, pow2, pow3, pow4, radians, reflect, refract, remainder, roughness, round, sampler, saturate, shiftLeft, shiftRight, sign, sin, smoothstep, specularColor, sqrt, step, sub, tan, temp, texture, transformDirection, transformedNormalView, uint, umat3, umat4, uniform, uv, uvec2, uvec3, uvec4, vec2, vec3, vec4, viewMatrix, xor } from './nodes/ShaderNode.js';
|
278
|
+
export { ACESFilmicToneMappingShader } from './shaders/ACESFilmicToneMappingShader.js';
|
279
|
+
export { AfterimageShader } from './shaders/AfterimageShader.js';
|
280
|
+
export { BasicShader } from './shaders/BasicShader.js';
|
281
|
+
export { BleachBypassShader } from './shaders/BleachBypassShader.js';
|
282
|
+
export { BlendShader } from './shaders/BlendShader.js';
|
283
|
+
export { BokehShader } from './shaders/BokehShader.js';
|
284
|
+
export { BokehDepthShader, BokehShader2 } from './shaders/BokehShader2.js';
|
285
|
+
export { BrightnessContrastShader } from './shaders/BrightnessContrastShader.js';
|
286
|
+
export { ColorCorrectionShader } from './shaders/ColorCorrectionShader.js';
|
287
|
+
export { ColorifyShader } from './shaders/ColorifyShader.js';
|
288
|
+
export { ConvolutionShader } from './shaders/ConvolutionShader.js';
|
289
|
+
export { CopyShader } from './shaders/CopyShader.js';
|
290
|
+
export { DOFMipMapShader } from './shaders/DOFMipMapShader.js';
|
291
|
+
export { BlurShaderUtils, DepthLimitedBlurShader } from './shaders/DepthLimitedBlurShader.js';
|
292
|
+
export { DigitalGlitch } from './shaders/DigitalGlitch.js';
|
293
|
+
export { DotScreenShader } from './shaders/DotScreenShader.js';
|
294
|
+
export { FXAAShader } from './shaders/FXAAShader.js';
|
295
|
+
export { FilmShader } from './shaders/FilmShader.js';
|
296
|
+
export { FocusShader } from './shaders/FocusShader.js';
|
297
|
+
export { FreiChenShader } from './shaders/FreiChenShader.js';
|
298
|
+
export { FresnelShader } from './shaders/FresnelShader.js';
|
299
|
+
export { GammaCorrectionShader } from './shaders/GammaCorrectionShader.js';
|
300
|
+
export { GodRaysCombineShader, GodRaysDepthMaskShader, GodRaysFakeSunShader, GodRaysGenerateShader } from './shaders/GodRaysShader.js';
|
301
|
+
export { HalftoneShader } from './shaders/HalftoneShader.js';
|
302
|
+
export { HorizontalBlurShader } from './shaders/HorizontalBlurShader.js';
|
303
|
+
export { HorizontalTiltShiftShader } from './shaders/HorizontalTiltShiftShader.js';
|
304
|
+
export { HueSaturationShader } from './shaders/HueSaturationShader.js';
|
305
|
+
export { KaleidoShader } from './shaders/KaleidoShader.js';
|
306
|
+
export { LuminosityHighPassShader } from './shaders/LuminosityHighPassShader.js';
|
307
|
+
export { LuminosityShader } from './shaders/LuminosityShader.js';
|
308
|
+
export { MirrorShader } from './shaders/MirrorShader.js';
|
309
|
+
export { NormalMapShader } from './shaders/NormalMapShader.js';
|
310
|
+
export { ParallaxShader } from './shaders/ParallaxShader.js';
|
311
|
+
export { PixelShader } from './shaders/PixelShader.js';
|
312
|
+
export { RGBShiftShader } from './shaders/RGBShiftShader.js';
|
313
|
+
export { SAOShader } from './shaders/SAOShader.js';
|
314
|
+
export { SMAABlendShader, SMAAEdgesShader, SMAAWeightsShader } from './shaders/SMAAShader.js';
|
315
|
+
export { SSAOBlurShader, SSAODepthShader, SSAOShader } from './shaders/SSAOShader.js';
|
316
|
+
export { SSRBlurShader, SSRDepthShader, SSRShader } from './shaders/SSRShader.js';
|
317
|
+
export { SepiaShader } from './shaders/SepiaShader.js';
|
318
|
+
export { SobelOperatorShader } from './shaders/SobelOperatorShader.js';
|
319
|
+
export { SubsurfaceScatteringShader } from './shaders/SubsurfaceScatteringShader.js';
|
320
|
+
export { TechnicolorShader } from './shaders/TechnicolorShader.js';
|
321
|
+
export { ToneMapShader } from './shaders/ToneMapShader.js';
|
322
|
+
export { ToonShader1, ToonShader2, ToonShaderDotted, ToonShaderHatching } from './shaders/ToonShader.js';
|
323
|
+
export { TriangleBlurShader } from './shaders/TriangleBlurShader.js';
|
324
|
+
export { UnpackDepthRGBAShader } from './shaders/UnpackDepthRGBAShader.js';
|
325
|
+
export { VerticalBlurShader } from './shaders/VerticalBlurShader.js';
|
326
|
+
export { VerticalTiltShiftShader } from './shaders/VerticalTiltShiftShader.js';
|
327
|
+
export { VignetteShader } from './shaders/VignetteShader.js';
|
328
|
+
export { VolumeRenderShader1 } from './shaders/VolumeShader.js';
|
329
|
+
export { WaterRefractionShader } from './shaders/WaterRefractionShader.js';
|
package/lines/LineMaterial.d.ts
CHANGED
@@ -1,15 +1,16 @@
|
|
1
|
-
import { ShaderMaterial, Vector2,
|
2
|
-
import {
|
3
|
-
export declare type
|
1
|
+
import { ShaderMaterial, Vector2, Color } from 'three';
|
2
|
+
import type { ShaderMaterialParameters } from 'three';
|
3
|
+
export declare type ColorOptions = Color | string | number;
|
4
|
+
export interface LineMaterialParameters extends ShaderMaterialParameters {
|
4
5
|
color?: ColorOptions;
|
5
|
-
linewidth?: number;
|
6
6
|
dashed?: boolean;
|
7
|
+
dashOffset?: number;
|
7
8
|
dashScale?: number;
|
8
9
|
dashSize?: number;
|
9
|
-
dashOffset?: number;
|
10
10
|
gapSize?: number;
|
11
|
+
linewidth?: number;
|
11
12
|
resolution?: Vector2;
|
12
|
-
}
|
13
|
+
}
|
13
14
|
declare class LineMaterial extends ShaderMaterial {
|
14
15
|
private readonly isLineMaterial;
|
15
16
|
dashed: boolean;
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("three");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(e);const s=(e=1)=>{const n=new Float32Array(4096*e*4),r=new t.DataTexture(n,1024,4*e,t.RGBAFormat,t.FloatType);return r.wrapS=t.RepeatWrapping,r.wrapT=t.RepeatWrapping,r.magFilter=t.NearestFilter,r.needsUpdate=!0,r},i=(e,t,n=0)=>{const r=Math.floor(1024);t.arcLengthDivisions=r/2,t.updateArcLengths();const s=t.getSpacedPoints(r),i=t.computeFrenetFrames(r,!0);for(let t=0;t<r;t++){const r=Math.floor(t/1024),o=t%1024;let f=s[t];a(e,o,f.x,f.y,f.z,0+r+4*n),f=i.tangents[t],a(e,o,f.x,f.y,f.z,1+r+4*n),f=i.normals[t],a(e,o,f.x,f.y,f.z,2+r+4*n),f=i.binormals[t],a(e,o,f.x,f.y,f.z,3+r+4*n)}e.needsUpdate=!0},a=(e,t,n,r,s,i)=>{const a=e.image,{data:o}=a,f=4096*i;o[4*t+f+0]=n,o[4*t+f+1]=r,o[4*t+f+2]=s,o[4*t+f+3]=1}
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("three");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(e);const s=(e=1)=>{const n=new Float32Array(4096*e*4),r=new t.DataTexture(n,1024,4*e,t.RGBAFormat,t.FloatType);return r.wrapS=t.RepeatWrapping,r.wrapT=t.RepeatWrapping,r.magFilter=t.NearestFilter,r.needsUpdate=!0,r},i=(e,t,n=0)=>{const r=Math.floor(1024);t.arcLengthDivisions=r/2,t.updateArcLengths();const s=t.getSpacedPoints(r),i=t.computeFrenetFrames(r,!0);for(let t=0;t<r;t++){const r=Math.floor(t/1024),o=t%1024;let f=s[t];a(e,o,f.x,f.y,f.z,0+r+4*n),f=i.tangents[t],a(e,o,f.x,f.y,f.z,1+r+4*n),f=i.normals[t],a(e,o,f.x,f.y,f.z,2+r+4*n),f=i.binormals[t],a(e,o,f.x,f.y,f.z,3+r+4*n)}e.needsUpdate=!0},a=(e,t,n,r,s,i)=>{const a=e.image,{data:o}=a,f=4096*i;o[4*t+f+0]=n,o[4*t+f+1]=r,o[4*t+f+2]=s,o[4*t+f+3]=1},o=e=>({spineTexture:{value:e},pathOffset:{type:"f",value:0},pathSegment:{type:"f",value:1},spineOffset:{type:"f",value:161},spineLength:{type:"f",value:400},flow:{type:"i",value:1}});function f(e,t,n=1){e.__ok||(e.__ok=!0,e.onBeforeCompile=e=>{if(e.__modified)return;e.__modified=!0,Object.assign(e.uniforms,t);const r=`\n\t\tuniform sampler2D spineTexture;\n\t\tuniform float pathOffset;\n\t\tuniform float pathSegment;\n\t\tuniform float spineOffset;\n\t\tuniform float spineLength;\n\t\tuniform int flow;\n\n\t\tfloat textureLayers = ${4*n}.;\n\t\tfloat textureStacks = 1.;\n\n\t\t${e.vertexShader}\n\t\t`.replace("#include <beginnormal_vertex>","").replace("#include <defaultnormal_vertex>","").replace("#include <begin_vertex>","").replace(/void\s*main\s*\(\)\s*\{/,"\n void main() {\n #include <beginnormal_vertex>\n\n vec4 worldPos = modelMatrix * vec4(position, 1.);\n\n bool bend = flow > 0;\n float xWeight = bend ? 0. : 1.;\n\n #ifdef USE_INSTANCING\n float pathOffsetFromInstanceMatrix = instanceMatrix[3][2];\n float spineLengthFromInstanceMatrix = instanceMatrix[3][0];\n float spinePortion = bend ? (worldPos.x + spineOffset) / spineLengthFromInstanceMatrix : 0.;\n float mt = (spinePortion * pathSegment + pathOffset + pathOffsetFromInstanceMatrix)*textureStacks;\n #else\n float spinePortion = bend ? (worldPos.x + spineOffset) / spineLength : 0.;\n float mt = (spinePortion * pathSegment + pathOffset)*textureStacks;\n #endif\n\n mt = mod(mt, textureStacks);\n float rowOffset = floor(mt);\n\n #ifdef USE_INSTANCING\n rowOffset += instanceMatrix[3][1] * 4.;\n #endif\n\n vec3 spinePos = texture2D(spineTexture, vec2(mt, (0. + rowOffset + 0.5) / textureLayers)).xyz;\n vec3 a = texture2D(spineTexture, vec2(mt, (1. + rowOffset + 0.5) / textureLayers)).xyz;\n vec3 b = texture2D(spineTexture, vec2(mt, (2. + rowOffset + 0.5) / textureLayers)).xyz;\n vec3 c = texture2D(spineTexture, vec2(mt, (3. + rowOffset + 0.5) / textureLayers)).xyz;\n mat3 basis = mat3(a, b, c);\n\n vec3 transformed = basis\n * vec3(worldPos.x * xWeight, worldPos.y * 1., worldPos.z * 1.)\n + spinePos;\n\n vec3 transformedNormal = normalMatrix * (basis * objectNormal);\n\t\t\t").replace("#include <project_vertex>","vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n\t\t\t\tgl_Position = projectionMatrix * mvPosition;");e.vertexShader=r})}class l{constructor(e,n=1){r.default(this,"curveArray",void 0),r.default(this,"curveLengthArray",void 0),r.default(this,"object3D",void 0),r.default(this,"splineTexure",void 0),r.default(this,"uniforms",void 0);const i=e.clone(),a=s(n),l=o(a);i.traverse((e=>{(e instanceof t.Mesh||e instanceof t.InstancedMesh)&&(e.material=e.material.clone(),f(e.material,l,n))})),this.curveArray=new Array(n),this.curveLengthArray=new Array(n),this.object3D=i,this.splineTexure=a,this.uniforms=l}updateCurve(e,t){if(e>=this.curveArray.length)throw Error("Index out of range for Flow");const n=t.getLength();this.uniforms.spineLength.value=n,this.curveLengthArray[e]=n,this.curveArray[e]=t,i(this.splineTexure,t,e)}moveAlongCurve(e){this.uniforms.pathOffset.value+=e}}const u=new t.Matrix4;exports.Flow=l,exports.InstancedFlow=class extends l{constructor(e,n,s,i){const a=new t.InstancedMesh(s,i,e);a.instanceMatrix.setUsage(t.DynamicDrawUsage),super(a,n),r.default(this,"offsets",void 0),r.default(this,"whichCurve",void 0),this.offsets=new Array(e).fill(0),this.whichCurve=new Array(e).fill(0)}writeChanges(e){u.makeTranslation(this.curveLengthArray[this.whichCurve[e]],this.whichCurve[e],this.offsets[e]),this.object3D.setMatrixAt(e,u),this.object3D.instanceMatrix.needsUpdate=!0}moveIndividualAlongCurve(e,t){this.offsets[e]+=t,this.writeChanges(e)}setCurve(e,t){if(isNaN(t))throw Error("curve index being set is Not a Number (NaN)");this.whichCurve[e]=t,this.writeChanges(e)}},exports.getUniforms=o,exports.initSplineTexture=s,exports.modifyShader=f,exports.updateSplineTexture=i;
|
@@ -1,16 +1,20 @@
|
|
1
1
|
import { DataTexture, Mesh, InstancedMesh, Material, Curve, BufferGeometry } from 'three';
|
2
|
-
import {
|
2
|
+
import type { IUniform } from 'three';
|
3
3
|
export declare const initSplineTexture: (numberOfCurves?: number) => DataTexture;
|
4
4
|
export declare const updateSplineTexture: <TCurve extends Curve<any>>(texture: DataTexture, splineCurve: TCurve, offset?: number) => void;
|
5
|
-
export interface
|
6
|
-
|
7
|
-
|
8
|
-
pathSegment: TUniform<number>;
|
9
|
-
spineOffset: TUniform<number>;
|
10
|
-
spineLength: TUniform<number>;
|
11
|
-
flow: TUniform<number>;
|
5
|
+
export interface INumericUniform extends IUniform {
|
6
|
+
type: 'f' | 'i';
|
7
|
+
value: number;
|
12
8
|
}
|
13
|
-
export declare
|
9
|
+
export declare type CurveModifierUniforms = {
|
10
|
+
spineTexture: IUniform<DataTexture>;
|
11
|
+
pathOffset: INumericUniform;
|
12
|
+
pathSegment: INumericUniform;
|
13
|
+
spineOffset: INumericUniform;
|
14
|
+
spineLength: INumericUniform;
|
15
|
+
flow: INumericUniform;
|
16
|
+
};
|
17
|
+
export declare const getUniforms: (splineTexture: DataTexture) => CurveModifierUniforms;
|
14
18
|
export declare type ModifiedMaterial<TMaterial extends Material> = TMaterial & {
|
15
19
|
__ok: boolean;
|
16
20
|
};
|
@@ -69,36 +69,33 @@ const setTextureValue = (texture, index, x, y, z, o) => {
|
|
69
69
|
*
|
70
70
|
* @param { DataTexture } Texture which holds the curve description
|
71
71
|
*/
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
};
|
100
|
-
return uniforms;
|
101
|
-
}
|
72
|
+
const getUniforms = splineTexture => ({
|
73
|
+
spineTexture: {
|
74
|
+
value: splineTexture
|
75
|
+
},
|
76
|
+
pathOffset: {
|
77
|
+
type: 'f',
|
78
|
+
value: 0
|
79
|
+
},
|
80
|
+
// time of path curve
|
81
|
+
pathSegment: {
|
82
|
+
type: 'f',
|
83
|
+
value: 1
|
84
|
+
},
|
85
|
+
// fractional length of path
|
86
|
+
spineOffset: {
|
87
|
+
type: 'f',
|
88
|
+
value: 161
|
89
|
+
},
|
90
|
+
spineLength: {
|
91
|
+
type: 'f',
|
92
|
+
value: 400
|
93
|
+
},
|
94
|
+
flow: {
|
95
|
+
type: 'i',
|
96
|
+
value: 1
|
97
|
+
}
|
98
|
+
});
|
102
99
|
function modifyShader(material, uniforms, numberOfCurves = 1) {
|
103
100
|
if (material.__ok) return;
|
104
101
|
material.__ok = true;
|
package/objects/Lensflare.cjs.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("three");class e extends t.Mesh{constructor(){super(e.Geometry,new t.MeshBasicMaterial({opacity:0,transparent:!0})),this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const i=new t.Vector3,r=new t.Vector3,o=new t.
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("three");class e extends t.Mesh{constructor(){super(e.Geometry,new t.MeshBasicMaterial({opacity:0,transparent:!0})),this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const i=new t.Vector3,r=new t.Vector3,o=new t.DataTexture(new Uint8Array(768),16,16,t.RGBAFormat);o.minFilter=t.NearestFilter,o.magFilter=t.NearestFilter,o.wrapS=t.ClampToEdgeWrapping,o.wrapT=t.ClampToEdgeWrapping;const s=new t.DataTexture(new Uint8Array(768),16,16,t.RGBAFormat);s.minFilter=t.NearestFilter,s.magFilter=t.NearestFilter,s.wrapS=t.ClampToEdgeWrapping,s.wrapT=t.ClampToEdgeWrapping;const a=e.Geometry,l=new t.RawShaderMaterial({uniforms:{scale:{value:null},screenPosition:{value:null}},vertexShader:"\n\n\t\t\t\tprecision highp float;\n\n\t\t\t\tuniform vec3 screenPosition;\n\t\t\t\tuniform vec2 scale;\n\n\t\t\t\tattribute vec3 position;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tgl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );\n\n\t\t\t\t}",fragmentShader:"\n\n\t\t\t\tprecision highp float;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tgl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 );\n\n\t\t\t\t}",depthTest:!0,depthWrite:!1,transparent:!1}),c=new t.RawShaderMaterial({uniforms:{map:{value:o},scale:{value:null},screenPosition:{value:null}},vertexShader:"\n\n\t\t\t\tprecision highp float;\n\n\t\t\t\tuniform vec3 screenPosition;\n\t\t\t\tuniform vec2 scale;\n\n\t\t\t\tattribute vec3 position;\n\t\t\t\tattribute vec2 uv;\n\n\t\t\t\tvarying vec2 vUV;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvUV = uv;\n\n\t\t\t\t\tgl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );\n\n\t\t\t\t}",fragmentShader:"\n\n\t\t\t\tprecision highp float;\n\n\t\t\t\tuniform sampler2D map;\n\n\t\t\t\tvarying vec2 vUV;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tgl_FragColor = texture2D( map, vUV );\n\n\t\t\t\t}",depthTest:!1,depthWrite:!1,transparent:!1}),u=new t.Mesh(a,l),v=[],p=n.Shader,d=new t.RawShaderMaterial({uniforms:{map:{value:null},occlusionMap:{value:s},color:{value:new t.Color(16777215)},scale:{value:new t.Vector2},screenPosition:{value:new t.Vector3}},vertexShader:p.vertexShader,fragmentShader:p.fragmentShader,blending:t.AdditiveBlending,transparent:!0,depthWrite:!1}),m=new t.Mesh(a,d);this.addElement=function(t){v.push(t)};const f=new t.Vector2,y=new t.Vector2,x=new t.Box2,h=new t.Vector4;this.onBeforeRender=function(t,e,n){t.getCurrentViewport(h);const p=h.w/h.z,g=h.z/2,w=h.w/2;let b=16/h.w;if(f.set(b*p,b),x.min.set(h.x,h.y),x.max.set(h.x+(h.z-16),h.y+(h.w-16)),r.setFromMatrixPosition(this.matrixWorld),r.applyMatrix4(n.matrixWorldInverse),!(r.z>0)&&(i.copy(r).applyMatrix4(n.projectionMatrix),y.x=h.x+i.x*g+g-8,y.y=h.y+i.y*w+w-8,x.containsPoint(y))){t.copyFramebufferToTexture(y,o);let e=l.uniforms;e.scale.value=f,e.screenPosition.value=i,t.renderBufferDirect(n,null,a,l,u,null),t.copyFramebufferToTexture(y,s),e=c.uniforms,e.scale.value=f,e.screenPosition.value=i,t.renderBufferDirect(n,null,a,c,u,null);const r=2*-i.x,p=2*-i.y;for(let e=0,o=v.length;e<o;e++){const o=v[e],s=d.uniforms;s.color.value.copy(o.color),s.map.value=o.texture,s.screenPosition.value.x=i.x+r*o.distance,s.screenPosition.value.y=i.y+p*o.distance,b=o.size/h.w;const l=h.w/h.z;s.scale.value.set(b*l,b),d.uniformsNeedUpdate=!0,t.renderBufferDirect(n,null,a,d,m,null)}}},this.dispose=function(){l.dispose(),c.dispose(),d.dispose(),o.dispose(),s.dispose();for(let t=0,e=v.length;t<e;t++)v[t].texture.dispose()}}}e.prototype.isLensflare=!0;class n{constructor(e,n=1,i=0,r=new t.Color(16777215)){this.texture=e,this.size=n,this.distance=i,this.color=r}}n.Shader={uniforms:{map:{value:null},occlusionMap:{value:null},color:{value:null},scale:{value:null},screenPosition:{value:null}},vertexShader:"\n\n\t\tprecision highp float;\n\n\t\tuniform vec3 screenPosition;\n\t\tuniform vec2 scale;\n\n\t\tuniform sampler2D occlusionMap;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\n\t\tvarying vec2 vUV;\n\t\tvarying float vVisibility;\n\n\t\tvoid main() {\n\n\t\t\tvUV = uv;\n\n\t\t\tvec2 pos = position.xy;\n\n\t\t\tvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\n\t\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\n\n\t\t\tvVisibility = visibility.r / 9.0;\n\t\t\tvVisibility *= 1.0 - visibility.g / 9.0;\n\t\t\tvVisibility *= visibility.b / 9.0;\n\n\t\t\tgl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tprecision highp float;\n\n\t\tuniform sampler2D map;\n\t\tuniform vec3 color;\n\n\t\tvarying vec2 vUV;\n\t\tvarying float vVisibility;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texture = texture2D( map, vUV );\n\t\t\ttexture.a *= vVisibility;\n\t\t\tgl_FragColor = texture;\n\t\t\tgl_FragColor.rgb *= color;\n\n\t\t}"},e.Geometry=function(){const e=new t.BufferGeometry,n=new Float32Array([-1,-1,0,0,0,1,-1,0,1,0,1,1,0,1,1,-1,1,0,0,1]),i=new t.InterleavedBuffer(n,5);return e.setIndex([0,1,2,0,2,3]),e.setAttribute("position",new t.InterleavedBufferAttribute(i,3,0,!1)),e.setAttribute("uv",new t.InterleavedBufferAttribute(i,2,3,!1)),e}(),exports.Lensflare=e,exports.LensflareElement=n;
|
package/objects/Lensflare.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Mesh, MeshBasicMaterial, Vector3,
|
1
|
+
import { Mesh, MeshBasicMaterial, Vector3, DataTexture, RGBAFormat, NearestFilter, ClampToEdgeWrapping, RawShaderMaterial, Color, Vector2, AdditiveBlending, Box2, Vector4, BufferGeometry, InterleavedBuffer, InterleavedBufferAttribute } from 'three';
|
2
2
|
|
3
3
|
class Lensflare extends Mesh {
|
4
4
|
constructor() {
|
@@ -13,8 +13,16 @@ class Lensflare extends Mesh {
|
|
13
13
|
const positionScreen = new Vector3();
|
14
14
|
const positionView = new Vector3(); // textures
|
15
15
|
|
16
|
-
const tempMap = new
|
17
|
-
|
16
|
+
const tempMap = new DataTexture(new Uint8Array(16 * 16 * 3), 16, 16, RGBAFormat);
|
17
|
+
tempMap.minFilter = NearestFilter;
|
18
|
+
tempMap.magFilter = NearestFilter;
|
19
|
+
tempMap.wrapS = ClampToEdgeWrapping;
|
20
|
+
tempMap.wrapT = ClampToEdgeWrapping;
|
21
|
+
const occlusionMap = new DataTexture(new Uint8Array(16 * 16 * 3), 16, 16, RGBAFormat);
|
22
|
+
occlusionMap.minFilter = NearestFilter;
|
23
|
+
occlusionMap.magFilter = NearestFilter;
|
24
|
+
occlusionMap.wrapS = ClampToEdgeWrapping;
|
25
|
+
occlusionMap.wrapT = ClampToEdgeWrapping; // material
|
18
26
|
|
19
27
|
const geometry = Lensflare.Geometry;
|
20
28
|
const material1a = new RawShaderMaterial({
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "three-stdlib",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.9.0",
|
4
4
|
"private": false,
|
5
5
|
"description": "stand-alone library of threejs examples",
|
6
6
|
"main": "index.cjs.js",
|
@@ -22,7 +22,7 @@
|
|
22
22
|
"dependencies": {
|
23
23
|
"@babel/runtime": "^7.16.7",
|
24
24
|
"@webgpu/glslang": "^0.0.15",
|
25
|
-
"chevrotain": "^10.1.
|
25
|
+
"chevrotain": "^10.1.2",
|
26
26
|
"draco3d": "^1.4.1",
|
27
27
|
"fflate": "^0.6.9",
|
28
28
|
"ktx-parse": "^0.2.1",
|
@@ -32,6 +32,6 @@
|
|
32
32
|
"zstddec": "^0.0.2"
|
33
33
|
},
|
34
34
|
"peerDependencies": {
|
35
|
-
"three": ">=0.
|
35
|
+
"three": ">=0.122.0"
|
36
36
|
}
|
37
37
|
}
|
@@ -1,42 +1,14 @@
|
|
1
1
|
import { MeshBasicMaterial, WebGLRenderer, ShaderMaterial, WebGLRenderTarget } from 'three';
|
2
2
|
import { Pass, FullScreenQuad } from './Pass';
|
3
3
|
declare class AfterimagePass extends Pass {
|
4
|
-
shader:
|
5
|
-
uniforms: {
|
6
|
-
damp: {
|
7
|
-
value: number;
|
8
|
-
};
|
9
|
-
tOld: {
|
10
|
-
value: null;
|
11
|
-
};
|
12
|
-
tNew: {
|
13
|
-
value: null;
|
14
|
-
};
|
15
|
-
};
|
16
|
-
vertexShader: string;
|
17
|
-
fragmentShader: string;
|
18
|
-
};
|
4
|
+
shader: import("../shaders/AfterimageShader").IAfterimageShader;
|
19
5
|
uniforms: any;
|
20
6
|
textureComp: WebGLRenderTarget;
|
21
7
|
textureOld: WebGLRenderTarget;
|
22
8
|
shaderMaterial: ShaderMaterial;
|
23
9
|
compFsQuad: FullScreenQuad<ShaderMaterial>;
|
24
10
|
copyFsQuad: FullScreenQuad<MeshBasicMaterial>;
|
25
|
-
constructor(damp?: number, shader?:
|
26
|
-
uniforms: {
|
27
|
-
damp: {
|
28
|
-
value: number;
|
29
|
-
};
|
30
|
-
tOld: {
|
31
|
-
value: null;
|
32
|
-
};
|
33
|
-
tNew: {
|
34
|
-
value: null;
|
35
|
-
};
|
36
|
-
};
|
37
|
-
vertexShader: string;
|
38
|
-
fragmentShader: string;
|
39
|
-
});
|
11
|
+
constructor(damp?: number, shader?: import("../shaders/AfterimageShader").IAfterimageShader);
|
40
12
|
render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void;
|
41
13
|
setSize(width: number, height: number): void;
|
42
14
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("three"),e=require("./Pass.cjs.js");require("@babel/runtime/helpers/defineProperty");class n extends e.Pass{constructor(n,i,a,o,l={}){var s,d;super(),this.pixelSize=i,this.resolution=new t.Vector2,this.renderResolution=new t.Vector2,this.setSize(n.x,n.y),this.fsQuad=new e.FullScreenQuad(this.material()),this.scene=a,this.camera=o,this.normalEdgeStrength=null!=(s=l.normalEdgeStrength)?s:.3,this.depthEdgeStrength=null!=(d=l.depthEdgeStrength)?d:.4,this.rgbRenderTarget=r(this.renderResolution,t.RGBAFormat,!0),this.normalRenderTarget=r(this.renderResolution,t.RGBFormat,!1),this.normalMaterial=new t.MeshNormalMaterial}dispose(){this.rgbRenderTarget.dispose(),this.normalRenderTarget.dispose(),this.fsQuad.dispose()}setSize(t,e){var n,r,i;this.resolution.set(t,e),this.renderResolution.set(t/this.pixelSize|0,e/this.pixelSize|0);const{x:a,y:o}=this.renderResolution;null===(n=this.rgbRenderTarget)||void 0===n||n.setSize(a,o),null===(r=this.normalRenderTarget)||void 0===r||r.setSize(a,o),null===(i=this.fsQuad)||void 0===i||i.material.uniforms.resolution.value.set(a,o,1/a,1/o)}setPixelSize(t){this.pixelSize=t,this.setSize(this.resolution.x,this.resolution.y)}render(t,e){const n=this.fsQuad.material.uniforms;n.normalEdgeStrength.value=this.normalEdgeStrength,n.depthEdgeStrength.value=this.depthEdgeStrength,t.setRenderTarget(this.rgbRenderTarget),t.render(this.scene,this.camera);const r=this.scene.overrideMaterial;t.setRenderTarget(this.normalRenderTarget),this.scene.overrideMaterial=this.normalMaterial,t.render(this.scene,this.camera),this.scene.overrideMaterial=r,n.tDiffuse.value=this.rgbRenderTarget.texture,n.tDepth.value=this.rgbRenderTarget.depthTexture,n.tNormal.value=this.normalRenderTarget.texture,this.renderToScreen?t.setRenderTarget(null):(t.setRenderTarget(e),this.clear&&t.clear()),this.fsQuad.render(t)}material(){return new t.ShaderMaterial({uniforms:{tDiffuse:{value:null},tDepth:{value:null},tNormal:{value:null},resolution:{value:new t.Vector4(this.renderResolution.x,this.renderResolution.y,1/this.renderResolution.x,1/this.renderResolution.y)},normalEdgeStrength:{value:0},depthEdgeStrength:{value:0}},vertexShader:"\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t\t\t}\n\t\t\t\t",fragmentShader:"\n\t\t\t\tuniform sampler2D tDiffuse;\n\t\t\t\tuniform sampler2D tDepth;\n\t\t\t\tuniform sampler2D tNormal;\n\t\t\t\tuniform vec4 resolution;\n\t\t\t\tuniform float normalEdgeStrength;\n\t\t\t\tuniform float depthEdgeStrength;\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t\tfloat getDepth(int x, int y) {\n\n\t\t\t\t\treturn texture2D( tDepth, vUv + vec2(x, y) * resolution.zw ).r;\n\n\t\t\t\t}\n\n\t\t\t\tvec3 getNormal(int x, int y) {\n\n\t\t\t\t\treturn texture2D( tNormal, vUv + vec2(x, y) * resolution.zw ).rgb * 2.0 - 1.0;\n\n\t\t\t\t}\n\n\t\t\t\tfloat depthEdgeIndicator(float depth, vec3 normal) {\n\n\t\t\t\t\tfloat diff = 0.0;\n\t\t\t\t\tdiff += clamp(getDepth(1, 0) - depth, 0.0, 1.0);\n\t\t\t\t\tdiff += clamp(getDepth(-1, 0) - depth, 0.0, 1.0);\n\t\t\t\t\tdiff += clamp(getDepth(0, 1) - depth, 0.0, 1.0);\n\t\t\t\t\tdiff += clamp(getDepth(0, -1) - depth, 0.0, 1.0);\n\t\t\t\t\treturn floor(smoothstep(0.01, 0.02, diff) * 2.) / 2.;\n\n\t\t\t\t}\n\n\t\t\t\tfloat neighborNormalEdgeIndicator(int x, int y, float depth, vec3 normal) {\n\n\t\t\t\t\tfloat depthDiff = getDepth(x, y) - depth;\n\t\t\t\t\tvec3 neighborNormal = getNormal(x, y);\n\t\t\t\t\t\n\t\t\t\t\t// Edge pixels should yield to faces who's normals are closer to the bias normal.\n\t\t\t\t\tvec3 normalEdgeBias = vec3(1., 1., 1.); // This should probably be a parameter.\n\t\t\t\t\tfloat normalDiff = dot(normal - neighborNormal, normalEdgeBias);\n\t\t\t\t\tfloat normalIndicator = clamp(smoothstep(-.01, .01, normalDiff), 0.0, 1.0);\n\t\t\t\t\t\n\t\t\t\t\t// Only the shallower pixel should detect the normal edge.\n\t\t\t\t\tfloat depthIndicator = clamp(sign(depthDiff * .25 + .0025), 0.0, 1.0);\n\n\t\t\t\t\treturn (1.0 - dot(normal, neighborNormal)) * depthIndicator * normalIndicator;\n\n\t\t\t\t}\n\n\t\t\t\tfloat normalEdgeIndicator(float depth, vec3 normal) {\n\t\t\t\t\t\n\t\t\t\t\tfloat indicator = 0.0;\n\n\t\t\t\t\tindicator += neighborNormalEdgeIndicator(0, -1, depth, normal);\n\t\t\t\t\tindicator += neighborNormalEdgeIndicator(0, 1, depth, normal);\n\t\t\t\t\tindicator += neighborNormalEdgeIndicator(-1, 0, depth, normal);\n\t\t\t\t\tindicator += neighborNormalEdgeIndicator(1, 0, depth, normal);\n\n\t\t\t\t\treturn step(0.1, indicator);\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\t\t\tfloat depth = 0.0;\n\t\t\t\t\tvec3 normal = vec3(0.0);\n\n\t\t\t\t\tif (depthEdgeStrength > 0.0 || normalEdgeStrength > 0.0) {\n\n\t\t\t\t\t\tdepth = getDepth(0, 0);\n\t\t\t\t\t\tnormal = getNormal(0, 0);\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat dei = 0.0;\n\t\t\t\t\tif (depthEdgeStrength > 0.0) \n\t\t\t\t\t\tdei = depthEdgeIndicator(depth, normal);\n\n\t\t\t\t\tfloat nei = 0.0; \n\t\t\t\t\tif (normalEdgeStrength > 0.0) \n\t\t\t\t\t\tnei = normalEdgeIndicator(depth, normal);\n\n\t\t\t\t\tfloat Strength = dei > 0.0 ? (1.0 - depthEdgeStrength * dei) : (1.0 + normalEdgeStrength * nei);\n\n\t\t\t\t\tgl_FragColor = texel * Strength;\n\n\t\t\t\t}\n\t\t\t\t"})}}function r(e,n,r){const i=new t.WebGLRenderTarget(e.x,e.y,r?{depthTexture:new t.DepthTexture(e.x,e.y),depthBuffer:!0}:void 0);return i.texture.format=n,i.texture.minFilter=t.NearestFilter,i.texture.magFilter=t.NearestFilter,i.texture.generateMipmaps=!1,i.stencilBuffer=!1,i}exports.RenderPixelatedPass=n;
|