rayzee 4.8.9 → 4.8.11
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 +160 -74
- package/dist/rayzee.es.js +368 -86
- package/dist/rayzee.es.js.map +1 -1
- package/dist/rayzee.umd.js +1 -1
- package/dist/rayzee.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/PathTracerApp.js +179 -27
- package/src/api/AnimationAPI.js +87 -0
- package/src/api/CameraAPI.js +109 -0
- package/src/api/DenoisingAPI.js +243 -0
- package/src/api/EnvironmentAPI.js +106 -0
- package/src/api/LightsAPI.js +80 -0
- package/src/api/MaterialsAPI.js +73 -0
- package/src/api/OutputAPI.js +90 -0
- package/src/api/SelectionAPI.js +89 -0
- package/src/api/TransformAPI.js +49 -0
- package/src/api/index.js +16 -0
- package/src/index.js +13 -0
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
}
|
package/src/api/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rayzee Sub-API Facades
|
|
3
|
+
*
|
|
4
|
+
* Namespaced API modules accessed via engine.camera, engine.lights, etc.
|
|
5
|
+
* Each facade wraps an internal manager with a clean, consistent public interface.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export { OutputAPI } from './OutputAPI.js';
|
|
9
|
+
export { LightsAPI } from './LightsAPI.js';
|
|
10
|
+
export { AnimationAPI } from './AnimationAPI.js';
|
|
11
|
+
export { SelectionAPI } from './SelectionAPI.js';
|
|
12
|
+
export { TransformAPI } from './TransformAPI.js';
|
|
13
|
+
export { CameraAPI } from './CameraAPI.js';
|
|
14
|
+
export { EnvironmentAPI } from './EnvironmentAPI.js';
|
|
15
|
+
export { MaterialsAPI } from './MaterialsAPI.js';
|
|
16
|
+
export { DenoisingAPI } from './DenoisingAPI.js';
|
package/src/index.js
CHANGED
|
@@ -52,3 +52,16 @@ export { TransformManager } from './managers/TransformManager.js';
|
|
|
52
52
|
|
|
53
53
|
// Video rendering
|
|
54
54
|
export { VideoRenderManager } from './managers/VideoRenderManager.js';
|
|
55
|
+
|
|
56
|
+
// Sub-API facades (namespaced access via engine.camera, engine.lights, etc.)
|
|
57
|
+
export {
|
|
58
|
+
OutputAPI,
|
|
59
|
+
LightsAPI,
|
|
60
|
+
AnimationAPI,
|
|
61
|
+
SelectionAPI,
|
|
62
|
+
TransformAPI,
|
|
63
|
+
CameraAPI,
|
|
64
|
+
EnvironmentAPI,
|
|
65
|
+
MaterialsAPI,
|
|
66
|
+
DenoisingAPI,
|
|
67
|
+
} from './api/index.js';
|