Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pmndrs/drei
Browse files Browse the repository at this point in the history
  • Loading branch information
drcmda committed Jan 18, 2024
2 parents 4d741a2 + 71b7757 commit e33a2e8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .storybook/stories/useBVH.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react'

import { Setup } from '../Setup'
import { MeshBVHVisualizer } from 'three-mesh-bvh'
import { MeshBVHHelper } from 'three-mesh-bvh'

import { useHelper, useBVH, TorusKnot, OrbitControls } from '../../src'
import { useFrame, useThree } from '@react-three/fiber'
Expand All @@ -24,7 +24,7 @@ function TorusBVH({ bvh, ...props }) {
})
const debug = boolean('vizualize bounds', true)

useHelper(debug ? mesh : dummy, MeshBVHVisualizer)
useHelper(debug ? mesh : dummy, MeshBVHHelper)

const [hovered, setHover] = React.useState(false)
return (
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
"stats-gl": "^2.0.0",
"stats.js": "^0.17.0",
"suspend-react": "^0.1.3",
"three-mesh-bvh": "^0.6.7",
"three-stdlib": "^2.28.0",
"three-mesh-bvh": "^0.7.0",
"three-stdlib": "^2.29.4",
"troika-three-text": "^0.47.2",
"tunnel-rat": "^0.1.2",
"utility-types": "^3.10.0",
Expand Down
8 changes: 5 additions & 3 deletions src/core/Line.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ForwardRefComponent } from '../helpers/ts-utils'

export type LineProps = {
points: Array<Vector3 | Vector2 | [number, number, number] | [number, number] | number>
vertexColors?: Array<Color | [number, number, number]>
vertexColors?: Array<Color | [number, number, number] | [number, number, number, number]>
lineWidth?: number
segments?: boolean
} & Omit<LineMaterialParameters, 'vertexColors' | 'color'> &
Expand All @@ -29,6 +29,7 @@ export const Line: ForwardRefComponent<LineProps, Line2 | LineSegments2> = /* @_
const size = useThree((state) => state.size)
const line2 = React.useMemo(() => (segments ? new LineSegments2() : new Line2()), [segments])
const [lineMaterial] = React.useState(() => new LineMaterial())
const itemSize = (vertexColors?.[0] as number[] | undefined)?.length === 4 ? 4 : 3
const lineGeom = React.useMemo(() => {
const geom = segments ? new LineSegmentsGeometry() : new LineGeometry()
const pValues = points.map((p) => {
Expand All @@ -48,11 +49,11 @@ export const Line: ForwardRefComponent<LineProps, Line2 | LineSegments2> = /* @_

if (vertexColors) {
const cValues = vertexColors.map((c) => (c instanceof Color ? c.toArray() : c))
geom.setColors(cValues.flat())
geom.setColors(cValues.flat(), itemSize)
}

return geom
}, [points, segments, vertexColors])
}, [points, segments, vertexColors, itemSize])

React.useLayoutEffect(() => {
line2.computeLineDistances()
Expand Down Expand Up @@ -83,6 +84,7 @@ export const Line: ForwardRefComponent<LineProps, Line2 | LineSegments2> = /* @_
resolution={[size.width, size.height]}
linewidth={linewidth ?? lineWidth}
dashed={dashed}
transparent={itemSize === 4}
{...rest}
/>
</primitive>
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13037,15 +13037,15 @@ text-table@^0.2.0, text-table@~0.2.0:
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==

three-mesh-bvh@^0.6.7:
version "0.6.7"
resolved "https://registry.yarnpkg.com/three-mesh-bvh/-/three-mesh-bvh-0.6.7.tgz#6491876f5bf0c0d67be81a4402f2abdbb2266d76"
integrity sha512-RYdjMsH+vZvjLwA+ehI4+ZqTaTehAz4iho2yfL5PdGsIHyxpB78g0iy4Emj8079m/9KBX02TzddkvPSKSruQjg==

three-stdlib@^2.28.0:
version "2.28.5"
resolved "https://registry.yarnpkg.com/three-stdlib/-/three-stdlib-2.28.5.tgz#8184f5bacc90c2eec6ed36a861224e18799226fd"
integrity sha512-JdLMhkpT+1ZWeQPyKQNW1zqUwISI2hsUljS6u3vB9lp5EvwsayaAzGnbVeR35895udOF+zxcTiQY3psk+qqlxg==
three-mesh-bvh@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/three-mesh-bvh/-/three-mesh-bvh-0.7.0.tgz#8327c3483060bb7fe3e0151d7863d338095527d4"
integrity sha512-Hj0Z1Rp02yy5H+/xtMBu/dYAeRsSONaBaVLZoST9sMpZxycHypRiUeMHucPOLWFHnpc5hwelOnONcLpkfhDg0Q==

three-stdlib@^2.29.4:
version "2.29.4"
resolved "https://registry.yarnpkg.com/three-stdlib/-/three-stdlib-2.29.4.tgz#6e8741f6a2d435d15ed73f3a14dd149660d4ce51"
integrity sha512-XNzGCrz/uAk9XoLwd35eN7dQyI4ggXZTeqjcN034YdYBpBlNO9kmLHehl/0Nw9jCelblB7jla+unHAOIyLyV6Q==
dependencies:
"@types/draco3d" "^1.4.0"
"@types/offscreencanvas" "^2019.6.4"
Expand Down

1 comment on commit e33a2e8

@vercel
Copy link

@vercel vercel bot commented on e33a2e8 Jan 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.