-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jonathan Greenemeier
committed
Jan 20, 2021
1 parent
116e1a1
commit fd63390
Showing
4 changed files
with
29 additions
and
2 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
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,26 @@ | ||
<script> | ||
import { MeshStandardMaterial } from 'three'; | ||
import { setContext } from 'svelte'; | ||
import { writable } from 'svelte/store'; | ||
export let metalness = 0.8; | ||
export let roughness = 0.2; | ||
export let color = Math.random() * 0xffffff; | ||
const material = new MeshStandardMaterial({ | ||
metalness, | ||
roughness, | ||
color, | ||
...$$props, | ||
}); | ||
setContext('material', material); | ||
$: Object.entries($$props, ([key, val]) => { | ||
update((mat) => { | ||
mat[key] = val; | ||
return mat; | ||
}); | ||
}); | ||
</script> | ||
|
||
<slot /> |
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,3 @@ | ||
import StandardMaterial from './StandardMaterial.svelte'; | ||
|
||
export { StandardMaterial }; |
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