Removed unnesasary async from createDiceInstace and simplified dice meshes to reduce spawn delay
This commit is contained in:
parent
2775fc6e16
commit
fc8c65e525
@ -154,17 +154,17 @@ function DiceTrayOverlay({ isOpen }) {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDiceAdd(style, type) {
|
||||
function handleDiceAdd(style, type) {
|
||||
const scene = sceneRef.current;
|
||||
const shadowGenerator = shadowGeneratorRef.current;
|
||||
if (scene && shadowGenerator) {
|
||||
const instance = await style.createInstance(type, scene);
|
||||
const instance = style.createInstance(type, scene);
|
||||
shadowGenerator.addShadowCaster(instance);
|
||||
Dice.roll(instance);
|
||||
let dice = { type, instance, asleep: false };
|
||||
// If we have a d100 add a d10 as well
|
||||
if (type === "d100") {
|
||||
const d10Instance = await style.createInstance("d10", scene);
|
||||
const d10Instance = style.createInstance("d10", scene);
|
||||
shadowGenerator.addShadowCaster(d10Instance);
|
||||
Dice.roll(d10Instance);
|
||||
dice.d10Instance = d10Instance;
|
||||
|
@ -138,7 +138,7 @@ class Dice {
|
||||
);
|
||||
}
|
||||
|
||||
static async createInstance(mesh, physicalProperties, scene) {
|
||||
static createInstance(mesh, physicalProperties, scene) {
|
||||
this.instanceCount++;
|
||||
|
||||
return this.createInstanceFromMesh(
|
||||
|
@ -21,7 +21,7 @@ class GalaxyDice extends Dice {
|
||||
}
|
||||
}
|
||||
|
||||
static async createInstance(diceType, scene) {
|
||||
static createInstance(diceType, scene) {
|
||||
if (!this.material || !this.meshes) {
|
||||
throw Error("Dice not loaded, call load before creating an instance");
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class GemstoneDice extends Dice {
|
||||
}
|
||||
}
|
||||
|
||||
static async createInstance(diceType, scene) {
|
||||
static createInstance(diceType, scene) {
|
||||
if (!this.material || !this.meshes) {
|
||||
throw Error("Dice not loaded, call load before creating an instance");
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class GlassDice extends Dice {
|
||||
}
|
||||
}
|
||||
|
||||
static async createInstance(diceType, scene) {
|
||||
static createInstance(diceType, scene) {
|
||||
if (!this.material || !this.meshes) {
|
||||
throw Error("Dice not loaded, call load before creating an instance");
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ class IronDice extends Dice {
|
||||
}
|
||||
}
|
||||
|
||||
static async createInstance(diceType, scene) {
|
||||
static createInstance(diceType, scene) {
|
||||
if (!this.material || !this.meshes) {
|
||||
throw Error("Dice not loaded, call load before creating an instance");
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ class NebulaDice extends Dice {
|
||||
}
|
||||
}
|
||||
|
||||
static async createInstance(diceType, scene) {
|
||||
static createInstance(diceType, scene) {
|
||||
if (!this.material || !this.meshes) {
|
||||
throw Error("Dice not loaded, call load before creating an instance");
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -21,7 +21,7 @@ class SunriseDice extends Dice {
|
||||
}
|
||||
}
|
||||
|
||||
static async createInstance(diceType, scene) {
|
||||
static createInstance(diceType, scene) {
|
||||
if (!this.material || !this.meshes) {
|
||||
throw Error("Dice not loaded, call load before creating an instance");
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ class SunsetDice extends Dice {
|
||||
}
|
||||
}
|
||||
|
||||
static async createInstance(diceType, scene) {
|
||||
static createInstance(diceType, scene) {
|
||||
if (!this.material || !this.meshes) {
|
||||
throw Error("Dice not loaded, call load before creating an instance");
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class WalnutDice extends Dice {
|
||||
}
|
||||
}
|
||||
|
||||
static async createInstance(diceType, scene) {
|
||||
static createInstance(diceType, scene) {
|
||||
if (!this.material || !this.meshes) {
|
||||
throw Error("Dice not loaded, call load before creating an instance");
|
||||
}
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user