@kitware/vtk.js 32.6.2 → 32.7.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.
- package/Common/Core/Math/index.js +1 -1
- package/Common/Core/Math.js +1 -1
- package/IO/Geometry/GLTFImporter/Animations.js +239 -0
- package/IO/Geometry/GLTFImporter/Constants.js +87 -0
- package/IO/Geometry/GLTFImporter/Decoder.js +69 -0
- package/IO/Geometry/GLTFImporter/Extensions.js +110 -0
- package/IO/Geometry/GLTFImporter/ORMTexture.worker.js +42 -0
- package/IO/Geometry/GLTFImporter/Parser.js +359 -0
- package/IO/Geometry/GLTFImporter/Reader.js +507 -0
- package/IO/Geometry/GLTFImporter/Utils.js +165 -0
- package/IO/Geometry/GLTFImporter.d.ts +266 -0
- package/IO/Geometry/GLTFImporter.js +245 -0
- package/IO/Geometry.js +3 -1
- package/IO/Image/HDRReader/Utils.js +1 -1
- package/IO/Image/HDRReader.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballRollManipulator.js +1 -1
- package/Interaction/Style/InteractorStyleTrackballCamera.js +1 -1
- package/Rendering/Core/Prop3D.js +1 -1
- package/Rendering/Core/RenderWindowInteractor.js +1 -1
- package/_virtual/rollup-plugin-worker-loader__module_Sources/IO/Geometry/GLTFImporter/ORMTexture.worker.js +296 -0
- package/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { vtkAlgorithm, vtkObject } from './../../interfaces';
|
|
2
|
+
import HtmlDataAccessHelper from './../Core/DataAccessHelper/HtmlDataAccessHelper';
|
|
3
|
+
import HttpDataAccessHelper from './../Core/DataAccessHelper/HttpDataAccessHelper';
|
|
4
|
+
import JSZipDataAccessHelper from './../Core/DataAccessHelper/JSZipDataAccessHelper';
|
|
5
|
+
import LiteHttpDataAccessHelper from './../Core/DataAccessHelper/LiteHttpDataAccessHelper';
|
|
6
|
+
|
|
7
|
+
import vtkActor from './../../Rendering/Core/Actor';
|
|
8
|
+
import vtkRenderer from './../../Rendering/Core/Renderer';
|
|
9
|
+
import vtkCamera from './../../Rendering/Core/Camera';
|
|
10
|
+
|
|
11
|
+
interface IGLTFImporterOptions {
|
|
12
|
+
binary?: boolean;
|
|
13
|
+
compression?: string;
|
|
14
|
+
progressCallback?: any;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface IGLTFAnimation {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
channels: any[];
|
|
21
|
+
samplers: any[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface IGLTFAnimationMixer {
|
|
25
|
+
addAnimation: (glTFAnimation: object) => void;
|
|
26
|
+
play: (name: string, weight?: number) => void;
|
|
27
|
+
stop: (name: string) => void;
|
|
28
|
+
stopAll: () => void;
|
|
29
|
+
update: (deltaTime: number) => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface IGLTFMaterialVariant {
|
|
33
|
+
material: number;
|
|
34
|
+
variants: number[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
export interface IGLTFImporterInitialValues {}
|
|
41
|
+
|
|
42
|
+
type vtkGLTFImporterBase = vtkObject &
|
|
43
|
+
Omit<
|
|
44
|
+
vtkAlgorithm,
|
|
45
|
+
| 'getInputData'
|
|
46
|
+
| 'setInputData'
|
|
47
|
+
| 'setInputConnection'
|
|
48
|
+
| 'getInputConnection'
|
|
49
|
+
| 'addInputConnection'
|
|
50
|
+
| 'addInputData'
|
|
51
|
+
>;
|
|
52
|
+
|
|
53
|
+
export interface vtkGLTFImporter extends vtkGLTFImporterBase {
|
|
54
|
+
/**
|
|
55
|
+
* Get the actors.
|
|
56
|
+
*/
|
|
57
|
+
getActors(): Map<string, vtkActor>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Get the animation mixer.
|
|
61
|
+
*/
|
|
62
|
+
getAnimationMixer(): IGLTFAnimationMixer;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Get the animations.
|
|
66
|
+
*/
|
|
67
|
+
getAnimations(): IGLTFAnimation[];
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Get the base url.
|
|
71
|
+
*/
|
|
72
|
+
getBaseURL(): string;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Get the cameras.
|
|
76
|
+
*/
|
|
77
|
+
getCameras(): Map<string, vtkCamera>;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
*
|
|
81
|
+
*/
|
|
82
|
+
getDataAccessHelper():
|
|
83
|
+
| HtmlDataAccessHelper
|
|
84
|
+
| HttpDataAccessHelper
|
|
85
|
+
| JSZipDataAccessHelper
|
|
86
|
+
| LiteHttpDataAccessHelper;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Get the url of the object to load.
|
|
90
|
+
*/
|
|
91
|
+
getUrl(): string;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Get the variant array.
|
|
95
|
+
*/
|
|
96
|
+
getVariants(): string[];
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Get the variant mappings.
|
|
100
|
+
*/
|
|
101
|
+
getVariantMappings(): Map<string, IGLTFMaterialVariant[]>;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Import the actors.
|
|
105
|
+
*/
|
|
106
|
+
importActors(): void;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Import the animations.
|
|
110
|
+
*/
|
|
111
|
+
importAnimations(): void;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Import the cameras.
|
|
115
|
+
*/
|
|
116
|
+
importCameras(): void;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Import the lights.
|
|
120
|
+
*/
|
|
121
|
+
importLights(): void;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Invoke the ready event.
|
|
125
|
+
*/
|
|
126
|
+
invokeReady(): void;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Load the object data.
|
|
130
|
+
* @param {IGLTFImporterOptions} [options]
|
|
131
|
+
*/
|
|
132
|
+
loadData(options?: IGLTFImporterOptions): Promise<any>;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
*
|
|
136
|
+
* @param callback
|
|
137
|
+
*/
|
|
138
|
+
onReady(callback: () => void): void;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Parse data.
|
|
142
|
+
* @param {String | ArrayBuffer} content The content to parse.
|
|
143
|
+
*/
|
|
144
|
+
parse(content: string | ArrayBuffer): void;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Parse data as ArrayBuffer.
|
|
148
|
+
* @param {ArrayBuffer} content The content to parse.
|
|
149
|
+
*/
|
|
150
|
+
parseAsArrayBuffer(content: ArrayBuffer): void;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Parse data as text.
|
|
154
|
+
* @param {String} content The content to parse.
|
|
155
|
+
*/
|
|
156
|
+
parseAsText(content: string): void;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
*
|
|
160
|
+
* @param inData
|
|
161
|
+
* @param outData
|
|
162
|
+
*/
|
|
163
|
+
requestData(inData: any, outData: any): void;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
*
|
|
167
|
+
* @param dataAccessHelper
|
|
168
|
+
*/
|
|
169
|
+
setDataAccessHelper(
|
|
170
|
+
dataAccessHelper:
|
|
171
|
+
| HtmlDataAccessHelper
|
|
172
|
+
| HttpDataAccessHelper
|
|
173
|
+
| JSZipDataAccessHelper
|
|
174
|
+
| LiteHttpDataAccessHelper
|
|
175
|
+
): boolean;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Set the url of the object to load.
|
|
179
|
+
* @param {String} url the url of the object to load.
|
|
180
|
+
* @param {IGLTFImporterOptions} [option] The Draco reader options.
|
|
181
|
+
*/
|
|
182
|
+
setUrl(url: string, option?: IGLTFImporterOptions): Promise<string | any>;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Set the camera id.
|
|
186
|
+
* @param cameraId
|
|
187
|
+
*/
|
|
188
|
+
setCamera(cameraId: string): void;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Set the Draco decoder.
|
|
192
|
+
* @param mappings
|
|
193
|
+
*/
|
|
194
|
+
setDracoDecoder(decoder: any): void;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Set the vtk Renderer.
|
|
198
|
+
* @param renderer
|
|
199
|
+
*/
|
|
200
|
+
setRenderer(renderer: vtkRenderer): void;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Switch to a variant.
|
|
204
|
+
* @param variantIndex
|
|
205
|
+
*/
|
|
206
|
+
switchToVariant(variantIndex: number): void;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Method used to decorate a given object (publicAPI+model) with vtkGLTFImporter characteristics.
|
|
211
|
+
*
|
|
212
|
+
* @param publicAPI object on which methods will be bounds (public)
|
|
213
|
+
* @param model object on which data structure will be bounds (protected)
|
|
214
|
+
* @param {IGLTFImporterInitialValues} [initialValues] (default: {})
|
|
215
|
+
*/
|
|
216
|
+
export function extend(
|
|
217
|
+
publicAPI: object,
|
|
218
|
+
model: object,
|
|
219
|
+
initialValues?: IGLTFImporterInitialValues
|
|
220
|
+
): void;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Method used to create a new instance of vtkGLTFImporter
|
|
224
|
+
* @param {IGLTFImporterInitialValues} [initialValues] for pre-setting some of its content
|
|
225
|
+
*/
|
|
226
|
+
export function newInstance(
|
|
227
|
+
initialValues?: IGLTFImporterInitialValues
|
|
228
|
+
): vtkGLTFImporter;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Load the WASM decoder from url and set the decoderModule
|
|
232
|
+
* @param url
|
|
233
|
+
* @param binaryName
|
|
234
|
+
*/
|
|
235
|
+
export function setWasmBinary(
|
|
236
|
+
url: string,
|
|
237
|
+
binaryName: string
|
|
238
|
+
): Promise<boolean>;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* vtkGLTFImporter can import glTF 2.0 files.
|
|
242
|
+
*
|
|
243
|
+
* The GL Transmission Format (glTF) is an API-neutral runtime asset delivery
|
|
244
|
+
* format. A glTF asset is represented by:
|
|
245
|
+
* * A JSON-formatted file (.gltf) containing a full scene description: node
|
|
246
|
+
* hierarchy, materials, cameras, as well as descriptor information for
|
|
247
|
+
* meshes, animations, and other constructs
|
|
248
|
+
* * Binary files (.bin) containing geometry and animation data, and other
|
|
249
|
+
* buffer-based data
|
|
250
|
+
* * Image files (.jpg, .png) for textures
|
|
251
|
+
*
|
|
252
|
+
* Supported extensions:
|
|
253
|
+
* * KHR_draco_mesh_compression
|
|
254
|
+
* * KHR_lights_punctual
|
|
255
|
+
* * KHR_materials_unlit
|
|
256
|
+
* * KHR_materials_ior
|
|
257
|
+
* * KHR_materials_specular
|
|
258
|
+
* * KHR_materials_variants
|
|
259
|
+
* * EXT_texture_webp
|
|
260
|
+
* * EXT_texture_avif
|
|
261
|
+
*/
|
|
262
|
+
export declare const vtkGLTFImporter: {
|
|
263
|
+
newInstance: typeof newInstance;
|
|
264
|
+
extend: typeof extend;
|
|
265
|
+
};
|
|
266
|
+
export default vtkGLTFImporter;
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { m as macro } from '../../macros2.js';
|
|
2
|
+
import BinaryHelper from '../Core/BinaryHelper.js';
|
|
3
|
+
import DataAccessHelper from '../Core/DataAccessHelper.js';
|
|
4
|
+
import vtkDracoReader from './DracoReader.js';
|
|
5
|
+
import { parseGLTF, createVTKObjects, GLTFCameraToVTKCamera, applyTransformToCamera, createPropertyFromGLTFMaterial } from './GLTFImporter/Reader.js';
|
|
6
|
+
import parseGLB from './GLTFImporter/Decoder.js';
|
|
7
|
+
import { createAnimationMixer } from './GLTFImporter/Animations.js';
|
|
8
|
+
import { BINARY_HEADER_MAGIC } from './GLTFImporter/Constants.js';
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
vtkDebugMacro,
|
|
12
|
+
vtkErrorMacro
|
|
13
|
+
} = macro;
|
|
14
|
+
|
|
15
|
+
// ----------------------------------------------------------------------------
|
|
16
|
+
// vtkGLTFImporter methods
|
|
17
|
+
// ----------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
function vtkGLTFImporter(publicAPI, model) {
|
|
20
|
+
// Set our className
|
|
21
|
+
model.classHierarchy.push('vtkGLTFImporter');
|
|
22
|
+
|
|
23
|
+
// Create default dataAccessHelper if not available
|
|
24
|
+
if (!model.dataAccessHelper) {
|
|
25
|
+
model.dataAccessHelper = DataAccessHelper.get('http');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Internal method to fetch Array
|
|
29
|
+
function fetchData(url) {
|
|
30
|
+
let option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
31
|
+
const {
|
|
32
|
+
compression,
|
|
33
|
+
progressCallback
|
|
34
|
+
} = model;
|
|
35
|
+
if (option.binary) {
|
|
36
|
+
return model.dataAccessHelper.fetchBinary(url, {
|
|
37
|
+
compression,
|
|
38
|
+
progressCallback
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return model.dataAccessHelper.fetchText(publicAPI, url, {
|
|
42
|
+
compression,
|
|
43
|
+
progressCallback
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Set DataSet url
|
|
48
|
+
publicAPI.setUrl = function (url) {
|
|
49
|
+
let option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
50
|
+
binary: true
|
|
51
|
+
};
|
|
52
|
+
model.url = url;
|
|
53
|
+
|
|
54
|
+
// Remove the file in the URL
|
|
55
|
+
const path = url.split('/');
|
|
56
|
+
path.pop();
|
|
57
|
+
model.baseURL = path.join('/');
|
|
58
|
+
model.compression = option.compression;
|
|
59
|
+
model.sceneId = option.sceneId ? option.sceneId : 0;
|
|
60
|
+
|
|
61
|
+
// Fetch metadata
|
|
62
|
+
return publicAPI.loadData({
|
|
63
|
+
progressCallback: option.progressCallback,
|
|
64
|
+
binary: !!option.binary
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// Fetch the actual data arrays
|
|
69
|
+
publicAPI.loadData = function () {
|
|
70
|
+
let option = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
71
|
+
const promise = fetchData(model.url, option);
|
|
72
|
+
promise.then(publicAPI.parse);
|
|
73
|
+
return promise;
|
|
74
|
+
};
|
|
75
|
+
publicAPI.parse = content => {
|
|
76
|
+
if (typeof content === 'string') {
|
|
77
|
+
publicAPI.parseAsText(content);
|
|
78
|
+
} else {
|
|
79
|
+
publicAPI.parseAsBinary(content);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
publicAPI.parseAsBinary = async content => {
|
|
83
|
+
if (!content) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (content !== model.parseData) {
|
|
87
|
+
publicAPI.modified();
|
|
88
|
+
} else {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const glTF = {};
|
|
92
|
+
const options = {
|
|
93
|
+
baseUri: model.baseURL
|
|
94
|
+
};
|
|
95
|
+
const magic = BinaryHelper.arrayBufferToString(new Uint8Array(content, 0, 4));
|
|
96
|
+
if (magic === BINARY_HEADER_MAGIC) {
|
|
97
|
+
const {
|
|
98
|
+
json,
|
|
99
|
+
buffers
|
|
100
|
+
} = parseGLB(content);
|
|
101
|
+
vtkDebugMacro('Loaded GLB', json, buffers);
|
|
102
|
+
glTF.glbBuffers = buffers;
|
|
103
|
+
glTF.json = json;
|
|
104
|
+
} else {
|
|
105
|
+
glTF.json = JSON.parse(BinaryHelper.arrayBufferToString(content));
|
|
106
|
+
}
|
|
107
|
+
if (glTF.json.asset === undefined || glTF.json.asset.version[0] < 2) {
|
|
108
|
+
vtkErrorMacro('Unsupported asset. glTF versions >=2.0 are supported.');
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
model.glTFTree = await parseGLTF(glTF, options);
|
|
112
|
+
model.actors = new Map();
|
|
113
|
+
model.cameras = new Map();
|
|
114
|
+
model.lights = new Map();
|
|
115
|
+
model.animations = [];
|
|
116
|
+
model.variants = [];
|
|
117
|
+
model.variantMappings = new Map();
|
|
118
|
+
await createVTKObjects(model);
|
|
119
|
+
model.scenes = model.glTFTree.scenes;
|
|
120
|
+
publicAPI.invokeReady();
|
|
121
|
+
};
|
|
122
|
+
publicAPI.parseAsText = content => {
|
|
123
|
+
if (!content) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (content !== model.parseData) {
|
|
127
|
+
publicAPI.modified();
|
|
128
|
+
} else {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
model.parseData = content;
|
|
132
|
+
};
|
|
133
|
+
publicAPI.requestData = (inData, outData) => {
|
|
134
|
+
publicAPI.parse(model.parseData);
|
|
135
|
+
};
|
|
136
|
+
publicAPI.setDracoDecoder = decoder => {
|
|
137
|
+
vtkDracoReader.setDracoDecoder(decoder);
|
|
138
|
+
};
|
|
139
|
+
publicAPI.importActors = () => {
|
|
140
|
+
// Add actors to renderer
|
|
141
|
+
model.actors.forEach(actor => model.renderer.addActor(actor));
|
|
142
|
+
};
|
|
143
|
+
publicAPI.importCameras = () => {
|
|
144
|
+
// Set up camera
|
|
145
|
+
model.glTFTree.cameras?.forEach(glTFcamera => {
|
|
146
|
+
const camera = GLTFCameraToVTKCamera(glTFcamera);
|
|
147
|
+
model.cameras.set(glTFcamera.id, camera);
|
|
148
|
+
});
|
|
149
|
+
model.scenes.forEach(scene => {
|
|
150
|
+
scene.nodes.forEach(node => {
|
|
151
|
+
const camera = model.cameras.get(node.camera?.id);
|
|
152
|
+
if (camera) {
|
|
153
|
+
applyTransformToCamera(camera, node.transform);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
publicAPI.importAnimations = () => {
|
|
159
|
+
// Set up animations
|
|
160
|
+
if (model.glTFTree.animations?.length > 0) {
|
|
161
|
+
model.animationMixer = createAnimationMixer(model.actors, model.glTFTree.accessors);
|
|
162
|
+
model.glTFTree.animations.forEach(animation => {
|
|
163
|
+
model.animationMixer.addAnimation(animation);
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
model.animations = model.glTFTree.animations || [];
|
|
167
|
+
};
|
|
168
|
+
publicAPI.importLights = () => {
|
|
169
|
+
// Set up lights
|
|
170
|
+
model.lights?.forEach(light => {
|
|
171
|
+
vtkDebugMacro('Adding light', light);
|
|
172
|
+
model.renderer.addLight(light);
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
publicAPI.setCamera = cameraId => {
|
|
176
|
+
const camera = model.cameras.get(cameraId);
|
|
177
|
+
if (!camera) {
|
|
178
|
+
vtkErrorMacro(`Camera ${cameraId} not found`);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
vtkDebugMacro('Setting camera', camera);
|
|
182
|
+
model.renderer.setActiveCamera(camera);
|
|
183
|
+
};
|
|
184
|
+
publicAPI.switchToVariant = async variantIndex => {
|
|
185
|
+
const promises = Array.from(model.actors).map(async _ref => {
|
|
186
|
+
let [nodeId, actor] = _ref;
|
|
187
|
+
vtkDebugMacro('Switching to variant', variantIndex, 'for node', nodeId);
|
|
188
|
+
const variantMappings = model.variantMappings.get(nodeId);
|
|
189
|
+
if (variantMappings) {
|
|
190
|
+
const mapping = variantMappings.find(m => m.variants.includes(variantIndex));
|
|
191
|
+
if (mapping) {
|
|
192
|
+
const variantMaterial = model.glTFTree.materials[mapping.material];
|
|
193
|
+
await createPropertyFromGLTFMaterial(model, variantMaterial, actor);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
await Promise.all(promises);
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// ----------------------------------------------------------------------------
|
|
202
|
+
// Object factory
|
|
203
|
+
// ----------------------------------------------------------------------------
|
|
204
|
+
|
|
205
|
+
const DEFAULT_VALUES = {
|
|
206
|
+
// baseURL: null,
|
|
207
|
+
// dataAccessHelper: null,
|
|
208
|
+
// url: null,
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
// ----------------------------------------------------------------------------
|
|
212
|
+
|
|
213
|
+
function extend(publicAPI, model) {
|
|
214
|
+
let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
215
|
+
Object.assign(model, DEFAULT_VALUES, initialValues);
|
|
216
|
+
|
|
217
|
+
// Build VTK API
|
|
218
|
+
macro.obj(publicAPI, model);
|
|
219
|
+
macro.get(publicAPI, model, ['url', 'baseURL', 'actors', 'scenes', 'cameras', 'animations', 'animationMixer', 'variants', 'variantMappings']);
|
|
220
|
+
macro.set(publicAPI, model, ['renderer', 'dracoDecoder']);
|
|
221
|
+
macro.event(publicAPI, model, 'ready');
|
|
222
|
+
|
|
223
|
+
// vtkGLTFImporter methods
|
|
224
|
+
vtkGLTFImporter(publicAPI, model);
|
|
225
|
+
|
|
226
|
+
// To support destructuring
|
|
227
|
+
if (!model.compression) {
|
|
228
|
+
model.compression = null;
|
|
229
|
+
}
|
|
230
|
+
if (!model.progressCallback) {
|
|
231
|
+
model.progressCallback = null;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
// ----------------------------------------------------------------------------
|
|
235
|
+
|
|
236
|
+
const newInstance = macro.newInstance(extend, 'vtkGLTFImporter');
|
|
237
|
+
|
|
238
|
+
// ----------------------------------------------------------------------------
|
|
239
|
+
|
|
240
|
+
var vtkGLTFImporter$1 = {
|
|
241
|
+
extend,
|
|
242
|
+
newInstance
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
export { vtkGLTFImporter$1 as default, extend, newInstance };
|
package/IO/Geometry.js
CHANGED
|
@@ -3,13 +3,15 @@ import vtkPLYReader from './Geometry/PLYReader.js';
|
|
|
3
3
|
import vtkDracoReader from './Geometry/DracoReader.js';
|
|
4
4
|
import vtkSTLWriter from './Geometry/STLWriter.js';
|
|
5
5
|
import vtkPLYWriter from './Geometry/PLYWriter.js';
|
|
6
|
+
import vtkGLTFImporter from './Geometry/GLTFImporter.js';
|
|
6
7
|
|
|
7
8
|
var Geometry = {
|
|
8
9
|
vtkSTLReader,
|
|
9
10
|
vtkPLYReader,
|
|
10
11
|
vtkDracoReader,
|
|
11
12
|
vtkSTLWriter,
|
|
12
|
-
vtkPLYWriter
|
|
13
|
+
vtkPLYWriter,
|
|
14
|
+
vtkGLTFImporter
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
export { Geometry as default };
|
package/IO/Image/HDRReader.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../Core/DataAccessHelper/LiteHttpDataAccessHelper.js';
|
|
2
2
|
import { m as macro } from '../../macros2.js';
|
|
3
3
|
import DataAccessHelper from '../Core/DataAccessHelper.js';
|
|
4
|
-
import {
|
|
4
|
+
import { C as xyz2rgb } from '../../Common/Core/Math/index.js';
|
|
5
5
|
import vtkImageData from '../../Common/DataModel/ImageData.js';
|
|
6
6
|
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
7
7
|
import { readLine, rgbe2float } from './HDRReader/Utils.js';
|
|
@@ -2,7 +2,7 @@ import { mat4, vec3 } from 'gl-matrix';
|
|
|
2
2
|
import { m as macro } from '../../macros2.js';
|
|
3
3
|
import vtkCompositeCameraManipulator from './CompositeCameraManipulator.js';
|
|
4
4
|
import vtkCompositeMouseManipulator from './CompositeMouseManipulator.js';
|
|
5
|
-
import { r as radiansFromDegrees,
|
|
5
|
+
import { r as radiansFromDegrees, A as degreesFromRadians } from '../../Common/Core/Math/index.js';
|
|
6
6
|
|
|
7
7
|
// ----------------------------------------------------------------------------
|
|
8
8
|
// vtkMouseCameraTrackballRollManipulator methods
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { m as macro } from '../../macros2.js';
|
|
2
2
|
import vtkInteractorStyle from '../../Rendering/Core/InteractorStyle.js';
|
|
3
3
|
import vtkInteractorStyleConstants from '../../Rendering/Core/InteractorStyle/Constants.js';
|
|
4
|
-
import {
|
|
4
|
+
import { A as degreesFromRadians } from '../../Common/Core/Math/index.js';
|
|
5
5
|
import { Device, Input } from '../../Rendering/Core/RenderWindowInteractor/Constants.js';
|
|
6
6
|
|
|
7
7
|
const {
|
package/Rendering/Core/Prop3D.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mat4, quat } from 'gl-matrix';
|
|
2
2
|
import { m as macro } from '../../macros2.js';
|
|
3
3
|
import vtkBoundingBox from '../../Common/DataModel/BoundingBox.js';
|
|
4
|
-
import {
|
|
4
|
+
import { A as degreesFromRadians, r as radiansFromDegrees, a as areMatricesEqual } from '../../Common/Core/Math/index.js';
|
|
5
5
|
import vtkProp from './Prop.js';
|
|
6
6
|
|
|
7
7
|
const VTK_EPSILON = 1e-6;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { m as macro } from '../../macros2.js';
|
|
2
|
-
import {
|
|
2
|
+
import { A as degreesFromRadians } from '../../Common/Core/Math/index.js';
|
|
3
3
|
import Constants from './RenderWindowInteractor/Constants.js';
|
|
4
4
|
|
|
5
5
|
const {
|