Skip to content

Commit 89cd723

Browse files
committed
fixed type generation
1 parent 2f5d62f commit 89cd723

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+4518
-1214
lines changed

dist/three-js-blobtree.module.d.ts

Lines changed: 2919 additions & 0 deletions
Large diffs are not rendered by default.

dist/three-js-blobtree.module.js

Lines changed: 229 additions & 453 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/three-js-blobtree.module.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/types/blobtree/Element.d.ts

Lines changed: 53 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
import { Box3, Vector3 } from "three";
2+
import type { Node } from "./Node";
3+
import type { Area } from "./areas";
4+
import type { Primitive } from "./Primitive";
5+
import type { Material } from "./Material";
6+
/**
7+
* Computed values will be stored here. Each values should exist and be allocated already.
8+
* @property {number} v Value, must be defined
9+
* @property {Material=} m Material, must be allocated and defined if wanted
10+
* @property {Vector3=} g Gradient, must be allocated and defined if wanted
11+
* @property {number=} step ??? Not sure, probably a "safe" step for raymarching
12+
* @property {number=} stepOrtho ??? Same as step but in orthogonal direction ?
13+
*/
14+
export type ValueResultType = {
15+
v: number;
16+
m: Material;
17+
g: Vector3;
18+
step: number;
19+
stepOrtho: number;
20+
};
21+
export type ElementJSON = {
22+
type: string;
23+
};
124
/**
225
* A superclass for Node and Primitive in the blobtree.
326
* @class
@@ -9,26 +32,26 @@ export declare class Element {
932
* @param {ElementJSON} _json
1033
*/
1134
static fromJSON(_json: any): void;
35+
id: number;
36+
aabb: Box3;
37+
valid_aabb: boolean;
38+
parentNode: Node | null;
1239
constructor();
1340
/**
1441
* Return a Javscript Object respecting JSON convention.
1542
* All classes must defined it.
16-
* @return {ElementJSON}
1743
*/
18-
toJSON(): {
19-
type: string;
20-
};
44+
toJSON(): ElementJSON;
2145
/**
2246
* Clone the object.
23-
* @return {Element}
2447
*/
25-
clone(): any;
48+
clone(): Element;
2649
/**
27-
* @return {Node} The parent node of this primitive.
50+
* @return The parent node of this primitive.
2851
*/
29-
getParentNode(): any;
52+
getParentNode(): Node | null;
3053
/**
31-
* @return {string} Type of the element
54+
* @return Type of the element
3255
*/
3356
getType(): string;
3457
/**
@@ -49,12 +72,12 @@ export declare class Element {
4972
* isValidAABB before to ensure the current AABB does correspond to the primitive
5073
* settings.
5174
*/
52-
getAABB(): any;
75+
getAABB(): Box3;
5376
/**
54-
* @return {boolean} True if the current aabb is valid, ie it does
77+
* @return True if the current aabb is valid, ie it does
5578
* correspond to the internal primitive parameters.
5679
*/
57-
isValidAABB(): any;
80+
isValidAABB(): boolean;
5881
/**
5982
* Invalid the bounding boxes recursively up to the root
6083
*/
@@ -79,29 +102,33 @@ export declare class Element {
79102
* @param {Vector3} _p Point where we want to evaluate the primitive field
80103
* @param {ValueResultType} _res
81104
*/
82-
value(_p: any, _res: any): void;
105+
value(_p: Vector3, _res: ValueResultType): void;
83106
/**
84107
* @param {Vector3} p The point where we want the numerical gradient
85108
* @param {Vector3} res The resulting gradient
86109
* @param {number} epsilon The step value for the numerical evaluation
87110
*/
88-
numericalGradient: (p: any, res: any, epsilon: any) => void;
111+
numericalGradient: (this: Element, p: Vector3, res: Vector3, epsilon: number) => void;
89112
/**
90113
* @abstract
91114
* Get the Area object.
92115
* Area objects do provide methods useful when rasterizing, raytracing or polygonizing
93116
* the area (intersections with other areas, minimum level of detail needed to
94117
* capture the feature nicely, etc etc...).
95-
* @returns {Array.<{aabb: Box3, bv:Area, obj:Primitive}>} The Areas object corresponding to the node/primitive, in an array
118+
* @returns The Areas object corresponding to the node/primitive, in an array
96119
*/
97-
getAreas(): never[];
120+
getAreas(): {
121+
aabb: Box3;
122+
bv: Area;
123+
obj: Primitive;
124+
}[];
98125
/**
99126
* @abstract
100127
* This function is called when a point is outside of the potential influence of a primitive/node.
101-
* @param {Vector3} _p
102-
* @return {number} The next step length to do with respect to this primitive/node
128+
* @param _p
129+
* @return The next step length to do with respect to this primitive/node
103130
*/
104-
distanceTo(_p: any): void;
131+
distanceTo(_p: Vector3): number;
105132
/**
106133
* @abstract
107134
* This function is called when a point is within the potential influence of a primitive/node.
@@ -114,17 +141,17 @@ export declare class Element {
114141
* Default behaviour is doing nothing, leaves cannot be sub-trimmed, only nodes.
115142
* Note : only the root can untrim
116143
*
117-
* @param {Box3} _aabb
118-
* @param {Array.<Element>} _trimmed Array of trimmed Elements
119-
* @param {Array.<Node>} _parents Array of fathers from which each trimmed element has been removed.
144+
* @param _aabb
145+
* @param _trimmed Array of trimmed Elements
146+
* @param _parents Array of fathers from which each trimmed element has been removed.
120147
*/
121-
trim(_aabb: any, _trimmed: any, _parents: any): void;
148+
trim(_aabb: Box3, _trimmed: Element[], _parents: Node[]): void;
122149
/**
123150
* count the number of elements of class cls in this node and subnodes
124-
* @param {Function} _cls the class of the elements we want to count
125-
* @return {number} The number of element of class cls
151+
* @param _cls the class of the elements we want to count
152+
* @return The number of element of class cls
126153
*/
127-
count(_cls: any): number;
154+
count(_cls: Function): number;
128155
destroy(): void;
129156
}
130157
//# sourceMappingURL=Element.d.ts.map

dist/types/blobtree/Element.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/types/blobtree/Material.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
export type MaterialJSON = Object;
12
/**
2-
* @typedef {Object} MaterialJSON
33
* @property {string} color
44
* @property {number} roughness
55
* @property {number} metalness

dist/types/blobtree/Material.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/types/blobtree/Node.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ export declare class Node extends Element {
2424
*/
2525
toJSON(): {
2626
children: never[];
27-
type: string;
27+
type: string; /**
28+
* @return {NodeJSON}
29+
*/
2830
};
2931
/**
3032
* Clone current node and itss hierarchy

dist/types/blobtree/Node.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/types/blobtree/Primitive.d.ts

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { Element } from './Element';
1+
import { Element, type ElementJSON } from './Element';
2+
import { Material, type MaterialJSON } from './Material';
3+
import type { Area } from './areas';
24
/**
35
* @typedef {import('./Material.js')} Material
46
* @typedef {import('./Material.js').MaterialJSON} MaterialJSON
@@ -7,9 +9,9 @@ import { Element } from './Element';
79
*
810
* @typedef {import('./areas/Area.js')} Area
911
*/
10-
/**
11-
* @typedef {{materials:Array<MaterialJSON>} & ElementJSON} PrimitiveJSON
12-
*/
12+
export type PrimitiveJSON = {
13+
materials: Array<MaterialJSON>;
14+
} & ElementJSON;
1315
/**
1416
* Represent a blobtree primitive.
1517
*
@@ -18,26 +20,18 @@ import { Element } from './Element';
1820
*/
1921
export declare class Primitive extends Element {
2022
static type: string;
21-
/**
22-
* @param {PrimitiveJSON} _json
23-
*/
24-
static fromJSON(_json: any): void;
23+
static fromJSON(_json: PrimitiveJSON): void;
24+
materials: Material[];
2525
constructor();
26+
toJSON(): PrimitiveJSON;
2627
/**
27-
* @returns {PrimitiveJSON}
28-
*/
29-
toJSON(): {
30-
materials: never[];
31-
type: string;
32-
};
33-
/**
34-
* @param {Array.<!Material>} mats Array of materials to set. they will be copied to the primitive materials
28+
* @param mats Array of materials to set. they will be copied to the primitive materials
3529
*/
36-
setMaterials(mats: any): void;
30+
setMaterials(mats: Material[]): void;
3731
/**
38-
* @return {Array.<!Material>} Current primitive materials
32+
* @return Current primitive materials
3933
*/
40-
getMaterials: () => any;
34+
getMaterials(): Material[];
4135
/**
4236
* @link Element.computeAABB for a complete description
4337
*/
@@ -50,9 +44,12 @@ export declare class Primitive extends Element {
5044
destroy(): void;
5145
/**
5246
* @abstract
53-
* @returns {Array.<{aabb: THREE.Box3, bv:Area, obj:Primitive}>}
5447
*/
55-
getAreas(): never[];
48+
getAreas(): {
49+
aabb: THREE.Box3;
50+
bv: Area;
51+
obj: Primitive;
52+
}[];
5653
/**
5754
* @abstract
5855
* Compute variables to help with value computation.
@@ -61,8 +58,8 @@ export declare class Primitive extends Element {
6158
/**
6259
* @abstract
6360
* Compute variables to help with value computation.
64-
* @param {*} cls The class to count. Primitives have no children so no complexty here.
61+
* @param cls The class to count. Primitives have no children so no complexty here.
6562
*/
66-
count(cls: any): 0 | 1;
63+
count(cls: Function): 1 | 0;
6764
}
6865
//# sourceMappingURL=Primitive.d.ts.map

0 commit comments

Comments
 (0)