Skip to content

Commit afe0515

Browse files
fix(types): remove use of ambient three (#320)
1 parent dd0f276 commit afe0515

File tree

4 files changed

+10
-50
lines changed

4 files changed

+10
-50
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
"dependencies": {
3535
"maath": "^0.6.0",
3636
"n8ao": "^1.9.4",
37-
"postprocessing": "^6.36.6",
38-
"three-stdlib": "^2.35.7"
37+
"postprocessing": "^6.36.6"
3938
},
4039
"devDependencies": {
4140
"@react-three/fiber": "9.0.0-rc.4",

src/EffectComposer.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { TextureDataType, Group } from 'three'
1+
import type { TextureDataType, Group, Camera, Scene } from 'three'
22
import { HalfFloatType, NoToneMapping } from 'three'
33
import {
44
type JSX,
@@ -22,14 +22,13 @@ import {
2222
Pass,
2323
EffectAttribute,
2424
} from 'postprocessing'
25-
import { isWebGL2Available } from 'three-stdlib'
2625

2726
export const EffectComposerContext = /* @__PURE__ */ createContext<{
2827
composer: EffectComposerImpl
2928
normalPass: NormalPass | null
3029
downSamplingPass: DepthDownsamplingPass | null
31-
camera: THREE.Camera
32-
scene: THREE.Scene
30+
camera: Camera
31+
scene: Scene
3332
resolutionScale?: number
3433
}>(null!)
3534

@@ -45,8 +44,8 @@ export type EffectComposerProps = {
4544
multisampling?: number
4645
frameBufferType?: TextureDataType
4746
renderPriority?: number
48-
camera?: THREE.Camera
49-
scene?: THREE.Scene
47+
camera?: Camera
48+
scene?: Scene
5049
}
5150

5251
const isConvolution = (effect: Effect): boolean =>
@@ -76,12 +75,11 @@ export const EffectComposer = /* @__PURE__ */ memo(
7675
const camera = _camera || defaultCamera
7776

7877
const [composer, normalPass, downSamplingPass] = useMemo(() => {
79-
const webGL2Available = isWebGL2Available()
8078
// Initialize composer
8179
const effectComposer = new EffectComposerImpl(gl, {
8280
depthBuffer,
8381
stencilBuffer,
84-
multisampling: multisampling > 0 && webGL2Available ? multisampling : 0,
82+
multisampling,
8583
frameBufferType,
8684
})
8785

@@ -95,7 +93,7 @@ export const EffectComposer = /* @__PURE__ */ memo(
9593
normalPass = new NormalPass(scene, camera)
9694
normalPass.enabled = false
9795
effectComposer.addPass(normalPass)
98-
if (resolutionScale !== undefined && webGL2Available) {
96+
if (resolutionScale !== undefined) {
9997
downSamplingPass = new DepthDownsamplingPass({ normalBuffer: normalPass.texture, resolutionScale })
10098
downSamplingPass.enabled = false
10199
effectComposer.addPass(downSamplingPass)

src/effects/ASCII.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class ASCIIEffect extends Effect {
8282
}
8383

8484
/** Draws the characters on a Canvas and returns a texture */
85-
public createCharactersTexture(characters: string, font: string, fontSize: number): THREE.Texture {
85+
public createCharactersTexture(characters: string, font: string, fontSize: number): Texture {
8686
const canvas = document.createElement('canvas')
8787
const SIZE = 1024
8888
const MAX_PER_ROW = 16

yarn.lock

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -865,11 +865,6 @@
865865
resolved "https://registry.yarnpkg.com/@types/debounce/-/debounce-1.2.4.tgz#cb7e85d9ad5ababfac2f27183e8ac8b576b2abb3"
866866
integrity sha512-jBqiORIzKDOToaF63Fm//haOCHuwQuLa2202RK4MozpA6lh93eCBc+/8+wZn5OzjJt3ySdc+74SXWXB55Ewtyw==
867867

868-
"@types/draco3d@^1.4.0":
869-
version "1.4.2"
870-
resolved "https://registry.yarnpkg.com/@types/draco3d/-/draco3d-1.4.2.tgz#7faccb809db2a5e19b9efb97c5f2eb9d64d527ea"
871-
integrity sha512-goh23EGr6CLV6aKPwN1p8kBD/7tT5V/bLpToSbarKrwVejqNrspVrv8DhliteYkkhZYrlq/fwKZRRUzH4XN88w==
872-
873868
"@types/estree@1.0.6", "@types/estree@^1.0.0":
874869
version "1.0.6"
875870
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.6.tgz#628effeeae2064a1b4e79f78e81d87b7e5fc7b50"
@@ -902,11 +897,6 @@
902897
resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz#d3357479a0fdfdd5907fe67e17e0a85c906e1301"
903898
integrity sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==
904899

905-
"@types/offscreencanvas@^2019.6.4":
906-
version "2019.7.0"
907-
resolved "https://registry.yarnpkg.com/@types/offscreencanvas/-/offscreencanvas-2019.7.0.tgz#e4a932069db47bb3eabeb0b305502d01586fa90d"
908-
integrity sha512-PGcyveRIpL1XIqK8eBsmRBt76eFgtzuPiSTyKHZxnGemp2yzGzWpjYKAfK3wIMiU7eH+851yEpiuP8JZerTmWg==
909-
910900
"@types/prop-types@*":
911901
version "15.7.5"
912902
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.5.tgz#5f19d2b85a98e9558036f6a3cacc8819420f05cf"
@@ -980,11 +970,6 @@
980970
resolved "https://registry.yarnpkg.com/@types/webxr/-/webxr-0.5.1.tgz#4908349419104bd476a4252d04e4c3abb496748d"
981971
integrity sha512-xlFXPfgJR5vIuDefhaHuUM9uUgvPaXB6GKdXy2gdEh8gBWQZ2ul24AJz3foUd8NNKlSTQuWYJpCb1/pL81m1KQ==
982972

983-
"@types/webxr@^0.5.2":
984-
version "0.5.2"
985-
resolved "https://registry.yarnpkg.com/@types/webxr/-/webxr-0.5.2.tgz#5d9627b0ffe223aa3b166de7112ac8a9460dc54f"
986-
integrity sha512-szL74BnIcok9m7QwYtVmQ+EdIKwbjPANudfuvDrAF8Cljg9MKUlIoc1w5tjj9PMpeSH3U1Xnx//czQybJ0EfSw==
987-
988973
"@typescript-eslint/eslint-plugin@^5.59.1":
989974
version "5.59.1"
990975
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.1.tgz#9b09ee1541bff1d2cebdcb87e7ce4a4003acde08"
@@ -1887,11 +1872,6 @@ dot-prop@^5.1.0:
18871872
dependencies:
18881873
is-obj "^2.0.0"
18891874

1890-
draco3d@^1.4.1:
1891-
version "1.5.6"
1892-
resolved "https://registry.yarnpkg.com/draco3d/-/draco3d-1.5.6.tgz#0d570a9792e3a3a9fafbfea065b692940441c626"
1893-
integrity sha512-+3NaRjWktb5r61ZFoDejlykPEFKT5N/LkbXsaddlw6xNSXBanUYpFc2AXXpbJDilPHazcSreU/DpQIaxfX0NfQ==
1894-
18951875
duplexer2@~0.1.0:
18961876
version "0.1.4"
18971877
resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1"
@@ -2353,7 +2333,7 @@ fastq@^1.6.0:
23532333
dependencies:
23542334
reusify "^1.0.4"
23552335

2356-
fflate@^0.6.9, fflate@~0.6.10:
2336+
fflate@~0.6.10:
23572337
version "0.6.10"
23582338
resolved "https://registry.yarnpkg.com/fflate/-/fflate-0.6.10.tgz#5f40f9659205936a2d18abf88b2e7781662b6d43"
23592339
integrity sha512-IQrh3lEPM93wVCEczc9SaAOvkmcoQn/G8Bo1e8ZPlY3X3bnAxWaBdvTdvM1hP62iZp0BXWDy4vTAy4fF0+Dlpg==
@@ -4465,11 +4445,6 @@ postprocessing@^6.36.6:
44654445
resolved "https://registry.yarnpkg.com/postprocessing/-/postprocessing-6.36.6.tgz#5717ee9f0af43c872e620366a181efc4b6950edd"
44664446
integrity sha512-mjJjoXbC97XMV6iQVhOZYNjD5X93o3+/zpYm9oRmsyjP3LjfwedT8PgusECTk+s5DZeZoJ8vA9htdWuH8JH+mQ==
44674447

4468-
potpack@^1.0.1:
4469-
version "1.0.2"
4470-
resolved "https://registry.yarnpkg.com/potpack/-/potpack-1.0.2.tgz#23b99e64eb74f5741ffe7656b5b5c4ddce8dfc14"
4471-
integrity sha512-choctRBIV9EMT9WGAZHn3V7t0Z2pMQyl0EZE6pFc/6ml3ssw7Dlf/oAOvFwjm1HVsqfQN8GfeFyJ+d8tRzqueQ==
4472-
44734448
prelude-ls@^1.2.1:
44744449
version "1.2.1"
44754450
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
@@ -5311,18 +5286,6 @@ text-table@^0.2.0, text-table@~0.2.0:
53115286
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
53125287
integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==
53135288

5314-
three-stdlib@^2.35.7:
5315-
version "2.35.7"
5316-
resolved "https://registry.yarnpkg.com/three-stdlib/-/three-stdlib-2.35.7.tgz#13d345722d33328e2ffa820afadbf35a7b241c5b"
5317-
integrity sha512-k1oDqa1GYT4smhsN204DtmcQLfDuzSD4bbGmErTvUH40dpcwgBUgbwMzYYVWYB5tT7u0KBvAQpwuAPEXuwJVpQ==
5318-
dependencies:
5319-
"@types/draco3d" "^1.4.0"
5320-
"@types/offscreencanvas" "^2019.6.4"
5321-
"@types/webxr" "^0.5.2"
5322-
draco3d "^1.4.1"
5323-
fflate "^0.6.9"
5324-
potpack "^1.0.1"
5325-
53265289
three@^0.156.0:
53275290
version "0.156.1"
53285291
resolved "https://registry.yarnpkg.com/three/-/three-0.156.1.tgz#bab4fec121a5b3975eb4f4d227d9c912171eb399"

0 commit comments

Comments
 (0)