@takram/three-clouds 0.6.0 → 0.7.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takram/three-clouds",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "description": "A Three.js and R3F implementation of geospatial volumetric clouds",
5
5
  "keywords": [
6
6
  "three",
@@ -45,15 +45,15 @@
45
45
  "README.md"
46
46
  ],
47
47
  "dependencies": {
48
- "@takram/three-atmosphere": "0.16.0",
49
- "@takram/three-geospatial": "0.6.0",
48
+ "@takram/three-atmosphere": "0.17.0",
49
+ "@takram/three-geospatial": "0.7.0",
50
50
  "tiny-invariant": "^1.3.3",
51
- "type-fest": "^4.41.0"
51
+ "type-fest": "^5.4.4"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@react-three/fiber": ">=9.0.4",
55
55
  "@react-three/postprocessing": ">=3.0.4",
56
- "postprocessing": ">=6.36.7",
56
+ "postprocessing": ">=6.38.0",
57
57
  "react": ">=19.0",
58
58
  "three": ">=0.170.0"
59
59
  },
@@ -14,8 +14,8 @@
14
14
  * copies of the Software, and to permit persons to whom the Software is
15
15
  * furnished to do so, subject to the following conditions:
16
16
  *
17
- * The above copyright notice and this permission notice shall be included in all
18
- * copies or substantial portions of the Software.
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
19
  *
20
20
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
21
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
package/src/CloudLayer.ts CHANGED
@@ -14,10 +14,9 @@ const paramKeys = [
14
14
  'densityProfile'
15
15
  ] as const
16
16
 
17
- export interface CloudLayerLike
18
- extends Partial<
19
- Pick<CloudLayer, Exclude<(typeof paramKeys)[number], 'densityProfile'>>
20
- > {
17
+ export interface CloudLayerLike extends Partial<
18
+ Pick<CloudLayer, Exclude<(typeof paramKeys)[number], 'densityProfile'>>
19
+ > {
21
20
  densityProfile?: DensityProfileLike
22
21
  }
23
22
 
@@ -119,11 +119,13 @@ const shadowMapsParameterKeys = [
119
119
  ] as const satisfies Array<keyof CascadedShadowMaps>
120
120
 
121
121
  interface CloudsShorthand
122
- extends UniformShorthand<CloudsMaterial, (typeof cloudsUniformKeys)[number]>,
122
+ extends
123
+ UniformShorthand<CloudsMaterial, (typeof cloudsUniformKeys)[number]>,
123
124
  PropertyShorthand<[CloudsMaterial, typeof cloudsMaterialParameterKeys]> {}
124
125
 
125
126
  interface ShadowShorthand
126
- extends UniformShorthand<ShadowMaterial, (typeof shadowUniformKeys)[number]>,
127
+ extends
128
+ UniformShorthand<ShadowMaterial, (typeof shadowUniformKeys)[number]>,
127
129
  PropertyShorthand<
128
130
  [
129
131
  ShadowMaterial,
@@ -699,16 +701,6 @@ export class CloudsEffect extends Effect {
699
701
  this.cloudsPass.currentMaterial.scatterAnisotropyMix = value
700
702
  }
701
703
 
702
- /** @deprecated Use skyLightScale instead. */
703
- get skyIrradianceScale(): number {
704
- return this.skyLightScale
705
- }
706
-
707
- /** @deprecated Use skyLightScale instead. */
708
- set skyIrradianceScale(value: number) {
709
- this.skyLightScale = value
710
- }
711
-
712
704
  get skyLightScale(): number {
713
705
  return this.cloudsPass.currentMaterial.uniforms.skyLightScale.value
714
706
  }
@@ -717,16 +709,6 @@ export class CloudsEffect extends Effect {
717
709
  this.cloudsPass.currentMaterial.uniforms.skyLightScale.value = value
718
710
  }
719
711
 
720
- /** @deprecated Use groundBounceScale instead. */
721
- get groundIrradianceScale(): number {
722
- return this.groundBounceScale
723
- }
724
-
725
- /** @deprecated Use groundBounceScale instead. */
726
- set groundIrradianceScale(value: number) {
727
- this.groundBounceScale = value
728
- }
729
-
730
712
  get groundBounceScale(): number {
731
713
  return this.cloudsPass.currentMaterial.uniforms.groundBounceScale.value
732
714
  }
@@ -73,9 +73,7 @@ export interface CloudsMaterialParameters {
73
73
  }
74
74
 
75
75
  export interface CloudsMaterialUniforms
76
- extends CloudParameterUniforms,
77
- CloudLayerUniforms,
78
- AtmosphereUniforms {
76
+ extends CloudParameterUniforms, CloudLayerUniforms, AtmosphereUniforms {
79
77
  depthBuffer: Uniform<Texture | null>
80
78
  viewMatrix: Uniform<Matrix4>
81
79
  inverseProjectionMatrix: Uniform<Matrix4>
@@ -458,16 +456,6 @@ export class CloudsMaterial extends AtmosphereMaterialBase {
458
456
  @defineInt('MULTI_SCATTERING_OCTAVES', { min: 1, max: 12 })
459
457
  multiScatteringOctaves: number = defaults.clouds.multiScatteringOctaves
460
458
 
461
- /** @deprecated Use accurateSunSkyLight instead. */
462
- get accurateSunSkyIrradiance(): boolean {
463
- return this.accurateSunSkyLight
464
- }
465
-
466
- /** @deprecated Use accurateSunSkyLight instead. */
467
- set accurateSunSkyIrradiance(value: boolean) {
468
- this.accurateSunSkyLight = value
469
- }
470
-
471
459
  @define('ACCURATE_SUN_SKY_LIGHT')
472
460
  accurateSunSkyLight: boolean = defaults.clouds.accurateSunSkyLight
473
461
 
@@ -1,7 +1,6 @@
1
- export interface DensityProfileLike
2
- extends Partial<
3
- Pick<DensityProfile, 'expTerm' | 'exponent' | 'linearTerm' | 'constantTerm'>
4
- > {}
1
+ export interface DensityProfileLike extends Partial<
2
+ Pick<DensityProfile, 'expTerm' | 'exponent' | 'linearTerm' | 'constantTerm'>
3
+ > {}
5
4
 
6
5
  export class DensityProfile {
7
6
  constructor(
@@ -37,9 +37,7 @@ export interface ShadowMaterialParameters {
37
37
  }
38
38
 
39
39
  export interface ShadowMaterialUniforms
40
- extends CloudParameterUniforms,
41
- CloudLayerUniforms,
42
- AtmosphereUniforms {
40
+ extends CloudParameterUniforms, CloudLayerUniforms, AtmosphereUniforms {
43
41
  [key: string]: Uniform<unknown>
44
42
  inverseShadowMatrices: Uniform<Matrix4[]>
45
43
  reprojectionMatrices: Uniform<Matrix4[]>
@@ -14,8 +14,8 @@
14
14
  * copies of the Software, and to permit persons to whom the Software is
15
15
  * furnished to do so, subject to the following conditions:
16
16
  *
17
- * The above copyright notice and this permission notice shall be included in all
18
- * copies or substantial portions of the Software.
17
+ * The above copyright notice and this permission notice shall be included in
18
+ * all copies or substantial portions of the Software.
19
19
  *
20
20
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
21
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
@@ -17,8 +17,7 @@ import { CloudLayers } from '../CloudLayers'
17
17
  import { CloudLayersContext } from './CloudLayers'
18
18
 
19
19
  export interface CloudLayerProps
20
- extends CloudLayerLike,
21
- ExpandNestedProps<CloudLayerLike, 'densityProfile'> {
20
+ extends CloudLayerLike, ExpandNestedProps<CloudLayerLike, 'densityProfile'> {
22
21
  ref?: Ref<CloudLayerImpl>
23
22
  index?: number
24
23
  }
@@ -117,20 +117,19 @@ function useLoadSTBNTexture(
117
117
  return (typeof input === 'string' ? loadedTexture : input) ?? null
118
118
  }
119
119
 
120
- export interface CloudsProps
121
- extends Omit<
122
- ElementProps<
123
- typeof CloudsEffect,
124
- CloudsEffect &
125
- ExpandNestedProps<CloudsEffect, 'clouds'> &
126
- ExpandNestedProps<CloudsEffect, 'shadow'>
127
- >,
128
- | 'localWeatherTexture'
129
- | 'shapeTexture'
130
- | 'shapeDetailTexture'
131
- | 'turbulenceTexture'
132
- | 'stbnTexture'
133
- > {
120
+ export interface CloudsProps extends Omit<
121
+ ElementProps<
122
+ typeof CloudsEffect,
123
+ CloudsEffect &
124
+ ExpandNestedProps<CloudsEffect, 'clouds'> &
125
+ ExpandNestedProps<CloudsEffect, 'shadow'>
126
+ >,
127
+ | 'localWeatherTexture'
128
+ | 'shapeTexture'
129
+ | 'shapeDetailTexture'
130
+ | 'turbulenceTexture'
131
+ | 'stbnTexture'
132
+ > {
134
133
  disableDefaultLayers?: boolean
135
134
  localWeatherTexture?: Texture | ProceduralTexture | string
136
135
  shapeTexture?: Data3DTexture | Procedural3DTexture | string
@@ -819,8 +819,8 @@ vec2 getHazeRayNearFar(const IntersectionResult intersections) {
819
819
 
820
820
  float getRayDistanceToScene(const vec3 rayDirection, out float viewZ) {
821
821
  float depth = readDepth(vUv * targetUvScale + temporalJitter);
822
+ depth = reverseLogDepth(depth, cameraNear, cameraFar);
822
823
  if (depth < 1.0 - 1e-7) {
823
- depth = reverseLogDepth(depth, cameraNear, cameraFar);
824
824
  viewZ = getViewZ(depth);
825
825
  return -viewZ / dot(rayDirection, vCameraDirection);
826
826
  }
@@ -139,16 +139,8 @@ export declare class CloudsEffect extends Effect {
139
139
  set scatterAnisotropy2(value: number);
140
140
  get scatterAnisotropyMix(): number;
141
141
  set scatterAnisotropyMix(value: number);
142
- /** @deprecated Use skyLightScale instead. */
143
- get skyIrradianceScale(): number;
144
- /** @deprecated Use skyLightScale instead. */
145
- set skyIrradianceScale(value: number);
146
142
  get skyLightScale(): number;
147
143
  set skyLightScale(value: number);
148
- /** @deprecated Use groundBounceScale instead. */
149
- get groundIrradianceScale(): number;
150
- /** @deprecated Use groundBounceScale instead. */
151
- set groundIrradianceScale(value: number);
152
144
  get groundBounceScale(): number;
153
145
  set groundBounceScale(value: number);
154
146
  get powderScale(): number;
@@ -72,10 +72,6 @@ export declare class CloudsMaterial extends AtmosphereMaterialBase {
72
72
  shadowLength: boolean;
73
73
  haze: boolean;
74
74
  multiScatteringOctaves: number;
75
- /** @deprecated Use accurateSunSkyLight instead. */
76
- get accurateSunSkyIrradiance(): boolean;
77
- /** @deprecated Use accurateSunSkyLight instead. */
78
- set accurateSunSkyIrradiance(value: boolean);
79
75
  accurateSunSkyLight: boolean;
80
76
  accuratePhaseFunction: boolean;
81
77
  shadowCascadeCount: number;