simple-circuit-engine 0.0.11 → 0.0.13
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/AGENTS.md +11 -7
- package/CLAUDE.md +6 -6
- package/README.md +5 -2
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.js +85 -2115
- package/dist/core/setup.d.ts +25 -0
- package/dist/core/simulation/CircuitRunner.d.ts +176 -0
- package/dist/core/simulation/DirtyTracker.d.ts +87 -0
- package/dist/core/simulation/EventQueue.d.ts +68 -0
- package/dist/core/simulation/StateManager.d.ts +100 -0
- package/dist/core/simulation/behaviors/BehaviorRegistry.d.ts +70 -0
- package/dist/core/simulation/behaviors/ComponentBehavior.d.ts +53 -0
- package/dist/core/simulation/behaviors/arithmetic/AdderBehavior.d.ts +28 -0
- package/dist/core/simulation/behaviors/arithmetic/ArithmeticBehaviorMixin.d.ts +63 -0
- package/dist/core/simulation/behaviors/arithmetic/EightBitAdderBehavior.d.ts +51 -0
- package/dist/core/simulation/behaviors/arithmetic/EightBitOnesComplementBehavior.d.ts +29 -0
- package/dist/core/simulation/behaviors/arithmetic/HalfAdderBehavior.d.ts +22 -0
- package/dist/core/simulation/behaviors/arithmetic/index.d.ts +7 -0
- package/dist/core/simulation/behaviors/basic/BatteryBehavior.d.ts +14 -0
- package/dist/core/simulation/behaviors/basic/ClockBehavior.d.ts +24 -0
- package/dist/core/simulation/behaviors/basic/DoubleThrowSwitchBehavior.d.ts +33 -0
- package/dist/core/simulation/behaviors/basic/LightbulbBehavior.d.ts +23 -0
- package/dist/core/simulation/behaviors/basic/RectangleLEDBehavior.d.ts +24 -0
- package/dist/core/simulation/behaviors/basic/RelayBehavior.d.ts +33 -0
- package/dist/core/simulation/behaviors/basic/SmallLEDBehavior.d.ts +24 -0
- package/dist/core/simulation/behaviors/basic/SwitchBehavior.d.ts +33 -0
- package/dist/core/simulation/behaviors/basic/index.d.ts +20 -0
- package/dist/core/simulation/behaviors/gates/InverterBehavior.d.ts +29 -0
- package/dist/core/simulation/behaviors/gates/Nand4GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/Nand8GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/NandGateBehavior.d.ts +28 -0
- package/dist/core/simulation/behaviors/gates/Nor4GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/Nor8GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/NorGateBehavior.d.ts +22 -0
- package/dist/core/simulation/behaviors/gates/Xor4GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/Xor8GateBehavior.d.ts +18 -0
- package/dist/core/simulation/behaviors/gates/XorGateBehavior.d.ts +22 -0
- package/dist/core/simulation/behaviors/gates/index.d.ts +34 -0
- package/dist/core/simulation/behaviors/index.d.ts +28 -0
- package/dist/core/simulation/behaviors/types.d.ts +101 -0
- package/dist/core/simulation/index.d.ts +18 -0
- package/dist/core/simulation/states/ComponentState.d.ts +57 -0
- package/dist/core/simulation/states/SimulationState.d.ts +46 -0
- package/dist/core/simulation/states/arithmetic/AdderState.d.ts +16 -0
- package/dist/core/simulation/states/arithmetic/ArithmeticState.d.ts +53 -0
- package/dist/core/simulation/states/arithmetic/EightBitAdderState.d.ts +25 -0
- package/dist/core/simulation/states/arithmetic/EightBitOnesComplementState.d.ts +18 -0
- package/dist/core/simulation/states/arithmetic/HalfAdderState.d.ts +16 -0
- package/dist/core/simulation/states/arithmetic/index.d.ts +7 -0
- package/dist/core/simulation/states/basic/BatteryState.d.ts +16 -0
- package/dist/core/simulation/states/basic/ClockState.d.ts +16 -0
- package/dist/core/simulation/states/basic/DoubleThrowSwitchState.d.ts +21 -0
- package/dist/core/simulation/states/basic/LightbulbState.d.ts +21 -0
- package/dist/core/simulation/states/basic/RectangleLEDState.d.ts +9 -0
- package/dist/core/simulation/states/basic/RelayState.d.ts +25 -0
- package/dist/core/simulation/states/basic/SmallLEDState.d.ts +21 -0
- package/dist/core/simulation/states/basic/SwitchState.d.ts +25 -0
- package/dist/core/simulation/states/gates/InverterState.d.ts +17 -0
- package/dist/core/simulation/states/gates/Nand4GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/Nand8GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/NandGateState.d.ts +16 -0
- package/dist/core/simulation/states/gates/Nor4GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/Nor8GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/NorGateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/Xor4GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/Xor8GateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/XorGateState.d.ts +10 -0
- package/dist/core/simulation/states/gates/index.d.ts +25 -0
- package/dist/core/simulation/states/index.d.ts +31 -0
- package/dist/core/simulation/states/types.d.ts +32 -0
- package/dist/core/simulation/types.d.ts +155 -0
- package/dist/core/topology/Circuit.d.ts +420 -0
- package/dist/core/topology/CircuitMetadata.d.ts +24 -0
- package/dist/core/topology/CircuitOptions.d.ts +14 -0
- package/dist/core/topology/Component.d.ts +153 -0
- package/dist/core/topology/ENode.d.ts +200 -0
- package/dist/core/topology/Wire.d.ts +130 -0
- package/dist/core/topology/delays.d.ts +52 -0
- package/dist/core/topology/index.d.ts +14 -0
- package/dist/core/topology/types.d.ts +189 -0
- package/dist/core/utils/CameraOptions.d.ts +83 -0
- package/dist/core/utils/MemoizeDecorator.d.ts +9 -0
- package/dist/core/utils/Position.d.ts +166 -0
- package/dist/core/utils/Position3D.d.ts +77 -0
- package/dist/core/utils/Rotation.d.ts +82 -0
- package/dist/core/utils/index.d.ts +24 -0
- package/dist/core/utils/types.d.ts +35 -0
- package/dist/core-b6Q8w2sn.js +3560 -0
- package/dist/core-b6Q8w2sn.js.map +1 -0
- package/dist/i18n/index.d.ts +882 -0
- package/dist/i18n/locales/en.json.d.ts +268 -0
- package/dist/i18n/locales/fr.json.d.ts +268 -0
- package/dist/index.d.ts +14 -6306
- package/dist/index.js +136 -112
- package/dist/scene/CircuitEngine.d.ts +283 -0
- package/dist/scene/index.d.ts +1 -2
- package/dist/scene/index.js +50 -41
- package/dist/scene/setup.d.ts +26 -0
- package/dist/scene/shared/AbstractCircuitController.d.ts +217 -0
- package/dist/scene/shared/BranchingPointVisualFactory.d.ts +70 -0
- package/dist/scene/shared/EventEmitter.d.ts +92 -0
- package/dist/scene/shared/HoverManager.d.ts +151 -0
- package/dist/scene/shared/SelectionManager.d.ts +159 -0
- package/dist/scene/shared/WireVisualManager.d.ts +242 -0
- package/dist/scene/shared/components/ComponentVisualFactory.d.ts +438 -0
- package/dist/scene/shared/components/DefaultVisualFactory.d.ts +51 -0
- package/dist/scene/shared/components/FactoryRegistry.d.ts +84 -0
- package/dist/scene/shared/components/GroupedFactoryRegistry.d.ts +153 -0
- package/dist/scene/shared/components/arithmetic/AdderVisualFactory.d.ts +54 -0
- package/dist/scene/shared/components/arithmetic/EightBitAdderVisualFactory.d.ts +45 -0
- package/dist/scene/shared/components/arithmetic/EightBitOnesComplementVisualFactory.d.ts +63 -0
- package/dist/scene/shared/components/arithmetic/HalfAdderVisualFactory.d.ts +55 -0
- package/dist/scene/shared/components/arithmetic/index.d.ts +4 -0
- package/dist/scene/shared/components/basic/BatteryVisualFactory.d.ts +13 -0
- package/dist/scene/shared/components/basic/ClockVisualFactory.d.ts +79 -0
- package/dist/scene/shared/components/basic/DoubleThrowSwitchVisualFactory.d.ts +87 -0
- package/dist/scene/shared/components/basic/LabelVisualFactory.d.ts +148 -0
- package/dist/scene/shared/components/basic/LightbulbVisualFactory.d.ts +72 -0
- package/dist/scene/shared/components/basic/RectangleLEDVisualFactory.d.ts +86 -0
- package/dist/scene/shared/components/basic/RelayVisualFactory.d.ts +92 -0
- package/dist/scene/shared/components/basic/SmallLEDVisualFactory.d.ts +86 -0
- package/dist/scene/shared/components/basic/SwitchVisualFactory.d.ts +85 -0
- package/dist/scene/shared/components/gates/InverterVisualFactory.d.ts +104 -0
- package/dist/scene/shared/components/gates/Nand4GateVisualFactory.d.ts +27 -0
- package/dist/scene/shared/components/gates/Nand8GateVisualFactory.d.ts +27 -0
- package/dist/scene/shared/components/gates/NandGateVisualFactory.d.ts +101 -0
- package/dist/scene/shared/components/gates/Nor4GateVisualFactory.d.ts +27 -0
- package/dist/scene/shared/components/gates/Nor8GateVisualFactory.d.ts +27 -0
- package/dist/scene/shared/components/gates/NorGateVisualFactory.d.ts +101 -0
- package/dist/scene/shared/components/gates/Xor4GateVisualFactory.d.ts +29 -0
- package/dist/scene/shared/components/gates/Xor8GateVisualFactory.d.ts +29 -0
- package/dist/scene/shared/components/gates/XorGateVisualFactory.d.ts +103 -0
- package/dist/scene/shared/components/index.d.ts +33 -0
- package/dist/scene/shared/components/types.d.ts +43 -0
- package/dist/scene/shared/types.d.ts +474 -0
- package/dist/scene/shared/utils/CameraUtils.d.ts +23 -0
- package/dist/scene/shared/utils/ColorUtils.d.ts +26 -0
- package/dist/scene/shared/utils/ControlsUtils.d.ts +8 -0
- package/dist/scene/shared/utils/GeometryUtils.d.ts +337 -0
- package/dist/scene/shared/utils/LayerConstants.d.ts +40 -0
- package/dist/scene/shared/utils/LightingUtils.d.ts +31 -0
- package/dist/scene/shared/utils/MaterialUtils.d.ts +73 -0
- package/dist/scene/shared/utils/Options.d.ts +16 -0
- package/dist/scene/simulation/CircuitRunnerController.d.ts +227 -0
- package/dist/scene/static/CircuitController.d.ts +228 -0
- package/dist/scene/static/CircuitWriter.d.ts +146 -0
- package/dist/scene/static/PinTooltipWidget.d.ts +31 -0
- package/dist/scene/static/tools/BuildTool.d.ts +290 -0
- package/dist/scene/static/tools/ComponentPickerWidget.d.ts +89 -0
- package/dist/scene/static/tools/ConfigPanelWidget.d.ts +107 -0
- package/dist/scene/static/tools/MultiSelectTool.d.ts +265 -0
- package/dist/scene-D4QcWeiq.js +8745 -0
- package/dist/scene-D4QcWeiq.js.map +1 -0
- package/package.json +29 -25
- package/dist/CircuitRunner-BQQlhwjD.js +0 -1981
- package/dist/CircuitRunner-BQQlhwjD.js.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/scene/index.js.map +0 -1
- package/dist/setup-CIq_kgaw.js +0 -10230
- package/dist/setup-CIq_kgaw.js.map +0 -1
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { ComponentVisualFactoryBase } from '../ComponentVisualFactory';
|
|
2
|
+
import { Component } from '../../../../core/index.ts';
|
|
3
|
+
import { ConfigFormDefinition, VisualContext } from '../../types';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
/**
|
|
6
|
+
* Visual factory for Label components
|
|
7
|
+
*
|
|
8
|
+
* Creates:
|
|
9
|
+
* - Text mesh using CanvasTexture for stencil/technical font styling
|
|
10
|
+
* - Component hitbox for raycasting
|
|
11
|
+
* - No pin groups (Label has zero pins)
|
|
12
|
+
*
|
|
13
|
+
* Configuration:
|
|
14
|
+
* - text: Display text content (max 64 characters, default "Label")
|
|
15
|
+
* - size: Scale multiplier (1-10, default 1)
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const factory = new LabelVisualFactory();
|
|
20
|
+
* const visual = factory.createVisual(labelComponent);
|
|
21
|
+
* scene.add(visual);
|
|
22
|
+
*
|
|
23
|
+
* // Update text
|
|
24
|
+
* const newConfig = new Map([['text', 'Power Supply'], ['size', '2']]);
|
|
25
|
+
* factory.updateFromConfiguration(visual, newConfig);
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare class LabelVisualFactory extends ComponentVisualFactoryBase {
|
|
29
|
+
/** Maximum text length in characters */
|
|
30
|
+
private static readonly MAX_TEXT_LENGTH;
|
|
31
|
+
/** Font family for technical/stencil aesthetic */
|
|
32
|
+
private static readonly FONT_FAMILY;
|
|
33
|
+
/** Text color (dark gray for readability) */
|
|
34
|
+
private static readonly TEXT_COLOR;
|
|
35
|
+
/** Hover text color (blue tint matching other components) */
|
|
36
|
+
private static readonly HOVER_COLOR;
|
|
37
|
+
/** Selection text color (orange tint matching other components) */
|
|
38
|
+
private static readonly SELECTION_COLOR;
|
|
39
|
+
/** Base font size in pixels */
|
|
40
|
+
private static readonly BASE_FONT_SIZE;
|
|
41
|
+
/** Padding around text in pixels */
|
|
42
|
+
private static readonly PADDING;
|
|
43
|
+
constructor();
|
|
44
|
+
createVisual(component: Component, _context: VisualContext): THREE.Object3D;
|
|
45
|
+
/**
|
|
46
|
+
* Create a canvas with rendered text
|
|
47
|
+
*
|
|
48
|
+
* @param text - Text to render (truncated to MAX_TEXT_LENGTH)
|
|
49
|
+
* @returns HTMLCanvasElement with rendered text
|
|
50
|
+
*/
|
|
51
|
+
private createTextCanvas;
|
|
52
|
+
/**
|
|
53
|
+
* Create a text mesh using CanvasTexture
|
|
54
|
+
*
|
|
55
|
+
* @param text - Text to display
|
|
56
|
+
* @returns THREE.Mesh with text texture
|
|
57
|
+
*/
|
|
58
|
+
private createTextMesh;
|
|
59
|
+
/**
|
|
60
|
+
* Find the text mesh within the component group
|
|
61
|
+
*
|
|
62
|
+
* @param object3D - The component group
|
|
63
|
+
* @returns The text mesh or null if not found
|
|
64
|
+
*/
|
|
65
|
+
private findTextMesh;
|
|
66
|
+
/**
|
|
67
|
+
* Normalize display text by truncating and providing default
|
|
68
|
+
* @param text
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
71
|
+
private normalizeDisplayText;
|
|
72
|
+
/**
|
|
73
|
+
* Update the text mesh with new text content
|
|
74
|
+
*
|
|
75
|
+
* Resizes canvas and geometry to fit the new text, then redraws.
|
|
76
|
+
*
|
|
77
|
+
* @param mesh - The text mesh to update
|
|
78
|
+
* @param text - New text content
|
|
79
|
+
* @param group - The parent group containing the hitbox to update
|
|
80
|
+
*/
|
|
81
|
+
private updateTextMesh;
|
|
82
|
+
/**
|
|
83
|
+
* Update visual based on Label configuration
|
|
84
|
+
*
|
|
85
|
+
* @param object3D - The component group
|
|
86
|
+
* @param config - Configuration map with text and size
|
|
87
|
+
*/
|
|
88
|
+
updateFromConfiguration(object3D: THREE.Object3D, config: Map<string, string>): void;
|
|
89
|
+
/**
|
|
90
|
+
* Get config form definition for Label component
|
|
91
|
+
*
|
|
92
|
+
* @returns Form definition with text and size fields
|
|
93
|
+
*/
|
|
94
|
+
getConfigFormDefinition(): ConfigFormDefinition;
|
|
95
|
+
/**
|
|
96
|
+
* Map core config to form data
|
|
97
|
+
*
|
|
98
|
+
* @param config - Core config from Component.config
|
|
99
|
+
* @returns Form data with appropriate types
|
|
100
|
+
*/
|
|
101
|
+
mapCoreConfigToForm(config: Map<string, string>): Map<string, any>;
|
|
102
|
+
/**
|
|
103
|
+
* Map form data back to core config
|
|
104
|
+
*
|
|
105
|
+
* @param formData - Form data from UI
|
|
106
|
+
* @returns Core config with string values
|
|
107
|
+
*/
|
|
108
|
+
mapFormToCoreConfig(formData: Map<string, any>): Map<string, string>;
|
|
109
|
+
/**
|
|
110
|
+
* Apply hover visual effect to the Label
|
|
111
|
+
*
|
|
112
|
+
* Changes text color to hover color (blue) by redrawing the canvas.
|
|
113
|
+
*
|
|
114
|
+
* @param object3D - The component group
|
|
115
|
+
*/
|
|
116
|
+
applyHover(object3D: THREE.Object3D): void;
|
|
117
|
+
/**
|
|
118
|
+
* Remove hover visual effect from the Label
|
|
119
|
+
*
|
|
120
|
+
* Restores text color to default by redrawing the canvas.
|
|
121
|
+
*
|
|
122
|
+
* @param object3D - The component group
|
|
123
|
+
*/
|
|
124
|
+
removeHover(object3D: THREE.Object3D): void;
|
|
125
|
+
/**
|
|
126
|
+
* Apply selection visual effect to the Label
|
|
127
|
+
*
|
|
128
|
+
* Changes text color to selection color (orange) by redrawing the canvas.
|
|
129
|
+
*
|
|
130
|
+
* @param object3D - The component group
|
|
131
|
+
*/
|
|
132
|
+
applySelection(object3D: THREE.Object3D): void;
|
|
133
|
+
/**
|
|
134
|
+
* Remove selection visual effect from the Label
|
|
135
|
+
*
|
|
136
|
+
* Restores text color based on hover state.
|
|
137
|
+
*
|
|
138
|
+
* @param object3D - The component group
|
|
139
|
+
*/
|
|
140
|
+
removeSelection(object3D: THREE.Object3D): void;
|
|
141
|
+
/**
|
|
142
|
+
* Redraw the text canvas with a specific color
|
|
143
|
+
*
|
|
144
|
+
* @param object3D - The component group
|
|
145
|
+
* @param color - The CSS color string to use
|
|
146
|
+
*/
|
|
147
|
+
private redrawTextWithColor;
|
|
148
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ComponentVisualFactoryBase } from '../ComponentVisualFactory';
|
|
2
|
+
import { Component, ComponentState } from '../../../../core/index.ts';
|
|
3
|
+
import { ConfigFormDefinition, VisualContext } from '../../types';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
/**
|
|
6
|
+
* Visual factory for Lightbulb components
|
|
7
|
+
* Animation:
|
|
8
|
+
* - Smooth emissive glow transition when Lightbulb lights up or turns off
|
|
9
|
+
* - Uses AnimationMixer with material property tracks (emissive, opacity)
|
|
10
|
+
* - Clones shared GLASS material per-instance during simulation for independent animation
|
|
11
|
+
*/
|
|
12
|
+
export declare class LightbulbVisualFactory extends ComponentVisualFactoryBase {
|
|
13
|
+
/** Lightbulb lit color (yellow glow) */
|
|
14
|
+
private readonly BULB_LIT_COLOR;
|
|
15
|
+
/** Lightbulb lit emissive intensity */
|
|
16
|
+
private readonly BULB_LIT_INTENSITY;
|
|
17
|
+
/** Lightbulb unlit opacity */
|
|
18
|
+
private readonly BULB_UNLIT_OPACITY;
|
|
19
|
+
private readonly BASE_GEOMETRY;
|
|
20
|
+
private readonly BULB_GEOMETRY;
|
|
21
|
+
/** Yellow in normalized RGB for ColorKeyframeTrack */
|
|
22
|
+
private readonly LIT_RGB;
|
|
23
|
+
/** Black in normalized RGB for ColorKeyframeTrack */
|
|
24
|
+
private readonly UNLIT_RGB;
|
|
25
|
+
constructor();
|
|
26
|
+
createVisual(component: Component, context: VisualContext): THREE.Object3D;
|
|
27
|
+
private createPinsVisual;
|
|
28
|
+
/**
|
|
29
|
+
* Get config form definition for Lightbulb
|
|
30
|
+
*
|
|
31
|
+
* @returns Form definition with size
|
|
32
|
+
*/
|
|
33
|
+
getConfigFormDefinition(): ConfigFormDefinition | null;
|
|
34
|
+
mapCoreConfigToForm(config: Map<string, string>): Map<string, any>;
|
|
35
|
+
/**
|
|
36
|
+
* Map form data to core config
|
|
37
|
+
*
|
|
38
|
+
* @param formData - Form data with size
|
|
39
|
+
* @returns Core config with string size
|
|
40
|
+
*/
|
|
41
|
+
mapFormToCoreConfig(formData: Map<string, any>): Map<string, string>;
|
|
42
|
+
updateFromConfiguration(object3D: THREE.Object3D, config: Map<string, string>): void;
|
|
43
|
+
/**
|
|
44
|
+
* Update Lightbulb animation based on simulation state.
|
|
45
|
+
*
|
|
46
|
+
* - null state / no context: restore shared material, cleanup mixer
|
|
47
|
+
* - paused/initial: snap to target state
|
|
48
|
+
* - playing + transitional (goingOn/goingOff): smooth material animation
|
|
49
|
+
* - playing + stable (on/off): snap to final state
|
|
50
|
+
*/
|
|
51
|
+
updateAnimation(object3D: THREE.Object3D, state: ComponentState | null): void;
|
|
52
|
+
/**
|
|
53
|
+
* Clone the shared GLASS material for independent per-instance animation.
|
|
54
|
+
* No-op if already cloned.
|
|
55
|
+
*/
|
|
56
|
+
private _ensureClonedMaterial;
|
|
57
|
+
/**
|
|
58
|
+
* Dispose the per-instance clone and restore the shared GLASS.NORMAL material.
|
|
59
|
+
* No-op if not cloned.
|
|
60
|
+
*/
|
|
61
|
+
private _restoreSharedMaterial;
|
|
62
|
+
private _snapToState;
|
|
63
|
+
/**
|
|
64
|
+
* Create a smooth material animation for goingOn / goingOff transitions.
|
|
65
|
+
*/
|
|
66
|
+
private _animateBulb;
|
|
67
|
+
/**
|
|
68
|
+
* Stop all animations, clean up mixer.
|
|
69
|
+
*/
|
|
70
|
+
private _cleanupMixer;
|
|
71
|
+
private findBulbMesh;
|
|
72
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ComponentVisualFactoryBase } from '../ComponentVisualFactory';
|
|
2
|
+
import { Component, ComponentState } from '../../../../core/index.ts';
|
|
3
|
+
import { ConfigFormDefinition, VisualContext } from '../../types';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
/**
|
|
6
|
+
* Visual factory for RectangleLED components
|
|
7
|
+
*
|
|
8
|
+
* Creates:
|
|
9
|
+
* - LED box mesh
|
|
10
|
+
* - Input pin group
|
|
11
|
+
* - Output pin group
|
|
12
|
+
* - Component hitbox for raycasting
|
|
13
|
+
*
|
|
14
|
+
* Animation:
|
|
15
|
+
* - Smooth emissive glow transition when LED lights up or turns off
|
|
16
|
+
* - Uses AnimationMixer with material property tracks (emissive, emissiveIntensity)
|
|
17
|
+
* - Clones PRIVATE material per-instance during simulation for independent animation
|
|
18
|
+
*/
|
|
19
|
+
export declare class RectangleLEDVisualFactory extends ComponentVisualFactoryBase {
|
|
20
|
+
/** LED lit color (yellow glow) */
|
|
21
|
+
private readonly LED_LIT_COLOR;
|
|
22
|
+
/** LED lit emissive intensity */
|
|
23
|
+
private readonly LED_LIT_INTENSITY;
|
|
24
|
+
/** Black in normalized RGB for ColorKeyframeTrack */
|
|
25
|
+
private readonly UNLIT_RGB;
|
|
26
|
+
constructor();
|
|
27
|
+
createVisual(component: Component, context: VisualContext): THREE.Object3D;
|
|
28
|
+
private createPinsVisual;
|
|
29
|
+
/**
|
|
30
|
+
* Get config form definition for RectangleLED (T027)
|
|
31
|
+
*
|
|
32
|
+
* @returns Form definition with activeColor and idleColor color fields
|
|
33
|
+
*/
|
|
34
|
+
getConfigFormDefinition(): ConfigFormDefinition | null;
|
|
35
|
+
/**
|
|
36
|
+
* Map core config to form data (T027)
|
|
37
|
+
* Converts hex/preset strings to hex values for color picker
|
|
38
|
+
*
|
|
39
|
+
* @param config - Core component config
|
|
40
|
+
* @returns Form data with hex color strings
|
|
41
|
+
*/
|
|
42
|
+
mapCoreConfigToForm(config: Map<string, string>): Map<string, any>;
|
|
43
|
+
/**
|
|
44
|
+
* Map form data to core config (T027)
|
|
45
|
+
* Converts hex colors to preset names if they match, otherwise keeps hex
|
|
46
|
+
*
|
|
47
|
+
* @param formData - Form data with hex color strings
|
|
48
|
+
* @returns Core config with hex or preset name strings
|
|
49
|
+
*/
|
|
50
|
+
mapFormToCoreConfig(formData: Map<string, any>): Map<string, string>;
|
|
51
|
+
/**
|
|
52
|
+
* Update visual from configuration (T022)
|
|
53
|
+
* Updates LED color and geometry based on config
|
|
54
|
+
*/
|
|
55
|
+
updateFromConfiguration(object3D: THREE.Object3D, config: Map<string, string>): void;
|
|
56
|
+
/**
|
|
57
|
+
* Update LED animation based on simulation state.
|
|
58
|
+
*
|
|
59
|
+
* - null state / no context: restore private material, cleanup mixer
|
|
60
|
+
* - paused/initial: snap to target state
|
|
61
|
+
* - playing + transitional (goingOn/goingOff): smooth material animation
|
|
62
|
+
* - playing + stable (on/off): snap to final state
|
|
63
|
+
*/
|
|
64
|
+
updateAnimation(object3D: THREE.Object3D, state: ComponentState | null): void;
|
|
65
|
+
/**
|
|
66
|
+
* Clone the PRIVATE material for independent per-instance animation.
|
|
67
|
+
* Stashes the original PRIVATE material in mesh.userData.privateMat.
|
|
68
|
+
* No-op if already cloned.
|
|
69
|
+
*/
|
|
70
|
+
private _ensureClonedMaterial;
|
|
71
|
+
/**
|
|
72
|
+
* Dispose the animation clone and restore the stashed PRIVATE material.
|
|
73
|
+
* No-op if not cloned.
|
|
74
|
+
*/
|
|
75
|
+
private _restorePrivateMaterial;
|
|
76
|
+
private _snapToState;
|
|
77
|
+
/**
|
|
78
|
+
* Create a smooth material animation for goingOn / goingOff transitions.
|
|
79
|
+
*/
|
|
80
|
+
private _animateLed;
|
|
81
|
+
/**
|
|
82
|
+
* Stop all animations, clean up mixer.
|
|
83
|
+
*/
|
|
84
|
+
private _cleanupMixer;
|
|
85
|
+
private findLedMesh;
|
|
86
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { ComponentVisualFactoryBase } from '../ComponentVisualFactory';
|
|
2
|
+
import { Component, ComponentState } from '../../../../core/index.ts';
|
|
3
|
+
import { ConfigFormDefinition, VisualContext } from '../../types';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
/**
|
|
6
|
+
* Visual factory for Relay components.
|
|
7
|
+
*
|
|
8
|
+
* Animation (3 independent clip groups on a single AnimationMixer):
|
|
9
|
+
*
|
|
10
|
+
* 1. **Mechanical clip** — contactor rotation + coil bar position + bar emissive glow
|
|
11
|
+
* Triggered on state transition (closing/opening). Duration = transitionSpan.
|
|
12
|
+
*
|
|
13
|
+
* 2. **Coil color clip** — all coil rings share one cloned material, single color track
|
|
14
|
+
* Triggered on cmd param change. Deduped by target color hex.
|
|
15
|
+
*
|
|
16
|
+
* 3. **Power color clip** — contactor + powerInBar share one cloned material, single color track
|
|
17
|
+
* Triggered on power param change. Deduped by target color hex.
|
|
18
|
+
*/
|
|
19
|
+
export declare class RelayVisualFactory extends ComponentVisualFactoryBase {
|
|
20
|
+
private readonly COIL_GEOM;
|
|
21
|
+
private readonly COIL_BAR_GEOM;
|
|
22
|
+
private readonly PWIN_BAR_GEOM;
|
|
23
|
+
private readonly CONTACTOR_GEOM;
|
|
24
|
+
private readonly NEGATIVE_CONTACTOR_GEOM;
|
|
25
|
+
private readonly COIL_BAR_Z_IDLE;
|
|
26
|
+
private readonly COIL_BAR_Z_ACTIVE;
|
|
27
|
+
private readonly IDLE_ROTATION;
|
|
28
|
+
private readonly ACTIVE_ROTATION;
|
|
29
|
+
/** Coil ring colors (from cmd.voltage / cmd.current) */
|
|
30
|
+
private readonly COIL_COLOR_BOTH;
|
|
31
|
+
private readonly COIL_COLOR_VOLTAGE;
|
|
32
|
+
private readonly COIL_COLOR_CURRENT;
|
|
33
|
+
private readonly COIL_COLOR_NONE;
|
|
34
|
+
/** Magnetic bar glow */
|
|
35
|
+
private readonly BAR_GLOW_COLOR;
|
|
36
|
+
private readonly BAR_GLOW_INTENSITY;
|
|
37
|
+
/** Power element colors (from power_in / power_out) */
|
|
38
|
+
private readonly POWER_COLOR_BOTH;
|
|
39
|
+
private readonly POWER_COLOR_VOLTAGE;
|
|
40
|
+
private readonly POWER_COLOR_CURRENT;
|
|
41
|
+
private readonly POWER_COLOR_NONE;
|
|
42
|
+
constructor();
|
|
43
|
+
createVisual(component: Component, context: VisualContext): THREE.Object3D;
|
|
44
|
+
private _createPinsVisual;
|
|
45
|
+
private _createCoilGroup;
|
|
46
|
+
private _createContactorGroup;
|
|
47
|
+
private _disposeContactorGroup;
|
|
48
|
+
getConfigFormDefinition(): ConfigFormDefinition | null;
|
|
49
|
+
mapCoreConfigToForm(config: Map<string, string>): Map<string, any>;
|
|
50
|
+
mapFormToCoreConfig(formData: Map<string, any>): Map<string, string>;
|
|
51
|
+
updateFromConfiguration(object3D: THREE.Object3D, config: Map<string, string>): void;
|
|
52
|
+
/**
|
|
53
|
+
* Update relay animation based on simulation state.
|
|
54
|
+
*
|
|
55
|
+
* - null / no context → cleanup, restore materials, reset to idle
|
|
56
|
+
* - paused → snap all parts to current state values
|
|
57
|
+
* - playing + transitional → animate mechanical + bar effect; update color clips
|
|
58
|
+
* - playing + stable → snap mechanical + bar; update color clips
|
|
59
|
+
*/
|
|
60
|
+
updateAnimation(object3D: THREE.Object3D, state: ComponentState | null): void;
|
|
61
|
+
/** Is the coil magnetically active in the given state? */
|
|
62
|
+
private _isCmdActive;
|
|
63
|
+
/** Is the transition moving TOWARD the active position? */
|
|
64
|
+
private _isGoingActive;
|
|
65
|
+
private _computeCoilColor;
|
|
66
|
+
private _computePowerColor;
|
|
67
|
+
private _getColorAnimDurationSecs;
|
|
68
|
+
private _snapMechanical;
|
|
69
|
+
private _snapCoilColor;
|
|
70
|
+
private _snapBarEffect;
|
|
71
|
+
private _snapPowerColor;
|
|
72
|
+
/** Clone WHITE once and assign the same clone to all 7 coil rings. */
|
|
73
|
+
private _ensureCoilClonedMaterial;
|
|
74
|
+
/** Clone SHINY_SILVER for the coil bar (emissive animation). */
|
|
75
|
+
private _ensureBarClonedMaterial;
|
|
76
|
+
/** Clone WHITE once and assign to both contactor and powerInBar. */
|
|
77
|
+
private _ensurePowerClonedMaterial;
|
|
78
|
+
/** Restore all animated materials to their SHARED originals. */
|
|
79
|
+
private _restoreAllMaterials;
|
|
80
|
+
private _animateMechanical;
|
|
81
|
+
private _updateCoilColorAnim;
|
|
82
|
+
private _updatePowerColorAnim;
|
|
83
|
+
/** Stop only the mechanical clip (rotation + bar position + bar glow). */
|
|
84
|
+
private _cleanupMechanicalClip;
|
|
85
|
+
/** Stop all animations, dispose mixer, clear all animation userData. */
|
|
86
|
+
private _cleanupMixer;
|
|
87
|
+
/** Reset positions/rotations to idle (no coil energized). */
|
|
88
|
+
private _resetToDefault;
|
|
89
|
+
/** Find all animated sub-objects in a single traverse. */
|
|
90
|
+
private _findParts;
|
|
91
|
+
private _findContactorGroup;
|
|
92
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ComponentVisualFactoryBase } from '../ComponentVisualFactory';
|
|
2
|
+
import { Component, ComponentState } from '../../../../core/index.ts';
|
|
3
|
+
import { ConfigFormDefinition, VisualContext } from '../../types';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
/**
|
|
6
|
+
* Visual factory for SmallLED components
|
|
7
|
+
*
|
|
8
|
+
* Creates:
|
|
9
|
+
* - LED cylinder mesh
|
|
10
|
+
* - Input pin group
|
|
11
|
+
* - Output pin group
|
|
12
|
+
* - Component hitbox for raycasting
|
|
13
|
+
*
|
|
14
|
+
* Animation:
|
|
15
|
+
* - Smooth emissive glow transition when LED lights up or turns off
|
|
16
|
+
* - Uses AnimationMixer with material property tracks (emissive, emissiveIntensity)
|
|
17
|
+
* - Clones PRIVATE material per-instance during simulation for independent animation
|
|
18
|
+
*/
|
|
19
|
+
export declare class SmallLEDVisualFactory extends ComponentVisualFactoryBase {
|
|
20
|
+
/** LED lit color (yellow glow) */
|
|
21
|
+
private readonly LED_LIT_COLOR;
|
|
22
|
+
/** LED lit emissive intensity */
|
|
23
|
+
private readonly LED_LIT_INTENSITY;
|
|
24
|
+
/** Black in normalized RGB for ColorKeyframeTrack */
|
|
25
|
+
private readonly UNLIT_RGB;
|
|
26
|
+
constructor();
|
|
27
|
+
createVisual(component: Component, context: VisualContext): THREE.Object3D;
|
|
28
|
+
private createPinsVisual;
|
|
29
|
+
/**
|
|
30
|
+
* Get config form definition for SmallLED (T027)
|
|
31
|
+
*
|
|
32
|
+
* @returns Form definition with activeColor and idleColor color fields
|
|
33
|
+
*/
|
|
34
|
+
getConfigFormDefinition(): ConfigFormDefinition | null;
|
|
35
|
+
/**
|
|
36
|
+
* Map core config to form data (T027)
|
|
37
|
+
* Converts hex/preset strings to hex values for color picker
|
|
38
|
+
*
|
|
39
|
+
* @param config - Core component config
|
|
40
|
+
* @returns Form data with hex color strings
|
|
41
|
+
*/
|
|
42
|
+
mapCoreConfigToForm(config: Map<string, string>): Map<string, any>;
|
|
43
|
+
/**
|
|
44
|
+
* Map form data to core config (T027)
|
|
45
|
+
* Converts hex colors to preset names if they match, otherwise keeps hex
|
|
46
|
+
*
|
|
47
|
+
* @param formData - Form data with hex color strings
|
|
48
|
+
* @returns Core config with hex or preset name strings
|
|
49
|
+
*/
|
|
50
|
+
mapFormToCoreConfig(formData: Map<string, any>): Map<string, string>;
|
|
51
|
+
/**
|
|
52
|
+
* Update visual from configuration (T022)
|
|
53
|
+
* Updates LED color based on activeColor config
|
|
54
|
+
*/
|
|
55
|
+
updateFromConfiguration(object3D: THREE.Object3D, config: Map<string, string>): void;
|
|
56
|
+
/**
|
|
57
|
+
* Update LED animation based on simulation state.
|
|
58
|
+
*
|
|
59
|
+
* - null state / no context: restore private material, cleanup mixer
|
|
60
|
+
* - paused/initial: snap to target state
|
|
61
|
+
* - playing + transitional (goingOn/goingOff): smooth material animation
|
|
62
|
+
* - playing + stable (on/off): snap to final state
|
|
63
|
+
*/
|
|
64
|
+
updateAnimation(object3D: THREE.Object3D, state: ComponentState | null): void;
|
|
65
|
+
/**
|
|
66
|
+
* Clone the PRIVATE material for independent per-instance animation.
|
|
67
|
+
* Stashes the original PRIVATE material in mesh.userData.privateMat.
|
|
68
|
+
* No-op if already cloned.
|
|
69
|
+
*/
|
|
70
|
+
private _ensureClonedMaterial;
|
|
71
|
+
/**
|
|
72
|
+
* Dispose the animation clone and restore the stashed PRIVATE material.
|
|
73
|
+
* No-op if not cloned.
|
|
74
|
+
*/
|
|
75
|
+
private _restorePrivateMaterial;
|
|
76
|
+
private _snapToState;
|
|
77
|
+
/**
|
|
78
|
+
* Create a smooth material animation for goingOn / goingOff transitions.
|
|
79
|
+
*/
|
|
80
|
+
private _animateLed;
|
|
81
|
+
/**
|
|
82
|
+
* Stop all animations, clean up mixer.
|
|
83
|
+
*/
|
|
84
|
+
private _cleanupMixer;
|
|
85
|
+
private findLedMesh;
|
|
86
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ComponentVisualFactoryBase } from '../ComponentVisualFactory';
|
|
2
|
+
import { Component, ComponentState } from '../../../../core/index.ts';
|
|
3
|
+
import { ConfigFormDefinition, VisualContext } from '../../types';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
/**
|
|
6
|
+
* Visual factory for Switch components
|
|
7
|
+
*
|
|
8
|
+
* Creates:
|
|
9
|
+
* - Contactor (box, rotatable for animation)
|
|
10
|
+
* - Input pin group
|
|
11
|
+
* - Output pin group
|
|
12
|
+
* - Component hitbox for raycasting
|
|
13
|
+
*
|
|
14
|
+
* Animation:
|
|
15
|
+
* - Smooth rotation of contactor between open/closed via AnimationMixer
|
|
16
|
+
* - Supports mid-transition interruption (re-toggle during closing/opening)
|
|
17
|
+
*/
|
|
18
|
+
export declare class SwitchVisualFactory extends ComponentVisualFactoryBase {
|
|
19
|
+
/** Rotation for closed switch (contactor aligned) */
|
|
20
|
+
private readonly CLOSED_ROTATION;
|
|
21
|
+
/** Rotation for open switch (contactor misaligned) */
|
|
22
|
+
private readonly OPEN_ROTATION;
|
|
23
|
+
private readonly CONTACTOR_GEOMETRY;
|
|
24
|
+
/** Contactor color when output has both voltage and current */
|
|
25
|
+
private readonly COLOR_VOLTAGE_CURRENT;
|
|
26
|
+
/** Contactor color when output has current only */
|
|
27
|
+
private readonly COLOR_CURRENT;
|
|
28
|
+
/** Contactor color when output has voltage only */
|
|
29
|
+
private readonly COLOR_VOLTAGE;
|
|
30
|
+
/** Contactor color when output has neither */
|
|
31
|
+
private readonly COLOR_NONE;
|
|
32
|
+
constructor();
|
|
33
|
+
createVisual(component: Component, context: VisualContext): THREE.Object3D;
|
|
34
|
+
private createPinsVisual;
|
|
35
|
+
/**
|
|
36
|
+
* Get config form definition for Switch
|
|
37
|
+
*
|
|
38
|
+
* @returns Form definition with initialState, transitionSpan and size
|
|
39
|
+
*/
|
|
40
|
+
getConfigFormDefinition(): ConfigFormDefinition | null;
|
|
41
|
+
/**
|
|
42
|
+
* Map core config to form data
|
|
43
|
+
* Converts "open"/"closed" strings to boolean
|
|
44
|
+
*/
|
|
45
|
+
mapCoreConfigToForm(config: Map<string, string>): Map<string, any>;
|
|
46
|
+
/**
|
|
47
|
+
* Map form data to core config
|
|
48
|
+
* Converts boolean to "open"/"closed" strings
|
|
49
|
+
*/
|
|
50
|
+
mapFormToCoreConfig(formData: Map<string, any>): Map<string, string>;
|
|
51
|
+
updateFromConfiguration(object3D: THREE.Object3D, config: Map<string, string>): void;
|
|
52
|
+
/**
|
|
53
|
+
* Update switch animation based on simulation state.
|
|
54
|
+
*
|
|
55
|
+
* - null state / no context: cleanup mixer, reset to config default
|
|
56
|
+
* - paused/initial + transitional: snap to start rotation
|
|
57
|
+
* - paused/initial + stable: snap to state rotation
|
|
58
|
+
* - playing + transitional: smooth rotation animation
|
|
59
|
+
* - playing + stable: snap to final rotation, cleanup mixer
|
|
60
|
+
*/
|
|
61
|
+
updateAnimation(object3D: THREE.Object3D, state: ComponentState | null): void;
|
|
62
|
+
/** Maps stable state → target rotation */
|
|
63
|
+
private _getStateRotation;
|
|
64
|
+
/** Maps transitional state → the rotation it came FROM */
|
|
65
|
+
private _getStartRotation;
|
|
66
|
+
/**
|
|
67
|
+
* Create smooth rotation + color animations for closing/opening transitions.
|
|
68
|
+
* Rotation clip: current → target state rotation (persists across updateAnimation calls)
|
|
69
|
+
* Color clip: current contactor color → white (stopped on next updateAnimation so pin state takes over)
|
|
70
|
+
*/
|
|
71
|
+
private _animateContactor;
|
|
72
|
+
/**
|
|
73
|
+
* Stop the color fade animation so _updateContactorColor can set color from pin state.
|
|
74
|
+
*/
|
|
75
|
+
private _stopColorAnimation;
|
|
76
|
+
/**
|
|
77
|
+
* Stop all animations, clean up mixer, reset to config default rotation.
|
|
78
|
+
*/
|
|
79
|
+
private _cleanupMixer;
|
|
80
|
+
private _ensureClonedMaterial;
|
|
81
|
+
private _restoreSharedMaterial;
|
|
82
|
+
private _updateContactorColor;
|
|
83
|
+
private findContactorGroup;
|
|
84
|
+
private _findContactorMesh;
|
|
85
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ComponentVisualFactoryBase } from '../ComponentVisualFactory';
|
|
2
|
+
import { Component, ComponentState } from '../../../../core/index.ts';
|
|
3
|
+
import { ConfigFormDefinition, VisualContext } from '../../types';
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
/**
|
|
6
|
+
* Visual factory for Inverter/Buffer components
|
|
7
|
+
*
|
|
8
|
+
* Creates:
|
|
9
|
+
* - Inverter triangle or Buffer trapezoid extrude geom mesh
|
|
10
|
+
* - Vcc, input and output pin group
|
|
11
|
+
* - Component hitbox for raycasting
|
|
12
|
+
*
|
|
13
|
+
* Animation:
|
|
14
|
+
* - Emissive glow when component is high (based on simulation state)
|
|
15
|
+
*/
|
|
16
|
+
export declare class InverterVisualFactory extends ComponentVisualFactoryBase {
|
|
17
|
+
/** Shared Inverter envelope geometry */
|
|
18
|
+
private readonly INVERTER_GEOM;
|
|
19
|
+
/** Shared Inverter inner hole geometry */
|
|
20
|
+
private readonly INVERTER_HOLE_GEOM;
|
|
21
|
+
/** Shared Buffer envelope geometry */
|
|
22
|
+
private readonly BUFFER_GEOM;
|
|
23
|
+
/** Shared Buffer inner hole geometry */
|
|
24
|
+
private readonly BUFFER_HOLE_GEOM;
|
|
25
|
+
private readonly HOLE_COLOR_HIGH;
|
|
26
|
+
private readonly HOLE_COLOR_LOW;
|
|
27
|
+
private readonly HOLE_EMISSIVE_HIGH_INTENSITY;
|
|
28
|
+
private readonly HOLE_EMISSIVE_LOW_INTENSITY;
|
|
29
|
+
constructor();
|
|
30
|
+
createVisual(component: Component, context: VisualContext): THREE.Object3D;
|
|
31
|
+
private createPinsVisual;
|
|
32
|
+
private replaceEnvelope;
|
|
33
|
+
private replaceHole;
|
|
34
|
+
/**
|
|
35
|
+
* Get config form definition for Inverter
|
|
36
|
+
*
|
|
37
|
+
* @param config - Optional current config to determine disabled state of transitionSpan
|
|
38
|
+
* @returns Form definition with defaultLogicFamily dropdown, activationLogic boolean, and transitionSpan number
|
|
39
|
+
*/
|
|
40
|
+
getConfigFormDefinition(config?: Map<string, string>): ConfigFormDefinition | null;
|
|
41
|
+
/**
|
|
42
|
+
* Map core config to form data
|
|
43
|
+
* Converts "positive"/"negative" strings to boolean
|
|
44
|
+
*
|
|
45
|
+
* @param config - Core component config
|
|
46
|
+
* @returns Form data with boolean activationLogic
|
|
47
|
+
*/
|
|
48
|
+
mapCoreConfigToForm(config: Map<string, string>): Map<string, any>;
|
|
49
|
+
/**
|
|
50
|
+
* Map form data to core config
|
|
51
|
+
* Converts boolean to "positive"/"negative" strings
|
|
52
|
+
*
|
|
53
|
+
* @param formData - Form data with boolean activationLogic
|
|
54
|
+
* @returns Core config with string activationLogic
|
|
55
|
+
*/
|
|
56
|
+
mapFormToCoreConfig(formData: Map<string, any>): Map<string, string>;
|
|
57
|
+
updateFromConfiguration(object3D: THREE.Object3D, config: Map<string, string>): void;
|
|
58
|
+
/**
|
|
59
|
+
* Update Inverter animation based on simulation state
|
|
60
|
+
*
|
|
61
|
+
* @param object3D - The Object3D created by createVisual()
|
|
62
|
+
* @param state - The Inverter's current simulation state
|
|
63
|
+
*/
|
|
64
|
+
updateAnimation(object3D: THREE.Object3D, state: ComponentState | null): void;
|
|
65
|
+
private _setHoleColor;
|
|
66
|
+
private _ensureClonedHoleMaterial;
|
|
67
|
+
private _restoreSharedHoleMaterial;
|
|
68
|
+
private _cleanupMixer;
|
|
69
|
+
/**
|
|
70
|
+
* Animate the hole color between LOW and HIGH over the transition span.
|
|
71
|
+
* Reads current color for mid-transition support.
|
|
72
|
+
*/
|
|
73
|
+
private _animateHoleColor;
|
|
74
|
+
/**
|
|
75
|
+
* Find the envelope mesh within the component group
|
|
76
|
+
*
|
|
77
|
+
* @param object3D - The Object3D group created by createVisual()
|
|
78
|
+
* @returns The envelope mesh if found, null otherwise
|
|
79
|
+
*
|
|
80
|
+
* @remarks
|
|
81
|
+
* Searches for a mesh with userData.part === 'envelope'
|
|
82
|
+
*/
|
|
83
|
+
private findEnvelopeMesh;
|
|
84
|
+
/**
|
|
85
|
+
* Find the hole mesh within the component group
|
|
86
|
+
*
|
|
87
|
+
* @param object3D - The Object3D group created by createVisual()
|
|
88
|
+
* @returns The hole mesh if found, null otherwise
|
|
89
|
+
*
|
|
90
|
+
* @remarks
|
|
91
|
+
* Searches for a mesh with userData.part === 'hole'
|
|
92
|
+
*/
|
|
93
|
+
private findHoleMesh;
|
|
94
|
+
/**
|
|
95
|
+
* Find the negative marker mesh within the component group
|
|
96
|
+
*
|
|
97
|
+
* @param object3D - The Object3D group created by createVisual()
|
|
98
|
+
* @returns The negative marker mesh if found, null otherwise
|
|
99
|
+
*
|
|
100
|
+
* @remarks
|
|
101
|
+
* Searches for a mesh with userData.part === 'negativeMarker'
|
|
102
|
+
*/
|
|
103
|
+
protected findNegativeMarkerMesh(object3D: THREE.Object3D): THREE.Mesh | null;
|
|
104
|
+
}
|