Added dice tray mesh
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
26
src/dice/diceTray/DiceTrayMesh.js
Normal file
26
src/dice/diceTray/DiceTrayMesh.js
Normal file
@@ -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);
|
||||
}
|
||||
BIN
src/dice/diceTray/albedo.jpg
Normal file
BIN
src/dice/diceTray/albedo.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 693 KiB |
BIN
src/dice/diceTray/metalRoughness.jpg
Normal file
BIN
src/dice/diceTray/metalRoughness.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 244 KiB |
BIN
src/dice/diceTray/normal.jpg
Normal file
BIN
src/dice/diceTray/normal.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 250 KiB |
BIN
src/dice/meshes/diceTraySingle.glb
Normal file
BIN
src/dice/meshes/diceTraySingle.glb
Normal file
Binary file not shown.
Reference in New Issue
Block a user