mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
fix import
This commit is contained in:
parent
4900a69c30
commit
567a8982bc
@ -1,6 +1,6 @@
|
|||||||
import { defineComponent, inject, onMounted, onUnmounted } from 'vue'
|
import { defineComponent, inject, onMounted, onUnmounted } from 'vue'
|
||||||
import { LoadingManager } from 'three'
|
import { LoadingManager } from 'three'
|
||||||
import * as PP from 'postprocessing'
|
import { BloomEffect, DepthOfFieldEffect, EdgeDetectionMode, GodRaysEffect, SMAAEffect, SMAAImageLoader, SMAAPreset } from 'postprocessing'
|
||||||
import { EffectPassInjectionKey } from './EffectPass'
|
import { EffectPassInjectionKey } from './EffectPass'
|
||||||
|
|
||||||
// type EffectTypes = 'bloom' | 'dof' | 'godrays' | 'smaa'
|
// type EffectTypes = 'bloom' | 'dof' | 'godrays' | 'smaa'
|
||||||
@ -33,7 +33,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (props.type === 'smaa') {
|
if (props.type === 'smaa') {
|
||||||
const smaaImageLoader = new PP.SMAAImageLoader(new LoadingManager())
|
const smaaImageLoader = new SMAAImageLoader(new LoadingManager())
|
||||||
smaaImageLoader.load(([search, area]) => {
|
smaaImageLoader.load(([search, area]) => {
|
||||||
initEffect({ smaaSearch: search, smaaArea: area })
|
initEffect({ smaaSearch: search, smaaArea: area })
|
||||||
})
|
})
|
||||||
@ -56,10 +56,10 @@ function createEffect(effectPass, type, options, assets) {
|
|||||||
let effect
|
let effect
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'bloom' :
|
case 'bloom' :
|
||||||
effect = new PP.BloomEffect(options)
|
effect = new BloomEffect(options)
|
||||||
break
|
break
|
||||||
case 'dof' :
|
case 'dof' :
|
||||||
effect = new PP.DepthOfFieldEffect(effectPass.composer.renderer, options)
|
effect = new DepthOfFieldEffect(effectPass.composer.renderer, options)
|
||||||
break
|
break
|
||||||
case 'godrays' :
|
case 'godrays' :
|
||||||
effect = createGodraysEffect(effectPass, options)
|
effect = createGodraysEffect(effectPass, options)
|
||||||
@ -73,8 +73,8 @@ function createEffect(effectPass, type, options, assets) {
|
|||||||
|
|
||||||
function createSmaaEffect(options, assets) {
|
function createSmaaEffect(options, assets) {
|
||||||
const { smaaSearch, smaaArea } = assets
|
const { smaaSearch, smaaArea } = assets
|
||||||
const params = [options.preset ?? PP.SMAAPreset.HIGH, options.edgeDetectionMode ?? PP.EdgeDetectionMode.COLOR]
|
const params = [options.preset ?? SMAAPreset.HIGH, options.edgeDetectionMode ?? EdgeDetectionMode.COLOR]
|
||||||
return new PP.SMAAEffect(smaaSearch, smaaArea, ...params)
|
return new SMAAEffect(smaaSearch, smaaArea, ...params)
|
||||||
}
|
}
|
||||||
|
|
||||||
function createGodraysEffect(effectPass, options) {
|
function createGodraysEffect(effectPass, options) {
|
||||||
@ -92,5 +92,5 @@ function createGodraysEffect(effectPass, options) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
return new PP.GodRaysEffect(effectPass.composer.renderer.camera, lightSourceComp.mesh, opts)
|
return new GodRaysEffect(effectPass.composer.renderer.camera, lightSourceComp.mesh, opts)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user