rayzee 4.8.15 → 5.0.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/README.md +84 -97
- package/dist/rayzee.es.js +1910 -2175
- package/dist/rayzee.es.js.map +1 -1
- package/dist/rayzee.umd.js +56 -56
- package/dist/rayzee.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/PathTracerApp.js +402 -1567
- package/src/Pipeline/CompletionTracker.js +89 -0
- package/src/Processor/AssetLoader.js +25 -1
- package/src/Processor/SceneProcessor.js +146 -0
- package/src/Processor/TLASBuilder.js +61 -30
- package/src/RenderSettings.js +82 -4
- package/src/index.js +2 -12
- package/src/managers/AnimationManager.js +18 -6
- package/src/managers/CameraManager.js +133 -15
- package/src/managers/DenoisingManager.js +289 -3
- package/src/managers/EnvironmentManager.js +94 -1
- package/src/managers/InteractionManager.js +142 -0
- package/src/managers/LightManager.js +51 -1
- package/src/managers/OverlayManager.js +97 -0
- package/src/managers/TransformManager.js +1 -0
- package/src/managers/VideoRenderManager.js +6 -6
- package/src/managers/helpers/StatsHelper.js +45 -0
- package/src/api/AnimationAPI.js +0 -87
- package/src/api/CameraAPI.js +0 -109
- package/src/api/DenoisingAPI.js +0 -243
- package/src/api/EnvironmentAPI.js +0 -106
- package/src/api/LightsAPI.js +0 -80
- package/src/api/MaterialsAPI.js +0 -73
- package/src/api/OutputAPI.js +0 -90
- package/src/api/SelectionAPI.js +0 -89
- package/src/api/TransformAPI.js +0 -49
- package/src/api/index.js +0 -16
package/src/api/DenoisingAPI.js
DELETED
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Denoising sub-API — denoiser strategy, ASVGF, OIDN, upscaler,
|
|
3
|
-
* adaptive sampling, and auto-exposure controls.
|
|
4
|
-
*
|
|
5
|
-
* Access via `engine.denoising`.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* engine.denoising.setStrategy('asvgf', 'medium');
|
|
9
|
-
* engine.denoising.setAutoExposure(true);
|
|
10
|
-
* engine.denoising.setASVGFParams({ temporalAlpha: 0.1 });
|
|
11
|
-
*/
|
|
12
|
-
export class DenoisingAPI {
|
|
13
|
-
|
|
14
|
-
/** @param {import('../PathTracerApp.js').PathTracerApp} app */
|
|
15
|
-
constructor( app ) {
|
|
16
|
-
|
|
17
|
-
this._app = app;
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// ── Strategy ──
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Switches the real-time denoiser strategy.
|
|
25
|
-
* @param {'none'|'asvgf'|'ssrc'|'edgeaware'} strategy
|
|
26
|
-
* @param {string} [asvgfPreset] - ASVGF quality preset if strategy is 'asvgf'
|
|
27
|
-
*/
|
|
28
|
-
setStrategy( strategy, asvgfPreset ) {
|
|
29
|
-
|
|
30
|
-
this._app.setDenoiserStrategy( strategy, asvgfPreset );
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Enables or disables the ASVGF denoiser with optional quality preset.
|
|
36
|
-
* @param {boolean} enabled
|
|
37
|
-
* @param {string} [qualityPreset]
|
|
38
|
-
*/
|
|
39
|
-
setASVGFEnabled( enabled, qualityPreset ) {
|
|
40
|
-
|
|
41
|
-
this._app.setASVGFEnabled( enabled, qualityPreset );
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Applies an ASVGF quality preset.
|
|
47
|
-
* @param {'low'|'medium'|'high'} presetName
|
|
48
|
-
*/
|
|
49
|
-
applyASVGFPreset( presetName ) {
|
|
50
|
-
|
|
51
|
-
this._app.applyASVGFPreset( presetName );
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Enables or disables auto-exposure.
|
|
57
|
-
* @param {boolean} enabled
|
|
58
|
-
*/
|
|
59
|
-
setAutoExposure( enabled ) {
|
|
60
|
-
|
|
61
|
-
this._app.setAutoExposureEnabled( enabled );
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Enables or disables adaptive sampling.
|
|
67
|
-
* @param {boolean} enabled
|
|
68
|
-
*/
|
|
69
|
-
setAdaptiveSampling( enabled ) {
|
|
70
|
-
|
|
71
|
-
this._app.setAdaptiveSamplingEnabled( enabled );
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// ── Stage Parameters ──
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Updates ASVGF stage parameters.
|
|
79
|
-
* @param {Object} params - { temporalAlpha, phiColor, phiLuminance, atrousIterations, ... }
|
|
80
|
-
*/
|
|
81
|
-
setASVGFParams( params ) {
|
|
82
|
-
|
|
83
|
-
this._app.updateASVGFParameters( params );
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Toggles the ASVGF heatmap debug overlay.
|
|
89
|
-
* @param {boolean} enabled
|
|
90
|
-
*/
|
|
91
|
-
toggleASVGFHeatmap( enabled ) {
|
|
92
|
-
|
|
93
|
-
this._app.toggleASVGFHeatmap( enabled );
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Configures ASVGF for a specific render mode.
|
|
99
|
-
* @param {Object} config - { enabled, temporalAlpha, atrousIterations, ... }
|
|
100
|
-
*/
|
|
101
|
-
configureASVGFForMode( config ) {
|
|
102
|
-
|
|
103
|
-
this._app.configureASVGFForMode( config );
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Updates SSRC stage parameters.
|
|
109
|
-
* @param {Object} params - { temporalAlpha, spatialRadius, spatialWeight }
|
|
110
|
-
*/
|
|
111
|
-
setSSRCParams( params ) {
|
|
112
|
-
|
|
113
|
-
this._app.updateSSRCParameters( params );
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Updates edge-aware filtering parameters.
|
|
119
|
-
* @param {Object} params - { pixelEdgeSharpness, edgeSharpenSpeed, edgeThreshold }
|
|
120
|
-
*/
|
|
121
|
-
setEdgeAwareParams( params ) {
|
|
122
|
-
|
|
123
|
-
this._app.updateEdgeAwareUniforms( params );
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Updates auto-exposure stage parameters.
|
|
129
|
-
* @param {Object} params - { keyValue, minExposure, maxExposure, ... }
|
|
130
|
-
*/
|
|
131
|
-
setAutoExposureParams( params ) {
|
|
132
|
-
|
|
133
|
-
this._app.updateAutoExposureParameters( params );
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// ── Adaptive Sampling ──
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Updates adaptive sampling parameters.
|
|
141
|
-
* @param {Object} params
|
|
142
|
-
*/
|
|
143
|
-
setAdaptiveSamplingParams( params ) {
|
|
144
|
-
|
|
145
|
-
this._app.setAdaptiveSamplingParameters( params );
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Toggles the adaptive sampling debug helper.
|
|
151
|
-
* @param {boolean} enabled
|
|
152
|
-
*/
|
|
153
|
-
toggleAdaptiveSamplingHelper( enabled ) {
|
|
154
|
-
|
|
155
|
-
this._app.toggleAdaptiveSamplingHelper( enabled );
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// ── OIDN ──
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Enables or disables Intel OIDN denoiser (final render quality).
|
|
163
|
-
* @param {boolean} enabled
|
|
164
|
-
*/
|
|
165
|
-
setOIDNEnabled( enabled ) {
|
|
166
|
-
|
|
167
|
-
this._app.setOIDNEnabled( enabled );
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Sets OIDN denoiser quality.
|
|
173
|
-
* @param {string} quality
|
|
174
|
-
*/
|
|
175
|
-
setOIDNQuality( quality ) {
|
|
176
|
-
|
|
177
|
-
this._app.updateOIDNQuality( quality );
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Enables or disables the OIDN tile helper overlay.
|
|
183
|
-
* @param {boolean} enabled
|
|
184
|
-
*/
|
|
185
|
-
setOIDNTileHelper( enabled ) {
|
|
186
|
-
|
|
187
|
-
this._app.setOIDNTileHelper( enabled );
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Enables or disables the tile helper overlay.
|
|
193
|
-
* @param {boolean} enabled
|
|
194
|
-
*/
|
|
195
|
-
setTileHelperEnabled( enabled ) {
|
|
196
|
-
|
|
197
|
-
this._app.setTileHelperEnabled( enabled );
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Enables or disables tile highlight.
|
|
203
|
-
* @param {boolean} enabled
|
|
204
|
-
*/
|
|
205
|
-
setTileHighlightEnabled( enabled ) {
|
|
206
|
-
|
|
207
|
-
this._app.setTileHighlightEnabled( enabled );
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// ── AI Upscaler ──
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Enables or disables the AI upscaler.
|
|
215
|
-
* @param {boolean} enabled
|
|
216
|
-
*/
|
|
217
|
-
setUpscalerEnabled( enabled ) {
|
|
218
|
-
|
|
219
|
-
this._app.setUpscalerEnabled( enabled );
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Sets the upscaler scale factor.
|
|
225
|
-
* @param {number} factor
|
|
226
|
-
*/
|
|
227
|
-
setUpscalerScaleFactor( factor ) {
|
|
228
|
-
|
|
229
|
-
this._app.setUpscalerScaleFactor( factor );
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Sets the upscaler quality level.
|
|
235
|
-
* @param {string} quality
|
|
236
|
-
*/
|
|
237
|
-
setUpscalerQuality( quality ) {
|
|
238
|
-
|
|
239
|
-
this._app.setUpscalerQuality( quality );
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Environment sub-API — HDR maps, sky modes, and procedural generation.
|
|
3
|
-
*
|
|
4
|
-
* Access via `engine.environment`.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* await engine.environment.setMode('gradient');
|
|
8
|
-
* engine.environment.params.sunElevation = 45;
|
|
9
|
-
* engine.environment.markDirty();
|
|
10
|
-
*/
|
|
11
|
-
export class EnvironmentAPI {
|
|
12
|
-
|
|
13
|
-
/** @param {import('../PathTracerApp.js').PathTracerApp} app */
|
|
14
|
-
constructor( app ) {
|
|
15
|
-
|
|
16
|
-
this._app = app;
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Current environment parameters (sun position, sky colors, etc.).
|
|
22
|
-
* @returns {Object|null}
|
|
23
|
-
*/
|
|
24
|
-
get params() {
|
|
25
|
-
|
|
26
|
-
return this._app.getEnvParams();
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* The loaded environment texture.
|
|
32
|
-
* @returns {import('three').Texture|null}
|
|
33
|
-
*/
|
|
34
|
-
get texture() {
|
|
35
|
-
|
|
36
|
-
return this._app.getEnvironmentTexture();
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Loads an HDR/EXR environment map from URL.
|
|
42
|
-
* @param {string} url
|
|
43
|
-
*/
|
|
44
|
-
async load( url ) {
|
|
45
|
-
|
|
46
|
-
await this._app.loadEnvironment( url );
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Sets a custom environment texture directly.
|
|
52
|
-
* @param {import('three').Texture} texture
|
|
53
|
-
*/
|
|
54
|
-
async setTexture( texture ) {
|
|
55
|
-
|
|
56
|
-
await this._app.setEnvironmentMap( texture );
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Switches the sky mode.
|
|
62
|
-
* @param {'hdri'|'procedural'|'gradient'|'color'} mode
|
|
63
|
-
*/
|
|
64
|
-
async setMode( mode ) {
|
|
65
|
-
|
|
66
|
-
await this._app.setEnvironmentMode( mode );
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Generates a procedural Preetham-model sky texture.
|
|
72
|
-
*/
|
|
73
|
-
async generateProcedural() {
|
|
74
|
-
|
|
75
|
-
return this._app.generateProceduralSkyTexture();
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Generates a gradient sky texture.
|
|
81
|
-
*/
|
|
82
|
-
async generateGradient() {
|
|
83
|
-
|
|
84
|
-
return this._app.generateGradientTexture();
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Generates a solid color sky texture.
|
|
90
|
-
*/
|
|
91
|
-
async generateSolid() {
|
|
92
|
-
|
|
93
|
-
return this._app.generateSolidColorTexture();
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Flags the environment texture for GPU re-upload.
|
|
99
|
-
*/
|
|
100
|
-
markDirty() {
|
|
101
|
-
|
|
102
|
-
this._app.markEnvironmentNeedsUpdate();
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
}
|
package/src/api/LightsAPI.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lights sub-API — light CRUD, helpers, and GPU sync.
|
|
3
|
-
*
|
|
4
|
-
* Access via `engine.lights`.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* engine.lights.add('PointLight');
|
|
8
|
-
* engine.lights.showHelpers(true);
|
|
9
|
-
* engine.lights.getAll();
|
|
10
|
-
*/
|
|
11
|
-
export class LightsAPI {
|
|
12
|
-
|
|
13
|
-
/** @param {import('../PathTracerApp.js').PathTracerApp} app */
|
|
14
|
-
constructor( app ) {
|
|
15
|
-
|
|
16
|
-
this._app = app;
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Adds a light to the scene.
|
|
22
|
-
* @param {'DirectionalLight'|'PointLight'|'SpotLight'|'RectAreaLight'} type
|
|
23
|
-
* @returns {Object|null} Light descriptor
|
|
24
|
-
*/
|
|
25
|
-
add( type ) {
|
|
26
|
-
|
|
27
|
-
return this._app.addLight( type );
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Removes a light by UUID.
|
|
33
|
-
* @param {string} uuid
|
|
34
|
-
* @returns {boolean}
|
|
35
|
-
*/
|
|
36
|
-
remove( uuid ) {
|
|
37
|
-
|
|
38
|
-
return this._app.removeLight( uuid );
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Removes all lights from the scene.
|
|
44
|
-
*/
|
|
45
|
-
clear() {
|
|
46
|
-
|
|
47
|
-
this._app.clearLights();
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Returns descriptors for all lights in the scene.
|
|
53
|
-
* @returns {Object[]}
|
|
54
|
-
*/
|
|
55
|
-
getAll() {
|
|
56
|
-
|
|
57
|
-
return this._app.getLights();
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Re-uploads light data to the GPU.
|
|
63
|
-
*/
|
|
64
|
-
sync() {
|
|
65
|
-
|
|
66
|
-
this._app.updateLights();
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Shows or hides visual light helpers.
|
|
72
|
-
* @param {boolean} show
|
|
73
|
-
*/
|
|
74
|
-
showHelpers( show ) {
|
|
75
|
-
|
|
76
|
-
this._app.setShowLightHelper( show );
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
}
|
package/src/api/MaterialsAPI.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Materials sub-API — material property updates and texture transforms.
|
|
3
|
-
*
|
|
4
|
-
* Access via `engine.materials`.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* engine.materials.setProperty(0, 'roughness', 0.5);
|
|
8
|
-
* engine.materials.refresh();
|
|
9
|
-
*/
|
|
10
|
-
export class MaterialsAPI {
|
|
11
|
-
|
|
12
|
-
/** @param {import('../PathTracerApp.js').PathTracerApp} app */
|
|
13
|
-
constructor( app ) {
|
|
14
|
-
|
|
15
|
-
this._app = app;
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Updates a single material property and triggers emissive rebuild if needed.
|
|
21
|
-
* @param {number} materialIndex
|
|
22
|
-
* @param {string} property
|
|
23
|
-
* @param {*} value
|
|
24
|
-
*/
|
|
25
|
-
setProperty( materialIndex, property, value ) {
|
|
26
|
-
|
|
27
|
-
this._app.updateMaterialProperty( materialIndex, property, value );
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Updates a material's texture transform (offset, repeat, rotation).
|
|
33
|
-
* @param {number} materialIndex
|
|
34
|
-
* @param {string} textureName
|
|
35
|
-
* @param {Object} transform
|
|
36
|
-
*/
|
|
37
|
-
setTextureTransform( materialIndex, textureName, transform ) {
|
|
38
|
-
|
|
39
|
-
this._app.updateTextureTransform( materialIndex, textureName, transform );
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Re-uploads all material data to the GPU.
|
|
45
|
-
*/
|
|
46
|
-
refresh() {
|
|
47
|
-
|
|
48
|
-
this._app.refreshMaterial();
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Replaces a material entirely.
|
|
54
|
-
* @param {number} materialIndex
|
|
55
|
-
* @param {import('three').Material} material
|
|
56
|
-
*/
|
|
57
|
-
replace( materialIndex, material ) {
|
|
58
|
-
|
|
59
|
-
this._app.updateMaterial( materialIndex, material );
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Full material rebuild (required after texture changes).
|
|
65
|
-
* @param {import('three').Scene} [scene]
|
|
66
|
-
*/
|
|
67
|
-
async rebuild( scene ) {
|
|
68
|
-
|
|
69
|
-
await this._app.rebuildMaterials( scene );
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
}
|
package/src/api/OutputAPI.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Output sub-API — canvas, screenshots, resize, and scene statistics.
|
|
3
|
-
*
|
|
4
|
-
* Access via `engine.output`.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* engine.output.setSize(1920, 1080);
|
|
8
|
-
* engine.output.screenshot();
|
|
9
|
-
* const stats = engine.output.getStatistics();
|
|
10
|
-
*/
|
|
11
|
-
export class OutputAPI {
|
|
12
|
-
|
|
13
|
-
/** @param {import('../PathTracerApp.js').PathTracerApp} app */
|
|
14
|
-
constructor( app ) {
|
|
15
|
-
|
|
16
|
-
this._app = app;
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Returns the canvas element with the final rendered image.
|
|
22
|
-
* Ensures the WebGPU canvas has fresh content if needed.
|
|
23
|
-
* @returns {HTMLCanvasElement|null}
|
|
24
|
-
*/
|
|
25
|
-
getCanvas() {
|
|
26
|
-
|
|
27
|
-
return this._app.getOutputCanvas();
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Downloads a PNG screenshot of the current render.
|
|
33
|
-
*/
|
|
34
|
-
screenshot() {
|
|
35
|
-
|
|
36
|
-
this._app.takeScreenshot();
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Returns scene statistics (triangle count, mesh count, etc.).
|
|
42
|
-
* @returns {Object|null}
|
|
43
|
-
*/
|
|
44
|
-
getStatistics() {
|
|
45
|
-
|
|
46
|
-
return this._app.getSceneStatistics();
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Sets explicit canvas dimensions and triggers resize.
|
|
52
|
-
* @param {number} width
|
|
53
|
-
* @param {number} height
|
|
54
|
-
*/
|
|
55
|
-
setSize( width, height ) {
|
|
56
|
-
|
|
57
|
-
this._app.setCanvasSize( width, height );
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Triggers a manual resize recalculation from current canvas dimensions.
|
|
63
|
-
*/
|
|
64
|
-
resize() {
|
|
65
|
-
|
|
66
|
-
this._app.onResize();
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Whether the path tracer has finished converging.
|
|
72
|
-
* @returns {boolean}
|
|
73
|
-
*/
|
|
74
|
-
isComplete() {
|
|
75
|
-
|
|
76
|
-
return this._app.isComplete();
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Returns the current accumulated frame/sample count.
|
|
82
|
-
* @returns {number}
|
|
83
|
-
*/
|
|
84
|
-
getFrameCount() {
|
|
85
|
-
|
|
86
|
-
return this._app.getFrameCount();
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
}
|
package/src/api/SelectionAPI.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Selection sub-API — object picking and interaction modes.
|
|
3
|
-
*
|
|
4
|
-
* Access via `engine.selection`.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* engine.selection.select(meshObject);
|
|
8
|
-
* engine.selection.toggleMode();
|
|
9
|
-
*/
|
|
10
|
-
export class SelectionAPI {
|
|
11
|
-
|
|
12
|
-
/** @param {import('../PathTracerApp.js').PathTracerApp} app */
|
|
13
|
-
constructor( app ) {
|
|
14
|
-
|
|
15
|
-
this._app = app;
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Programmatically selects an object (or deselects if null).
|
|
21
|
-
* @param {import('three').Object3D|null} object
|
|
22
|
-
*/
|
|
23
|
-
select( object ) {
|
|
24
|
-
|
|
25
|
-
this._app.selectObject( object );
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Deselects the current object.
|
|
31
|
-
*/
|
|
32
|
-
deselect() {
|
|
33
|
-
|
|
34
|
-
this._app.selectObject( null );
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Toggles object selection mode on/off.
|
|
40
|
-
* @returns {boolean} Whether selection mode is now active
|
|
41
|
-
*/
|
|
42
|
-
toggleMode() {
|
|
43
|
-
|
|
44
|
-
return this._app.toggleSelectMode();
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Disables selection mode and detaches transform gizmo.
|
|
50
|
-
*/
|
|
51
|
-
disableMode() {
|
|
52
|
-
|
|
53
|
-
this._app.disableSelectMode();
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Toggles click-to-focus DOF mode.
|
|
59
|
-
* @returns {boolean} Whether focus mode is now active
|
|
60
|
-
*/
|
|
61
|
-
toggleFocusMode() {
|
|
62
|
-
|
|
63
|
-
return this._app.toggleFocusMode();
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Dispatches an event through the interaction manager.
|
|
69
|
-
* @param {Object} event
|
|
70
|
-
*/
|
|
71
|
-
dispatchEvent( event ) {
|
|
72
|
-
|
|
73
|
-
this._app.dispatchInteractionEvent( event );
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Subscribes to an interaction manager event.
|
|
79
|
-
* @param {string} type
|
|
80
|
-
* @param {Function} handler
|
|
81
|
-
* @returns {Function} Unsubscribe function
|
|
82
|
-
*/
|
|
83
|
-
on( type, handler ) {
|
|
84
|
-
|
|
85
|
-
return this._app.onInteractionEvent( type, handler );
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
}
|
package/src/api/TransformAPI.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transform sub-API — gizmo mode and space controls.
|
|
3
|
-
*
|
|
4
|
-
* Access via `engine.transform`.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* engine.transform.setMode('rotate');
|
|
8
|
-
* engine.transform.setSpace('local');
|
|
9
|
-
*/
|
|
10
|
-
export class TransformAPI {
|
|
11
|
-
|
|
12
|
-
/** @param {import('../PathTracerApp.js').PathTracerApp} app */
|
|
13
|
-
constructor( app ) {
|
|
14
|
-
|
|
15
|
-
this._app = app;
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Sets the transform gizmo mode.
|
|
21
|
-
* @param {'translate'|'rotate'|'scale'} mode
|
|
22
|
-
*/
|
|
23
|
-
setMode( mode ) {
|
|
24
|
-
|
|
25
|
-
this._app.setTransformMode( mode );
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Sets the transform gizmo coordinate space.
|
|
31
|
-
* @param {'world'|'local'} space
|
|
32
|
-
*/
|
|
33
|
-
setSpace( space ) {
|
|
34
|
-
|
|
35
|
-
this._app.setTransformSpace( space );
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Direct access to the underlying TransformManager (advanced).
|
|
41
|
-
* @returns {import('../managers/TransformManager.js').TransformManager}
|
|
42
|
-
*/
|
|
43
|
-
get manager() {
|
|
44
|
-
|
|
45
|
-
return this._app.transformManager;
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
}
|