rayzee 4.8.14 → 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 CHANGED
@@ -63,10 +63,10 @@ npm install rayzee three
63
63
  engine.set('bounces', 8);
64
64
  engine.set('exposure', 1.2);
65
65
 
66
- // Use namespaced sub-APIs
67
- engine.camera.switch(0);
68
- engine.lights.add('PointLight');
69
- engine.output.screenshot();
66
+ // Use namespaced APIs and direct methods
67
+ engine.cameraManager.switch(0);
68
+ engine.lightManager.add('PointLight');
69
+ engine.screenshot();
70
70
  ```
71
71
 
72
72
  4. **Run**
@@ -116,7 +116,7 @@ A single HTML file — no Node.js, no build step. Uses [ES module import maps](h
116
116
  window.addEventListener('resize', () => {
117
117
  canvas.width = window.innerWidth;
118
118
  canvas.height = window.innerHeight;
119
- engine.output.resize();
119
+ engine.onResize();
120
120
  });
121
121
  </script>
122
122
  </body>
@@ -168,7 +168,7 @@ No special build config is needed — models and HDRs are loaded via URL at runt
168
168
 
169
169
  ### PathTracerApp
170
170
 
171
- The main engine class. Extends Three.js `EventDispatcher`. Related functionality is grouped into **namespaced sub-APIs** accessed via `engine.camera`, `engine.lights`, etc.
171
+ The main engine class. Extends Three.js `EventDispatcher`. Related functionality is grouped into **namespaced managers** accessed via `engine.cameraManager`, `engine.lightManager`, etc., or as direct methods on the engine instance.
172
172
 
173
173
  ```js
174
174
  const engine = new PathTracerApp(canvas, options?)
@@ -250,137 +250,137 @@ engine.configureForMode('results') // Paused rendering for image viewing
250
250
 
251
251
  ---
252
252
 
253
- ### engine.camera
253
+ ### engine.cameraManager
254
254
 
255
255
  Camera switching, auto-focus, DOF, and direct Three.js access.
256
256
 
257
257
  ```js
258
- engine.camera.active // The active PerspectiveCamera
259
- engine.camera.controls // The OrbitControls instance
260
- engine.camera.switch(index) // Switch between scene cameras
261
- engine.camera.getNames() // List available cameras
262
- engine.camera.focusOn(center) // Focus orbit camera on a world-space point
263
- engine.camera.setAutoFocusMode(mode) // 'auto' | 'manual'
264
- engine.camera.setAFScreenPoint(x, y) // Set normalized AF screen point (0-1)
258
+ engine.cameraManager.active // The active PerspectiveCamera
259
+ engine.cameraManager.controls // The OrbitControls instance
260
+ engine.cameraManager.switch(index) // Switch between scene cameras
261
+ engine.cameraManager.getNames() // List available cameras
262
+ engine.cameraManager.focusOn(center) // Focus orbit camera on a world-space point
263
+ engine.cameraManager.setAutoFocusMode(mode) // 'auto' | 'manual'
264
+ engine.cameraManager.setAFScreenPoint(x, y) // Set normalized AF screen point (0-1)
265
265
  ```
266
266
 
267
- ### engine.lights
267
+ ### engine.lightManager
268
268
 
269
269
  Light CRUD, visual helpers, and GPU sync.
270
270
 
271
271
  ```js
272
- engine.lights.add('PointLight') // Add a light (PointLight, SpotLight, DirectionalLight, RectAreaLight)
273
- engine.lights.remove(uuid) // Remove by UUID
274
- engine.lights.clear() // Remove all lights
275
- engine.lights.getAll() // Get all light descriptors
276
- engine.lights.sync() // Re-upload light data to GPU
277
- engine.lights.showHelpers(true) // Toggle visual helpers
272
+ engine.lightManager.add('PointLight') // Add a light (PointLight, SpotLight, DirectionalLight, RectAreaLight)
273
+ engine.lightManager.remove(uuid) // Remove by UUID
274
+ engine.lightManager.clear() // Remove all lights
275
+ engine.lightManager.getAll() // Get all light descriptors
276
+ engine.lightManager.sync() // Re-upload light data to GPU
277
+ engine.lightManager.showHelpers(true) // Toggle visual helpers
278
278
  ```
279
279
 
280
- ### engine.animation
280
+ ### engine.animationManager
281
281
 
282
282
  GLTF animation playback controls.
283
283
 
284
284
  ```js
285
- engine.animation.play(clipIndex) // Play an animation clip
286
- engine.animation.pause() // Pause playback
287
- engine.animation.resume() // Resume playback
288
- engine.animation.stop() // Stop and reset
289
- engine.animation.setSpeed(2) // Set playback speed multiplier
290
- engine.animation.setLoop(true) // Enable/disable looping
291
- engine.animation.clips // Get available animation clips
285
+ engine.animationManager.play(clipIndex) // Play an animation clip
286
+ engine.animationManager.pause() // Pause playback
287
+ engine.animationManager.resume() // Resume playback
288
+ engine.animationManager.stop() // Stop and reset
289
+ engine.animationManager.setSpeed(2) // Set playback speed multiplier
290
+ engine.animationManager.setLoop(true) // Enable/disable looping
291
+ engine.animationManager.clips // Get available animation clips
292
292
  ```
293
293
 
294
- ### engine.materials
294
+ ### Materials
295
295
 
296
- Material property updates and texture transforms.
296
+ Material property updates and texture transforms — accessed as direct methods on the engine.
297
297
 
298
298
  ```js
299
- engine.materials.setProperty(index, property, value) // Update a material property
300
- engine.materials.setTextureTransform(index, name, transform)
301
- engine.materials.refresh() // Re-upload all material data to GPU
302
- engine.materials.replace(index, mat) // Replace a material entirely
303
- await engine.materials.rebuild(scene) // Full rebuild (after texture changes)
299
+ engine.setMaterialProperty(index, property, value) // Update a material property
300
+ engine.setTextureTransform(index, name, transform) // Update texture transform
301
+ engine.reset() // Re-upload all material data to GPU
302
+ engine.stages.pathTracer.materialData.updateMaterial(index, mat) // Replace a material
303
+ await engine.rebuildMaterials(scene) // Full rebuild (after texture changes)
304
304
  ```
305
305
 
306
- ### engine.environment
306
+ ### engine.environmentManager
307
307
 
308
308
  Environment maps, sky modes, and procedural generation.
309
309
 
310
310
  ```js
311
- engine.environment.params // Current environment parameters
312
- engine.environment.texture // The loaded environment texture
313
- await engine.environment.load(url) // Load HDR/EXR environment map
314
- await engine.environment.setTexture(tex) // Set a custom environment texture
315
- await engine.environment.setMode(mode) // 'hdri' | 'procedural' | 'gradient' | 'color'
316
- await engine.environment.generateProcedural() // Preetham-model sky
317
- await engine.environment.generateGradient() // Gradient sky
318
- await engine.environment.generateSolid() // Solid color sky
319
- engine.environment.markDirty() // Flag environment for GPU re-upload
311
+ engine.environmentManager.params // Current environment parameters
312
+ engine.environmentManager.texture // The loaded environment texture
313
+ await engine.environmentManager.load(url) // Load HDR/EXR environment map
314
+ await engine.environmentManager.setTexture(tex) // Set a custom environment texture
315
+ await engine.environmentManager.setMode(mode) // 'hdri' | 'procedural' | 'gradient' | 'color'
316
+ await engine.environmentManager.generateProcedural() // Preetham-model sky
317
+ await engine.environmentManager.generateGradient() // Gradient sky
318
+ await engine.environmentManager.generateSolid() // Solid color sky
319
+ engine.environmentManager.markDirty() // Flag environment for GPU re-upload
320
320
  ```
321
321
 
322
- ### engine.denoising
322
+ ### engine.denoisingManager
323
323
 
324
324
  Denoiser strategy, ASVGF, OIDN, upscaler, adaptive sampling, and auto-exposure.
325
325
 
326
326
  ```js
327
327
  // Strategy
328
- engine.denoising.setStrategy('asvgf', 'medium') // 'none' | 'asvgf' | 'ssrc' | 'edgeaware'
329
- engine.denoising.setASVGFEnabled(true, 'medium')
330
- engine.denoising.applyASVGFPreset('high') // 'low' | 'medium' | 'high'
331
- engine.denoising.setAutoExposure(true)
332
- engine.denoising.setAdaptiveSampling(true)
328
+ engine.denoisingManager.setStrategy('asvgf', 'medium') // 'none' | 'asvgf' | 'ssrc' | 'edgeaware'
329
+ engine.denoisingManager.setASVGFEnabled(true, 'medium')
330
+ engine.denoisingManager.applyASVGFPreset('high') // 'low' | 'medium' | 'high'
331
+ engine.denoisingManager.setAutoExposure(true)
332
+ engine.denoisingManager.setAdaptiveSampling(true)
333
333
 
334
334
  // Fine-grained parameters
335
- engine.denoising.setASVGFParams({ temporalAlpha: 0.1, phiColor: 10 })
336
- engine.denoising.setSSRCParams({ temporalAlpha: 0.1, spatialRadius: 3 })
337
- engine.denoising.setEdgeAwareParams({ pixelEdgeSharpness: 1.0 })
338
- engine.denoising.setAutoExposureParams({ keyValue: 0.18 })
339
- engine.denoising.setAdaptiveSamplingParams({ varianceThreshold: 0.01 })
335
+ engine.denoisingManager.setASVGFParams({ temporalAlpha: 0.1, phiColor: 10 })
336
+ engine.denoisingManager.setSSRCParams({ temporalAlpha: 0.1, spatialRadius: 3 })
337
+ engine.denoisingManager.setEdgeAwareParams({ pixelEdgeSharpness: 1.0 })
338
+ engine.denoisingManager.setAutoExposureParams({ keyValue: 0.18 })
339
+ engine.denoisingManager.setAdaptiveSamplingParams({ varianceThreshold: 0.01 })
340
340
 
341
341
  // OIDN & Upscaler
342
- engine.denoising.setOIDNEnabled(true)
343
- engine.denoising.setOIDNQuality('high')
344
- engine.denoising.setUpscalerEnabled(true)
345
- engine.denoising.setUpscalerScaleFactor(2)
346
- engine.denoising.setUpscalerQuality('high')
342
+ engine.denoisingManager.setOIDNEnabled(true)
343
+ engine.denoisingManager.setOIDNQuality('high')
344
+ engine.denoisingManager.setUpscalerEnabled(true)
345
+ engine.denoisingManager.setUpscalerScaleFactor(2)
346
+ engine.denoisingManager.setUpscalerQuality('high')
347
347
  ```
348
348
 
349
- ### engine.selection
349
+ ### engine.interactionManager
350
350
 
351
351
  Object picking and interaction modes.
352
352
 
353
353
  ```js
354
- engine.selection.select(object) // Programmatically select an object
355
- engine.selection.deselect() // Deselect the current object
356
- engine.selection.toggleMode() // Toggle object selection mode
357
- engine.selection.disableMode() // Disable selection mode
358
- engine.selection.toggleFocusMode() // Toggle click-to-focus DOF
359
- engine.selection.on(type, handler) // Subscribe to interaction events
354
+ engine.interactionManager.select(object) // Programmatically select an object
355
+ engine.interactionManager.deselect() // Deselect the current object
356
+ engine.interactionManager.toggleSelectMode() // Toggle object selection mode
357
+ engine.interactionManager.disableMode() // Disable selection mode and detach gizmo
358
+ engine.interactionManager.toggleFocusMode() // Toggle click-to-focus DOF
359
+ engine.interactionManager.on(type, handler) // Subscribe (returns unsubscribe function)
360
360
  ```
361
361
 
362
- ### engine.transform
362
+ ### engine.transformManager
363
363
 
364
364
  Transform gizmo controls.
365
365
 
366
366
  ```js
367
- engine.transform.setMode('translate') // 'translate' | 'rotate' | 'scale'
368
- engine.transform.setSpace('world') // 'world' | 'local'
369
- engine.transform.manager // Access the underlying TransformManager
367
+ engine.transformManager.setMode('translate') // 'translate' | 'rotate' | 'scale'
368
+ engine.transformManager.setSpace('world') // 'world' | 'local'
369
+ engine.transformManager.manager // Access the underlying TransformManager
370
370
  ```
371
371
 
372
- ### engine.output
372
+ ### Output Methods
373
373
 
374
- Canvas output, screenshots, and scene statistics.
374
+ Canvas output, screenshots, and scene statistics — accessed as direct methods on the engine.
375
375
 
376
376
  ```js
377
- engine.output.getCanvas() // Get the canvas with the final rendered image
378
- engine.output.screenshot() // Download a PNG screenshot
379
- engine.output.getStatistics() // Triangle count, mesh count, etc.
380
- engine.output.setSize(1920, 1080) // Set explicit canvas dimensions
381
- engine.output.resize() // Trigger manual resize recalculation
382
- engine.output.isComplete() // Check if rendering has converged
383
- engine.output.getFrameCount() // Get the current accumulated frame count
377
+ engine.getCanvas() // Get the canvas with the final rendered image
378
+ engine.screenshot() // Download a PNG screenshot
379
+ engine.getStatistics() // Triangle count, mesh count, etc.
380
+ engine.setCanvasSize(1920, 1080) // Set explicit canvas dimensions
381
+ engine.onResize() // Trigger manual resize recalculation
382
+ engine.isComplete() // Check if rendering has converged
383
+ engine.getFrameCount() // Get the current accumulated frame count
384
384
  ```
385
385
 
386
386
  ---
@@ -443,19 +443,6 @@ class MyCustomStage extends RenderStage {
443
443
  // Core
444
444
  import { PathTracerApp, EngineEvents } from 'rayzee';
445
445
 
446
- // Sub-API facades (also accessible as engine.camera, engine.lights, etc.)
447
- import {
448
- CameraAPI,
449
- LightsAPI,
450
- AnimationAPI,
451
- MaterialsAPI,
452
- EnvironmentAPI,
453
- DenoisingAPI,
454
- SelectionAPI,
455
- TransformAPI,
456
- OutputAPI,
457
- } from 'rayzee';
458
-
459
446
  // Configuration & presets
460
447
  import {
461
448
  ENGINE_DEFAULTS,
@@ -517,8 +504,8 @@ OIDN provides high-quality AI denoising for final renders. It runs automatically
517
504
 
518
505
  ```js
519
506
  // After engine.init() completes
520
- engine.denoising.setOIDNEnabled(true);
521
- engine.denoising.setOIDNQuality('balance'); // 'fast' | 'balance' | 'high'
507
+ engine.denoisingManager.setOIDNEnabled(true);
508
+ engine.denoisingManager.setOIDNQuality('balance'); // 'fast' | 'balance' | 'high'
522
509
  ```
523
510
 
524
511
  3. **Listen for progress** (optional)