@equinor/videx-3d 3.0.0 → 3.2.0

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,16 +1,17 @@
1
1
  import { ReactElement } from 'react';
2
- import { Group, MeshStandardMaterialParameters, Object3D } from 'three';
2
+ import { Group, Object3D } from 'three';
3
3
  import { CommonComponentProps } from '../../../common/types';
4
4
  import { PointerEvents } from '../../../main';
5
+ import { CasingEffects, CasingMaterialParameters } from './CasingMaterial';
5
6
  import { CasingSectionType } from './casings-defs';
6
7
  /**
7
8
  * CasingSectionMaterialOptions
8
9
  * @expand
9
10
  */
10
11
  export type CasingSectionMaterialOptions = {
11
- primary: MeshStandardMaterialParameters;
12
- inner?: MeshStandardMaterialParameters;
13
- slice?: MeshStandardMaterialParameters;
12
+ primary: CasingMaterialParameters;
13
+ inner?: CasingMaterialParameters;
14
+ slice?: CasingMaterialParameters;
14
15
  };
15
16
  /**
16
17
  * MaterialOptions
@@ -31,9 +32,29 @@ export type CasingProps = PointerEvents & CommonComponentProps & {
31
32
  shoeFactor?: number;
32
33
  overrideSegmentsPerMeter?: number;
33
34
  overrideSimplificationThreshold?: number;
35
+ /** Schematic (diagram) mode: an unlit, flat-shaded look for a clean "cutaway
36
+ * schematic" rather than realism. Locks the slice to a half-cut that always faces
37
+ * the camera (`sliceAngle = PI`, `autoSlicePosition = true`, `sliceOffset = 0` -
38
+ * those props are ignored), renders each face with only its flat `color` (all
39
+ * lighting/env, textures and realism detail are ignored) plus the `silhouette`
40
+ * outline for contrast. Dropping the specular lighting also removes the dominant
41
+ * source of casing aliasing; note that geometric silhouette-edge anti-aliasing still
42
+ * relies on the host render pipeline (MSAA/FXAA/SMAA). Default false. */
43
+ schematic?: boolean;
44
+ /** Maps each section to its material parameters. Keep this a STABLE reference
45
+ * (module-level function or `useCallback`) - a new function identity each render
46
+ * rebuilds every section's materials and forces a shader recompile per frame,
47
+ * which is the main cause of sluggish casing updates. Defaults to a stable
48
+ * module-level function. */
34
49
  materialOptions?: MaterialOptions;
35
50
  opacity?: number;
36
51
  priority?: number;
52
+ /** Grouped casing stylization effects (silhouette outline, section edge shading,
53
+ * procedural weathering, per-section variation and micro-normal surface detail).
54
+ * Applied as the global default for every section; a section's per-face
55
+ * `materialOptions.*.effects` override individual sub-effects on top of this.
56
+ * Defaults to {@link defaultCasingEffects}. */
57
+ effects?: CasingEffects;
37
58
  };
38
59
  /**
39
60
  * Generic render of casings based on depths, diameters and type. Must be a child of the `Wellbore` component.
@@ -66,7 +87,27 @@ export declare const Casings: import('react').ForwardRefExoticComponent<PointerE
66
87
  shoeFactor?: number;
67
88
  overrideSegmentsPerMeter?: number;
68
89
  overrideSimplificationThreshold?: number;
90
+ /** Schematic (diagram) mode: an unlit, flat-shaded look for a clean "cutaway
91
+ * schematic" rather than realism. Locks the slice to a half-cut that always faces
92
+ * the camera (`sliceAngle = PI`, `autoSlicePosition = true`, `sliceOffset = 0` -
93
+ * those props are ignored), renders each face with only its flat `color` (all
94
+ * lighting/env, textures and realism detail are ignored) plus the `silhouette`
95
+ * outline for contrast. Dropping the specular lighting also removes the dominant
96
+ * source of casing aliasing; note that geometric silhouette-edge anti-aliasing still
97
+ * relies on the host render pipeline (MSAA/FXAA/SMAA). Default false. */
98
+ schematic?: boolean;
99
+ /** Maps each section to its material parameters. Keep this a STABLE reference
100
+ * (module-level function or `useCallback`) - a new function identity each render
101
+ * rebuilds every section's materials and forces a shader recompile per frame,
102
+ * which is the main cause of sluggish casing updates. Defaults to a stable
103
+ * module-level function. */
69
104
  materialOptions?: MaterialOptions;
70
105
  opacity?: number;
71
106
  priority?: number;
107
+ /** Grouped casing stylization effects (silhouette outline, section edge shading,
108
+ * procedural weathering, per-section variation and micro-normal surface detail).
109
+ * Applied as the global default for every section; a section's per-face
110
+ * `materialOptions.*.effects` override individual sub-effects on top of this.
111
+ * Defaults to {@link defaultCasingEffects}. */
112
+ effects?: CasingEffects;
72
113
  } & import('react').RefAttributes<Group<import('three').Object3DEventMap>>>;
@@ -1,4 +1,6 @@
1
+ import { Color } from 'three';
1
2
  import { Vec3 } from '../../../sdk';
3
+ import { CasingEffects } from './CasingMaterial';
2
4
  export declare const casings = "casings";
3
5
  export type CasingSectionType = {
4
6
  type: string;
@@ -15,3 +17,45 @@ export type CasingSectionType = {
15
17
  };
16
18
  };
17
19
  export type CasingsGeneratorResponse = CasingSectionType[];
20
+ /**
21
+ * The component-level default {@link CasingEffects} applied globally to every section
22
+ * (a section's per-face `materialOptions.*.effects` can override individual sub-effects
23
+ * on top of this). Tuned to help adjacent/nested strings read apart.
24
+ */
25
+ export declare const defaultCasingEffects: CasingEffects;
26
+ /**
27
+ * A custom function may be passed to the component, but this is not well documented at this time
28
+ * as this behavior is subject to change.
29
+ */
30
+ export declare const defaultMaterialOptions: (section: CasingSectionType) => {
31
+ primary: {
32
+ color: string;
33
+ roughness: number;
34
+ metalness: number;
35
+ effects: {
36
+ weathering: {
37
+ resistance: number;
38
+ };
39
+ };
40
+ };
41
+ inner: {
42
+ color: string;
43
+ roughness: number;
44
+ metalness: number;
45
+ };
46
+ slice: {
47
+ color: Color;
48
+ roughness: number;
49
+ metalness: number;
50
+ effects: {
51
+ weathering: {
52
+ resistance: number;
53
+ };
54
+ };
55
+ } | {
56
+ color: Color;
57
+ roughness: number;
58
+ metalness: number;
59
+ effects?: undefined;
60
+ };
61
+ };
@@ -1,5 +1,6 @@
1
+ export * from './CasingMaterial';
1
2
  export * from './Casings';
2
3
  export * from './casings-defs';
4
+ export * from './CasingAnnotations/casing-annotations-defs';
3
5
  export * from './CasingAnnotations/CasingAnnotations';
4
6
  export * from './CasingAnnotations/CasingLabel';
5
- export * from './CasingAnnotations/casing-annotations-defs';
@@ -14,6 +14,31 @@ export declare function copyVec3(vec: Vec3): Vec3;
14
14
  export declare function angleVec3(v1: Vec3, v2: Vec3): number;
15
15
  export declare function rotateVec3(vector: Vec3, axis?: Vec3, angle?: number): Vec3;
16
16
  export declare function directionVec3(v1: Vec3, v2: Vec3): Vec3;
17
+ /**
18
+ * A bounds shape for distance-based level of detail: a bounding `sphere`, an
19
+ * axis-aligned bounding `box` (as `[min, max]`) or a single `position`. Consumed by the
20
+ * `Bounds` component and {@link distanceToBounds}.
21
+ */
22
+ export type BoundsShape = {
23
+ /** Bounding sphere. Highest precedence. */
24
+ sphere?: {
25
+ center: Vec3;
26
+ radius: number;
27
+ };
28
+ /** Axis-aligned bounding box as `[min, max]`. Used when `sphere` is unset. */
29
+ box?: [Vec3, Vec3];
30
+ /** A single point. Lowest precedence. */
31
+ position?: Vec3;
32
+ };
33
+ /**
34
+ * Non-negative distance from `point` to a {@link BoundsShape} — `0` when the point is
35
+ * inside or on the shape. Precedence when several are set: `sphere` > `box` >
36
+ * `position`; returns `Infinity` when none is provided. Pure math (no rendering
37
+ * dependencies), so it can drive level-of-detail decisions and be unit tested directly.
38
+ *
39
+ * Mirrors three.js' `Sphere`/`Box3.distanceToPoint` (clamped to `0` on the inside).
40
+ */
41
+ export declare function distanceToBounds(point: Vec3, bounds: BoundsShape): number;
17
42
  export declare function distanceVec3(v1: Vec3, v2: Vec3): number;
18
43
  /**
19
44
  * Resolve a `number | Vec2 | undefined` parameter into a concrete `Vec2`. A
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/videx-3d",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -20,7 +20,7 @@
20
20
  "dist"
21
21
  ],
22
22
  "engines": {
23
- "npm": "^11.7.0"
23
+ "npm": "^12.0.0"
24
24
  },
25
25
  "exports": {
26
26
  ".": {
@@ -41,7 +41,7 @@
41
41
  "build": "npm run build-lib && npm run build-static",
42
42
  "build-lib": "tsc && vite build",
43
43
  "build-static": "node scripts/generate-story-args.js && storybook build -o static && typedoc",
44
- "lint": "eslint .",
44
+ "lint": "oxlint",
45
45
  "storybook": "node scripts/generate-story-args.js && storybook dev -p 6006",
46
46
  "test": "vitest",
47
47
  "coverage": "vitest --coverage"
@@ -69,7 +69,6 @@
69
69
  },
70
70
  "devDependencies": {
71
71
  "@chromatic-com/storybook": "^5.2.1",
72
- "@eslint/js": "^9.39.3",
73
72
  "@react-three/drei": "^10.7.7",
74
73
  "@react-three/fiber": "^9.5.0",
75
74
  "@storybook/addon-docs": "^10.4.6",
@@ -88,18 +87,14 @@
88
87
  "@types/rbush": "^3.0.3",
89
88
  "@types/react": "^19.2.14",
90
89
  "@types/react-dom": "^19.0.4",
91
- "@typescript-eslint/eslint-plugin": "^8.56.1",
92
- "@typescript-eslint/parser": "8.56.1",
93
90
  "@vitejs/plugin-react": "^6.0.3",
94
91
  "@vitest/coverage-v8": "^4.0.18",
95
92
  "@vitest/ui": "^4.0.18",
96
- "eslint": "^9.39.3",
97
- "eslint-plugin-react-hooks": "^7.0.1",
98
- "eslint-plugin-react-refresh": "^0.5.2",
99
93
  "eslint-plugin-storybook": "^10.4.6",
100
94
  "globals": "^17.4.0",
101
95
  "lodash": "^4.17.23",
102
96
  "minimist": "^1.2.8",
97
+ "oxlint": "^1.72.0",
103
98
  "prettier": "^3.8.1",
104
99
  "react": "^19.2.4",
105
100
  "react-dom": "^19.2.4",
@@ -108,7 +103,6 @@
108
103
  "storybook": "^10.4.6",
109
104
  "typedoc": "^0.28.17",
110
105
  "typescript": "^5.9.3",
111
- "typescript-eslint": "^8.56.1",
112
106
  "unplugin-dts": "^1.0.0-beta.6",
113
107
  "vite": "^8.1.3",
114
108
  "vite-plugin-css-injected-by-js": "^4.0.1",