@takram/three-geospatial 0.0.1-alpha.7 → 0.0.1-alpha.8

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.
@@ -1,19 +1,21 @@
1
1
  import _cascadedShadowMaps from './cascadedShadowMaps.glsl?raw'
2
2
  import _depth from './depth.glsl?raw'
3
3
  import _generators from './generators.glsl?raw'
4
+ import _interleavedGradientNoise from './interleavedGradientNoise.glsl?raw'
4
5
  import _math from './math.glsl?raw'
5
6
  import _packing from './packing.glsl?raw'
6
- import _poissonDisk from './poissonDisk.glsl?raw'
7
7
  import _raySphereIntersection from './raySphereIntersection.glsl?raw'
8
8
  import _transform from './transform.glsl?raw'
9
9
  import _turbo from './turbo.glsl?raw'
10
+ import _vogelDisk from './vogelDisk.glsl?raw'
10
11
 
11
12
  export const cascadedShadowMaps: string = _cascadedShadowMaps
12
13
  export const depth: string = _depth
13
14
  export const generators: string = _generators
15
+ export const interleavedGradientNoise = _interleavedGradientNoise
14
16
  export const math: string = _math
15
17
  export const packing: string = _packing
16
- export const poissonDisk: string = _poissonDisk
17
18
  export const raySphereIntersection: string = _raySphereIntersection
18
19
  export const transform: string = _transform
19
20
  export const turbo: string = _turbo
21
+ export const vogelDisk = _vogelDisk
@@ -0,0 +1,6 @@
1
+ // Reference: https://advances.realtimerendering.com/s2014/index.html#_NEXT_GENERATION_POST
2
+
3
+ float interleavedGradientNoise(const vec2 coord) {
4
+ const vec3 magic = vec3(0.06711056, 0.00583715, 52.9829189);
5
+ return fract(magic.z * fract(dot(coord, magic.xy)));
6
+ }
@@ -0,0 +1,8 @@
1
+ // Reference: https://www.gamedev.net/tutorials/programming/graphics/contact-hardening-soft-shadows-made-fast-r4906/
2
+
3
+ vec2 vogelDisk(const int index, const int sampleCount, const float phi) {
4
+ const float goldenAngle = 2.39996322972865332;
5
+ float r = sqrt(float(index) + 0.5) / sqrt(float(sampleCount));
6
+ float theta = float(index) * goldenAngle + phi;
7
+ return r * vec2(cos(theta), sin(theta));
8
+ }
@@ -7,15 +7,15 @@ import { Data3DTexture, DataTexture, Loader, TypedArray } from 'three';
7
7
  type ParameterProperties<T> = {
8
8
  [K in WritableKeysOf<T> as T[K] extends Callable ? never : K]: T[K];
9
9
  };
10
- export type DataTextureParameters = Omit<Partial<ParameterProperties<DataTexture>>, 'image'> & {
10
+ export interface DataTextureParameters extends Omit<Partial<ParameterProperties<DataTexture>>, 'image'> {
11
11
  width?: number;
12
12
  height?: number;
13
- };
14
- export type Data3DTextureParameters = Omit<Partial<ParameterProperties<Data3DTexture>>, 'image'> & {
13
+ }
14
+ export interface Data3DTextureParameters extends Omit<Partial<ParameterProperties<Data3DTexture>>, 'image'> {
15
15
  width?: number;
16
16
  height?: number;
17
17
  depth?: number;
18
- };
18
+ }
19
19
  export declare abstract class DataLoader<T extends DataTexture | Data3DTexture = DataTexture | Data3DTexture, U extends TypedArray = TypedArray> extends Loader<T> {
20
20
  abstract readonly Texture: Class<T>;
21
21
  abstract readonly TypedArrayLoader: Class<TypedArrayLoader<U>>;
@@ -1,5 +1,6 @@
1
1
  import { BufferGeometry } from 'three';
2
2
 
3
- export type BufferGeometryLike = Pick<BufferGeometry, 'attributes' | 'index' | 'boundingBox' | 'boundingSphere'>;
3
+ export interface BufferGeometryLike extends Pick<BufferGeometry, 'attributes' | 'index' | 'boundingBox' | 'boundingSphere'> {
4
+ }
4
5
  export declare function toBufferGeometryLike(geometry: BufferGeometry): [BufferGeometryLike, ArrayBuffer[]];
5
6
  export declare function fromBufferGeometryLike(input: BufferGeometryLike, result?: BufferGeometry<import('three').NormalBufferAttributes>): BufferGeometry;
@@ -0,0 +1,22 @@
1
+ import { Material } from 'three';
2
+
3
+ interface EffectLike {
4
+ defines: Map<string, string>;
5
+ }
6
+ export declare function define(name: string): <T extends Material | EffectLike, K extends keyof T>(target: T[K] extends boolean ? T : never, propertyKey: K) => void;
7
+ export interface DefineIntDecoratorOptions {
8
+ min?: number;
9
+ max?: number;
10
+ }
11
+ export declare function defineInt(name: string, { min, max }?: DefineIntDecoratorOptions): <T extends Material | EffectLike, K extends keyof T>(target: T[K] extends number ? T : never, propertyKey: K) => void;
12
+ export interface DefineFloatDecoratorOptions {
13
+ min?: number;
14
+ max?: number;
15
+ precision?: number;
16
+ }
17
+ export declare function defineFloat(name: string, { min, max, precision }?: DefineFloatDecoratorOptions): <T extends Material | EffectLike, K extends keyof T>(target: T[K] extends number ? T : never, propertyKey: K) => void;
18
+ export interface DefineExpressionDecoratorOptions {
19
+ validate?: (value: string) => boolean;
20
+ }
21
+ export declare function defineExpression(name: string, { validate }?: DefineExpressionDecoratorOptions): <T extends Material | EffectLike, K extends keyof T>(target: T[K] extends string ? T : never, propertyKey: K) => void;
22
+ export {};
package/types/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from './assertions';
3
3
  export * from './bufferGeometry';
4
4
  export * from './constants';
5
5
  export * from './DataLoader';
6
+ export * from './decorators';
6
7
  export * from './defineShorthand';
7
8
  export * from './Ellipsoid';
8
9
  export * from './EllipsoidGeometry';
@@ -16,6 +16,6 @@ export type PassThoughInstanceProps<RefType, Args extends readonly any[], Props>
16
16
  [K in NonFunctionKeys<Props> as K extends WritableNonExtendableKeysOf<Props> ? K : never]: Props[K];
17
17
  }>, NodeProps<RefType, Args>>;
18
18
  export type ExpandNestedProps<T, Prop extends keyof T & string> = {
19
- [K in keyof T[Prop] as K extends string ? `${Prop}-${K}` : never]: T[Prop][K];
19
+ [K in keyof NonNullable<T[Prop]> as K extends string ? `${Prop}-${K}` : 'never']: NonNullable<T[Prop]>[K];
20
20
  };
21
21
  export {};
@@ -1,9 +1,10 @@
1
1
  export declare const cascadedShadowMaps: string;
2
2
  export declare const depth: string;
3
3
  export declare const generators: string;
4
+ export declare const interleavedGradientNoise: string;
4
5
  export declare const math: string;
5
6
  export declare const packing: string;
6
- export declare const poissonDisk: string;
7
7
  export declare const raySphereIntersection: string;
8
8
  export declare const transform: string;
9
9
  export declare const turbo: string;
10
+ export declare const vogelDisk: string;
@@ -1,23 +0,0 @@
1
- // TODO: Maybe switch to Vogel disk with IGN:
2
- // https://www.gamedev.net/tutorials/programming/graphics/contact-hardening-soft-shadows-made-fast-r4906/
3
- // Taken from: https://developer.download.nvidia.com/whitepapers/2008/PCSS_Integration.pdf
4
- const vec2 poissonDisk[16] = vec2[16](
5
- vec2(-0.94201624, -0.39906216),
6
- vec2(0.94558609, -0.76890725),
7
- vec2(-0.094184101, -0.9293887),
8
- vec2(0.34495938, 0.2938776),
9
- vec2(-0.91588581, 0.45771432),
10
- vec2(-0.81544232, -0.87912464),
11
- vec2(-0.38277543, 0.27676845),
12
- vec2(0.97484398, 0.75648379),
13
- vec2(0.44323325, -0.97511554),
14
- vec2(0.53742981, -0.4737342),
15
- vec2(-0.26496911, -0.41893023),
16
- vec2(0.79197514, 0.19090188),
17
- vec2(-0.2418884, 0.99706507),
18
- vec2(-0.81409955, 0.9143759),
19
- vec2(0.19984126, 0.78641367),
20
- vec2(0.14383161, -0.1410079)
21
- );
22
-
23
- #define POISSON_DISK_COUNT (16)