From e2d958fa2ed15f6141384ffa1704b1d179b84716 Mon Sep 17 00:00:00 2001 From: Cody Bennett Date: Thu, 16 Jan 2025 11:48:47 -0600 Subject: [PATCH] chore: cleanup --- README.md | 2 +- docs/introduction.mdx | 2 +- package.json | 12 +++++----- src/EffectComposer.tsx | 1 - src/Selection.tsx | 2 +- src/effects/GodRays.tsx | 1 - src/effects/Texture.tsx | 7 ++---- yarn.lock | 53 +++++++++++++++++++---------------------- 8 files changed, 35 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index c2626ff7..f5d78005 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ From > the screen diagonal. This is especially beneficial for GPGPU passes and > effects that use complex fragment shaders. -Postprocessing also supports srgb-encoding out of the box, as well as WebGL2 +Postprocessing also supports gamma correction out of the box, as well as WebGL2 MSAA (multi sample anti aliasing), which is react-postprocessing's default, you get high performance crisp results w/o jagged edges. diff --git a/docs/introduction.mdx b/docs/introduction.mdx index ebd58508..f19ef334 100644 --- a/docs/introduction.mdx +++ b/docs/introduction.mdx @@ -36,7 +36,7 @@ From > the screen diagonal. This is especially beneficial for GPGPU passes and > effects that use complex fragment shaders. -Postprocessing also supports srgb-encoding out of the box, as well as WebGL2 +Postprocessing also supports gamma correction out of the box, as well as WebGL2 MSAA (multi sample anti aliasing), which is react-postprocessing's default, you get high performance crisp results w/o jagged edges. diff --git a/package.json b/package.json index 59a8a303..1b29c12b 100644 --- a/package.json +++ b/package.json @@ -50,11 +50,11 @@ "maath": "^0.6.0", "n8ao": "^1.6.6", "postprocessing": "^6.32.1", - "three-stdlib": "^2.23.4" + "three-stdlib": "^2.35.7" }, "devDependencies": { "@react-three/drei": "^9.68.2", - "@react-three/fiber": "9.0.0-rc.2", + "@react-three/fiber": "9.0.0-rc.4", "@storybook/addon-essentials": "^7.0.10", "@storybook/addon-interactions": "^7.0.10", "@storybook/addon-links": "^7.0.10", @@ -64,7 +64,7 @@ "@storybook/testing-library": "^0.0.14-next.2", "@types/react": "^19.0.2", "@types/react-dom": "^19.0.2", - "@types/three": "^0.150.2", + "@types/three": "^0.156.0", "@typescript-eslint/eslint-plugin": "^5.59.1", "@typescript-eslint/parser": "^5.59.1", "eslint": "^8.39.0", @@ -83,14 +83,14 @@ "rimraf": "^5.0.0", "semantic-release": "^21.0.2", "storybook": "^7.0.10", - "three": "^0.151.3", + "three": "^0.156.0", "typescript": "^5.0.4", "vite": "^4.3.5", "vitest": "^2.1.8" }, "peerDependencies": { - "@react-three/fiber": ">=8.0", + "@react-three/fiber": "9.0.0-rc.4", "react": ">=19.0", - "three": ">= 0.138.0" + "three": ">= 0.156.0" } } diff --git a/src/EffectComposer.tsx b/src/EffectComposer.tsx index 9c676af9..ecebf60b 100644 --- a/src/EffectComposer.tsx +++ b/src/EffectComposer.tsx @@ -17,7 +17,6 @@ import { RenderPass, EffectPass, NormalPass, - // @ts-ignore DepthDownsamplingPass, Effect, Pass, diff --git a/src/Selection.tsx b/src/Selection.tsx index 16e6c941..f6c57a60 100644 --- a/src/Selection.tsx +++ b/src/Selection.tsx @@ -25,7 +25,7 @@ export function Select({ enabled = false, children, ...props }: SelectApi) { useEffect(() => { if (api && enabled) { let changed = false - const current: THREE.Object3D[] = [] + const current: THREE.Object3D[] = [] group.current.traverse((o) => { o.type === 'Mesh' && current.push(o) if (api.selected.indexOf(o) === -1) changed = true diff --git a/src/effects/GodRays.tsx b/src/effects/GodRays.tsx index 9eb1b701..c0cd3b83 100644 --- a/src/effects/GodRays.tsx +++ b/src/effects/GodRays.tsx @@ -11,7 +11,6 @@ type GodRaysProps = ConstructorParameters[2] & { export const GodRays = forwardRef(function GodRays(props: GodRaysProps, ref: Ref) { const { camera } = useContext(EffectComposerContext) const effect = useMemo(() => new GodRaysEffect(camera, resolveRef(props.sun), props), [camera, props]) - // @ts-ignore v6.30.2 https://github.com/pmndrs/postprocessing/pull/470/commits/091ef6f9516ca02efa7576305afbecf1ce8323ae useLayoutEffect(() => void (effect.lightSource = resolveRef(props.sun)), [effect, props.sun]) return }) diff --git a/src/effects/Texture.tsx b/src/effects/Texture.tsx index e9e06668..a45688a5 100644 --- a/src/effects/Texture.tsx +++ b/src/effects/Texture.tsx @@ -1,7 +1,7 @@ import { TextureEffect } from 'postprocessing' import { Ref, forwardRef, useMemo, useLayoutEffect } from 'react' import { useLoader } from '@react-three/fiber' -import { TextureLoader, RepeatWrapping } from 'three' +import { TextureLoader, SRGBColorSpace, RepeatWrapping } from 'three' type TextureProps = ConstructorParameters[0] & { textureSrc: string @@ -13,10 +13,7 @@ export const Texture = forwardRef(function Texture( ) { const t = useLoader(TextureLoader, textureSrc) useLayoutEffect(() => { - // @ts-ignore - if ('encoding' in t) t.encoding = 3001 // sRGBEncoding - // @ts-ignore - else t.colorSpace = 'srgb' + t.colorSpace = SRGBColorSpace t.wrapS = t.wrapT = RepeatWrapping }, [t]) const effect = useMemo(() => new TextureEffect({ ...props, texture: t || texture }), [props, t, texture]) diff --git a/yarn.lock b/yarn.lock index 1791eb60..22afd371 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1900,10 +1900,10 @@ utility-types "^3.10.0" zustand "^3.5.13" -"@react-three/fiber@9.0.0-rc.2": - version "9.0.0-rc.2" - resolved "https://registry.yarnpkg.com/@react-three/fiber/-/fiber-9.0.0-rc.2.tgz#adf834070cc51cbd379780dd34854e56d620aaff" - integrity sha512-rK2O51Z7ujYgd0U7vIEA0xyOI6B+eXE8tX02pPB7Zj/2uSwUhP8rwALBPsnC0WagILDwMTRCL5r2un+dCFD1Kw== +"@react-three/fiber@9.0.0-rc.4": + version "9.0.0-rc.4" + resolved "https://registry.yarnpkg.com/@react-three/fiber/-/fiber-9.0.0-rc.4.tgz#6abe769b7a4e2baa099381bd5a9494aa66118f24" + integrity sha512-J75gr7ZbBRjS1FaN3e0lLXk2Cw7NV8sURM2kKoJP8ZoO7pzi2hXMj5vrxrrgdKfnsEy8xXHQdbCe3xw7Tckk8A== dependencies: "@babel/runtime" "^7.17.8" "@types/debounce" "^1.2.1" @@ -3373,15 +3373,15 @@ resolved "https://registry.yarnpkg.com/@types/stats.js/-/stats.js-0.17.0.tgz#0ed81d48e03b590c24da85540c1d952077a9fe20" integrity sha512-9w+a7bR8PeB0dCT/HBULU2fMqf6BAzvKbxFboYhmDtDkKPiyXYbjoe2auwsXlEFI7CFNMF1dCv3dFH5Poy9R1w== -"@types/three@^0.150.2": - version "0.150.2" - resolved "https://registry.yarnpkg.com/@types/three/-/three-0.150.2.tgz#6f36b299a3d21416cc07342cc87accffbde32db4" - integrity sha512-cvcz/81Mmj4oiAA+uxzwaRK3t8lYw8WxejXKqIBfu6PqvwSAEEiCi3VfCiVY18UflBqL0LDX/za85+sfqjMoIw== +"@types/three@^0.156.0": + version "0.156.0" + resolved "https://registry.yarnpkg.com/@types/three/-/three-0.156.0.tgz#cd49f2a12e858400962ea818d1e1c45e638141a8" + integrity sha512-733bXDSRdlrxqOmQuOmfC1UBRuJ2pREPk8sWnx9MtIJEVDQMx8U0NQO5MVVaOrjzDPyLI+cFPim2X/ss9v0+LQ== dependencies: "@types/stats.js" "*" "@types/webxr" "*" - fflate "~0.6.9" - lil-gui "~0.17.0" + fflate "~0.6.10" + meshoptimizer "~0.18.1" "@types/unist@^2.0.0": version "2.0.6" @@ -5731,7 +5731,7 @@ fetch-retry@^5.0.2: resolved "https://registry.yarnpkg.com/fetch-retry/-/fetch-retry-5.0.5.tgz#61079b816b6651d88a022ebd45d51d83aa72b521" integrity sha512-q9SvpKH5Ka6h7X2C6r1sP31pQoeDb3o6/R9cg21ahfPAqbIOkW9tus1dXfwYb6G6dOI4F7nVS4Q+LSssBGIz0A== -fflate@^0.6.9, fflate@~0.6.9: +fflate@^0.6.9, fflate@~0.6.10: version "0.6.10" resolved "https://registry.yarnpkg.com/fflate/-/fflate-0.6.10.tgz#5f40f9659205936a2d18abf88b2e7781662b6d43" integrity sha512-IQrh3lEPM93wVCEczc9SaAOvkmcoQn/G8Bo1e8ZPlY3X3bnAxWaBdvTdvM1hP62iZp0BXWDy4vTAy4fF0+Dlpg== @@ -7299,11 +7299,6 @@ libnpmversion@^4.0.2: proc-log "^3.0.0" semver "^7.3.7" -lil-gui@~0.17.0: - version "0.17.0" - resolved "https://registry.yarnpkg.com/lil-gui/-/lil-gui-0.17.0.tgz#b41ae55d0023fcd9185f7395a218db0f58189663" - integrity sha512-MVBHmgY+uEbmJNApAaPbtvNh1RCAeMnKym82SBjtp5rODTYKWtM+MXHCifLe2H2Ti1HuBGBtK/5SyG4ShQ3pUQ== - lilconfig@2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.1.0.tgz#78e23ac89ebb7e1bfbf25b18043de756548e7f52" @@ -7702,6 +7697,11 @@ meshline@^3.1.6: resolved "https://registry.yarnpkg.com/meshline/-/meshline-3.1.6.tgz#eee67d9b0fd9841652cc1dc2d3833093ae8e68ca" integrity sha512-8JZJOdaL5oz3PI/upG8JvP/5FfzYUOhrkJ8np/WKvXzl0/PZ2V9pqTvCIjSKv+w9ccg2xb+yyBhXAwt6ier3ug== +meshoptimizer@~0.18.1: + version "0.18.1" + resolved "https://registry.yarnpkg.com/meshoptimizer/-/meshoptimizer-0.18.1.tgz#cdb90907f30a7b5b1190facd3b7ee6b7087797d8" + integrity sha512-ZhoIoL7TNV4s5B6+rx5mC//fw8/POGyNxS/DZyCJeiZ12ScLfVwRE/GfsxwiTkMYYD5DmK2/JXnEVXqL4rF+Sw== + methods@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" @@ -10288,27 +10288,22 @@ three-stdlib@^2.21.8: potpack "^1.0.1" zstddec "^0.0.2" -three-stdlib@^2.23.4: - version "2.23.4" - resolved "https://registry.yarnpkg.com/three-stdlib/-/three-stdlib-2.23.4.tgz#21e415573f9cddb8dbc2dea0495cc35d8d390b8b" - integrity sha512-bNtKL0UsE/TeSQ30tb9qDoGEuO6hqJfLFVqIiWlVpgAs2W/aZcpSISaLP3q+L4E9NSGmpRzI3dGufmDj0AnQ7Q== +three-stdlib@^2.35.7: + version "2.35.7" + resolved "https://registry.yarnpkg.com/three-stdlib/-/three-stdlib-2.35.7.tgz#13d345722d33328e2ffa820afadbf35a7b241c5b" + integrity sha512-k1oDqa1GYT4smhsN204DtmcQLfDuzSD4bbGmErTvUH40dpcwgBUgbwMzYYVWYB5tT7u0KBvAQpwuAPEXuwJVpQ== dependencies: "@types/draco3d" "^1.4.0" "@types/offscreencanvas" "^2019.6.4" "@types/webxr" "^0.5.2" - chevrotain "^10.1.2" draco3d "^1.4.1" fflate "^0.6.9" - ktx-parse "^0.4.5" - mmd-parser "^1.0.4" - opentype.js "^1.3.3" potpack "^1.0.1" - zstddec "^0.0.2" -three@^0.151.3: - version "0.151.3" - resolved "https://registry.yarnpkg.com/three/-/three-0.151.3.tgz#0b3c7de4b070d5b66b15217f42465d67cbfa6004" - integrity sha512-+vbuqxFy8kzLeO5MgpBHUvP/EAiecaDwDuOPPDe6SbrZr96kccF0ktLngXc7xA7bzyd3N0t2f6mw3Z9y6JCojQ== +three@^0.156.0: + version "0.156.1" + resolved "https://registry.yarnpkg.com/three/-/three-0.156.1.tgz#bab4fec121a5b3975eb4f4d227d9c912171eb399" + integrity sha512-kP7H0FK9d/k6t/XvQ9FO6i+QrePoDcNhwl0I02+wmUJRNSLCUIDMcfObnzQvxb37/0Uc9TDT0T1HgsRRrO6SYQ== through2@^2.0.3, through2@~2.0.0: version "2.0.5"