Skip to content
This repository has been archived by the owner on Feb 10, 2023. It is now read-only.

Commit

Permalink
fix(postprocessing): use NumberInput
Browse files Browse the repository at this point in the history
  • Loading branch information
nartc committed Apr 18, 2022
1 parent cd82c60 commit c443bc9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { AnyConstructor, NgtVector3, UnknownRecord } from '@angular-three/core';
import {
AnyConstructor,
coerceNumberProperty,
NgtVector3,
NumberInput,
UnknownRecord,
} from '@angular-three/core';
import {
NgtCommonEffect,
provideCommonEffectRef,
Expand Down Expand Up @@ -39,8 +45,8 @@ export class NgtDepthOfField extends NgtCommonEffect<DepthOfFieldEffect> {
this.set({ depthTexture });
}

@Input() set blur(blur: number) {
this.set({ blur });
@Input() set blur(blur: NumberInput) {
this.set({ blur: coerceNumberProperty(blur) });
}

private readonly targetParams$ = this.select(
Expand Down
14 changes: 8 additions & 6 deletions libs/postprocessing/src/lib/effect-composer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import {
AnyFunction,
BooleanInput,
coerceBooleanProperty,
coerceNumberProperty,
NGT_INSTANCE_HOST_REF,
NGT_INSTANCE_REF,
NGT_IS_WEBGL_AVAILABLE,
NgtInstance,
NgtInstanceState,
NgtRef,
NgtStore,
NumberInput,
provideInstanceRef,
startWithUndefined,
tapEffect,
Expand Down Expand Up @@ -84,20 +86,20 @@ export class NgtEffectComposer extends NgtInstance<
this.set({ autoClear: coerceBooleanProperty(autoClear) });
}

@Input() set resolutionScale(resolutionScale: number) {
this.set({ resolutionScale });
@Input() set resolutionScale(resolutionScale: NumberInput) {
this.set({ resolutionScale: coerceNumberProperty(resolutionScale) });
}

@Input() set multisampling(multisampling: number) {
this.set({ multisampling });
@Input() set multisampling(multisampling: NumberInput) {
this.set({ multisampling: coerceNumberProperty(multisampling) });
}

@Input() set frameBufferType(frameBufferType: THREE.TextureDataType) {
this.set({ frameBufferType });
}

@Input() set renderPriority(renderPriority: number) {
this.set({ renderPriority });
@Input() set renderPriority(renderPriority: NumberInput) {
this.set({ renderPriority: coerceNumberProperty(renderPriority) });
}

@Input() set camera(camera: THREE.Camera) {
Expand Down
6 changes: 4 additions & 2 deletions libs/postprocessing/src/lib/effect.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import {
AnyConstructor,
AnyFunction,
coerceNumberProperty,
NGT_INSTANCE_HOST_REF,
NGT_INSTANCE_REF,
NgtInstance,
NgtInstanceState,
NgtRef,
NgtStore,
NumberInput,
provideInstanceRef,
startWithUndefined,
tapEffect,
Expand Down Expand Up @@ -54,8 +56,8 @@ export interface NgtCommonEffectState<TEffect extends Effect = Effect>
export abstract class NgtCommonEffect<
TEffect extends Effect = Effect
> extends NgtInstance<TEffect, NgtCommonEffectState<TEffect>> {
@Input() set opacity(opacity: number) {
this.set({ opacity });
@Input() set opacity(opacity: NumberInput) {
this.set({ opacity: coerceNumberProperty(opacity) });
}

@Input() set blendFunction(blendFunction: BlendFunction) {
Expand Down

0 comments on commit c443bc9

Please sign in to comment.