gl-draw 0.15.20 → 0.15.21

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,7 +1,7 @@
1
1
  import { MeshLineGeometry } from './meshLine';
2
- import type { PointsRepresentation } from './meshLine/MeshLineGeometry';
2
+ import type { PointsInput } from './meshLine/MeshLineGeometry';
3
3
  interface Options {
4
- nodes: PointsRepresentation;
4
+ nodes: PointsInput;
5
5
  setPointWidth?: (p: number) => any;
6
6
  }
7
7
  declare const _default: (options: Options) => MeshLineGeometry;
@@ -1,11 +1,11 @@
1
1
  import { BufferGeometry } from 'three';
2
2
  import BaseObject from "../../core/BaseObject";
3
3
  import { MeshLineMaterial } from './meshLine';
4
+ import type { PointsInput } from './meshLine/MeshLineGeometry';
4
5
  import type { MeshLineMaterialParameters } from './meshLine/MeshLineMaterial';
5
- import type { PointsRepresentation } from './meshLine/MeshLineGeometry';
6
6
  interface Options {
7
- nodes?: PointsRepresentation;
8
- nodesArr?: PointsRepresentation[];
7
+ nodes?: PointsInput;
8
+ nodesArr?: PointsInput[];
9
9
  geometry?: BufferGeometry;
10
10
  geometryArr?: BufferGeometry[];
11
11
  material?: MeshLineMaterial;
@@ -20,11 +20,11 @@ export default class Line extends BaseObject {
20
20
  constructor(options?: Partial<Options>);
21
21
  get material(): MeshLineMaterial;
22
22
  create(): Promise<void>;
23
- setGeometry(nodes: PointsRepresentation, setPointWidth?: (p: number) => any): void;
23
+ setGeometry(nodes: PointsInput, setPointWidth?: (p: number) => any): void;
24
24
  getMaterial(materialOptions: Omit<MeshLineMaterialParameters, 'resolution'>): MeshLineMaterial;
25
25
  addGeometries(geometries: BufferGeometry[]): void;
26
26
  resize(w: number, h: number): void;
27
- useMaterial(type: string): void;
27
+ handleMaterialChange(mat: MeshLineMaterial | null): void;
28
28
  animate({ duration, delay, repeat, lineLoop, onRepeat, onUpdate, onComplete, startShow, }?: {
29
29
  duration?: number;
30
30
  delay?: number;
@@ -1,40 +1,21 @@
1
- import { BufferGeometry, Vector3, Vector2, Vector3Tuple, Vector2Tuple, BufferAttribute, Matrix4 } from 'three';
2
- export type PointsRepresentation = BufferGeometry | Float32Array | Vector3[] | Vector2[] | Vector3Tuple[] | Vector2Tuple[] | number[];
3
- export type WidthCallback = (p: number) => any;
1
+ import { BufferGeometry, Matrix4, Vector2, Vector3 } from 'three';
2
+ export type WidthCallback = (p: number) => number;
3
+ export type PointsInput = Vector3[] | Vector2[] | number[][] | number[];
4
4
  export declare class MeshLineGeometry extends BufferGeometry {
5
5
  type: string;
6
- isMeshLine: boolean;
7
- positions: number[];
8
- previous: number[];
9
- next: number[];
10
- side: number[];
11
- width: number[];
12
- indices_array: number[];
13
- uvs: number[];
14
- counters: number[];
15
- widthCallback: WidthCallback | null;
16
- _attributes: {
17
- position: BufferAttribute;
18
- previous: BufferAttribute;
19
- next: BufferAttribute;
20
- side: BufferAttribute;
21
- width: BufferAttribute;
22
- uv: BufferAttribute;
23
- index: BufferAttribute;
24
- counters: BufferAttribute;
25
- };
26
- _points: Float32Array | number[];
27
- points: Float32Array | number[];
6
+ private pointCount;
7
+ private _points;
8
+ private shape;
9
+ private shapeFunction;
28
10
  matrixWorld: Matrix4;
29
- constructor();
11
+ constructor(points?: PointsInput, shape?: 'none' | 'taper' | 'custom', shapeFunction?: WidthCallback);
12
+ private convertToVector3Array;
30
13
  setMatrixWorld(matrixWorld: Matrix4): void;
31
- setPoints(points: PointsRepresentation, wcb?: WidthCallback): void;
32
- compareV3(a: number, b: number): boolean;
33
- copyV3(a: number): Vector3Tuple;
34
- process(): void;
35
- /**
36
- * Fast method to advance the line by one position. The oldest position is removed.
37
- * @param position
38
- */
39
- advance({ x, y, z }: Vector3): void;
14
+ setPoints(points: PointsInput, shapeFunction?: WidthCallback): void;
15
+ private initializeGeometry;
16
+ private updateGeometry;
17
+ get points(): Vector3[];
18
+ set points(value: PointsInput);
19
+ updatePoints(points: PointsInput, shapeFunction?: WidthCallback): void;
20
+ setShape(shape: 'none' | 'taper' | 'custom', shapeFunction?: WidthCallback): void;
40
21
  }
@@ -1,49 +1,75 @@
1
- import { Texture, Color, Vector2, ShaderMaterial } from 'three';
2
- export interface MeshLineMaterialParameters {
3
- name?: string;
1
+ import { Color, type ColorRepresentation, ShaderMaterial, type ShaderMaterialParameters, Texture, Vector2 } from 'three';
2
+ export interface MeshLineMaterialParameters extends ShaderMaterialParameters {
3
+ /**
4
+ * Line width
5
+ * @default 1
6
+ */
4
7
  lineWidth?: number;
5
- map?: Texture;
6
- useMap?: number;
7
- alphaMap?: Texture;
8
- useAlphaMap?: number;
9
- color?: string | Color | number;
8
+ /**
9
+ * Line color
10
+ * @default '#ffffff'
11
+ */
12
+ color?: ColorRepresentation;
10
13
  opacity?: number;
11
- resolution?: Vector2;
12
- sizeAttenuation?: number;
13
- dashArray?: number;
14
+ /**
15
+ * Texture map
16
+ */
17
+ map?: Texture;
18
+ /**
19
+ * Dash offset for dashed lines
20
+ * @default 0
21
+ */
14
22
  dashOffset?: number;
23
+ /**
24
+ * Dash array for dashed lines
25
+ * @default 0
26
+ */
27
+ dashArray?: number;
28
+ /**
29
+ * Dash ratio for dashed lines
30
+ * @default 0
31
+ */
15
32
  dashRatio?: number;
16
- useDash?: number;
17
- visibility?: number;
33
+ /**
34
+ * Whether to apply size attenuation (alias for attenuate)
35
+ * @default true
36
+ */
37
+ sizeAttenuation?: boolean;
38
+ offsetLoop?: boolean;
39
+ /**
40
+ * Scale down factor
41
+ * @default 0
42
+ */
43
+ scaleDown?: number;
44
+ /**
45
+ * Alpha map texture
46
+ */
47
+ alphaMap?: Texture | undefined;
18
48
  alphaTest?: number;
49
+ /**
50
+ * Texture repeat
51
+ * @default Vector2(1, 1)
52
+ */
19
53
  repeat?: Vector2;
20
- lineLightAnimation?: number;
21
- time?: number;
22
- size?: number;
23
- speed?: number;
24
- lightWidth?: number;
25
- uCenter?: Vector2;
26
- lightColor?: string | Color | number;
27
- transparent?: boolean;
28
- depthTest?: boolean;
54
+ /**
55
+ * Screen resolution for line width calculation
56
+ */
57
+ resolution?: Vector2;
58
+ offset?: Vector2;
29
59
  }
30
- export declare class MeshLineMaterial extends ShaderMaterial implements MeshLineMaterialParameters {
31
- lineWidth: number;
32
- map: Texture;
33
- useMap: number;
34
- alphaMap: Texture;
35
- useAlphaMap: number;
36
- color: Color;
37
- opacity: number;
38
- resolution: Vector2;
39
- sizeAttenuation: number;
40
- dashArray: number;
41
- dashOffset: number;
42
- dashRatio: number;
43
- useDash: number;
44
- useDepth: number;
45
- visibility: number;
46
- repeat: Vector2;
47
- constructor(parameters: MeshLineMaterialParameters);
48
- copy(source: MeshLineMaterial): this;
60
+ export declare class MeshLineMaterial extends ShaderMaterial {
61
+ type: string;
62
+ constructor(parameters?: MeshLineMaterialParameters);
63
+ get color(): Color;
64
+ set color(value: ColorRepresentation);
65
+ get opacity(): number;
66
+ set opacity(value: number);
67
+ get map(): Texture | null;
68
+ set map(value: Texture | null);
69
+ get repeat(): Vector2;
70
+ set repeat(value: Vector2);
71
+ get lineWidth(): number;
72
+ set lineWidth(value: number);
73
+ get sizeAttenuation(): boolean;
74
+ set sizeAttenuation(value: boolean);
49
75
  }
@@ -0,0 +1 @@
1
+ export declare const fragmentShader: string;
@@ -1,2 +1,3 @@
1
1
  export * from './MeshLineGeometry';
2
2
  export * from './MeshLineMaterial';
3
+ export * from './raycast';
@@ -0,0 +1,3 @@
1
+ import { BufferGeometry, Intersection, Mesh, Raycaster } from 'three';
2
+ import { MeshLineMaterial } from './MeshLineMaterial';
3
+ export declare function MeshLineRaycast(this: Mesh<BufferGeometry, MeshLineMaterial>, raycaster: Raycaster, intersects: Intersection[]): void;
@@ -0,0 +1 @@
1
+ export declare const vertexShader: string;