UNPKG

mylingo3d

Version:

Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor

18 lines (15 loc) 665 B
import { createEffect } from "@lincode/reactivity" import { ShaderPass } from "three/examples/jsm/postprocessing/ShaderPass" import { FXAAShader } from "three/examples/jsm/shaders/FXAAShader" import { getPixelRatio } from "../../../states/usePixelRatio" import { getResolution } from "../../../states/useResolution" const fxaaPass = new ShaderPass(FXAAShader) export default fxaaPass createEffect(() => { const [w, h] = getResolution() const pixelRatio = Math.min(getPixelRatio(), devicePixelRatio) fxaaPass.material.uniforms["resolution"].value.set( 1 / (w * pixelRatio), 1 / (h * pixelRatio) ) }, [getPixelRatio, getResolution])