-
Notifications
You must be signed in to change notification settings - Fork 717
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [Feature] move stories to TS (#223) (#231) * feat: setup TS for stories * fix: eslint was ignore .storybook * feat: add TS to storybook * refactor: move stories to TS (WIP) * refactor: move more stories to TS (WIP) * refactor: src changes for TS move over I think these were TS problems that were missed. * fix: ContactShadows story * refactor: move more stories to TS * refactor: add MapControls.tsx after raising issues in three Two errors linked to three.js: mrdoob/three.js#21058 mrdoob/three.js#21059 * fix: TS errors for passing refs & children * refactor: add more stories (WIP) * fix: useContextBridge TS to accept array of children fixed using DefinitelyTyped/DefinitelyTyped#44572 (comment) because microsoft/TypeScript#14729 * refactor: convert more stories to TS also useGLTF does not need to declare it's type * chore: update storybook * fix: revert useTexture accidentally committed a WIP change * refactor: move stories to TS (WIP) * refactor: revert useGLTF story * Minor type fixes * chore: update react-three-fiber to latest Required for Types * refactor: move stories to TS * fix: shaderMaterial on init returns void, not null * refactor: remove unnecessary type in useFBX * refactor: type Environment stronger there was issues with useAsset not understanding it's types.... * Fixes CSB CI (#230) Co-authored-by: Gianmarco Simone <[email protected]> Co-authored-by: Josh <[email protected]> * 2.2.16 * chore: add templates (#232) * chore: add react-dom as optional peer depency if you're using react-native you don't need it. * docs: update readme * fix: fix storybook imports that should have been done before * BREAKING CHANGE: refactor internal to solve react-native imports my bad. Co-authored-by: Gianmarco <[email protected]> * 2.3.0-beta.0 * fix: edit transformOutputPath to remove .ts from files * 2.3.0-beta.1 * fix: useAnimations ref type & chore: add storybook entry for useAnimations * Added THREE.Group to useAnimations types * Small refactor * Added useAnimations story * Clean up storybook * Fix null ref typing on useAnimations * Forgot to change typing on useAnimations api * chore: add storybook entry to README Co-authored-by: Josh Ellis <[email protected]> * [fix] Blob is undefined when using SSR (#239) * fix: #233 Blob is undefined in SSR * refactor: it appears Billboard is fixed Looks like Typescript does not suck. * 2.3.0-beta.2 * fix: create polyfill for atob * 2.3.0-beta.3 * chore: update readme in response to #240 * fix: #242 Frustum has incorrect spelling in softshadows (#243) * fix: suggestion for fixing #242 * refactor: default should be other way round * chore: update readme with correct spelling * 2.3.0-beta.4 * feat: Add MeshoptDecoder support to useGLTF (#246) * Add MeshoptDecoder support to useGLTF * chore: move center Co-authored-by: Josh Ellis <[email protected]> * 2.3.0-beta.5 * feat: #181 – adding points to line (#247) * feat: re-create geometry on new points * refactor: useMemo the geometry instead of useEffect * 2.3.0-beta.6 * 3.0.0-beta.1 * 3.0.0-beta.2 * feat: update troika with new features (#255) * 3.0.0-beta.3 * feat: add ability to add custom scene as prop (#256) * feat: add ability to add custom scene as prop * docs: update Environment with new feats * 3.0.0-beta.4 * refactor: shuffle imports for beta * 3.0.0-beta.5 * docs: clearly specify name of package & old has been deprecated * BREAKING CHANGE: Upgrade Three.js to r125 (#262) * chore: update Three.js dependency * refactor: remove subdivision modifier * fix: remove use of FaceNormalsHelper as it no longer exists in Three * fix: update typings for THREE * fix: update modifiers to work without THREE.Geometry * docs: update README * chore: add Three.js peer dependency * fix: change install instructions to use yarn instead of npm (#265) * repurpose reflector, make it capable to blur (#260) * repurpose reflector, make it capable to blur * refactor: move materials out to reduce noise & fix types * refactor: merge beta * fix: add child propType * refactor: update reflector story & fix children type * changes * fix: shuffle types so reflectorProps come from what the material expects * docs Co-authored-by: Josh Ellis <[email protected]> * chore: add workflows to beta release * BREAKING CHANGE force build * 3.0.0-beta.6 Co-authored-by: Gianmarco Simone <[email protected]> Co-authored-by: Tanner Hartwig <[email protected]> Co-authored-by: Matt Rossman <[email protected]> Co-authored-by: Renaud Rohlinger <[email protected]> Co-authored-by: Jure Triglav <[email protected]> Co-authored-by: Jason Bixon <[email protected]> Co-authored-by: Paul Henschel <[email protected]>
- Loading branch information
1 parent
413bce8
commit 2c38242
Showing
85 changed files
with
819 additions
and
310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ name: release | |
on: | ||
push: | ||
branches: | ||
- 'master' | ||
- 'beta' | ||
- 'alpha' | ||
pull_request: {} | ||
|
@@ -27,7 +28,7 @@ jobs: | |
release: | ||
needs: main | ||
runs-on: ubuntu-latest | ||
if: ${{ github.repository == 'pmndrs/drei' && contains('refs/heads/beta,refs/heads/alpha',github.ref) && github.event_name == 'push' }} | ||
if: ${{ github.repository == 'pmndrs/drei' && contains('refs/heads/master,refs/heads/beta,refs/heads/alpha',github.ref) && github.event_name == 'push' }} | ||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import * as React from 'react' | ||
import { Vector3 } from 'three' | ||
import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader' | ||
import { withKnobs, select, number } from '@storybook/addon-knobs' | ||
|
||
import { Setup } from '../Setup' | ||
|
||
import { useAnimations, useGLTF, useMatcapTexture } from '../../src' | ||
|
||
export default { | ||
title: 'Abstractions/useAnimations', | ||
component: useAnimations, | ||
decorators: [(storyFn) => <Setup cameraPosition={new Vector3(0, 0, 3)}>{storyFn()}</Setup>, withKnobs], | ||
} | ||
|
||
type GLTFResult = GLTF & { | ||
nodes: { | ||
YB_Body: THREE.SkinnedMesh | ||
YB_Joints: THREE.SkinnedMesh | ||
mixamorigHips: THREE.Bone | ||
} | ||
materials: { | ||
YB_Body: THREE.MeshStandardMaterial | ||
YB_Joints: THREE.MeshStandardMaterial | ||
} | ||
} | ||
|
||
type AnimationControllerProps = { | ||
ybotRef: React.MutableRefObject<THREE.Group | undefined | null> | ||
animations: THREE.AnimationClip[] | ||
} | ||
|
||
function AnimationController(props: AnimationControllerProps) { | ||
const { actions } = useAnimations(props.animations, props.ybotRef) | ||
|
||
// Storybook Knobs | ||
const actionOptions = Object.keys(actions) | ||
const selectedAction = select('Animation', actionOptions, actionOptions[2]) | ||
const blendDuration = number('Blend duration', 0.5, { | ||
range: true, | ||
min: 0, | ||
max: 2, | ||
step: 0.1, | ||
}) | ||
|
||
React.useEffect(() => { | ||
actions[selectedAction].reset().fadeIn(blendDuration).play() | ||
return () => void actions[selectedAction].fadeOut(blendDuration) | ||
}, [actions, selectedAction, blendDuration]) | ||
|
||
return null | ||
} | ||
|
||
function YBotModel(props: JSX.IntrinsicElements['group']) { | ||
const ybotRef = React.useRef<THREE.Group>(null) | ||
const { nodes, animations } = useGLTF('ybot.glb') as GLTFResult | ||
const [matcapBody] = useMatcapTexture('293534_B2BFC5_738289_8A9AA7', 1024) | ||
const [matcapJoints] = useMatcapTexture('3A2412_A78B5F_705434_836C47', 1024) | ||
|
||
return ( | ||
<> | ||
<group ref={ybotRef} {...props} dispose={null}> | ||
<group rotation={[Math.PI / 2, 0, 0]} scale={[0.01, 0.01, 0.01]}> | ||
<primitive object={nodes.mixamorigHips} /> | ||
<skinnedMesh geometry={nodes.YB_Body.geometry} skeleton={nodes.YB_Body.skeleton}> | ||
<meshMatcapMaterial attach="material" matcap={matcapBody} skinning={true} /> | ||
</skinnedMesh> | ||
<skinnedMesh geometry={nodes.YB_Joints.geometry} skeleton={nodes.YB_Joints.skeleton}> | ||
<meshMatcapMaterial attach="material" matcap={matcapJoints} skinning={true} /> | ||
</skinnedMesh> | ||
</group> | ||
</group> | ||
|
||
<AnimationController ybotRef={ybotRef} animations={animations} /> | ||
</> | ||
) | ||
} | ||
|
||
useGLTF.preload('ybot.glb') | ||
|
||
function UseAnimationsScene() { | ||
return ( | ||
<React.Suspense fallback={null}> | ||
<YBotModel position={[0, -1, 0]} /> | ||
</React.Suspense> | ||
) | ||
} | ||
|
||
export const UseAnimationsSt = () => <UseAnimationsScene /> | ||
UseAnimationsSt.storyName = 'Default' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
2c38242
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: