// Get the Canvas element from our HTML below
var canvas = document.getElementById("renderCanvas");
// Load BABYLON 3D engine and set the root directory
var engine = new BABYLON.Engine(canvas, true);
//Create a new scene with a camera (mandatory), a light (better) and a sphere (to see the origin)
var scene = new BABYLON.Scene(engine);
scene.ambientColor = new BABYLON.Color3(1, 1, 1);
this.scene = scene;
// Creating a camera looking to the zero point (0,0,0)
var camera = new BABYLON.ArcRotateCamera("MainCamera", 1, 0.8, 10, new BABYLON.Vector3(0, 0, 0), scene);
//var camera = new BABYLON.FreeCamera("MainCamera", new BABYLON.Vector3(0, 5, -20), scene);
// Creating a omnidirectional light
var light0 = new BABYLON.DirectionalLight("Omni", new BABYLON.Vector3(0, -1, 0), scene);
var material = new BABYLON.StandardMaterial("Mat1", scene);
var box = BABYLON.Mesh.CreateBox("origin", 1, scene);
//material.diffuseTexture = new BABYLON.Texture("Assets/texture/10points.png", scene);
material.emissiveColor = new BABYLON.Color3(1, 1, 1);
box.material = material;
// Attach the camera to the scene
scene.activeCamera.attachControl(canvas);
var objectCount = 0;
for (var i = 0; i < 30; i++) {
for (var e = i; e < 30; e++) {
var clone = box.clone();
clone.position.x = (e - i * 0.5) * 1.01 + 7;
clone.position.y = 0.5 + i * 1.0;
clone.position.z = 3.0;
}
}
// Once the scene is loaded, just register a render loop to render it
engine.runRenderLoop(function () {
scene.render();
document.getElementById('fps').innerHTML = BABYLON.Tools.GetFps().toFixed() + " fps , active=" + scene._activeMeshes.length;
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.