From 49a0c1fef2cf3b11bbb642a089f9f09e521b8339 Mon Sep 17 00:00:00 2001 From: Kevin Levron Date: Mon, 26 Apr 2021 19:54:56 +0200 Subject: [PATCH] fix props ts --- src/effects/BokehPass.ts | 2 +- src/effects/FilmPass.ts | 2 +- src/effects/HalftonePass.ts | 2 +- src/effects/TiltShiftPass.ts | 2 +- src/effects/UnrealBloomPass.ts | 2 +- src/materials/StandardMaterial.ts | 4 ++-- src/materials/SubSurfaceMaterial.ts | 8 ++++---- src/meshes/Text.ts | 6 +++--- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/effects/BokehPass.ts b/src/effects/BokehPass.ts index ecd101b..ac6a1de 100644 --- a/src/effects/BokehPass.ts +++ b/src/effects/BokehPass.ts @@ -6,7 +6,7 @@ const props = { focus: { type: Number, default: 1 }, aperture: { type: Number, default: 0.025 }, maxblur: { type: Number, default: 0.01 }, -} +} as const export default defineComponent({ extends: EffectPass, diff --git a/src/effects/FilmPass.ts b/src/effects/FilmPass.ts index db21081..0c1c0d4 100644 --- a/src/effects/FilmPass.ts +++ b/src/effects/FilmPass.ts @@ -7,7 +7,7 @@ const props = { scanlinesIntensity: { type: Number, default: 0.05 }, scanlinesCount: { type: Number, default: 4096 }, grayscale: { type: Number, default: 0 }, -} +} as const export default defineComponent({ extends: EffectPass, diff --git a/src/effects/HalftonePass.ts b/src/effects/HalftonePass.ts index 00a1f6a..3c8050e 100644 --- a/src/effects/HalftonePass.ts +++ b/src/effects/HalftonePass.ts @@ -9,7 +9,7 @@ const props = { rotateG: { type: Number, default: Math.PI / 12 * 2 }, rotateB: { type: Number, default: Math.PI / 12 * 3 }, scatter: { type: Number, default: 0 }, -} +} as const export default defineComponent({ extends: EffectPass, diff --git a/src/effects/TiltShiftPass.ts b/src/effects/TiltShiftPass.ts index 5e38226..9dcafde 100644 --- a/src/effects/TiltShiftPass.ts +++ b/src/effects/TiltShiftPass.ts @@ -11,7 +11,7 @@ const props = { gradientRadius: { type: Number, default: 100 }, start: { type: Object as PropType, default: () => ({ x: 0, y: 100 }) }, end: { type: Object as PropType, default: () => ({ x: 10, y: 100 }) }, -} +} as const interface TiltShiftPassSetupInterface { uniforms1: {[name: string]: { value: any }} diff --git a/src/effects/UnrealBloomPass.ts b/src/effects/UnrealBloomPass.ts index 5e0d0c3..d6c16f3 100644 --- a/src/effects/UnrealBloomPass.ts +++ b/src/effects/UnrealBloomPass.ts @@ -7,7 +7,7 @@ const props = { strength: { type: Number, default: 1.5 }, radius: { type: Number, default: 0 }, threshold: { type: Number, default: 0 }, -} +} as const export default defineComponent({ extends: EffectPass, diff --git a/src/materials/StandardMaterial.ts b/src/materials/StandardMaterial.ts index 0a628ac..5b33cfe 100644 --- a/src/materials/StandardMaterial.ts +++ b/src/materials/StandardMaterial.ts @@ -9,7 +9,7 @@ const props = { bumpScale: { type: Number, default: 1 }, displacementBias: { type: Number, default: 0 }, displacementScale: { type: Number, default: 1 }, - emissive: { type: [Number, String], default: 0 }, + emissive: { type: [String, Number] as PropType, default: 0 }, emissiveIntensity: { type: Number, default: 1 }, envMapIntensity: { type: Number, default: 1 }, lightMapIntensity: { type: Number, default: 1 }, @@ -18,7 +18,7 @@ const props = { roughness: { type: Number, default: 1 }, refractionRatio: { type: Number, default: 0.98 }, flatShading: Boolean, -} +} as const export default defineComponent({ extends: Material, diff --git a/src/materials/SubSurfaceMaterial.ts b/src/materials/SubSurfaceMaterial.ts index c6eb7cf..7ae05bc 100644 --- a/src/materials/SubSurfaceMaterial.ts +++ b/src/materials/SubSurfaceMaterial.ts @@ -1,18 +1,18 @@ -import { defineComponent } from 'vue' +import { defineComponent, PropType } from 'vue' import { Color, ShaderMaterial, UniformsUtils } from 'three' import SubsurfaceScatteringShader from './SubsurfaceScatteringShader' import Material from './Material' // import { bindProps, propsValues } from '../tools' const props = { - color: { type: [String, Number], default: '#ffffff' }, - thicknessColor: { type: [String, Number], default: '#ffffff' }, + color: { type: [String, Number] as PropType, default: '#ffffff' }, + thicknessColor: { type: [String, Number] as PropType, default: '#ffffff' }, thicknessDistortion: { type: Number, default: 0.4 }, thicknessAmbient: { type: Number, default: 0.01 }, thicknessAttenuation: { type: Number, default: 0.7 }, thicknessPower: { type: Number, default: 2 }, thicknessScale: { type: Number, default: 4 }, -} +} as const export default defineComponent({ extends: Material, diff --git a/src/meshes/Text.ts b/src/meshes/Text.ts index 8b3cc77..60dedc4 100644 --- a/src/meshes/Text.ts +++ b/src/meshes/Text.ts @@ -1,4 +1,4 @@ -import { defineComponent, watch } from 'vue' +import { defineComponent, PropType, watch } from 'vue' import { Font, FontLoader, TextGeometry } from 'three' import Mesh, { MeshSetupInterface } from './Mesh' @@ -19,8 +19,8 @@ const props = { bevelSize: { type: Number, default: 8 }, bevelOffset: { type: Number, default: 0 }, bevelSegments: { type: Number, default: 5 }, - align: { type: [Boolean, String], default: false }, -} + align: { type: [Boolean, String] as PropType, default: false }, +} as const export default defineComponent({ extends: Mesh,