@equinor/videx-3d 1.0.3 → 1.1.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/dist/{chunk-BolRQZt9.js → chunk-BlPg4RjP.js} +3 -1
- package/dist/generators.js +1 -1
- package/dist/main.js +1993 -1817
- package/dist/sdk.js +490 -316
- package/dist/types/components/EventEmitter/EventEmitterContext.d.ts +2 -1
- package/dist/types/components/EventEmitter/index.d.ts +1 -0
- package/dist/types/components/EventEmitter/picking-helper.d.ts +3 -0
- package/dist/types/components/EventEmitter/picking-material.d.ts +8 -5
- package/dist/types/components/Wellbores/Casings/CasingEmitterMaterial.d.ts +16 -0
- package/dist/types/components/Wellbores/Casings/CasingSection.d.ts +3 -2
- package/dist/types/components/Wellbores/Casings/Casings.d.ts +3 -2
- package/dist/types/sdk/geometries/planar-geometry.d.ts +69 -0
- package/dist/types/sdk/index.d.ts +2 -0
- package/dist/types/sdk/utils/geojson.d.ts +15 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Camera, Object3D } from 'three';
|
|
1
|
+
import { Camera, Material, Object3D } from 'three';
|
|
2
2
|
import { Vec2, Vec3 } from '../../sdk';
|
|
3
3
|
export type KeysPressed = {
|
|
4
4
|
altKey: boolean;
|
|
@@ -22,6 +22,7 @@ export type Listener = {
|
|
|
22
22
|
ref?: any;
|
|
23
23
|
threshold?: number;
|
|
24
24
|
handlers: Record<string, EventEmitterCallback>;
|
|
25
|
+
customMaterial?: Material;
|
|
25
26
|
};
|
|
26
27
|
export type Emitter = {
|
|
27
28
|
source: Object3D;
|
|
@@ -20,6 +20,9 @@ export declare class PickingHelper {
|
|
|
20
20
|
private _pbo;
|
|
21
21
|
private _buffer;
|
|
22
22
|
private _material;
|
|
23
|
+
private _listeners;
|
|
24
|
+
private _emitters;
|
|
25
|
+
private _currentObjectMap;
|
|
23
26
|
constructor(options?: {});
|
|
24
27
|
private traverseObject;
|
|
25
28
|
updateListeners: () => void;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { Camera, Object3D, Scene, ShaderMaterial, WebGLRenderer } from 'three';
|
|
1
|
+
import { Camera, Object3D, Scene, ShaderMaterial, Uniform, WebGLRenderer } from 'three';
|
|
2
2
|
import { BufferGeometry } from 'three/webgpu';
|
|
3
|
-
|
|
3
|
+
export declare const pickingMaterialUniforms: {
|
|
4
|
+
emitterId: Uniform<number>;
|
|
5
|
+
side: Uniform<number>;
|
|
6
|
+
};
|
|
4
7
|
export declare class PickingMaterial extends ShaderMaterial {
|
|
5
|
-
listeners: Map<number, Listener>;
|
|
6
|
-
emitters: Map<number, Emitter>;
|
|
7
|
-
currentObjectMap: Array<number> | null;
|
|
8
8
|
constructor();
|
|
9
9
|
dispose(): void;
|
|
10
10
|
onBeforeRender(_renderer: WebGLRenderer, _scene: Scene, _camera: Camera, _geometry: BufferGeometry, object: Object3D): void;
|
|
11
11
|
}
|
|
12
|
+
export declare class CustomPickingMaterial extends PickingMaterial {
|
|
13
|
+
constructor(vertexShader?: string, uniforms?: Record<string, Uniform>);
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CustomPickingMaterial } from '../../EventEmitter/picking-material';
|
|
2
|
+
export declare class CasingEmitterMaterial extends CustomPickingMaterial {
|
|
3
|
+
constructor();
|
|
4
|
+
get sizeMultiplier(): number;
|
|
5
|
+
set sizeMultiplier(v: number);
|
|
6
|
+
get radius(): number;
|
|
7
|
+
set radius(v: number);
|
|
8
|
+
get innerRadius(): number;
|
|
9
|
+
set innerRadius(v: number);
|
|
10
|
+
get sliceOffset(): number;
|
|
11
|
+
set sliceOffset(v: number);
|
|
12
|
+
get sliceAngle(): number;
|
|
13
|
+
set sliceAngle(v: number);
|
|
14
|
+
get autoSlicePosition(): boolean;
|
|
15
|
+
set autoSlicePosition(v: boolean);
|
|
16
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PointerEvents } from '../../../main';
|
|
1
2
|
import { CasingSectionMaterialOptions } from './Casings';
|
|
2
3
|
import { CasingSectionType } from './casings-defs';
|
|
3
4
|
type CasingSectionProps = {
|
|
@@ -10,6 +11,6 @@ type CasingSectionProps = {
|
|
|
10
11
|
autoSlicePosition?: boolean;
|
|
11
12
|
opacity?: number;
|
|
12
13
|
renderOrder?: number;
|
|
13
|
-
};
|
|
14
|
-
export declare const CasingSection: ({ section, materialOptions, radialSegments, sizeMultiplier, sliceAngle, sliceOffset, autoSlicePosition, opacity, renderOrder, }: CasingSectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
} & PointerEvents;
|
|
15
|
+
export declare const CasingSection: ({ section, materialOptions, radialSegments, sizeMultiplier, sliceAngle, sliceOffset, autoSlicePosition, opacity, renderOrder, onPointerClick, onPointerEnter, onPointerLeave, onPointerMove, }: CasingSectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { Group, MeshStandardMaterialParameters, Object3D } from 'three';
|
|
3
3
|
import { CommonComponentProps } from '../../../common/types';
|
|
4
|
+
import { PointerEvents } from '../../../main';
|
|
4
5
|
import { CasingSectionType } from './casings-defs';
|
|
5
6
|
/**
|
|
6
7
|
* CasingSectionMaterialOptions
|
|
@@ -20,7 +21,7 @@ export type MaterialOptions = (section: CasingSectionType) => CasingSectionMater
|
|
|
20
21
|
* Casing props
|
|
21
22
|
* @expand
|
|
22
23
|
*/
|
|
23
|
-
export type CasingProps = CommonComponentProps & {
|
|
24
|
+
export type CasingProps = PointerEvents & CommonComponentProps & {
|
|
24
25
|
fallback?: () => ReactElement<Object3D>;
|
|
25
26
|
radialSegments?: number;
|
|
26
27
|
sliceAngle?: number;
|
|
@@ -55,7 +56,7 @@ export type CasingProps = CommonComponentProps & {
|
|
|
55
56
|
*
|
|
56
57
|
* @group Components
|
|
57
58
|
*/
|
|
58
|
-
export declare const Casings: import('react').ForwardRefExoticComponent<CommonComponentProps & {
|
|
59
|
+
export declare const Casings: import('react').ForwardRefExoticComponent<PointerEvents & CommonComponentProps & {
|
|
59
60
|
fallback?: () => ReactElement<Object3D>;
|
|
60
61
|
radialSegments?: number;
|
|
61
62
|
sliceAngle?: number;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Shape, Vector2 } from 'three';
|
|
2
|
+
import { Vec2 } from '../types/common';
|
|
3
|
+
export type PlanarGeometryType = 'point2d' | 'line2d' | 'polygon2d';
|
|
4
|
+
export type Coordinates2D = Vec2[];
|
|
5
|
+
export type PlanarPointCoordinates = Coordinates2D;
|
|
6
|
+
export type PlanarLineCoordinates = Coordinates2D[];
|
|
7
|
+
export type PlanarPolygonCoordinates = Coordinates2D[][];
|
|
8
|
+
export type PlanarGeometryCoordinates = PlanarPointCoordinates | PlanarLineCoordinates | PlanarPolygonCoordinates;
|
|
9
|
+
export type CoordinatesTransformFunction = (coord: Vec2) => Vec2;
|
|
10
|
+
/**
|
|
11
|
+
* A simple abstraction for defining 2D points, lines or polygons,
|
|
12
|
+
* primarily for making it easier to work with GeoJson in videx-3d.
|
|
13
|
+
*/
|
|
14
|
+
export declare abstract class PlanarGeometry {
|
|
15
|
+
type: PlanarGeometryType;
|
|
16
|
+
coordinates: PlanarGeometryCoordinates;
|
|
17
|
+
private _min;
|
|
18
|
+
private _max;
|
|
19
|
+
private _size;
|
|
20
|
+
protected _offset: Vec2;
|
|
21
|
+
constructor(type: PlanarGeometryType, coordinates: PlanarGeometryCoordinates, offset?: Vec2);
|
|
22
|
+
static fromPointCoordinates(coordinates: PlanarPointCoordinates, transform?: CoordinatesTransformFunction): PlanarPointGeometry;
|
|
23
|
+
static fromLineCoordinates(coordinates: PlanarLineCoordinates, transform?: CoordinatesTransformFunction): PlanarLineGeometry;
|
|
24
|
+
static fromPolygonCoordinates(coordinates: PlanarPolygonCoordinates, transform?: CoordinatesTransformFunction): PlanarPolygonGeometry;
|
|
25
|
+
abstract forEachCoordinate(callback: (pos: Vec2) => void): void;
|
|
26
|
+
private _calculateBounds;
|
|
27
|
+
get min(): Vec2;
|
|
28
|
+
get max(): Vec2;
|
|
29
|
+
get center(): Vec2;
|
|
30
|
+
get size(): Vec2;
|
|
31
|
+
get offset(): Vec2;
|
|
32
|
+
setOffset(offset: Vec2): void;
|
|
33
|
+
removeOffset(): void;
|
|
34
|
+
centralize(): void;
|
|
35
|
+
normalize(scale?: Vec2, offset?: Vec2): void;
|
|
36
|
+
transform(transformFunc: CoordinatesTransformFunction): void;
|
|
37
|
+
abstract clone(): PlanarGeometry;
|
|
38
|
+
toObject(): {
|
|
39
|
+
type: string;
|
|
40
|
+
coordinates: PlanarGeometryCoordinates;
|
|
41
|
+
offset: Vec2;
|
|
42
|
+
};
|
|
43
|
+
abstract getPoints(): Vector2[][];
|
|
44
|
+
getPointsFlattened(): Vector2[];
|
|
45
|
+
getBounds(): {
|
|
46
|
+
min: Vec2;
|
|
47
|
+
max: Vec2;
|
|
48
|
+
size: Vec2;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export declare class PlanarPointGeometry extends PlanarGeometry {
|
|
52
|
+
constructor(coordinates: PlanarPointCoordinates, offset?: Vec2);
|
|
53
|
+
forEachCoordinate(callback: (pos: Vec2) => void): void;
|
|
54
|
+
getPoints(): Vector2[][];
|
|
55
|
+
clone(): PlanarPointGeometry;
|
|
56
|
+
}
|
|
57
|
+
export declare class PlanarLineGeometry extends PlanarGeometry {
|
|
58
|
+
constructor(coordinates: PlanarLineCoordinates, offset?: Vec2);
|
|
59
|
+
forEachCoordinate(callback: (pos: Vec2) => void): void;
|
|
60
|
+
getPoints(): Vector2[][];
|
|
61
|
+
clone(): PlanarLineGeometry;
|
|
62
|
+
}
|
|
63
|
+
export declare class PlanarPolygonGeometry extends PlanarGeometry {
|
|
64
|
+
constructor(coordinates: PlanarPolygonCoordinates, offset?: Vec2);
|
|
65
|
+
forEachCoordinate(callback: (pos: Vec2) => void): void;
|
|
66
|
+
getPoints(): Vector2[][];
|
|
67
|
+
clone(): PlanarPolygonGeometry;
|
|
68
|
+
toShapes(): Shape[];
|
|
69
|
+
}
|
|
@@ -11,7 +11,9 @@ export * from './geometries/curve/curve-3d';
|
|
|
11
11
|
export * from './geometries/curve/tube-geometry';
|
|
12
12
|
export * from './geometries/delatin';
|
|
13
13
|
export * from './geometries/fence';
|
|
14
|
+
export * from './geometries/geometry';
|
|
14
15
|
export * from './geometries/packing';
|
|
16
|
+
export * from './geometries/planar-geometry';
|
|
15
17
|
export * from './geometries/triangulate-grid';
|
|
16
18
|
export * from './geometries/triangulate-grid-delaunay';
|
|
17
19
|
export * from './managers/CameraManager';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CoordinatesTransformFunction, PlanarGeometry } from '../geometries/planar-geometry';
|
|
2
|
+
export type GeoJsonFeature = {
|
|
3
|
+
properties: Record<string, any>;
|
|
4
|
+
geometry: PlanarGeometry;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Simple helper function to parse a GeoJSON feature into a videx-3d GeoJsonFeature type,
|
|
8
|
+
* where the geometry is represented as an instance of PlanarGeometry.
|
|
9
|
+
* @param feature GeoJSON feature object
|
|
10
|
+
* @param transform Coordinate conversion function (i.e. from wgs84 to 3D world coordinates)
|
|
11
|
+
* @returns GeoJsonFeature type
|
|
12
|
+
*
|
|
13
|
+
* @see PlanarGeometry
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseGeoJsonFeature(feature: any, transform?: CoordinatesTransformFunction): GeoJsonFeature;
|