diff --git a/src/components/map/MapDice.js b/src/components/map/MapDice.js index fc64c04..2798c35 100644 --- a/src/components/map/MapDice.js +++ b/src/components/map/MapDice.js @@ -5,7 +5,7 @@ import ExpandMoreDiceIcon from "../../icons/ExpandMoreDiceIcon"; import DiceTray from "./dice/DiceTray"; function MapDice() { - const [isExpanded, setIsExpanded] = useState(false); + const [isExpanded, setIsExpanded] = useState(true); return ( [...prevNumbers, null]); @@ -145,6 +165,7 @@ function DiceTray({ isOpen }) { borderRadius: "4px", display: isOpen ? "block" : "none", position: "relative", + overflow: "hidden", }} bg="background" > diff --git a/src/dice/Dice.js b/src/dice/Dice.js index b953ccc..7ad6d60 100644 --- a/src/dice/Dice.js +++ b/src/dice/Dice.js @@ -22,6 +22,7 @@ class Dice { mesh.material = material; + mesh.receiveShadows = true; mesh.isVisible = false; return mesh; } @@ -55,7 +56,7 @@ class Dice { ); // TODO: put in random start position - instance.position.y = 5; + instance.position.y = 2; return instance; } diff --git a/src/dice/diceTray/DiceTrayMesh.js b/src/dice/diceTray/DiceTrayMesh.js new file mode 100644 index 0000000..64f3d86 --- /dev/null +++ b/src/dice/diceTray/DiceTrayMesh.js @@ -0,0 +1,26 @@ +import * as BABYLON from "babylonjs"; + +import meshSource from "../meshes/diceTraySingle.glb"; + +import albedo from "./albedo.jpg"; +import metalRoughness from "./metalRoughness.jpg"; +import normal from "./normal.jpg"; + +export default async function createDiceTray(scene, shadowGenerator) { + let mesh = ( + await BABYLON.SceneLoader.ImportMeshAsync("", meshSource, "", scene) + ).meshes[1]; + mesh.id = "tray"; + let material = new BABYLON.PBRMaterial("dice_tray_mat", scene); + material.albedoTexture = new BABYLON.Texture(albedo); + material.normalTexture = new BABYLON.Texture(normal); + material.metallicTexture = new BABYLON.Texture(metalRoughness); + material.useRoughnessFromMetallicTextureAlpha = false; + material.useRoughnessFromMetallicTextureGreen = true; + material.useMetallnessFromMetallicTextureBlue = true; + mesh.material = material; + + mesh.receiveShadows = true; + + shadowGenerator.addShadowCaster(mesh); +} diff --git a/src/dice/diceTray/albedo.jpg b/src/dice/diceTray/albedo.jpg new file mode 100644 index 0000000..68b6322 Binary files /dev/null and b/src/dice/diceTray/albedo.jpg differ diff --git a/src/dice/diceTray/metalRoughness.jpg b/src/dice/diceTray/metalRoughness.jpg new file mode 100644 index 0000000..d2c068f Binary files /dev/null and b/src/dice/diceTray/metalRoughness.jpg differ diff --git a/src/dice/diceTray/normal.jpg b/src/dice/diceTray/normal.jpg new file mode 100644 index 0000000..5a0f29f Binary files /dev/null and b/src/dice/diceTray/normal.jpg differ diff --git a/src/dice/meshes/diceTraySingle.glb b/src/dice/meshes/diceTraySingle.glb new file mode 100644 index 0000000..efb0621 Binary files /dev/null and b/src/dice/meshes/diceTraySingle.glb differ