Added souce map analyzer and added tree shaking to Babylon to reduce bundle size

This commit is contained in:
Mitchell McCaffrey
2020-08-11 20:22:10 +10:00
parent 690f35de55
commit b94e06b5a7
10 changed files with 216 additions and 96 deletions

View File

@@ -1,9 +1,9 @@
import * as BABYLON from "babylonjs";
import { Texture } from "@babylonjs/core/Materials/Textures/texture";
// Turn texture load into an async function so it can be awaited
export async function importTextureAsync(url) {
return new Promise((resolve, reject) => {
let texture = new BABYLON.Texture(
let texture = new Texture(
url,
null,
undefined,

View File

@@ -1,4 +1,4 @@
import * as BABYLON from "babylonjs";
import { Vector3 } from "@babylonjs/core/Maths/math";
/**
* Find the number facing up on a mesh instance of a dice
@@ -12,7 +12,7 @@ export function getDiceInstanceRoll(instance) {
.getAbsolutePosition()
.subtract(instance.getAbsolutePosition());
let direction = dif.normalize();
const dot = BABYLON.Vector3.Dot(direction, BABYLON.Vector3.Up());
const dot = Vector3.Dot(direction, Vector3.Up());
if (dot > highestDot) {
highestDot = dot;
highestLocator = locator;