@needle-tools/engine 2.66.1-pre → 2.67.0-pre
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/CHANGELOG.md +20 -0
- package/dist/needle-engine.js +34306 -26230
- package/dist/needle-engine.umd.cjs +743 -298
- package/lib/engine/api.d.ts +4 -0
- package/lib/engine/api.js +10 -0
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/codegen/register_types.js +23 -7
- package/lib/engine/codegen/register_types.js.map +1 -1
- package/lib/engine/debug/debug_overlay.js +7 -1
- package/lib/engine/debug/debug_overlay.js.map +1 -1
- package/lib/engine/engine_addressables.js +2 -2
- package/lib/engine/engine_addressables.js.map +1 -1
- package/lib/engine/engine_assetdatabase.d.ts +17 -51
- package/lib/engine/engine_assetdatabase.js +252 -126
- package/lib/engine/engine_assetdatabase.js.map +1 -1
- package/lib/engine/engine_components.js +13 -1
- package/lib/engine/engine_components.js.map +1 -1
- package/lib/engine/engine_components_internal.d.ts +8 -0
- package/lib/engine/engine_components_internal.js +29 -0
- package/lib/engine/engine_components_internal.js.map +1 -0
- package/lib/engine/engine_constants.d.ts +1 -0
- package/lib/engine/engine_constants.js +1 -0
- package/lib/engine/engine_constants.js.map +1 -1
- package/lib/engine/engine_context_registry.d.ts +2 -0
- package/lib/engine/engine_context_registry.js +6 -0
- package/lib/engine/engine_context_registry.js.map +1 -1
- package/lib/engine/engine_editor-sync.d.ts +9 -0
- package/lib/engine/engine_editor-sync.js +8 -0
- package/lib/engine/engine_editor-sync.js.map +1 -0
- package/lib/engine/engine_element_loading.js +1 -1
- package/lib/engine/engine_element_loading.js.map +1 -1
- package/lib/engine/engine_gameobject.js +15 -20
- package/lib/engine/engine_gameobject.js.map +1 -1
- package/lib/engine/engine_gltf_builtin_components.d.ts +2 -3
- package/lib/engine/engine_gltf_builtin_components.js +23 -6
- package/lib/engine/engine_gltf_builtin_components.js.map +1 -1
- package/lib/engine/engine_networking_auto.d.ts +1 -0
- package/lib/engine/engine_networking_auto.js +42 -9
- package/lib/engine/engine_networking_auto.js.map +1 -1
- package/lib/engine/engine_patcher.d.ts +8 -0
- package/lib/engine/engine_patcher.js +98 -0
- package/lib/engine/engine_patcher.js.map +1 -0
- package/lib/engine/engine_physics.d.ts +5 -1
- package/lib/engine/engine_physics.js +11 -1
- package/lib/engine/engine_physics.js.map +1 -1
- package/lib/engine/engine_scenetools.js +0 -1
- package/lib/engine/engine_scenetools.js.map +1 -1
- package/lib/engine/engine_serialization_core.js +4 -0
- package/lib/engine/engine_serialization_core.js.map +1 -1
- package/lib/engine/engine_setup.d.ts +1 -1
- package/lib/engine/engine_setup.js +9 -5
- package/lib/engine/engine_setup.js.map +1 -1
- package/lib/engine/engine_texture.d.ts +6 -1
- package/lib/engine/engine_texture.js +39 -1
- package/lib/engine/engine_texture.js.map +1 -1
- package/lib/engine/engine_types.d.ts +4 -0
- package/lib/engine/engine_types.js.map +1 -1
- package/lib/engine/engine_utils.js +3 -2
- package/lib/engine/engine_utils.js.map +1 -1
- package/lib/engine/extensions/NEEDLE_progressive.d.ts +0 -1
- package/lib/engine/extensions/NEEDLE_progressive.js +24 -26
- package/lib/engine/extensions/NEEDLE_progressive.js.map +1 -1
- package/lib/engine/extensions/extensions.d.ts +4 -1
- package/lib/engine/extensions/extensions.js +16 -0
- package/lib/engine/extensions/extensions.js.map +1 -1
- package/lib/engine/extensions/usage_tracker.d.ts +12 -0
- package/lib/engine/extensions/usage_tracker.js +59 -0
- package/lib/engine/extensions/usage_tracker.js.map +1 -0
- package/lib/engine-components/AnimatorController.js +4 -0
- package/lib/engine-components/AnimatorController.js.map +1 -1
- package/lib/engine-components/AudioSource.js +2 -1
- package/lib/engine-components/AudioSource.js.map +1 -1
- package/lib/engine-components/Camera.d.ts +6 -0
- package/lib/engine-components/Camera.js +70 -31
- package/lib/engine-components/Camera.js.map +1 -1
- package/lib/engine-components/Component.d.ts +52 -0
- package/lib/engine-components/Component.js +55 -14
- package/lib/engine-components/Component.js.map +1 -1
- package/lib/engine-components/Networking.js +19 -0
- package/lib/engine-components/Networking.js.map +1 -1
- package/lib/engine-components/OrbitControls.d.ts +2 -0
- package/lib/engine-components/OrbitControls.js +9 -0
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/lib/engine-components/ParticleSystem.js +11 -1
- package/lib/engine-components/ParticleSystem.js.map +1 -1
- package/lib/engine-components/ReflectionProbe.js +18 -6
- package/lib/engine-components/ReflectionProbe.js.map +1 -1
- package/lib/engine-components/Renderer.d.ts +1 -1
- package/lib/engine-components/Renderer.js +24 -6
- package/lib/engine-components/Renderer.js.map +1 -1
- package/lib/engine-components/Skybox.js +2 -0
- package/lib/engine-components/Skybox.js.map +1 -1
- package/lib/engine-components/SmoothFollow.js +1 -2
- package/lib/engine-components/SmoothFollow.js.map +1 -1
- package/lib/engine-components/WebARCameraBackground.d.ts +19 -0
- package/lib/engine-components/WebARCameraBackground.js +185 -0
- package/lib/engine-components/WebARCameraBackground.js.map +1 -0
- package/lib/engine-components/WebXR.d.ts +4 -0
- package/lib/engine-components/WebXR.js +11 -8
- package/lib/engine-components/WebXR.js.map +1 -1
- package/lib/engine-components/WebXRAvatar.js +1 -0
- package/lib/engine-components/WebXRAvatar.js.map +1 -1
- package/lib/engine-components/codegen/components.d.ts +14 -6
- package/lib/engine-components/codegen/components.js +14 -6
- package/lib/engine-components/codegen/components.js.map +1 -1
- package/lib/engine-components/js-extensions/Object3D.js +4 -1
- package/lib/engine-components/js-extensions/Object3D.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Antialiasing.d.ts +13 -0
- package/lib/engine-components/postprocessing/Effects/Antialiasing.js +46 -0
- package/lib/engine-components/postprocessing/Effects/Antialiasing.js.map +1 -0
- package/lib/engine-components/postprocessing/Effects/Bloom.d.ts +12 -0
- package/lib/engine-components/postprocessing/Effects/Bloom.js +76 -0
- package/lib/engine-components/postprocessing/Effects/Bloom.js.map +1 -0
- package/lib/engine-components/postprocessing/Effects/ChromaticAberration.d.ts +8 -0
- package/lib/engine-components/postprocessing/Effects/ChromaticAberration.js +39 -0
- package/lib/engine-components/postprocessing/Effects/ChromaticAberration.js.map +1 -0
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.d.ts +12 -0
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js +96 -0
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js.map +1 -0
- package/lib/engine-components/postprocessing/Effects/DepthOfField.d.ts +21 -0
- package/lib/engine-components/postprocessing/Effects/DepthOfField.js +87 -0
- package/lib/engine-components/postprocessing/Effects/DepthOfField.js.map +1 -0
- package/lib/engine-components/postprocessing/Effects/Pixelation.d.ts +7 -0
- package/lib/engine-components/postprocessing/Effects/Pixelation.js +30 -0
- package/lib/engine-components/postprocessing/Effects/Pixelation.js.map +1 -0
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.d.ts +11 -0
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js +70 -0
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js.map +1 -0
- package/lib/engine-components/postprocessing/Effects/Tonemapping.d.ts +16 -0
- package/lib/engine-components/postprocessing/Effects/Tonemapping.js +52 -0
- package/lib/engine-components/postprocessing/Effects/Tonemapping.js.map +1 -0
- package/lib/engine-components/postprocessing/Effects/Vignette.d.ts +11 -0
- package/lib/engine-components/postprocessing/Effects/Vignette.js +57 -0
- package/lib/engine-components/postprocessing/Effects/Vignette.js.map +1 -0
- package/lib/engine-components/postprocessing/PostProcessingEffect.d.ts +29 -0
- package/lib/engine-components/postprocessing/PostProcessingEffect.js +89 -0
- package/lib/engine-components/postprocessing/PostProcessingEffect.js.map +1 -0
- package/lib/engine-components/postprocessing/PostProcessingHandler.d.ts +13 -0
- package/lib/engine-components/postprocessing/PostProcessingHandler.js +119 -0
- package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -0
- package/lib/engine-components/postprocessing/Volume.d.ts +23 -0
- package/lib/engine-components/postprocessing/Volume.js +176 -0
- package/lib/engine-components/postprocessing/Volume.js.map +1 -0
- package/lib/engine-components/postprocessing/VolumeParameter.d.ts +21 -0
- package/lib/engine-components/postprocessing/VolumeParameter.js +75 -0
- package/lib/engine-components/postprocessing/VolumeParameter.js.map +1 -0
- package/lib/engine-components/postprocessing/VolumeProfile.d.ts +7 -0
- package/lib/engine-components/postprocessing/VolumeProfile.js +42 -0
- package/lib/engine-components/postprocessing/VolumeProfile.js.map +1 -0
- package/lib/engine-components/timeline/TimelineTracks.js +14 -15
- package/lib/engine-components/timeline/TimelineTracks.js.map +1 -1
- package/lib/engine-components/ui/Text.js +28 -170
- package/lib/engine-components/ui/Text.js.map +1 -1
- package/lib/engine-components-experimental/networking/PlayerSync.d.ts +18 -0
- package/lib/engine-components-experimental/networking/PlayerSync.js +61 -7
- package/lib/engine-components-experimental/networking/PlayerSync.js.map +1 -1
- package/lib/include/three/ARButton.d.ts +1 -1
- package/lib/include/three/ARButton.js +11 -19
- package/lib/include/three/ARButton.js.map +1 -1
- package/lib/include/three/VRButton.js +1 -4
- package/lib/include/three/VRButton.js.map +1 -1
- package/package.json +3 -2
- package/plugins/vite/drop-client.js +77 -0
- package/plugins/vite/drop.js +81 -0
- package/plugins/vite/editor-connection.js +121 -0
- package/plugins/vite/index.js +9 -4
- package/src/engine/api.ts +30 -1
- package/src/engine/codegen/register_types.js +25 -9
- package/src/engine/debug/debug_overlay.ts +7 -1
- package/src/engine/engine_addressables.ts +2 -2
- package/src/engine/engine_assetdatabase.ts +291 -184
- package/src/engine/engine_components.ts +20 -1
- package/src/engine/engine_components_internal.ts +30 -0
- package/src/engine/engine_constants.ts +4 -1
- package/src/engine/engine_context_registry.ts +7 -0
- package/src/engine/engine_editor-sync.ts +21 -0
- package/src/engine/engine_element_loading.ts +1 -1
- package/src/engine/engine_gameobject.ts +16 -21
- package/src/engine/engine_gltf_builtin_components.ts +30 -15
- package/src/engine/engine_networking_auto.ts +48 -11
- package/src/engine/engine_patcher.ts +113 -0
- package/src/engine/engine_physics.ts +15 -2
- package/src/engine/engine_scenetools.ts +0 -1
- package/src/engine/engine_serialization_core.ts +6 -0
- package/src/engine/engine_setup.ts +11 -5
- package/src/engine/engine_texture.ts +54 -5
- package/src/engine/engine_types.ts +6 -1
- package/src/engine/engine_utils.ts +6 -5
- package/src/engine/extensions/NEEDLE_progressive.ts +32 -32
- package/src/engine/extensions/extensions.ts +22 -1
- package/src/engine/extensions/usage_tracker.ts +91 -0
- package/src/engine-components/AnimatorController.ts +2 -0
- package/src/engine-components/AudioSource.ts +1 -1
- package/src/engine-components/Camera.ts +77 -37
- package/src/engine-components/Component.ts +74 -30
- package/src/engine-components/Networking.ts +9 -1
- package/src/engine-components/OrbitControls.ts +11 -2
- package/src/engine-components/ParticleSystem.ts +9 -1
- package/src/engine-components/ReflectionProbe.ts +17 -7
- package/src/engine-components/Renderer.ts +22 -5
- package/src/engine-components/Skybox.ts +2 -0
- package/src/engine-components/SmoothFollow.ts +4 -4
- package/src/engine-components/WebARCameraBackground.ts +215 -0
- package/src/engine-components/WebXR.ts +12 -8
- package/src/engine-components/WebXRAvatar.ts +1 -0
- package/src/engine-components/codegen/components.ts +14 -6
- package/src/engine-components/js-extensions/Object3D.ts +6 -1
- package/src/engine-components/postprocessing/Effects/Antialiasing.ts +52 -0
- package/src/engine-components/postprocessing/Effects/Bloom.ts +75 -0
- package/src/engine-components/postprocessing/Effects/ChromaticAberration.ts +36 -0
- package/src/engine-components/postprocessing/Effects/ColorAdjustments.ts +114 -0
- package/src/engine-components/postprocessing/Effects/DepthOfField.ts +90 -0
- package/src/engine-components/postprocessing/Effects/Pixelation.ts +28 -0
- package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.ts +71 -0
- package/src/engine-components/postprocessing/Effects/Tonemapping.ts +55 -0
- package/src/engine-components/postprocessing/Effects/Vignette.ts +55 -0
- package/src/engine-components/postprocessing/PostProcessingEffect.ts +112 -0
- package/src/engine-components/postprocessing/PostProcessingHandler.ts +148 -0
- package/src/engine-components/postprocessing/Volume.ts +194 -0
- package/src/engine-components/postprocessing/VolumeParameter.ts +85 -0
- package/src/engine-components/postprocessing/VolumeProfile.ts +40 -0
- package/src/engine-components/timeline/TimelineTracks.ts +16 -17
- package/src/engine-components/ui/Text.ts +37 -174
- package/src/engine-components-experimental/networking/PlayerSync.ts +68 -7
- package/src/include/three/ARButton.js +13 -24
- package/src/include/three/VRButton.js +1 -7
- package/lib/engine-components/Volume.d.ts +0 -34
- package/lib/engine-components/Volume.js +0 -140
- package/lib/engine-components/Volume.js.map +0 -1
- package/src/engine-components/Volume.ts +0 -141
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { Behaviour, GameObject } from "../Component";
|
|
2
|
+
import { serializeable } from "../../engine/engine_serialization_decorator";
|
|
3
|
+
import { getParam } from "../../engine/engine_utils";
|
|
4
|
+
import { VolumeProfile } from "./VolumeProfile";
|
|
5
|
+
import { EditorModification, IEditorModification as IEditorModificationReceiver } from "../../engine/engine_editor-sync";
|
|
6
|
+
import { PostProcessingHandler } from "./PostProcessingHandler";
|
|
7
|
+
import { PostProcessingEffect } from "./PostProcessingEffect";
|
|
8
|
+
import { VolumeParameter } from "./VolumeParameter";
|
|
9
|
+
import { getEditorModificationCache } from "../../engine/engine_editor-sync";
|
|
10
|
+
import { isDevEnvironment } from "../../engine/debug";
|
|
11
|
+
// import { CustomPostProcessingEffect } from "./CustomPostProcessingEffect";
|
|
12
|
+
|
|
13
|
+
const debug = getParam("debugpost");
|
|
14
|
+
|
|
15
|
+
export class Volume extends Behaviour implements IEditorModificationReceiver {
|
|
16
|
+
|
|
17
|
+
@serializeable(VolumeProfile)
|
|
18
|
+
sharedProfile?: VolumeProfile;
|
|
19
|
+
|
|
20
|
+
private _postprocessing: PostProcessingHandler = new PostProcessingHandler();
|
|
21
|
+
private _effects: PostProcessingEffect[] = [];
|
|
22
|
+
|
|
23
|
+
awake() {
|
|
24
|
+
// ensure the profile is initialized
|
|
25
|
+
this.sharedProfile?.init();
|
|
26
|
+
|
|
27
|
+
if (debug) {
|
|
28
|
+
console.log(this);
|
|
29
|
+
console.log("Press P to toggle post processing");
|
|
30
|
+
window.addEventListener("keydown", (e) => {
|
|
31
|
+
if (e.key === "p") {
|
|
32
|
+
console.log("Toggle volume: " + this.name, !this.enabled);
|
|
33
|
+
this.enabled = !this.enabled;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
start() {
|
|
40
|
+
this.apply();
|
|
41
|
+
this.tryApplyCache();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
onEnable() {
|
|
45
|
+
// We need to wait for the camera to be ready
|
|
46
|
+
if (this.__internalDidAwakeAndStart)
|
|
47
|
+
this.apply();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
onDisable() {
|
|
51
|
+
this._postprocessing?.unapply(this.context);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
onBeforeRender(): void {
|
|
55
|
+
if (!this.context.isInXR && this.context.composer && this.context.mainCamera) {
|
|
56
|
+
this.context.composer.setRenderer(this.context.renderer);
|
|
57
|
+
this.context.composer.setMainScene(this.context.scene);
|
|
58
|
+
this.context.composer.setMainCamera(this.context.mainCamera);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
onDestroy(): void {
|
|
63
|
+
this._postprocessing?.dispose(this.context);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private _lastApplyTime?: number;
|
|
67
|
+
private _rapidApplyCount = 0;
|
|
68
|
+
|
|
69
|
+
private apply() {
|
|
70
|
+
if (debug) console.log("Apply PostProcessing", this);
|
|
71
|
+
|
|
72
|
+
if (isDevEnvironment()) {
|
|
73
|
+
if (this._lastApplyTime !== undefined && Date.now() - this._lastApplyTime < 100) {
|
|
74
|
+
this._rapidApplyCount++;
|
|
75
|
+
if (this._rapidApplyCount === 5)
|
|
76
|
+
console.warn("Detected rapid post processing modifications - this might be a bug", this);
|
|
77
|
+
}
|
|
78
|
+
this._lastApplyTime = Date.now();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
this.unapply();
|
|
83
|
+
|
|
84
|
+
this._effects.length = 0;
|
|
85
|
+
// get from profile
|
|
86
|
+
if (this.sharedProfile?.components) {
|
|
87
|
+
this._effects.push(...this.sharedProfile.components);
|
|
88
|
+
}
|
|
89
|
+
// get additional effects
|
|
90
|
+
const additionalComponents = this.gameObject.getComponentsInChildren(PostProcessingEffect);
|
|
91
|
+
if (debug && additionalComponents?.length)
|
|
92
|
+
console.log("Additional", additionalComponents);
|
|
93
|
+
if (additionalComponents) {
|
|
94
|
+
for (const comp of additionalComponents) {
|
|
95
|
+
if (comp.active) this._effects.push(comp);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (this._effects.length > 0) {
|
|
99
|
+
this._postprocessing.apply(this.context, this._effects);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
private unapply() {
|
|
104
|
+
this._postprocessing.unapply(this.context);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
private tryApplyCache() {
|
|
109
|
+
const cache = getEditorModificationCache();
|
|
110
|
+
if (cache) {
|
|
111
|
+
for (const entry of cache.values()) this.onEditorModification(entry);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
/** called from needle editor sync package if its active */
|
|
117
|
+
onEditorModification(modification: EditorModification): void | boolean | undefined {
|
|
118
|
+
|
|
119
|
+
if (modification.propertyName.startsWith("postprocessing.")) {
|
|
120
|
+
if (!this._effects?.length) return;
|
|
121
|
+
const path = modification.propertyName.split(".");
|
|
122
|
+
if (path.length === 3 || path.length === 4) {
|
|
123
|
+
const componentName = path[1];
|
|
124
|
+
const propertyName = path[2];
|
|
125
|
+
for (const comp of this._effects) {
|
|
126
|
+
if (comp.typeName?.toLowerCase() === componentName.toLowerCase()) {
|
|
127
|
+
|
|
128
|
+
if (propertyName === "active") {
|
|
129
|
+
comp.active = modification.value;
|
|
130
|
+
this.scheduleRecreate();
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// cache the volume parameters
|
|
135
|
+
if (!effectVolumeProperties.has(componentName)) {
|
|
136
|
+
const volumeParameterKeys = new Array<string>();
|
|
137
|
+
effectVolumeProperties.set(componentName, volumeParameterKeys);
|
|
138
|
+
const keys = Object.keys(comp);
|
|
139
|
+
for (const key of keys) {
|
|
140
|
+
const prop = comp[key];
|
|
141
|
+
if (prop instanceof VolumeParameter) {
|
|
142
|
+
volumeParameterKeys.push(key);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (effectVolumeProperties.has(componentName)) {
|
|
148
|
+
const paramName = propertyName.toLowerCase();
|
|
149
|
+
const volumeParameterKeys = effectVolumeProperties.get(componentName)!;
|
|
150
|
+
for (const key of volumeParameterKeys) {
|
|
151
|
+
if (key.toLowerCase() === paramName) {
|
|
152
|
+
const prop = comp[key] as VolumeParameter;
|
|
153
|
+
if (prop instanceof VolumeParameter) {
|
|
154
|
+
const isActiveStateChange = path.length === 4 && path[3] === "active";
|
|
155
|
+
if (isActiveStateChange) {
|
|
156
|
+
prop.overrideState = modification.value;
|
|
157
|
+
this.scheduleRecreate();
|
|
158
|
+
}
|
|
159
|
+
else if (prop && prop.value !== undefined) {
|
|
160
|
+
prop.value = modification.value;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
console.warn("Unknown modification", propertyName);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
private _recreateId: number = -1;
|
|
180
|
+
private scheduleRecreate() {
|
|
181
|
+
// When the editor modifications come in with changed active effects we want/need to re-create the effects
|
|
182
|
+
// We defer it slightly because multiple active changes could be made and we dont want to recreate the full effect stack multiple times
|
|
183
|
+
const id = ++this._recreateId;
|
|
184
|
+
setTimeout(() => {
|
|
185
|
+
if (id !== this._recreateId) return;
|
|
186
|
+
this.onDisable();
|
|
187
|
+
this.onEnable();
|
|
188
|
+
}, 200);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** cached VolumeParameter keys per object */
|
|
194
|
+
const effectVolumeProperties: Map<string, string[]> = new Map<string, string[]>();
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { serializable } from "../../engine/engine_serialization";
|
|
2
|
+
|
|
3
|
+
export declare type VolumeParameterChangedEvent = (newValue: any, oldValue: any, parameter: VolumeParameter) => void;
|
|
4
|
+
export declare type VolumeParameterValueProcessor = (value: any) => any;
|
|
5
|
+
|
|
6
|
+
export class VolumeParameter {
|
|
7
|
+
|
|
8
|
+
@serializable()
|
|
9
|
+
get overrideState(): boolean {
|
|
10
|
+
return this._active;
|
|
11
|
+
}
|
|
12
|
+
set overrideState(val: boolean) {
|
|
13
|
+
if (this._active === val) return;
|
|
14
|
+
this._active = val;
|
|
15
|
+
const value = val ? this._lastActiveSetValue : this._defaultValue;
|
|
16
|
+
this.processValue(value, true);
|
|
17
|
+
}
|
|
18
|
+
private _active: boolean = false;
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@serializable()
|
|
23
|
+
get value() {
|
|
24
|
+
return this._value;
|
|
25
|
+
}
|
|
26
|
+
set value(val: any) {
|
|
27
|
+
this.processValue(val, false);
|
|
28
|
+
}
|
|
29
|
+
private _value: any;
|
|
30
|
+
private _lastActiveSetValue?: any;
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
set defaultValue(val: any) {
|
|
34
|
+
this._defaultValue = val;
|
|
35
|
+
}
|
|
36
|
+
private _defaultValue: any = undefined;
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
/** enforce the value to be set and onValueChanged to be called if assigned */
|
|
40
|
+
__init() {
|
|
41
|
+
this.processValue(this._lastActiveSetValue, true);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** called to modify a changing value before it is saved */
|
|
45
|
+
valueProcessor: VolumeParameterValueProcessor | undefined;
|
|
46
|
+
/** called when a value has changed (with the final value) */
|
|
47
|
+
onValueChanged: VolumeParameterChangedEvent | undefined;
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
private processValue(val: any, forceUpdate: boolean): any {
|
|
51
|
+
if (val === null || val === undefined) return;
|
|
52
|
+
|
|
53
|
+
if (!forceUpdate && this.testIfValueChanged(val) === false)
|
|
54
|
+
return;
|
|
55
|
+
|
|
56
|
+
const oldValue = this._value;
|
|
57
|
+
|
|
58
|
+
if (!this._active && this._defaultValue !== undefined) {
|
|
59
|
+
// when setting the default value we dont process them (default values are explicitly set from the effect that declares them
|
|
60
|
+
// with the value that is expected to received when the parameter is disabled)
|
|
61
|
+
this._value = this._defaultValue;
|
|
62
|
+
val = this._defaultValue;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
this._lastActiveSetValue = val;
|
|
66
|
+
if (this._active && this.valueProcessor)
|
|
67
|
+
val = this.valueProcessor(val);
|
|
68
|
+
this._value = val;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (this.onValueChanged) {
|
|
72
|
+
this.onValueChanged(val, oldValue, this);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
private testIfValueChanged(newValue: any): boolean {
|
|
77
|
+
|
|
78
|
+
if (this._lastActiveSetValue === newValue)
|
|
79
|
+
return false;
|
|
80
|
+
|
|
81
|
+
// TODO: may need checks for colors or vectors (check by xyz,rgb because they might come in as anonymous objects via editor modifications)
|
|
82
|
+
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { serializeable } from "../../engine/engine_serialization_decorator";
|
|
2
|
+
import { getParam } from "../../engine/engine_utils";
|
|
3
|
+
import { PostProcessingEffect } from "./PostProcessingEffect";
|
|
4
|
+
|
|
5
|
+
const debug = getParam("debugpost");
|
|
6
|
+
|
|
7
|
+
const customEffects: { [name: string]: typeof PostProcessingEffect } = {};
|
|
8
|
+
export function registerCustomEffectType(name: string, effect: typeof PostProcessingEffect) {
|
|
9
|
+
customEffects[name] = effect;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// resolve the types:
|
|
13
|
+
function resolveComponentType(data: { __type: string }) {
|
|
14
|
+
if (data.__type in customEffects)
|
|
15
|
+
return customEffects[data.__type];
|
|
16
|
+
// if ("mode" in data) return ToneMapping;
|
|
17
|
+
// if ("postExposure" in data) return ColorAdjustments;
|
|
18
|
+
// switch (data.__type) {
|
|
19
|
+
// // case "Bloom": return Bloom;
|
|
20
|
+
// // case "DepthOfField": return DepthOfField;
|
|
21
|
+
// // case "Vignette": return Vignette
|
|
22
|
+
// // case "ColorAdjustments": return ColorAdjustments;
|
|
23
|
+
// // case "Tonemapping": return ToneMapping;
|
|
24
|
+
// }
|
|
25
|
+
if (debug && data.__type)
|
|
26
|
+
console.warn("Unknown postprocessing type", data.__type, data)
|
|
27
|
+
return PostProcessingEffect;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export class VolumeProfile {
|
|
31
|
+
|
|
32
|
+
@serializeable([d => resolveComponentType(d), PostProcessingEffect])
|
|
33
|
+
components?: PostProcessingEffect[];
|
|
34
|
+
|
|
35
|
+
/** call init on all components */
|
|
36
|
+
init() {
|
|
37
|
+
this.components?.forEach(c => c.init());
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
@@ -658,25 +658,24 @@ export class AudioTrackHandler extends TrackHandler {
|
|
|
658
658
|
|
|
659
659
|
private handleAudioLoading(model: Models.ClipModel, audio: THREE.Audio): Promise<AudioBuffer | null> | null {
|
|
660
660
|
if (!this._audioLoader) {
|
|
661
|
-
const path = this.getAudioFilePath(model.asset.clip);
|
|
662
661
|
this._audioLoader = new THREE.AudioLoader();
|
|
663
|
-
// TODO: maybe we should cache the loaders / buffers here by path
|
|
664
|
-
if (debug) console.warn("LOAD audio track", path, this.director.sourceId);
|
|
665
|
-
const loadingPromise = new Promise<AudioBuffer | null>((resolve, _reject) => {
|
|
666
|
-
this._audioLoader!.load(path,
|
|
667
|
-
buffer => {
|
|
668
|
-
audio.setBuffer(buffer);
|
|
669
|
-
resolve(buffer);
|
|
670
|
-
},
|
|
671
|
-
undefined,
|
|
672
|
-
err => {
|
|
673
|
-
console.error("Error loading audio", err);
|
|
674
|
-
resolve(null);
|
|
675
|
-
});
|
|
676
|
-
});
|
|
677
|
-
return loadingPromise;
|
|
678
662
|
}
|
|
679
|
-
|
|
663
|
+
// TODO: maybe we should cache the loaders / buffers here by path
|
|
664
|
+
const path = this.getAudioFilePath(model.asset.clip);
|
|
665
|
+
if (debug) console.warn("LOAD audio track", path, this.director.sourceId);
|
|
666
|
+
const loadingPromise = new Promise<AudioBuffer | null>((resolve, _reject) => {
|
|
667
|
+
this._audioLoader!.load(path,
|
|
668
|
+
buffer => {
|
|
669
|
+
audio.setBuffer(buffer);
|
|
670
|
+
resolve(buffer);
|
|
671
|
+
},
|
|
672
|
+
undefined,
|
|
673
|
+
err => {
|
|
674
|
+
console.error("Error loading audio", err);
|
|
675
|
+
resolve(null);
|
|
676
|
+
});
|
|
677
|
+
});
|
|
678
|
+
return loadingPromise;
|
|
680
679
|
}
|
|
681
680
|
}
|
|
682
681
|
|
|
@@ -167,6 +167,8 @@ export class Text extends Graphic {
|
|
|
167
167
|
// if (this.canvas) {
|
|
168
168
|
// fontSize /= this.canvas?.scaleFactor;
|
|
169
169
|
// }
|
|
170
|
+
|
|
171
|
+
// @TODO : THH check for changes. fontColor => color?
|
|
170
172
|
const textOpts = {
|
|
171
173
|
content: this.text,
|
|
172
174
|
fontColor: this.color,
|
|
@@ -203,8 +205,13 @@ export class Text extends Graphic {
|
|
|
203
205
|
private createBlock(rt: RectTransform, hideOverflow: boolean, content: THREE.Object3D | Array<THREE.Object3D> | null, isTextIntermediate: boolean = false): ThreeMeshUI.Block | null {
|
|
204
206
|
//@ts-ignore
|
|
205
207
|
const opts: ThreeMeshUI.BlockOptions = {};
|
|
208
|
+
|
|
209
|
+
// @TODO : THH would require update for 7.x
|
|
206
210
|
opts.hiddenOverflow = hideOverflow;
|
|
211
|
+
|
|
212
|
+
// @TODO : THH would require update for 7.x
|
|
207
213
|
opts.interLine = (this.lineSpacing - 1) * this.fontSize * 1.333;
|
|
214
|
+
|
|
208
215
|
this.getAlignment(opts, isTextIntermediate);
|
|
209
216
|
const block = rt.createNewBlock(opts);
|
|
210
217
|
if (content) {
|
|
@@ -219,9 +226,31 @@ export class Text extends Graphic {
|
|
|
219
226
|
|
|
220
227
|
|
|
221
228
|
private getAlignment(opts: ThreeMeshUI.BlockOptions | any, isTextIntermediate: boolean = false): ThreeMeshUI.BlockOptions {
|
|
222
|
-
if (!isTextIntermediate)
|
|
229
|
+
if (!isTextIntermediate) {
|
|
223
230
|
opts.contentDirection = "row";
|
|
231
|
+
|
|
232
|
+
switch (this.alignment) {
|
|
233
|
+
case TextAnchor.UpperLeft:
|
|
234
|
+
case TextAnchor.MiddleLeft:
|
|
235
|
+
case TextAnchor.LowerLeft:
|
|
236
|
+
opts.textAlign = "left";
|
|
237
|
+
break;
|
|
238
|
+
case TextAnchor.UpperCenter:
|
|
239
|
+
case TextAnchor.MiddleCenter:
|
|
240
|
+
case TextAnchor.LowerCenter:
|
|
241
|
+
opts.textAlign = "center";
|
|
242
|
+
|
|
243
|
+
break;
|
|
244
|
+
case TextAnchor.UpperRight:
|
|
245
|
+
case TextAnchor.MiddleRight:
|
|
246
|
+
case TextAnchor.LowerRight:
|
|
247
|
+
opts.textAlign = "right";
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
224
252
|
switch (this.alignment) {
|
|
253
|
+
// @info ThreeMeshUI remaining alignment : space-between|space-around|"stretch(experimental)"
|
|
225
254
|
default:
|
|
226
255
|
case TextAnchor.UpperLeft:
|
|
227
256
|
case TextAnchor.UpperCenter:
|
|
@@ -239,21 +268,24 @@ export class Text extends Graphic {
|
|
|
239
268
|
opts.justifyContent = "end";
|
|
240
269
|
break;
|
|
241
270
|
}
|
|
271
|
+
|
|
272
|
+
// @TODO : THH evaluate this is still useful. In case of texts, horizontal alignments are made with textAlign
|
|
242
273
|
switch (this.alignment) {
|
|
243
274
|
case TextAnchor.UpperLeft:
|
|
244
275
|
case TextAnchor.MiddleLeft:
|
|
245
276
|
case TextAnchor.LowerLeft:
|
|
246
|
-
opts.
|
|
277
|
+
opts.alignItems = "start";
|
|
247
278
|
break;
|
|
248
279
|
case TextAnchor.UpperCenter:
|
|
249
280
|
case TextAnchor.MiddleCenter:
|
|
250
281
|
case TextAnchor.LowerCenter:
|
|
251
|
-
opts.
|
|
282
|
+
opts.alignItems = "center";
|
|
283
|
+
|
|
252
284
|
break;
|
|
253
285
|
case TextAnchor.UpperRight:
|
|
254
286
|
case TextAnchor.MiddleRight:
|
|
255
287
|
case TextAnchor.LowerRight:
|
|
256
|
-
opts.
|
|
288
|
+
opts.alignItems = "end";
|
|
257
289
|
break;
|
|
258
290
|
}
|
|
259
291
|
return opts;
|
|
@@ -378,7 +410,7 @@ export class Text extends Graphic {
|
|
|
378
410
|
if (tag.type.length > 6) // color=
|
|
379
411
|
{
|
|
380
412
|
const col = tag.type.substring(6);
|
|
381
|
-
opts.fontColor =
|
|
413
|
+
opts.fontColor = new Color(col);
|
|
382
414
|
}
|
|
383
415
|
else {
|
|
384
416
|
// if it does not contain a color it is white
|
|
@@ -477,174 +509,5 @@ declare type TagInfo = {
|
|
|
477
509
|
isEndTag: boolean
|
|
478
510
|
}
|
|
479
511
|
|
|
480
|
-
|
|
481
|
-
function getColorFromString(str: string): Color {
|
|
482
|
-
if (str.startsWith("#")) {
|
|
483
|
-
const hex = str.substring(1);
|
|
484
|
-
var bigint = parseInt(hex, 16);
|
|
485
|
-
const r = (bigint >> 16) & 255;
|
|
486
|
-
const g = (bigint >> 8) & 255;
|
|
487
|
-
const b = bigint & 255;
|
|
488
|
-
return new Color(r / 255, g / 255, b / 255);
|
|
489
|
-
}
|
|
490
|
-
switch (str) {
|
|
491
|
-
// basic colors // https://www.rapidtables.com/web/color/RGB_Color.html
|
|
492
|
-
case "black": return new Color(0, 0, 0);
|
|
493
|
-
case "white": return new Color(1, 1, 1);
|
|
494
|
-
case "red": return new Color(1, 0, 0);
|
|
495
|
-
case "lime": return new Color(0, 1, 0);
|
|
496
|
-
case "blue": return new Color(0, 0, 1);
|
|
497
|
-
case "yellow": return new Color(1, 1, 0);
|
|
498
|
-
case "cyan": return new Color(0, 1, 1);
|
|
499
|
-
case "magenta": return new Color(1, 0, 1);
|
|
500
|
-
case "silver": return new Color(0.75, 0.75, 0.75);
|
|
501
|
-
case "gray": return new Color(0.5, 0.5, 0.5);
|
|
502
|
-
case "maroon": return new Color(0.5, 0, 0);
|
|
503
|
-
case "olive": return new Color(0.5, 0.5, 0);
|
|
504
|
-
case "green": return new Color(0, 0.5, 0);
|
|
505
|
-
case "purple": return new Color(0.5, 0, 0.5);
|
|
506
|
-
case "teal": return new Color(0, 0.5, 0.5);
|
|
507
|
-
case "navy": return new Color(0, 0, 0.5);
|
|
508
|
-
|
|
509
|
-
// case "maroon": return new Color(0.5, 0, 0);
|
|
510
|
-
case "darkred": return new Color(0.54, 0, 0);
|
|
511
|
-
case "brown": return new Color(0.55, 0.27, 0);
|
|
512
|
-
case "firebrick": return new Color(0.69, 0.13, 0.13);
|
|
513
|
-
case "crimson": return new Color(0.86, 0.08, 0.24);
|
|
514
|
-
// case "red": return new Color(1, 0, 0);
|
|
515
|
-
case "tomato": return new Color(1, 0.39, 0.28);
|
|
516
|
-
case "coral": return new Color(1, 0.49, 0.31);
|
|
517
|
-
case "indianred": return new Color(0.6, 0.31, 0.51);
|
|
518
|
-
case "lightcoral": return new Color(0.94, 0.5, 0.5);
|
|
519
|
-
case "darkorange": return new Color(1, 0.55, 0);
|
|
520
|
-
case "orange": return new Color(1, 0.65, 0);
|
|
521
|
-
case "gold": return new Color(1, 0.84, 0);
|
|
522
|
-
case "darkgoldenrod": return new Color(0.72, 0.53, 0.04);
|
|
523
|
-
case "goldenrod": return new Color(0.85, 0.65, 0.13);
|
|
524
|
-
case "palegoldenrod": return new Color(0.93, 0.87, 0.67);
|
|
525
|
-
case "darkkhaki": return new Color(0.74, 0.7, 0.42);
|
|
526
|
-
case "khaki": return new Color(0.94, 0.9, 0.55);
|
|
527
|
-
// case "olive": return new Color(0.5, 0.5, 0);
|
|
528
|
-
// case "yellow": return new Color(1, 1, 0);
|
|
529
|
-
case "yellowgreen": return new Color(0.6, 0.8, 0.19);
|
|
530
|
-
case "darkolivegreen": return new Color(0.33, 0.42, 0.18);
|
|
531
|
-
case "olivedrab": return new Color(0.42, 0.56, 0.14);
|
|
532
|
-
case "lawngreen": return new Color(0.49, 0.99, 0.0);
|
|
533
|
-
case "chartreuse": return new Color(0.5, 1, 0);
|
|
534
|
-
case "greenyellow": return new Color(0.68, 1, 0.18);
|
|
535
|
-
case "darkgreen": return new Color(0, 0.39, 0);
|
|
536
|
-
// case "green": return new Color(0, 1, 0);
|
|
537
|
-
case "forestgreen": return new Color(0.13, 0.55, 0.13);
|
|
538
|
-
// case "lime": return new Color(0, 1, 0);
|
|
539
|
-
case "limegreen": return new Color(0.19, 0.80, 0.19);
|
|
540
|
-
case "lightgreen": return new Color(0.56, 0.93, 0.56);
|
|
541
|
-
case "palegreen": return new Color(0.59, 0.98, 0.59);
|
|
542
|
-
case "darkseagreen": return new Color(0.56, 0.74, 0.56);
|
|
543
|
-
case "mediumspringgreen": return new Color(0, 0.98, 0.6);
|
|
544
|
-
case "springgreen": return new Color(0, 1, 0.5);
|
|
545
|
-
case "seagreen": return new Color(0.18, 0.31, 0.31);
|
|
546
|
-
case "mediumaquamarine": return new Color(0.4, 0.8, 0.66);
|
|
547
|
-
case "mediumseagreen": return new Color(0.24, 0.70, 0.44);
|
|
548
|
-
case "lightseagreen": return new Color(0.13, 0.70, 0.67);
|
|
549
|
-
case "darkslategray": return new Color(0.18, 0.31, 0.31);
|
|
550
|
-
// case "teal": return new Color(0, 0.5, 0.5);
|
|
551
|
-
case "darkcyan": return new Color(0, 0.55, 0.55);
|
|
552
|
-
case "aqua": return new Color(0, 1, 1);
|
|
553
|
-
// case "cyan": return new Color(0, 1, 1);
|
|
554
|
-
case "lightcyan": return new Color(0.8, 1, 1);
|
|
555
|
-
case "darkturquoise": return new Color(0, 0.81, 0.82);
|
|
556
|
-
case "turquoise": return new Color(0, 0.82, 0.82);
|
|
557
|
-
case "mediumturquoise": return new Color(0.28, 0.82, 0.8);
|
|
558
|
-
case "paleturquoise": return new Color(0.68, 1, 0.93);
|
|
559
|
-
case "aquamarine": return new Color(0.5, 1, 0.83);
|
|
560
|
-
case "powderblue": return new Color(0.69, 0.88, 0.9);
|
|
561
|
-
case "cadetblue": return new Color(0.37, 0.62, 0.63);
|
|
562
|
-
case "steelblue": return new Color(0.27, 0.51, 0.71);
|
|
563
|
-
case "cornflowerblue": return new Color(0.39, 0.58, 0.93);
|
|
564
|
-
case "deepskyblue": return new Color(0, 0.7, 1);
|
|
565
|
-
case "dodgerblue": return new Color(0.12, 0.56, 1);
|
|
566
|
-
case "lightblue": return new Color(0.68, 0.85, 0.9);
|
|
567
|
-
case "skyblue": return new Color(0.53, 0.81, 0.92);
|
|
568
|
-
case "lightskyblue": return new Color(0.53, 0.81, 0.98);
|
|
569
|
-
case "midnightblue": return new Color(0.18, 0.18, 0.31);
|
|
570
|
-
// case "navy": return new Color(0, 0, 0.5);
|
|
571
|
-
case "darkblue": return new Color(0, 0, 0.55);
|
|
572
|
-
case "mediumblue": return new Color(0, 0, 0.82);
|
|
573
|
-
// case "blue": return new Color(0, 0, 1);
|
|
574
|
-
case "royalblue": return new Color(0.25, 0.41, 0.88);
|
|
575
|
-
case "blueviolet": return new Color(0.54, 0.17, 0.89);
|
|
576
|
-
case "indigo": return new Color(0.29, 0, 0.51);
|
|
577
|
-
case "darkslateblue": return new Color(0.28, 0.24, 0.55);
|
|
578
|
-
case "slateblue": return new Color(0.42, 0.35, 0.80);
|
|
579
|
-
case "mediumslateblue": return new Color(0.48, 0.41, 0.9);
|
|
580
|
-
case "mediumpurple": return new Color(0.58, 0.44, 0.86);
|
|
581
|
-
case "darkmagenta": return new Color(0.55, 0, 0.55);
|
|
582
|
-
case "darkviolet": return new Color(0.58, 0, 0.83);
|
|
583
|
-
case "darkorchid": return new Color(0.6, 0.2, 0.8);
|
|
584
|
-
case "mediumorchid": return new Color(0.73, 0.33, 0.83);
|
|
585
|
-
// case "purple": return new Color(0.5, 0, 0.5);
|
|
586
|
-
case "thistle": return new Color(0.84, 0.75, 0.85);
|
|
587
|
-
case "plum": return new Color(0.87, 0.63, 0.87);
|
|
588
|
-
case "violet": return new Color(0.93, 0.51, 0.93);
|
|
589
|
-
// case "magenta": return new Color(1, 0, 1);
|
|
590
|
-
case "fuchsia": return new Color(1, 0, 1);
|
|
591
|
-
case "orchid": return new Color(0.85, 0.44, 0.84);
|
|
592
|
-
case "mediumvioletred": return new Color(0.78, 0.08, 0.52);
|
|
593
|
-
case "palevioletred": return new Color(0.86, 0.44, 0.58);
|
|
594
|
-
case "hotpink": return new Color(1, 0.4, 0.71);
|
|
595
|
-
case "deeppink": return new Color(1, 0.08, 0.58);
|
|
596
|
-
case "lightpink": return new Color(1, 0.71, 0.76);
|
|
597
|
-
case "pink": return new Color(1, 0.75, 0.78);
|
|
598
|
-
case "antiquewhite": return new Color(0.98, 0.92, 0.84);
|
|
599
|
-
case "beige": return new Color(0.96, 0.96, 0.86);
|
|
600
|
-
case "bisque": return new Color(1, 0.89, 0.77);
|
|
601
|
-
case "blanchedalmond": return new Color(1, 0.92, 0.82);
|
|
602
|
-
case "wheat": return new Color(0.96, 0.87, 0.87);
|
|
603
|
-
case "cornsilk": return new Color(1, 0.97, 0.86);
|
|
604
|
-
case "lemonchiffon": return new Color(1, 0.98, 0.8);
|
|
605
|
-
case "lightgoldenrodyellow": return new Color(0.98, 0.98, 0.82);
|
|
606
|
-
case "lightyellow": return new Color(1, 1, 0.8);
|
|
607
|
-
case "saddlebrown": return new Color(0.55, 0.27, 0.07);
|
|
608
|
-
case "sienna": return new Color(0.63, 0.32, 0.18);
|
|
609
|
-
case "chocolate": return new Color(0.82, 0.41, 0.12);
|
|
610
|
-
case "peru": return new Color(0.82, 0.52, 0.25);
|
|
611
|
-
case "sandybrown": return new Color(0.96, 0.64, 0.38);
|
|
612
|
-
case "burlywood": return new Color(0.87, 0.72, 0.53);
|
|
613
|
-
case "tan": return new Color(0.82, 0.71, 0.55);
|
|
614
|
-
case "rosybrown": return new Color(0.74, 0.56, 0.56);
|
|
615
|
-
case "moccasin": return new Color(1, 0.89, 0.71);
|
|
616
|
-
case "navajowhite": return new Color(1, 0.87, 0.68);
|
|
617
|
-
case "peachpuff": return new Color(1, 0.85, 0.73);
|
|
618
|
-
case "mistyrose": return new Color(1, 0.89, 0.88);
|
|
619
|
-
case "lavenderblush": return new Color(1, 0.94, 0.93);
|
|
620
|
-
case "linen": return new Color(0.98, 0.94, 0.9);
|
|
621
|
-
case "oldlace": return new Color(0.99, 0.96, 0.9);
|
|
622
|
-
case "papayawhip": return new Color(1, 0.94, 0.84);
|
|
623
|
-
case "seashell": return new Color(1, 0.96, 0.93);
|
|
624
|
-
case "mintcream": return new Color(0.98, 1, 0.98);
|
|
625
|
-
case "slategray": return new Color(0.44, 0.5, 0.56);
|
|
626
|
-
case "lightslategray": return new Color(0.47, 0.53, 0.6);
|
|
627
|
-
case "lightsteelblue": return new Color(0.69, 0.77, 0.87);
|
|
628
|
-
case "lavender": return new Color(0.9, 0.9, 0.98);
|
|
629
|
-
case "floralwhite": return new Color(1, 0.98, 0.98);
|
|
630
|
-
case "aliceblue": return new Color(0.94, 0.97, 1);
|
|
631
|
-
case "ghostwhite": return new Color(0.97, 0.97, 1);
|
|
632
|
-
case "honeydew": return new Color(0.94, 1, 0.94);
|
|
633
|
-
case "ivory": return new Color(1, 1, 0.94);
|
|
634
|
-
case "azure": return new Color(0.94, 1, 1);
|
|
635
|
-
case "snow": return new Color(1, 0.98, 0.98);
|
|
636
|
-
// case "black": return new Color(0, 0, 0);
|
|
637
|
-
case "dimgray": return new Color(0.4, 0.4, 0.4);
|
|
638
|
-
// case "gray": return new Color(0.5, 0.5, 0.5);
|
|
639
|
-
case "darkgray": return new Color(0.66, 0.66, 0.66);
|
|
640
|
-
// case "silver": return new Color(0.75, 0.75, 0.75);
|
|
641
|
-
case "lightgray": return new Color(0.83, 0.83, 0.83);
|
|
642
|
-
case "gainsboro": return new Color(0.86, 0.86, 0.86);
|
|
643
|
-
case "whitesmoke": return new Color(0.96, 0.96, 0.96);
|
|
644
|
-
|
|
645
|
-
}
|
|
646
|
-
return new Color(1, 1, 1);
|
|
647
|
-
}
|
|
648
|
-
|
|
649
512
|
// const anyTag = new RegExp('<.+?>', 'g');
|
|
650
513
|
// const regex = new RegExp('<(?<type>.+?)>(?<text>.+?)<\/.+?>', 'g');
|