|
| 1 | +import { StageManager } from '../managers/StageManager'; |
| 2 | + |
| 3 | +/** |
| 4 | + * Simple generator that delegates stage creation and management |
| 5 | + * to StageManager. This keeps configuration handling flexible |
| 6 | + * while exposing a minimal interface for external modules. |
| 7 | + */ |
| 8 | +export class StageGenerator { |
| 9 | + constructor(renderer, container) { |
| 10 | + this.manager = new StageManager(renderer, container); |
| 11 | + } |
| 12 | + |
| 13 | + /** |
| 14 | + * Create a new stage using the provided configuration. |
| 15 | + * Convenience wrapper over StageManager.createStage. |
| 16 | + * |
| 17 | + * @param {string} name - Identifier for the stage. |
| 18 | + * @param {object} [config={}] - Optional stage configuration. |
| 19 | + * @returns {THREE.Scene} |
| 20 | + */ |
| 21 | + create(name, config = {}) { |
| 22 | + return this.manager.createStage(name, config); |
| 23 | + } |
| 24 | + |
| 25 | + /** Proxy to StageManager.setActiveStage. */ |
| 26 | + setActive(name) { |
| 27 | + this.manager.setActiveStage(name); |
| 28 | + } |
| 29 | + |
| 30 | + /** Update the active stage each frame. */ |
| 31 | + update(deltaTime) { |
| 32 | + this.manager.update(deltaTime); |
| 33 | + } |
| 34 | + |
| 35 | + /** Resize the underlying renderer and cameras. */ |
| 36 | + resize(width, height) { |
| 37 | + this.manager.resize(width, height); |
| 38 | + } |
| 39 | + |
| 40 | + /** Dispose of all resources created by the generator. */ |
| 41 | + dispose() { |
| 42 | + this.manager.dispose(); |
| 43 | + } |
| 44 | +} |
| 45 | + |
| 46 | +export default StageGenerator; |
0 commit comments