angular-three-postprocessing 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +15 -0
  2. package/effects/README.md +3 -0
  3. package/effects/index.d.ts +14 -0
  4. package/effects/lib/bloom/bloom.d.ts +9 -0
  5. package/effects/lib/brightness-contrast/brightness-contrast.d.ts +8 -0
  6. package/effects/lib/color-depth/color-depth.d.ts +8 -0
  7. package/effects/lib/depth/depth.d.ts +8 -0
  8. package/effects/lib/dot-screen/dot-screen.d.ts +8 -0
  9. package/effects/lib/hue-saturation/hue-saturation.d.ts +8 -0
  10. package/effects/lib/lut/lut.d.ts +13 -0
  11. package/effects/lib/noise/noise.d.ts +9 -0
  12. package/effects/lib/scanline/scanline.d.ts +9 -0
  13. package/effects/lib/sepia/sepia.d.ts +8 -0
  14. package/effects/lib/ssao/ssao.d.ts +13 -0
  15. package/effects/lib/tilt-shift/tilt-shift.d.ts +9 -0
  16. package/effects/lib/tone-mapping/tone-mapping.d.ts +8 -0
  17. package/effects/lib/vignette/vignette.d.ts +8 -0
  18. package/esm2020/angular-three-postprocessing.mjs +5 -0
  19. package/esm2020/effects/angular-three-postprocessing-effects.mjs +5 -0
  20. package/esm2020/effects/index.mjs +15 -0
  21. package/esm2020/effects/lib/bloom/bloom.mjs +43 -0
  22. package/esm2020/effects/lib/brightness-contrast/brightness-contrast.mjs +28 -0
  23. package/esm2020/effects/lib/color-depth/color-depth.mjs +28 -0
  24. package/esm2020/effects/lib/depth/depth.mjs +28 -0
  25. package/esm2020/effects/lib/dot-screen/dot-screen.mjs +28 -0
  26. package/esm2020/effects/lib/hue-saturation/hue-saturation.mjs +28 -0
  27. package/esm2020/effects/lib/lut/lut.mjs +59 -0
  28. package/esm2020/effects/lib/noise/noise.mjs +32 -0
  29. package/esm2020/effects/lib/scanline/scanline.mjs +32 -0
  30. package/esm2020/effects/lib/sepia/sepia.mjs +28 -0
  31. package/esm2020/effects/lib/ssao/ssao.mjs +101 -0
  32. package/esm2020/effects/lib/tilt-shift/tilt-shift.mjs +42 -0
  33. package/esm2020/effects/lib/tone-mapping/tone-mapping.mjs +38 -0
  34. package/esm2020/effects/lib/vignette/vignette.mjs +28 -0
  35. package/esm2020/index.mjs +3 -0
  36. package/esm2020/lib/effect-composer.mjs +218 -0
  37. package/esm2020/lib/effect.mjs +79 -0
  38. package/fesm2015/angular-three-postprocessing-effects.mjs +481 -0
  39. package/fesm2015/angular-three-postprocessing-effects.mjs.map +1 -0
  40. package/fesm2015/angular-three-postprocessing.mjs +295 -0
  41. package/fesm2015/angular-three-postprocessing.mjs.map +1 -0
  42. package/fesm2020/angular-three-postprocessing-effects.mjs +484 -0
  43. package/fesm2020/angular-three-postprocessing-effects.mjs.map +1 -0
  44. package/fesm2020/angular-three-postprocessing.mjs +299 -0
  45. package/fesm2020/angular-three-postprocessing.mjs.map +1 -0
  46. package/index.d.ts +2 -0
  47. package/lib/effect-composer.d.ts +39 -0
  48. package/lib/effect.d.ts +22 -0
  49. package/package.json +68 -0
  50. package/plugin/README.md +11 -0
  51. package/plugin/generators.json +19 -0
  52. package/plugin/package.json +10 -0
  53. package/plugin/src/generators/init/compat.d.ts +2 -0
  54. package/plugin/src/generators/init/compat.js +6 -0
  55. package/plugin/src/generators/init/compat.js.map +1 -0
  56. package/plugin/src/generators/init/init.d.ts +4 -0
  57. package/plugin/src/generators/init/init.js +26 -0
  58. package/plugin/src/generators/init/init.js.map +1 -0
  59. package/plugin/src/generators/init/schema.json +6 -0
  60. package/plugin/src/index.d.ts +1 -0
  61. package/plugin/src/index.js +6 -0
  62. package/plugin/src/index.js.map +1 -0
@@ -0,0 +1,299 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, Directive, Input, reflectComponentType, InjectionToken, Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
3
+ import { NgtRxStore, NgtStore, startWithUndefined, extend, injectNgtRef, getLocalState } from 'angular-three';
4
+ import { BlendFunction, EffectComposer, RenderPass, NormalPass, DepthDownsamplingPass, EffectPass } from 'postprocessing';
5
+ import { combineLatest, map } from 'rxjs';
6
+ import { RxActionFactory } from '@rx-angular/state/actions';
7
+ import * as THREE from 'three';
8
+ import { Group } from 'three';
9
+ import { isWebGL2Available } from 'three-stdlib';
10
+
11
+ class NgtpEffect extends NgtRxStore {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.defaultBlendMode = BlendFunction.NORMAL;
15
+ this.store = inject(NgtStore);
16
+ }
17
+ set blendFunction(blendFunction) {
18
+ this.set({ blendFunction });
19
+ }
20
+ set opacity(opacity) {
21
+ this.set({ opacity });
22
+ }
23
+ ngOnChanges(changes) {
24
+ this.set((s) => ({
25
+ ...s,
26
+ ...simpleChangesToStateObject(changes, ['blendFunction', 'opacity']),
27
+ }));
28
+ }
29
+ ngOnInit() {
30
+ this.connect('effect', componentInputsToCombinedStream(this), (props) => {
31
+ delete props['__ngt_dummy__'];
32
+ delete props['effect'];
33
+ return new this.effectConstructor(props);
34
+ });
35
+ this.configureBlendMode();
36
+ }
37
+ configureBlendMode() {
38
+ this.hold(combineLatest([
39
+ this.select('effect'),
40
+ this.select('blendFunction').pipe(startWithUndefined()),
41
+ this.select('opacity').pipe(startWithUndefined()),
42
+ ]), ([effect, blendFunction, opacity]) => {
43
+ const invalidate = this.store.get('invalidate');
44
+ effect.blendMode.blendFunction =
45
+ !blendFunction && blendFunction !== 0 ? this.defaultBlendMode : blendFunction;
46
+ if (opacity !== undefined)
47
+ effect.blendMode.opacity.value = opacity;
48
+ invalidate();
49
+ });
50
+ }
51
+ }
52
+ NgtpEffect.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtpEffect, deps: null, target: i0.ɵɵFactoryTarget.Directive });
53
+ NgtpEffect.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.2", type: NgtpEffect, inputs: { blendFunction: "blendFunction", opacity: "opacity" }, usesInheritance: true, usesOnChanges: true, ngImport: i0 });
54
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtpEffect, decorators: [{
55
+ type: Directive
56
+ }], propDecorators: { blendFunction: [{
57
+ type: Input
58
+ }], opacity: [{
59
+ type: Input
60
+ }] } });
61
+ function simpleChangesToStateObject(changes, keysToDelete = []) {
62
+ for (const key of keysToDelete) {
63
+ if (changes[key])
64
+ delete changes[key];
65
+ }
66
+ return Object.entries(changes).reduce((obj, [key, change]) => {
67
+ obj[key] = change.currentValue;
68
+ return obj;
69
+ }, {});
70
+ }
71
+ function componentInputsToCombinedStream(component, filterFn = () => true) {
72
+ const inputs = reflectComponentType(component.constructor)
73
+ ?.inputs.filter(filterFn)
74
+ .map((input) => input.propName) || [];
75
+ return combineLatest(inputs.reduce((combined, input) => {
76
+ let input$ = component.select(input);
77
+ if (component.get(input) !== undefined) {
78
+ input$ = input$.pipe(startWithUndefined());
79
+ }
80
+ combined[input] = input$;
81
+ return combined;
82
+ }, {}));
83
+ }
84
+
85
+ extend({ Group });
86
+ const NGTP_EFFECT_COMPOSER_API = new InjectionToken('NgtpEffectComposer API');
87
+ function effectComposerApiFactory(composer) {
88
+ const api = {};
89
+ Object.defineProperties(api, {
90
+ composer: { get: () => composer.get('entities')[0] },
91
+ normalPass: { get: () => composer.get('entities')[1] },
92
+ downSamplingPass: { get: () => composer.get('entities')[2] },
93
+ resolutionScale: { get: () => composer.get('resolutionScale') },
94
+ scene: { get: () => composer.get('activeScene') },
95
+ camera: { get: () => composer.get('activeCamera') },
96
+ select: { get: () => composer.select.bind(composer) },
97
+ get: { get: () => composer.get.bind(composer) },
98
+ });
99
+ return api;
100
+ }
101
+ class NgtpEffectComposer extends NgtRxStore {
102
+ constructor() {
103
+ super(...arguments);
104
+ this.composerRef = injectNgtRef();
105
+ this.store = inject(NgtStore);
106
+ this.actions = inject((RxActionFactory)).create();
107
+ }
108
+ set enabled(enabled) {
109
+ this.set({ enabled });
110
+ }
111
+ set depthBuffer(depthBuffer) {
112
+ this.set({ depthBuffer });
113
+ }
114
+ set disableNormalPass(disableNormalPass) {
115
+ this.set({ disableNormalPass });
116
+ }
117
+ set stencilBuffer(stencilBuffer) {
118
+ this.set({ stencilBuffer });
119
+ }
120
+ set autoClear(autoClear) {
121
+ this.set({ autoClear });
122
+ }
123
+ set resolutionScale(resolutionScale) {
124
+ this.set({ resolutionScale });
125
+ }
126
+ set multisampling(multisampling) {
127
+ this.set({ multisampling });
128
+ }
129
+ set frameBufferType(frameBufferType) {
130
+ this.set({ frameBufferType });
131
+ }
132
+ set renderPriority(renderPriority) {
133
+ this.set({ renderPriority });
134
+ }
135
+ set camera(camera) {
136
+ this.set({ camera });
137
+ }
138
+ set scene(scene) {
139
+ this.set({ scene });
140
+ }
141
+ initialize() {
142
+ super.initialize();
143
+ this.set({
144
+ enabled: true,
145
+ renderPriority: 1,
146
+ autoClear: true,
147
+ multisampling: 0,
148
+ frameBufferType: THREE.HalfFloatType,
149
+ });
150
+ }
151
+ ngOnInit() {
152
+ this.connect('activeScene', combineLatest([this.store.select('scene'), this.select('scene').pipe(startWithUndefined())]).pipe(map(([defaultScene, scene]) => scene || defaultScene)));
153
+ this.connect('activeCamera', combineLatest([this.store.select('camera'), this.select('camera').pipe(startWithUndefined())]).pipe(map(([defaultCamera, camera]) => camera || defaultCamera)));
154
+ this.connect('entities', combineLatest([
155
+ this.store.select('gl'),
156
+ this.select('activeScene'),
157
+ this.select('activeCamera'),
158
+ this.select('multisampling'),
159
+ this.select('frameBufferType'),
160
+ this.select('depthBuffer').pipe(startWithUndefined()),
161
+ this.select('stencilBuffer').pipe(startWithUndefined()),
162
+ this.select('disableNormalPass').pipe(startWithUndefined()),
163
+ this.select('resolutionScale').pipe(startWithUndefined()),
164
+ ]).pipe(map(([gl, scene, camera, multisampling, frameBufferType, depthBuffer, stencilBuffer, disableNormalPass, resolutionScale,]) => {
165
+ const webGL2Available = isWebGL2Available();
166
+ // Initialize composer
167
+ const effectComposer = new EffectComposer(gl, {
168
+ depthBuffer,
169
+ stencilBuffer,
170
+ multisampling: multisampling > 0 && webGL2Available ? multisampling : 0,
171
+ frameBufferType,
172
+ });
173
+ // Add render pass
174
+ effectComposer.addPass(new RenderPass(scene, camera));
175
+ // Create normal pass
176
+ let downSamplingPass = null;
177
+ let normalPass = null;
178
+ if (!disableNormalPass) {
179
+ normalPass = new NormalPass(scene, camera);
180
+ normalPass.enabled = false;
181
+ effectComposer.addPass(normalPass);
182
+ if (resolutionScale !== undefined && webGL2Available) {
183
+ downSamplingPass = new DepthDownsamplingPass({
184
+ normalBuffer: normalPass.texture,
185
+ resolutionScale,
186
+ });
187
+ downSamplingPass.enabled = false;
188
+ effectComposer.addPass(downSamplingPass);
189
+ }
190
+ }
191
+ return [effectComposer, normalPass, downSamplingPass];
192
+ })));
193
+ this.setComposerSize();
194
+ this.setEffectPassed();
195
+ this.setBeforeRender();
196
+ }
197
+ setComposerSize() {
198
+ this.hold(combineLatest([this.select('entities'), this.store.select('size')]), ([[composer], size]) => void composer.setSize(size.width, size.height));
199
+ }
200
+ setEffectPassed() {
201
+ this.effect(combineLatest([
202
+ this.select('entities'),
203
+ this.select('activeCamera'),
204
+ this.composerRef.children$('nonObjects'),
205
+ ]), ([[composer, normalPass, downSamplingPass], camera, effects]) => {
206
+ let effectPass;
207
+ if (this.composerRef.nativeElement &&
208
+ Object.keys(getLocalState(this.composerRef.nativeElement)).length &&
209
+ composer) {
210
+ effectPass = new EffectPass(camera, ...effects);
211
+ effectPass.renderToScreen = true;
212
+ if (normalPass)
213
+ normalPass.enabled = true;
214
+ if (downSamplingPass)
215
+ downSamplingPass.enabled = true;
216
+ }
217
+ return () => {
218
+ if (effectPass)
219
+ composer?.removePass(effectPass);
220
+ if (normalPass)
221
+ normalPass.enabled = false;
222
+ if (downSamplingPass)
223
+ downSamplingPass.enabled = false;
224
+ };
225
+ });
226
+ }
227
+ setBeforeRender() {
228
+ const renderPriority = this.get('renderPriority');
229
+ const enabled = this.get('enabled');
230
+ this.effect(this.actions.setBeforeRender$, () => this.store.get('internal').subscribe(({ delta }) => {
231
+ const [composer] = this.get('entities') || [];
232
+ const enabled = this.get('enabled');
233
+ const autoClear = this.get('autoClear');
234
+ const gl = this.store.get('gl');
235
+ if (composer && enabled) {
236
+ gl.autoClear = autoClear;
237
+ composer.render(delta);
238
+ }
239
+ }, enabled ? renderPriority : 0));
240
+ this.actions.setBeforeRender();
241
+ }
242
+ }
243
+ NgtpEffectComposer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtpEffectComposer, deps: null, target: i0.ɵɵFactoryTarget.Component });
244
+ NgtpEffectComposer.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.2", type: NgtpEffectComposer, isStandalone: true, selector: "ngtp-effect-composer", inputs: { composerRef: "composerRef", enabled: "enabled", depthBuffer: "depthBuffer", disableNormalPass: "disableNormalPass", stencilBuffer: "stencilBuffer", autoClear: "autoClear", resolutionScale: "resolutionScale", multisampling: "multisampling", frameBufferType: "frameBufferType", renderPriority: "renderPriority", camera: "camera", scene: "scene" }, providers: [
245
+ { provide: NGTP_EFFECT_COMPOSER_API, useFactory: effectComposerApiFactory, deps: [NgtpEffectComposer] },
246
+ RxActionFactory,
247
+ ], usesInheritance: true, ngImport: i0, template: `
248
+ <ngt-group [ref]="composerRef">
249
+ <ng-content />
250
+ </ngt-group>
251
+ `, isInline: true });
252
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.2", ngImport: i0, type: NgtpEffectComposer, decorators: [{
253
+ type: Component,
254
+ args: [{
255
+ selector: 'ngtp-effect-composer',
256
+ standalone: true,
257
+ template: `
258
+ <ngt-group [ref]="composerRef">
259
+ <ng-content />
260
+ </ngt-group>
261
+ `,
262
+ providers: [
263
+ { provide: NGTP_EFFECT_COMPOSER_API, useFactory: effectComposerApiFactory, deps: [NgtpEffectComposer] },
264
+ RxActionFactory,
265
+ ],
266
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
267
+ }]
268
+ }], propDecorators: { composerRef: [{
269
+ type: Input
270
+ }], enabled: [{
271
+ type: Input
272
+ }], depthBuffer: [{
273
+ type: Input
274
+ }], disableNormalPass: [{
275
+ type: Input
276
+ }], stencilBuffer: [{
277
+ type: Input
278
+ }], autoClear: [{
279
+ type: Input
280
+ }], resolutionScale: [{
281
+ type: Input
282
+ }], multisampling: [{
283
+ type: Input
284
+ }], frameBufferType: [{
285
+ type: Input
286
+ }], renderPriority: [{
287
+ type: Input
288
+ }], camera: [{
289
+ type: Input
290
+ }], scene: [{
291
+ type: Input
292
+ }] } });
293
+
294
+ /**
295
+ * Generated bundle index. Do not edit.
296
+ */
297
+
298
+ export { NGTP_EFFECT_COMPOSER_API, NgtpEffect, NgtpEffectComposer, componentInputsToCombinedStream, simpleChangesToStateObject };
299
+ //# sourceMappingURL=angular-three-postprocessing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"angular-three-postprocessing.mjs","sources":["../../../../libs/angular-three-postprocessing/src/lib/effect.ts","../../../../libs/angular-three-postprocessing/src/lib/effect-composer.ts","../../../../libs/angular-three-postprocessing/src/angular-three-postprocessing.ts"],"sourcesContent":["import { Directive, inject, Input, OnChanges, OnInit, reflectComponentType, SimpleChanges, Type } from '@angular/core';\nimport { NgtAnyRecord, NgtRxStore, NgtStore, startWithUndefined } from 'angular-three';\nimport { BlendFunction, Effect } from 'postprocessing';\nimport { combineLatest, Observable } from 'rxjs';\n\n@Directive()\nexport abstract class NgtpEffect<T extends Effect> extends NgtRxStore implements OnInit, OnChanges {\n @Input() set blendFunction(blendFunction: BlendFunction) {\n this.set({ blendFunction });\n }\n\n @Input() set opacity(opacity: number) {\n this.set({ opacity });\n }\n\n abstract get effectConstructor(): new (...args: any[]) => T;\n\n protected defaultBlendMode = BlendFunction.NORMAL;\n protected readonly store = inject(NgtStore);\n\n ngOnChanges(changes: SimpleChanges) {\n this.set((s) => ({\n ...s,\n ...simpleChangesToStateObject(changes, ['blendFunction', 'opacity']),\n }));\n }\n\n ngOnInit() {\n this.connect('effect', componentInputsToCombinedStream(this), (props) => {\n delete props['__ngt_dummy__'];\n delete props['effect'];\n return new this.effectConstructor(props);\n });\n this.configureBlendMode();\n }\n\n private configureBlendMode() {\n this.hold(\n combineLatest([\n this.select('effect'),\n this.select('blendFunction').pipe(startWithUndefined()),\n this.select('opacity').pipe(startWithUndefined()),\n ]),\n ([effect, blendFunction, opacity]) => {\n const invalidate = this.store.get('invalidate');\n effect.blendMode.blendFunction =\n !blendFunction && blendFunction !== 0 ? this.defaultBlendMode : blendFunction;\n if (opacity !== undefined) effect.blendMode.opacity.value = opacity;\n invalidate();\n }\n );\n }\n}\n\nexport function simpleChangesToStateObject(changes: SimpleChanges, keysToDelete: string[] = []) {\n for (const key of keysToDelete) {\n if (changes[key]) delete changes[key];\n }\n\n return Object.entries(changes).reduce((obj, [key, change]) => {\n obj[key] = change.currentValue;\n return obj;\n }, {} as NgtAnyRecord);\n}\n\nexport function componentInputsToCombinedStream(\n component: NgtRxStore,\n filterFn: (input: { propName: string; templateName: string }) => boolean = () => true\n): Observable<NgtAnyRecord> {\n const inputs =\n reflectComponentType(component.constructor as Type<any>)\n ?.inputs.filter(filterFn)\n .map((input) => input.propName) || [];\n\n return combineLatest(\n inputs.reduce((combined, input) => {\n let input$ = component.select(input);\n if (component.get(input) !== undefined) {\n input$ = input$.pipe(startWithUndefined());\n }\n combined[input] = input$;\n return combined;\n }, {} as Record<string, Observable<any>>)\n );\n}\n","import { Component, CUSTOM_ELEMENTS_SCHEMA, inject, InjectionToken, Input, OnInit } from '@angular/core';\nimport { RxActionFactory } from '@rx-angular/state/actions';\nimport { extend, getLocalState, injectNgtRef, NgtRxStore, NgtStore, startWithUndefined } from 'angular-three';\nimport { DepthDownsamplingPass, EffectComposer, EffectPass, NormalPass, RenderPass } from 'postprocessing';\nimport { combineLatest, map } from 'rxjs';\nimport * as THREE from 'three';\nimport { Group } from 'three';\nimport { isWebGL2Available } from 'three-stdlib';\n\nextend({ Group });\n\nexport interface NgtpEffectComposerApi {\n composer: EffectComposer;\n normalPass: NormalPass | null;\n depthPass: DepthDownsamplingPass | null;\n scene: THREE.Scene;\n camera: THREE.Camera;\n resolutionScale?: number;\n select: NgtpEffectComposer['select'];\n get: NgtpEffectComposer['get'];\n}\n\nexport const NGTP_EFFECT_COMPOSER_API = new InjectionToken<NgtpEffectComposerApi>('NgtpEffectComposer API');\n\nfunction effectComposerApiFactory(composer: NgtpEffectComposer) {\n const api = {} as NgtpEffectComposerApi;\n\n Object.defineProperties(api, {\n composer: { get: () => composer.get('entities')[0] },\n normalPass: { get: () => composer.get('entities')[1] },\n downSamplingPass: { get: () => composer.get('entities')[2] },\n resolutionScale: { get: () => composer.get('resolutionScale') },\n scene: { get: () => composer.get('activeScene') },\n camera: { get: () => composer.get('activeCamera') },\n select: { get: () => composer.select.bind(composer) },\n get: { get: () => composer.get.bind(composer) },\n });\n\n return api;\n}\n\n@Component({\n selector: 'ngtp-effect-composer',\n standalone: true,\n template: `\n <ngt-group [ref]=\"composerRef\">\n <ng-content />\n </ngt-group>\n `,\n providers: [\n { provide: NGTP_EFFECT_COMPOSER_API, useFactory: effectComposerApiFactory, deps: [NgtpEffectComposer] },\n RxActionFactory,\n ],\n schemas: [CUSTOM_ELEMENTS_SCHEMA],\n})\nexport class NgtpEffectComposer extends NgtRxStore implements OnInit {\n @Input() composerRef = injectNgtRef<Group>();\n\n @Input() set enabled(enabled: boolean) {\n this.set({ enabled });\n }\n\n @Input() set depthBuffer(depthBuffer: boolean) {\n this.set({ depthBuffer });\n }\n\n @Input() set disableNormalPass(disableNormalPass: boolean) {\n this.set({ disableNormalPass });\n }\n\n @Input() set stencilBuffer(stencilBuffer: boolean) {\n this.set({ stencilBuffer });\n }\n\n @Input() set autoClear(autoClear: boolean) {\n this.set({ autoClear });\n }\n\n @Input() set resolutionScale(resolutionScale: number) {\n this.set({ resolutionScale });\n }\n\n @Input() set multisampling(multisampling: number) {\n this.set({ multisampling });\n }\n\n @Input() set frameBufferType(frameBufferType: THREE.TextureDataType) {\n this.set({ frameBufferType });\n }\n\n @Input() set renderPriority(renderPriority: number) {\n this.set({ renderPriority });\n }\n\n @Input() set camera(camera: THREE.Camera) {\n this.set({ camera });\n }\n\n @Input() set scene(scene: THREE.Scene) {\n this.set({ scene });\n }\n\n override initialize(): void {\n super.initialize();\n this.set({\n enabled: true,\n renderPriority: 1,\n autoClear: true,\n multisampling: 0,\n frameBufferType: THREE.HalfFloatType,\n });\n }\n\n private readonly store = inject(NgtStore);\n private readonly actions = inject(RxActionFactory<{ setBeforeRender: void }>).create();\n\n ngOnInit() {\n this.connect(\n 'activeScene',\n combineLatest([this.store.select('scene'), this.select('scene').pipe(startWithUndefined())]).pipe(\n map(([defaultScene, scene]) => scene || defaultScene)\n )\n );\n\n this.connect(\n 'activeCamera',\n combineLatest([this.store.select('camera'), this.select('camera').pipe(startWithUndefined())]).pipe(\n map(([defaultCamera, camera]) => camera || defaultCamera)\n )\n );\n\n this.connect(\n 'entities',\n combineLatest([\n this.store.select('gl'),\n this.select('activeScene'),\n this.select('activeCamera'),\n this.select('multisampling'),\n this.select('frameBufferType'),\n this.select('depthBuffer').pipe(startWithUndefined()),\n this.select('stencilBuffer').pipe(startWithUndefined()),\n this.select('disableNormalPass').pipe(startWithUndefined()),\n this.select('resolutionScale').pipe(startWithUndefined()),\n ]).pipe(\n map(\n ([\n gl,\n scene,\n camera,\n multisampling,\n frameBufferType,\n depthBuffer,\n stencilBuffer,\n disableNormalPass,\n resolutionScale,\n ]) => {\n const webGL2Available = isWebGL2Available();\n // Initialize composer\n const effectComposer = new EffectComposer(gl, {\n depthBuffer,\n stencilBuffer,\n multisampling: multisampling > 0 && webGL2Available ? multisampling : 0,\n frameBufferType,\n });\n\n // Add render pass\n effectComposer.addPass(new RenderPass(scene, camera));\n\n // Create normal pass\n let downSamplingPass = null;\n let normalPass = null;\n if (!disableNormalPass) {\n normalPass = new NormalPass(scene, camera);\n normalPass.enabled = false;\n effectComposer.addPass(normalPass);\n if (resolutionScale !== undefined && webGL2Available) {\n downSamplingPass = new DepthDownsamplingPass({\n normalBuffer: normalPass.texture,\n resolutionScale,\n });\n downSamplingPass.enabled = false;\n effectComposer.addPass(downSamplingPass);\n }\n }\n\n return [effectComposer, normalPass, downSamplingPass];\n }\n )\n )\n );\n\n this.setComposerSize();\n this.setEffectPassed();\n this.setBeforeRender();\n }\n\n private setComposerSize() {\n this.hold(\n combineLatest([this.select('entities'), this.store.select('size')]),\n ([[composer], size]) => void (composer as EffectComposer).setSize(size.width, size.height)\n );\n }\n\n private setEffectPassed() {\n this.effect(\n combineLatest([\n this.select('entities'),\n this.select('activeCamera'),\n this.composerRef.children$('nonObjects'),\n ]),\n ([[composer, normalPass, downSamplingPass], camera, effects]) => {\n let effectPass: EffectPass;\n if (\n this.composerRef.nativeElement &&\n Object.keys(getLocalState(this.composerRef.nativeElement)).length &&\n composer\n ) {\n effectPass = new EffectPass(camera, ...effects);\n effectPass.renderToScreen = true;\n if (normalPass) normalPass.enabled = true;\n if (downSamplingPass) downSamplingPass.enabled = true;\n }\n\n return () => {\n if (effectPass) composer?.removePass(effectPass);\n if (normalPass) normalPass.enabled = false;\n if (downSamplingPass) downSamplingPass.enabled = false;\n };\n }\n );\n }\n\n private setBeforeRender() {\n const renderPriority = this.get('renderPriority');\n const enabled = this.get('enabled');\n this.effect(this.actions.setBeforeRender$, () =>\n this.store.get('internal').subscribe(\n ({ delta }) => {\n const [composer] = this.get('entities') || [];\n const enabled = this.get('enabled');\n const autoClear = this.get('autoClear');\n const gl = this.store.get('gl');\n if (composer && enabled) {\n gl.autoClear = autoClear;\n composer.render(delta);\n }\n },\n enabled ? renderPriority : 0\n )\n );\n this.actions.setBeforeRender();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AA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UAAU,EAAE,wBAAwB,EAAE,IAAI,EAAE,CAAA,kBAAA,CAAoB,EAAE;wBACvG,eAAe;AAClB,qBAAA;oBACD,OAAO,EAAE,CAAC,sBAAsB,CAAC;AACpC,iBAAA,CAAA;8BAEY,WAAW,EAAA,CAAA;sBAAnB,KAAK;gBAEO,OAAO,EAAA,CAAA;sBAAnB,KAAK;gBAIO,WAAW,EAAA,CAAA;sBAAvB,KAAK;gBAIO,iBAAiB,EAAA,CAAA;sBAA7B,KAAK;gBAIO,aAAa,EAAA,CAAA;sBAAzB,KAAK;gBAIO,SAAS,EAAA,CAAA;sBAArB,KAAK;gBAIO,eAAe,EAAA,CAAA;sBAA3B,KAAK;gBAIO,aAAa,EAAA,CAAA;sBAAzB,KAAK;gBAIO,eAAe,EAAA,CAAA;sBAA3B,KAAK;gBAIO,cAAc,EAAA,CAAA;sBAA1B,KAAK;gBAIO,MAAM,EAAA,CAAA;sBAAlB,KAAK;gBAIO,KAAK,EAAA,CAAA;sBAAjB,KAAK;;;AClGV;;AAEG;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './lib/effect';
2
+ export * from './lib/effect-composer';
@@ -0,0 +1,39 @@
1
+ import { InjectionToken, OnInit } from '@angular/core';
2
+ import { NgtRxStore } from 'angular-three';
3
+ import { DepthDownsamplingPass, EffectComposer, NormalPass } from 'postprocessing';
4
+ import * as THREE from 'three';
5
+ import * as i0 from "@angular/core";
6
+ export interface NgtpEffectComposerApi {
7
+ composer: EffectComposer;
8
+ normalPass: NormalPass | null;
9
+ depthPass: DepthDownsamplingPass | null;
10
+ scene: THREE.Scene;
11
+ camera: THREE.Camera;
12
+ resolutionScale?: number;
13
+ select: NgtpEffectComposer['select'];
14
+ get: NgtpEffectComposer['get'];
15
+ }
16
+ export declare const NGTP_EFFECT_COMPOSER_API: InjectionToken<NgtpEffectComposerApi>;
17
+ export declare class NgtpEffectComposer extends NgtRxStore implements OnInit {
18
+ composerRef: import("angular-three").NgtInjectedRef<THREE.Group>;
19
+ set enabled(enabled: boolean);
20
+ set depthBuffer(depthBuffer: boolean);
21
+ set disableNormalPass(disableNormalPass: boolean);
22
+ set stencilBuffer(stencilBuffer: boolean);
23
+ set autoClear(autoClear: boolean);
24
+ set resolutionScale(resolutionScale: number);
25
+ set multisampling(multisampling: number);
26
+ set frameBufferType(frameBufferType: THREE.TextureDataType);
27
+ set renderPriority(renderPriority: number);
28
+ set camera(camera: THREE.Camera);
29
+ set scene(scene: THREE.Scene);
30
+ initialize(): void;
31
+ private readonly store;
32
+ private readonly actions;
33
+ ngOnInit(): void;
34
+ private setComposerSize;
35
+ private setEffectPassed;
36
+ private setBeforeRender;
37
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgtpEffectComposer, never>;
38
+ static ɵcmp: i0.ɵɵComponentDeclaration<NgtpEffectComposer, "ngtp-effect-composer", never, { "composerRef": "composerRef"; "enabled": "enabled"; "depthBuffer": "depthBuffer"; "disableNormalPass": "disableNormalPass"; "stencilBuffer": "stencilBuffer"; "autoClear": "autoClear"; "resolutionScale": "resolutionScale"; "multisampling": "multisampling"; "frameBufferType": "frameBufferType"; "renderPriority": "renderPriority"; "camera": "camera"; "scene": "scene"; }, {}, never, ["*"], true, never>;
39
+ }
@@ -0,0 +1,22 @@
1
+ import { OnChanges, OnInit, SimpleChanges } from '@angular/core';
2
+ import { NgtAnyRecord, NgtRxStore, NgtStore } from 'angular-three';
3
+ import { BlendFunction, Effect } from 'postprocessing';
4
+ import { Observable } from 'rxjs';
5
+ import * as i0 from "@angular/core";
6
+ export declare abstract class NgtpEffect<T extends Effect> extends NgtRxStore implements OnInit, OnChanges {
7
+ set blendFunction(blendFunction: BlendFunction);
8
+ set opacity(opacity: number);
9
+ abstract get effectConstructor(): new (...args: any[]) => T;
10
+ protected defaultBlendMode: BlendFunction;
11
+ protected readonly store: NgtStore;
12
+ ngOnChanges(changes: SimpleChanges): void;
13
+ ngOnInit(): void;
14
+ private configureBlendMode;
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgtpEffect<any>, never>;
16
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgtpEffect<any>, never, never, { "blendFunction": "blendFunction"; "opacity": "opacity"; }, {}, never, never, false, never>;
17
+ }
18
+ export declare function simpleChangesToStateObject(changes: SimpleChanges, keysToDelete?: string[]): NgtAnyRecord;
19
+ export declare function componentInputsToCombinedStream(component: NgtRxStore, filterFn?: (input: {
20
+ propName: string;
21
+ templateName: string;
22
+ }) => boolean): Observable<NgtAnyRecord>;
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "angular-three-postprocessing",
3
+ "version": "1.0.0",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/angular-threejs/postprocessing"
10
+ },
11
+ "author": {
12
+ "name": "Chau Tran",
13
+ "email": "nartc7789@gmail.com",
14
+ "url": "https://nartc.me"
15
+ },
16
+ "description": "Postprocessing integration with Angular Three",
17
+ "keywords": [
18
+ "angular",
19
+ "threejs",
20
+ "renderer",
21
+ "postprocessing"
22
+ ],
23
+ "license": "MIT",
24
+ "peerDependencies": {
25
+ "@angular/common": "^15.1.0",
26
+ "@angular/core": "^15.1.0",
27
+ "postprocessing": "^6.0.0",
28
+ "angular-three": "1.2.2",
29
+ "rxjs": "7.8.0",
30
+ "@rx-angular/state": "1.7.0",
31
+ "three": "0.149.0",
32
+ "three-stdlib": "2.21.6"
33
+ },
34
+ "dependencies": {
35
+ "@nrwl/devkit": "^15.0.0",
36
+ "tslib": "^2.3.0"
37
+ },
38
+ "sideEffects": false,
39
+ "generators": "./plugin/generators.json",
40
+ "schematics": "./plugin/generators.json",
41
+ "module": "fesm2015/angular-three-postprocessing.mjs",
42
+ "es2020": "fesm2020/angular-three-postprocessing.mjs",
43
+ "esm2020": "esm2020/angular-three-postprocessing.mjs",
44
+ "fesm2020": "fesm2020/angular-three-postprocessing.mjs",
45
+ "fesm2015": "fesm2015/angular-three-postprocessing.mjs",
46
+ "typings": "index.d.ts",
47
+ "exports": {
48
+ "./package.json": {
49
+ "default": "./package.json"
50
+ },
51
+ ".": {
52
+ "types": "./index.d.ts",
53
+ "esm2020": "./esm2020/angular-three-postprocessing.mjs",
54
+ "es2020": "./fesm2020/angular-three-postprocessing.mjs",
55
+ "es2015": "./fesm2015/angular-three-postprocessing.mjs",
56
+ "node": "./fesm2015/angular-three-postprocessing.mjs",
57
+ "default": "./fesm2020/angular-three-postprocessing.mjs"
58
+ },
59
+ "./effects": {
60
+ "types": "./effects/index.d.ts",
61
+ "esm2020": "./esm2020/effects/angular-three-postprocessing-effects.mjs",
62
+ "es2020": "./fesm2020/angular-three-postprocessing-effects.mjs",
63
+ "es2015": "./fesm2015/angular-three-postprocessing-effects.mjs",
64
+ "node": "./fesm2015/angular-three-postprocessing-effects.mjs",
65
+ "default": "./fesm2020/angular-three-postprocessing-effects.mjs"
66
+ }
67
+ }
68
+ }
@@ -0,0 +1,11 @@
1
+ # plugin
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build plugin` to build the library.
8
+
9
+ ## Running unit tests
10
+
11
+ Run `nx test plugin` to execute the unit tests via [Jest](https://jestjs.io).
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "name": "angular-three-postprocessing-plugin",
4
+ "version": "0.0.1",
5
+ "generators": {
6
+ "init": {
7
+ "factory": "./src/generators/init/init",
8
+ "schema": "./src/generators/init/schema.json",
9
+ "description": "Init Angular Three Postprocessing"
10
+ }
11
+ },
12
+ "schematics": {
13
+ "ng-add": {
14
+ "factory": "./src/generators/init/compat",
15
+ "schema": "./src/generators/init/schema.json",
16
+ "description": "Add Angular Three Postprocessing"
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "type": "commonjs",
3
+ "peerDependencies": {
4
+ "nx": "15.6.3",
5
+ "tslib": "2.5.0"
6
+ },
7
+ "main": "./src/index.js",
8
+ "types": "./src/index.d.ts",
9
+ "version": "1.0.0"
10
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: (generatorOptions: any) => (tree: any, context: any) => Promise<any>;
2
+ export default _default;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nrwl/devkit");
4
+ const init_1 = require("./init");
5
+ exports.default = (0, devkit_1.convertNxGenerator)(init_1.default);
6
+ //# sourceMappingURL=compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compat.js","sourceRoot":"","sources":["../../../../../../../libs/plugin/src/generators/init/compat.ts"],"names":[],"mappings":";;AAAA,yCAAkD;AAClD,iCAA0B;AAE1B,kBAAe,IAAA,2BAAkB,EAAC,cAAI,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Tree } from '@nrwl/devkit';
2
+ export declare const ANGULAR_THREE_POSTPROCESSING_VERSION = "^1.0.0";
3
+ export declare const POSTPROCESSING_VERSION = "^6.0.0";
4
+ export default function (tree: Tree): Promise<() => void>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.POSTPROCESSING_VERSION = exports.ANGULAR_THREE_POSTPROCESSING_VERSION = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nrwl/devkit");
6
+ exports.ANGULAR_THREE_POSTPROCESSING_VERSION = '^1.0.0';
7
+ exports.POSTPROCESSING_VERSION = '^6.0.0';
8
+ function default_1(tree) {
9
+ var _a, _b;
10
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
+ devkit_1.logger.log('Initializing Angular Three Cannon...');
12
+ const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
13
+ const version = ((_a = packageJson['dependencies']) === null || _a === void 0 ? void 0 : _a['angular-three-postprocessing']) ||
14
+ ((_b = packageJson['devDependencies']) === null || _b === void 0 ? void 0 : _b['angular-three-postprocessing']) ||
15
+ exports.ANGULAR_THREE_POSTPROCESSING_VERSION;
16
+ (0, devkit_1.addDependenciesToPackageJson)(tree, {
17
+ 'angular-three-postprocessing': version,
18
+ postprocessing: exports.POSTPROCESSING_VERSION,
19
+ }, {});
20
+ return () => {
21
+ (0, devkit_1.installPackagesTask)(tree);
22
+ };
23
+ });
24
+ }
25
+ exports.default = default_1;
26
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../../libs/plugin/src/generators/init/init.ts"],"names":[],"mappings":";;;;AAAA,yCAAyG;AAE5F,QAAA,oCAAoC,GAAG,QAAQ,CAAC;AAChD,QAAA,sBAAsB,GAAG,QAAQ,CAAC;AAE/C,mBAA+B,IAAU;;;QACrC,eAAM,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;QAEnD,MAAM,WAAW,GAAG,IAAA,iBAAQ,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QAEnD,MAAM,OAAO,GACT,CAAA,MAAA,WAAW,CAAC,cAAc,CAAC,0CAAG,8BAA8B,CAAC;aAC7D,MAAA,WAAW,CAAC,iBAAiB,CAAC,0CAAG,8BAA8B,CAAC,CAAA;YAChE,4CAAoC,CAAC;QAEzC,IAAA,qCAA4B,EACxB,IAAI,EACJ;YACI,8BAA8B,EAAE,OAAO;YACvC,cAAc,EAAE,8BAAsB;SACzC,EACD,EAAE,CACL,CAAC;QAEF,OAAO,GAAG,EAAE;YACR,IAAA,4BAAmB,EAAC,IAAI,CAAC,CAAC;QAC9B,CAAC,CAAC;;CACL;AAtBD,4BAsBC"}
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "cli": "nx",
4
+ "$id": "Init",
5
+ "title": "Init Angular Three Postprocessing"
6
+ }
@@ -0,0 +1 @@
1
+ export { default as initGenerator } from './generators/init/init';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initGenerator = void 0;
4
+ var init_1 = require("./generators/init/init");
5
+ Object.defineProperty(exports, "initGenerator", { enumerable: true, get: function () { return init_1.default; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/plugin/src/index.ts"],"names":[],"mappings":";;;AAAA,+CAAkE;AAAzD,qGAAA,OAAO,OAAiB"}