Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/BabylonJS/Babylon.js into…
Browse files Browse the repository at this point in the history
… webgpu-fastpath
  • Loading branch information
Popov72 committed Oct 18, 2021
2 parents e2fb687 + 7d0d6aa commit d8ca92c
Show file tree
Hide file tree
Showing 241 changed files with 65,676 additions and 62,850 deletions.
1 change: 1 addition & 0 deletions Playground/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var Versions = {
"https://cdn.jsdelivr.net/gh/BabylonJS/[email protected]/dist/babylon.js",
"https://cdn.jsdelivr.net/gh/BabylonJS/[email protected]/dist/gui/babylon.gui.min.js",
"https://cdn.jsdelivr.net/gh/BabylonJS/[email protected]/dist/inspector/babylon.inspector.bundle.js",
"https://cdn.jsdelivr.net/gh/BabylonJS/[email protected]/dist/nodeEditor/babylon.nodeEditor.js",
"https://cdn.jsdelivr.net/gh/BabylonJS/[email protected]/dist/materialsLibrary/babylonjs.materials.min.js",
"https://cdn.jsdelivr.net/gh/BabylonJS/[email protected]/dist/proceduralTexturesLibrary/babylonjs.proceduralTextures.min.js",
"https://cdn.jsdelivr.net/gh/BabylonJS/[email protected]/dist/postProcessesLibrary/babylonjs.postProcess.min.js",
Expand Down
8 changes: 4 additions & 4 deletions Playground/src/tools/monacoManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,14 +342,14 @@ class Playground {
// Default intensity is 1. Let's dim the light a small amount
light.intensity = 0.7;
// Our built-in 'sphere' shape. Params: name, subdivs, size, scene
var sphere = BABYLON.Mesh.CreateSphere("sphere1", 16, 2, scene);
// Our built-in 'sphere' shape. Params: name, options, scene
var sphere = BABYLON.MeshBuilder.CreateSphere("sphere", {diameter: 2, segments: 32}, scene);
// Move the sphere upward 1/2 its height
sphere.position.y = 1;
// Our built-in 'ground' shape. Params: name, width, depth, subdivs, scene
var ground = BABYLON.Mesh.CreateGround("ground1", 6, 6, 2, scene);
// Our built-in 'ground' shape. Params: name, options, scene
var ground = BABYLON.MeshBuilder.CreateGround("ground", {width: 6, height: 6}, scene);
return scene;
}
Expand Down
2 changes: 1 addition & 1 deletion Playground/workers/definitionWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function relatedName(node) {
return node.name.escapedText;

if (node.parent)
return relatedName(parent);
return relatedName(node.parent);

return undefined;
}
Expand Down
2 changes: 1 addition & 1 deletion Tools/Gulp/tasks/gulpTasks-dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const dependencies = function(settings, moduleName, cb) {
name: 'no-circular',
comment: 'circular dependencies will make you dizzy',
severity: 'error',
from: {},
from: {path: '^lts\.'},
to: {
circular: true
}
Expand Down
2 changes: 1 addition & 1 deletion Tools/Publisher/tasks/buildBabylonJSAndDependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const colorConsole = require("../../NodeHelpers/colorConsole");
*/
function buildBabylonJSAndDependencies() {
colorConsole.log("Running gulp compilation");
let exec = shelljs.exec("gulp --max-old-space-size=8192 typescript-all", {
let exec = shelljs.exec("npx gulp --max-old-space-size=8192 typescript-all", {
cwd: path.resolve(__dirname, "../../Gulp/")
});
if (exec.code) {
Expand Down
2 changes: 1 addition & 1 deletion Tools/Publisher/tasks/processUMDViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function processUMDViewer(module, version) {
// build the viewer.
colorConsole.log(" Executing " + ('tsc -p ' + projectPath).yellow);

let tscCompile = shelljs.exec('tsc -p ' + projectPath, {
let tscCompile = shelljs.exec('npx tsc -p ' + projectPath, {
cwd: path.resolve(__dirname)
});
if (tscCompile.code !== 0) {
Expand Down
4 changes: 2 additions & 2 deletions Viewer/src/managers/sceneManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { Scalar } from 'babylonjs/Maths/math.scalar';
import { SpotLight } from 'babylonjs/Lights/spotLight';
import { PointLight } from 'babylonjs/Lights/pointLight';
import { AbstractMesh } from 'babylonjs/Meshes/abstractMesh';
import { Mesh } from 'babylonjs/Meshes/mesh';
import { CreatePlane } from "babylonjs/Meshes/Builders/planeBuilder";
import { Tags } from 'babylonjs/Misc/tags';
import { Behavior } from 'babylonjs/Behaviors/behavior';
import { FramingBehavior } from 'babylonjs/Behaviors/Cameras/framingBehavior';
Expand Down Expand Up @@ -1372,7 +1372,7 @@ export class SceneManager {

if (!this._shadowGroundPlane) {
if (shadowGenerator.useBlurCloseExponentialShadowMap) {
let shadowGroundPlane = Mesh.CreatePlane("shadowGroundPlane", 100, this.scene, false);
let shadowGroundPlane = CreatePlane("shadowGroundPlane", { size: 100 }, this.scene);
shadowGroundPlane.useVertexColors = false;
//material isn't ever used in rendering, just used to set back face culling
shadowGroundPlane.material = new PBRMaterial('shadowGroundPlaneMaterial', this.scene);
Expand Down
43 changes: 22 additions & 21 deletions Viewer/tests/validation/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Math.random = function () {
seed %= maximum;

return seed / maximum;
}
};

function compare(renderData, referenceCanvas) {
var width = referenceCanvas.width;
Expand All @@ -34,9 +34,11 @@ function compare(renderData, referenceCanvas) {

var differencesCount = 0;
for (var index = 0; index < size; index += 4) {
if (Math.abs(renderData[index] - referenceData.data[index]) < threshold &&
if (
Math.abs(renderData[index] - referenceData.data[index]) < threshold &&
Math.abs(renderData[index + 1] - referenceData.data[index + 1]) < threshold &&
Math.abs(renderData[index + 2] - referenceData.data[index + 2]) < threshold) {
Math.abs(renderData[index + 2] - referenceData.data[index + 2]) < threshold
) {
continue;
}

Expand Down Expand Up @@ -88,10 +90,10 @@ async function getRenderData(canvas, engine) {
function saveRenderImage(data, canvas) {
var width = canvas.width;
var height = canvas.height;
var screenshotCanvas = document.createElement('canvas');
var screenshotCanvas = document.createElement("canvas");
screenshotCanvas.width = width;
screenshotCanvas.height = height;
var context = screenshotCanvas.getContext('2d');
var context = screenshotCanvas.getContext("2d");

var imageData = context.createImageData(width, height);
var castData = imageData.data;
Expand All @@ -102,7 +104,6 @@ function saveRenderImage(data, canvas) {
}

function downloadDataUrlFromJavascript(filename, dataUrl) {

// Construct the 'a' element
var link = document.createElement("a");
link.download = filename;
Expand All @@ -129,20 +130,19 @@ async function evaluate(test, resultCanvas, result, renderImage, index, waitRing
result.classList.add("failed");
result.innerHTML = "×";
testRes = false;
console.log('%c failed (gl error: ' + err + ')', 'color: red');
console.log("%c failed (gl error: " + err + ")", "color: red");
} else {

// Visual check
if (!test.onlyVisual) {
if (compare(renderData, resultCanvas)) {
result.classList.add("failed");
result.innerHTML = "×";
testRes = false;
console.log('%c failed', 'color: red');
console.log("%c failed", "color: red");
} else {
result.innerHTML = "✔";
testRes = true;
console.log('%c validated', 'color: green');
console.log("%c validated", "color: green");
}
}
}
Expand All @@ -162,7 +162,6 @@ function runTest(index, done) {
done(false);
}


var test = Object.assign({}, config.tests[index]);

var container = document.createElement("div");
Expand Down Expand Up @@ -201,7 +200,7 @@ function runTest(index, done) {
resultCanvas.width = img.width;
resultCanvas.height = img.height;
resultContext.drawImage(img, 0, 0);
}
};

img.src = "/tests/validation/ReferenceImages/" + test.referenceImage;

Expand Down Expand Up @@ -231,7 +230,7 @@ function runTest(index, done) {
if (!test.enableEnvironment) {
configuration.environmentMap = false;
} else {
console.log(configuration.environmentMap)
console.log(configuration.environmentMap);
}

//model config
Expand All @@ -246,18 +245,21 @@ function runTest(index, done) {
setTimeout(() => {
currentViewer = null;
currentScene = null;
viewerElement.innerHTML = '';
viewerElement.innerHTML = "";
currentViewer = new BabylonViewer.DefaultViewer(viewerElement, configuration);

currentViewer.onInitDoneObservable.add(() => {

var currentFrame = 0;
var waitForFrame = test.waitForFrame || 0;

currentViewer.onModelLoadedObservable.add((model) => {
console.log("model loaded");
currentViewer.onFrameRenderedObservable.add(() => {
console.log("frame rendered", currentFrame, model.meshes.every(m => m.isReady()));
console.log(
"frame rendered",
currentFrame,
model.meshes.every((m) => m.isReady())
);
if (test.animationTest && !currentFrame) {
model.playAnimation(model.getAnimationNames()[0]);
}
Expand All @@ -283,7 +285,7 @@ function runTest(index, done) {
function prepareMeshForViewer(viewer, configuration, test) {
let meshModel = new BabylonViewer.ViewerModel(viewer, configuration.model || {});

let sphereMesh = BABYLON.Mesh.CreateSphere('sphere-' + test.title, 20, 1.0, viewer.sceneManager.scene);
let sphereMesh = BABYLON.MeshBuilder.CreateSphere("sphere-" + test.title, { segments: 20, diameter: 1.0 }, viewer.sceneManager.scene);
if (test.createMaterial) {
let material = new BABYLON.PBRMaterial("sphereMat", viewer.sceneManager.scene);
sphereMesh.material = material;
Expand All @@ -306,13 +308,13 @@ function init() {
BABYLON.DracoCompression.Configuration.decoder = {
wasmUrl: GetAbsoluteUrl("../../dist/preview%20release/draco_wasm_wrapper_gltf.js"),
wasmBinaryUrl: GetAbsoluteUrl("../../dist/preview%20release/draco_decoder_gltf.wasm"),
fallbackUrl: GetAbsoluteUrl("../../dist/preview%20release/draco_decoder_gltf.js")
fallbackUrl: GetAbsoluteUrl("../../dist/preview%20release/draco_decoder_gltf.js"),
};
BABYLON.MeshoptCompression.Configuration.decoder = {
url: GetAbsoluteUrl("../../dist/preview%20release/meshopt_decoder.js")
url: GetAbsoluteUrl("../../dist/preview%20release/meshopt_decoder.js"),
};
BABYLON.GLTFValidation.Configuration = {
url: GetAbsoluteUrl("../../dist/preview%20release/gltf_validator.js")
url: GetAbsoluteUrl("../../dist/preview%20release/gltf_validator.js"),
};
BABYLON.KhronosTextureContainer2.URLConfig = {
jsDecoderModule: GetAbsoluteUrl("../../dist/preview%20release/babylon.ktx2Decoder.js"),
Expand Down Expand Up @@ -344,4 +346,3 @@ function init() {
}

init();

Loading

0 comments on commit d8ca92c

Please sign in to comment.