Skip to content

Commit

Permalink
fix(types): reference to three-mesh-bvh (#2014)
Browse files Browse the repository at this point in the history
  • Loading branch information
Methuselah96 authored Jul 7, 2024
1 parent 5953965 commit 88cb779
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
1 change: 0 additions & 1 deletion custom.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/core/Bvh.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ForwardRefComponent } from '../helpers/ts-utils'

export interface BVHOptions {
/** Split strategy, default: SAH (slowest to construct, fastest runtime, least memory) */
strategy?: typeof SplitStrategy
strategy?: SplitStrategy
/** Print out warnings encountered during tree construction, default: false */
verbose?: boolean
/** If true then the bounding box for the geometry is set once the BVH has been constructed, default: true */
Expand Down
4 changes: 1 addition & 3 deletions src/core/MeshRefractionMaterial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ export function MeshRefractionMaterial({
// Update the BVH
if (geometry) {
;(material.current as any).bvh = new MeshBVHUniformStruct()
;(material.current as any).bvh.updateFrom(
new MeshBVH(geometry.clone().toNonIndexed(), { lazyGeneration: false, strategy: SAH })
)
;(material.current as any).bvh.updateFrom(new MeshBVH(geometry.clone().toNonIndexed(), { strategy: SAH }))
}
}, [])

Expand Down
2 changes: 2 additions & 0 deletions src/core/shaderMaterial.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as THREE from 'three'
import { MeshBVHUniformStruct } from 'three-mesh-bvh'

export function shaderMaterial(
uniforms: {
Expand All @@ -14,6 +15,7 @@ export function shaderMaterial(
| THREE.Vector3
| THREE.Vector2
| THREE.Color
| MeshBVHUniformStruct
| number
| boolean
| Array<any>
Expand Down
4 changes: 4 additions & 0 deletions src/materials/MeshRefractionMaterial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { shaderMaterial } from '../core/shaderMaterial'
import { MeshBVHUniformStruct, shaderStructs, shaderIntersectFunction } from 'three-mesh-bvh'
import { version } from '../helpers/constants'

declare module 'three-mesh-bvh' {
const shaderIntersectFunction: string
}

export const MeshRefractionMaterial = /* @__PURE__ */ shaderMaterial(
{
envMap: null,
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
"noImplicitAny": false,
"noImplicitThis": false
},
"include": ["./src", "custom.d.ts"],
"include": ["./src"],
"exclude": ["./node_modules/**/*"]
}

0 comments on commit 88cb779

Please sign in to comment.