@needle-tools/engine 4.6.1-next.1e3d612 → 4.6.1-next.20d54cd
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/dist/{needle-engine.bundle-DsI9yYlp.umd.cjs → needle-engine.bundle-BVrLqIyi.umd.cjs} +174 -162
- package/dist/{needle-engine.bundle-Dx31Hfkf.js → needle-engine.bundle-BonYthMO.js} +6830 -6751
- package/dist/{needle-engine.bundle-BYdv-DmQ.min.js → needle-engine.bundle-CokaG-YG.min.js} +165 -153
- package/dist/needle-engine.js +48 -48
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/lib/engine/engine_context.d.ts +2 -1
- package/lib/engine/engine_context.js +3 -2
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_three_utils.d.ts +17 -14
- package/lib/engine/engine_three_utils.js +106 -53
- package/lib/engine/engine_three_utils.js.map +1 -1
- package/lib/engine/engine_tonemapping.d.ts +4 -0
- package/lib/engine/engine_tonemapping.js +21 -18
- package/lib/engine/engine_tonemapping.js.map +1 -1
- package/lib/engine/engine_utils.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.d.ts +4 -1
- package/lib/engine/webcomponents/needle-engine.extras.js +3 -3
- package/lib/engine/webcomponents/needle-engine.extras.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.js +11 -21
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine-components/CameraUtils.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/BloomEffect.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/BloomEffect.js +2 -2
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.d.ts +8 -0
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js +27 -8
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Sharpening.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/Sharpening.js +2 -2
- package/lib/engine-components/postprocessing/Effects/Sharpening.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Tonemapping.d.ts +2 -9
- package/lib/engine-components/postprocessing/Effects/Tonemapping.js +23 -71
- package/lib/engine-components/postprocessing/Effects/Tonemapping.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.d.ts +13 -0
- package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.js +52 -0
- package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.js.map +1 -0
- package/lib/engine-components/postprocessing/PostProcessingEffect.d.ts +7 -7
- package/lib/engine-components/postprocessing/PostProcessingEffect.js +7 -7
- package/lib/engine-components/postprocessing/PostProcessingEffect.js.map +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.d.ts +10 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.js +128 -16
- package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
- package/lib/engine-components/postprocessing/Volume.js +19 -24
- package/lib/engine-components/postprocessing/Volume.js.map +1 -1
- package/lib/engine-components/postprocessing/index.d.ts +1 -1
- package/lib/engine-components/postprocessing/index.js +1 -1
- package/lib/engine-components/postprocessing/index.js.map +1 -1
- package/lib/engine-components/postprocessing/utils.d.ts +6 -6
- package/lib/engine-components/postprocessing/utils.js +26 -25
- package/lib/engine-components/postprocessing/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/engine/engine_context.ts +5 -3
- package/src/engine/engine_three_utils.ts +134 -58
- package/src/engine/engine_tonemapping.ts +23 -24
- package/src/engine/engine_utils.ts +2 -2
- package/src/engine/webcomponents/needle-engine.extras.ts +3 -3
- package/src/engine/webcomponents/needle-engine.ts +14 -25
- package/src/engine-components/CameraUtils.ts +3 -3
- package/src/engine-components/postprocessing/Effects/BloomEffect.ts +2 -2
- package/src/engine-components/postprocessing/Effects/ColorAdjustments.ts +24 -13
- package/src/engine-components/postprocessing/Effects/Sharpening.ts +2 -2
- package/src/engine-components/postprocessing/Effects/Tonemapping.ts +26 -80
- package/src/engine-components/postprocessing/Effects/Tonemapping.utils.ts +60 -0
- package/src/engine-components/postprocessing/PostProcessingEffect.ts +7 -7
- package/src/engine-components/postprocessing/PostProcessingHandler.ts +143 -19
- package/src/engine-components/postprocessing/Volume.ts +19 -26
- package/src/engine-components/postprocessing/index.ts +1 -1
- package/src/engine-components/postprocessing/utils.ts +27 -26
|
@@ -64,21 +64,21 @@ export type PostprocessingEffectData = {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
|
-
* Default
|
|
68
|
-
* E.g. in your custom effect, you can set `
|
|
69
|
-
* OR `
|
|
67
|
+
* Default order for post-processing effects. This can be used to sort effects by their rendering order when creating custom effects.
|
|
68
|
+
* E.g. in your custom effect, you can set `order: PostProcessingEffectOrder.Bloom + 1;` to ensure it gets rendered after the bloom effect.
|
|
69
|
+
* OR `order: PostProcessingEffectOrder.Bloom - 1;` to ensure it gets rendered before the bloom effect.
|
|
70
70
|
* @example
|
|
71
71
|
* ```typescript
|
|
72
|
-
* import {
|
|
73
|
-
*
|
|
72
|
+
* import { PostProcessingEffectOrder } from "@needle-tools/engine"
|
|
73
|
+
*
|
|
74
74
|
* export class MyCustomEffect extends PostProcessingEffect {
|
|
75
|
-
*
|
|
75
|
+
* order: PostProcessingEffectPriority.Bloom + 1; // render after bloom
|
|
76
76
|
*
|
|
77
77
|
* // ... your effect code
|
|
78
78
|
* }
|
|
79
79
|
* ```
|
|
80
80
|
*/
|
|
81
|
-
export const
|
|
81
|
+
export const PostProcessingEffectOrder = {
|
|
82
82
|
/** Used to render effects at the start of the post-processing chain */
|
|
83
83
|
AT_START: -10_000,
|
|
84
84
|
|
|
@@ -109,36 +109,37 @@ export function orderEffects(effects: Array<PostprocessingEffectData>) {
|
|
|
109
109
|
|
|
110
110
|
if (!builtinOrder) {
|
|
111
111
|
builtinOrder = new Map<Constructor<Effect | Pass>, number>();
|
|
112
|
-
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.NormalPass,
|
|
113
|
-
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.DepthDownsamplingPass,
|
|
114
|
-
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.SMAAEffect,
|
|
115
|
-
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.SSAOEffect,
|
|
116
|
-
builtinOrder.set(MODULES.POSTPROCESSING_AO.MODULE.N8AOPostPass,
|
|
117
|
-
builtinOrder.set(MODULES.
|
|
118
|
-
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.
|
|
119
|
-
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.
|
|
120
|
-
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.
|
|
121
|
-
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.
|
|
122
|
-
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.
|
|
123
|
-
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.
|
|
124
|
-
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.
|
|
125
|
-
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.
|
|
126
|
-
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.
|
|
112
|
+
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.NormalPass, PostProcessingEffectOrder.NormalPass);
|
|
113
|
+
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.DepthDownsamplingPass, PostProcessingEffectOrder.DepthDownsamplingPass);
|
|
114
|
+
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.SMAAEffect, PostProcessingEffectOrder.SMAA);
|
|
115
|
+
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.SSAOEffect, PostProcessingEffectOrder.SSAO);
|
|
116
|
+
builtinOrder.set(MODULES.POSTPROCESSING_AO.MODULE.N8AOPostPass, PostProcessingEffectOrder.SSAO);
|
|
117
|
+
builtinOrder.set(MODULES.POSTPROCESSING_AO.MODULE.N8AOPass, PostProcessingEffectOrder.SSAO);
|
|
118
|
+
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.TiltShiftEffect, PostProcessingEffectOrder.TiltShift);
|
|
119
|
+
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.DepthOfFieldEffect, PostProcessingEffectOrder.DepthOfField);
|
|
120
|
+
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.ChromaticAberrationEffect, PostProcessingEffectOrder.ChromaticAberration);
|
|
121
|
+
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.BloomEffect, PostProcessingEffectOrder.Bloom);
|
|
122
|
+
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.SelectiveBloomEffect, PostProcessingEffectOrder.Bloom);
|
|
123
|
+
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.VignetteEffect, PostProcessingEffectOrder.Vignette);
|
|
124
|
+
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.PixelationEffect, PostProcessingEffectOrder.Pixelation);
|
|
125
|
+
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.ToneMappingEffect, PostProcessingEffectOrder.ToneMapping);
|
|
126
|
+
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.HueSaturationEffect, PostProcessingEffectOrder.HueSaturation);
|
|
127
|
+
builtinOrder.set(MODULES.POSTPROCESSING.MODULE.BrightnessContrastEffect, PostProcessingEffectOrder.BrightnessContrast);
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
// enforce correct order of effects (e.g. DOF before Bloom)
|
|
130
131
|
effects.sort((a, b) => {
|
|
131
132
|
// we use find index here because sometimes constructor names are prefixed with `_`
|
|
132
133
|
// TODO: find a more robust solution that isnt name based (not sure if that exists tho... maybe we must give effect TYPES some priority/index)
|
|
133
|
-
const aidx = typeof a.priority === "number" ? a.priority : builtinOrder!.get(a.effect.constructor as Constructor<Effect | Pass>)
|
|
134
|
-
const bidx = typeof b.priority === "number" ? b.priority : builtinOrder!.get(b.effect.constructor as Constructor<Effect | Pass>)
|
|
134
|
+
const aidx = typeof a.priority === "number" ? a.priority : builtinOrder!.get(a.effect.constructor as Constructor<Effect | Pass>) ?? Number.NEGATIVE_INFINITY;
|
|
135
|
+
const bidx = typeof b.priority === "number" ? b.priority : builtinOrder!.get(b.effect.constructor as Constructor<Effect | Pass>) ?? Number.NEGATIVE_INFINITY;
|
|
135
136
|
|
|
136
137
|
// Unknown effects should be rendered first
|
|
137
|
-
if (aidx
|
|
138
|
+
if (aidx === Number.NEGATIVE_INFINITY) {
|
|
138
139
|
if (debug) console.warn("Unknown effect found: ", a.constructor.name, a);
|
|
139
140
|
return 1;
|
|
140
141
|
}
|
|
141
|
-
else if (bidx
|
|
142
|
+
else if (bidx === Number.NEGATIVE_INFINITY) {
|
|
142
143
|
if (debug) console.warn("Unknown effect found: ", b.constructor.name, b);
|
|
143
144
|
return -1;
|
|
144
145
|
}
|