@takram/three-geospatial 0.0.1-alpha.6 → 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,3 +1,4 @@
1
1
  export declare const STBN_TEXTURE_WIDTH = 128;
2
2
  export declare const STBN_TEXTURE_HEIGHT = 128;
3
3
  export declare const STBN_TEXTURE_DEPTH = 64;
4
+ export declare const DEFAULT_STBN_URL = "https://media.githubusercontent.com/media/takram-design-engineering/three-geospatial/9627216cc50057994c98a2118f3c4a23765d43b9/packages/core/assets/stbn.bin";
@@ -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 {};
@@ -0,0 +1,16 @@
1
+ import { Uniform } from 'three';
2
+
3
+ export type PropertyShorthand<Args extends readonly unknown[]> = Args extends readonly [infer T, infer K, ...infer Rest] ? K extends readonly string[] ? K[number] extends keyof T ? Rest extends readonly unknown[] ? {
4
+ [P in K[number]]: T[P];
5
+ } & PropertyShorthand<Rest> : {
6
+ [P in K[number]]: T[P];
7
+ } : never : never : {};
8
+ export declare function definePropertyShorthand<T, Args extends readonly unknown[]>(destination: T, ...sourceKeysArgs: [...Args]): T & PropertyShorthand<Args>;
9
+ export type UniformShorthand<T extends {
10
+ uniforms: Record<K, Uniform>;
11
+ }, K extends keyof T['uniforms']> = {
12
+ [P in K]: T['uniforms'][P] extends Uniform<infer U> ? U : never;
13
+ };
14
+ export declare function defineUniformShorthand<T, S extends {
15
+ uniforms: Record<K, Uniform>;
16
+ }, K extends keyof S['uniforms']>(destination: T, source: S, keys: readonly K[]): T & UniformShorthand<S, K>;
package/types/index.d.ts CHANGED
@@ -3,6 +3,8 @@ export * from './assertions';
3
3
  export * from './bufferGeometry';
4
4
  export * from './constants';
5
5
  export * from './DataLoader';
6
+ export * from './decorators';
7
+ export * from './defineShorthand';
6
8
  export * from './Ellipsoid';
7
9
  export * from './EllipsoidGeometry';
8
10
  export * from './Geodetic';
@@ -10,6 +12,7 @@ export * from './math';
10
12
  export * from './PointOfView';
11
13
  export * from './Rectangle';
12
14
  export * from './resolveIncludes';
15
+ export * from './STBNLoader';
13
16
  export * from './TileCoordinate';
14
17
  export * from './TilingScheme';
15
18
  export * from './typedArray';
package/types/math.d.ts CHANGED
@@ -8,7 +8,10 @@ export declare const isPowerOfTwo: typeof import('three/src/math/MathUtils.js').
8
8
  export declare const ceilPowerOfTwo: typeof import('three/src/math/MathUtils.js').ceilPowerOfTwo;
9
9
  export declare const floorPowerOfTwo: typeof import('three/src/math/MathUtils.js').floorPowerOfTwo;
10
10
  export declare const normalize: typeof import('three/src/math/MathUtils.js').normalize;
11
- export declare const remap: typeof import('three/src/math/MathUtils.js').mapLinear;
11
+ export declare function remap(x: number, min1: number, max1: number): number;
12
+ export declare function remap(x: number, min1: number, max1: number, min2: number, max2: number): number;
13
+ export declare function remapClamped(x: number, min1: number, max1: number): number;
14
+ export declare function remapClamped(x: number, min1: number, max1: number, min2: number, max2: number): number;
12
15
  export declare function smoothstep(min: number, max: number, x: number): number;
13
16
  export declare function saturate(x: number): number;
14
17
  export declare function closeTo(a: number, b: number, relativeEpsilon: number, absoluteEpsilon?: number): boolean;
@@ -1,22 +1,21 @@
1
1
  import { Callable } from '../types';
2
2
  import { WritableKeysOf } from 'type-fest';
3
- import { Vector2 as Vector2Impl, Vector3 as Vector3Impl, Vector4 as Vector4Impl } from 'three';
4
- import { Color, ExtendedColors, NodeProps, Overwrite, Vector2, Vector3, Vector4 } from '@react-three/fiber';
3
+ import { Color as ColorImpl, Vector2 as Vector2Impl, Vector3 as Vector3Impl, Vector4 as Vector4Impl } from 'three';
4
+ import { NodeProps, Overwrite, Color as R3FColor, Vector2 as R3FVector2, Vector3 as R3FVector3, Vector4 as R3FVector4 } from '@react-three/fiber';
5
5
 
6
- export type ExtendedVectors<T> = {
7
- [K in keyof T]: Vector2Impl extends T[K] ? Vector2 | T[K] : Vector3Impl extends T[K] ? Vector3 | T[K] : Vector4Impl extends T[K] ? Vector4 | T[K] : T[K];
6
+ export type ExtendedProps<T> = {
7
+ [K in keyof T]: Vector2Impl extends T[K] ? R3FVector2 | T[K] : Vector3Impl extends T[K] ? R3FVector3 | T[K] : Vector4Impl extends T[K] ? R3FVector4 | T[K] : ColorImpl extends T[K] ? R3FColor | T[K] : T[K];
8
8
  };
9
- export type ExtendedProps<T> = ExtendedColors<ExtendedVectors<T>>;
10
9
  type NonFunctionKeys<T> = keyof {
11
10
  [K in keyof T as Callable extends T[K] ? never : K]: any;
12
11
  };
13
12
  type WritableNonExtendableKeysOf<T> = WritableKeysOf<T> | keyof {
14
- [K in keyof T as Vector2Impl extends T[K] ? K : Vector3Impl extends T[K] ? K : Vector4Impl extends T[K] ? K : Color extends T[K] ? K : never]: any;
13
+ [K in keyof T as Vector2Impl extends T[K] ? K : Vector3Impl extends T[K] ? K : Vector4Impl extends T[K] ? K : ColorImpl extends T[K] ? K : never]: any;
15
14
  };
16
15
  export type PassThoughInstanceProps<RefType, Args extends readonly any[], Props> = Overwrite<ExtendedProps<{
17
16
  [K in NonFunctionKeys<Props> as K extends WritableNonExtendableKeysOf<Props> ? K : never]: Props[K];
18
17
  }>, NodeProps<RefType, Args>>;
19
18
  export type ExpandNestedProps<T, Prop extends keyof T & string> = {
20
- [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];
21
20
  };
22
21
  export {};
@@ -1,8 +1,10 @@
1
+ export declare const cascadedShadowMaps: string;
1
2
  export declare const depth: string;
2
3
  export declare const generators: string;
4
+ export declare const interleavedGradientNoise: string;
3
5
  export declare const math: string;
4
6
  export declare const packing: string;
5
- export declare const poissonDisk: string;
6
7
  export declare const raySphereIntersection: string;
7
8
  export declare const transform: string;
8
9
  export declare const turbo: string;
10
+ export declare const vogelDisk: string;
@@ -1,21 +0,0 @@
1
- // Taken from: https://developer.download.nvidia.com/whitepapers/2008/PCSS_Integration.pdf
2
- const vec2 poissonDisk[16] = vec2[16](
3
- vec2(-0.94201624, -0.39906216),
4
- vec2(0.94558609, -0.76890725),
5
- vec2(-0.094184101, -0.9293887),
6
- vec2(0.34495938, 0.2938776),
7
- vec2(-0.91588581, 0.45771432),
8
- vec2(-0.81544232, -0.87912464),
9
- vec2(-0.38277543, 0.27676845),
10
- vec2(0.97484398, 0.75648379),
11
- vec2(0.44323325, -0.97511554),
12
- vec2(0.53742981, -0.4737342),
13
- vec2(-0.26496911, -0.41893023),
14
- vec2(0.79197514, 0.19090188),
15
- vec2(-0.2418884, 0.99706507),
16
- vec2(-0.81409955, 0.9143759),
17
- vec2(0.19984126, 0.78641367),
18
- vec2(0.14383161, -0.1410079)
19
- );
20
-
21
- #define POISSON_DISK_COUNT (16)