Separated dice loading and dice instance creation and added loading spinner for dice
This commit is contained in:
@@ -8,7 +8,7 @@ class SunsetDice extends Dice {
|
||||
static meshes;
|
||||
static material;
|
||||
|
||||
static async createInstance(diceType, scene) {
|
||||
static async load(scene) {
|
||||
if (!this.material) {
|
||||
this.material = this.loadMaterial(
|
||||
"sunset_pbr",
|
||||
@@ -19,6 +19,12 @@ class SunsetDice extends Dice {
|
||||
if (!this.meshes) {
|
||||
this.meshes = await this.loadMeshes(this.material, scene);
|
||||
}
|
||||
}
|
||||
|
||||
static async createInstance(diceType, scene) {
|
||||
if (!this.material || !this.meshes) {
|
||||
throw Error("Dice not loaded, call load before creating an instance");
|
||||
}
|
||||
|
||||
return Dice.createInstance(
|
||||
this.meshes[diceType],
|
||||
|
||||
Reference in New Issue
Block a user