Added dice tray mesh

This commit is contained in:
Mitchell McCaffrey
2020-05-10 16:13:15 +10:00
parent d8111de6cc
commit 145b08d93f
9 changed files with 61 additions and 13 deletions

View File

@@ -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;
}

View 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);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 KiB

Binary file not shown.