|
@@ -58,25 +58,25 @@
|
|
var spheres = []
|
|
var spheres = []
|
|
for (var i = 0; i < squareSize; i++) {
|
|
for (var i = 0; i < squareSize; i++) {
|
|
for (var j = 0; j < squareSize; j++) {
|
|
for (var j = 0; j < squareSize; j++) {
|
|
- for (var k = 0; k < 5; k++) {
|
|
|
|
|
|
+ for (var k = 0; k < 3; k++) {
|
|
var sphere = BABYLON.Mesh.CreateSphere("sphere", 4, 0.5, scene);
|
|
var sphere = BABYLON.Mesh.CreateSphere("sphere", 4, 0.5, scene);
|
|
|
|
|
|
// Move the sphere upward 1/2 its height
|
|
// Move the sphere upward 1/2 its height
|
|
sphere.position.z = - squareSize / 4 + j / 2;
|
|
sphere.position.z = - squareSize / 4 + j / 2;
|
|
sphere.position.x = - squareSize / 4 + i / 2;
|
|
sphere.position.x = - squareSize / 4 + i / 2;
|
|
sphere.position.y = - squareSize / 4 + k / 2;
|
|
sphere.position.y = - squareSize / 4 + k / 2;
|
|
- if (j === 0) {
|
|
|
|
sphere.material = new BABYLON.StandardMaterial("test");
|
|
sphere.material = new BABYLON.StandardMaterial("test");
|
|
- // sphere.material.diffuseTexture = new BABYLON.Texture("test.jpeg", scene);
|
|
|
|
- // sphere.material.bumpTexture = new BABYLON.Texture("test.jpeg", scene);
|
|
|
|
|
|
+ if (Math.random() > 0.2) {
|
|
|
|
+ sphere.material.diffuseTexture = new BABYLON.Texture("test.jpeg", scene);
|
|
|
|
+ }
|
|
|
|
+ if (Math.random() > 0.2) {
|
|
|
|
+ sphere.material.bumpTexture = new BABYLON.Texture("test.jpeg", scene);
|
|
|
|
+ }
|
|
sphere.material.diffuseColor = new BABYLON.Color3(Math.random(), Math.random(), Math.random());
|
|
sphere.material.diffuseColor = new BABYLON.Color3(Math.random(), Math.random(), Math.random());
|
|
sphere.material.specularColor = new BABYLON.Color3(Math.random() < 0.8 ? 0 : 1, Math.random() < 0.8 ? 0 : 1, Math.random() < 0.8 ? 0 : 1);
|
|
sphere.material.specularColor = new BABYLON.Color3(Math.random() < 0.8 ? 0 : 1, Math.random() < 0.8 ? 0 : 1, Math.random() < 0.8 ? 0 : 1);
|
|
sphere.material.emissiveColor = new BABYLON.Color3(0, 0, 0);
|
|
sphere.material.emissiveColor = new BABYLON.Color3(0, 0, 0);
|
|
sphere.material.freeze();
|
|
sphere.material.freeze();
|
|
- }
|
|
|
|
- else {
|
|
|
|
- sphere.material = spheres[0].material;
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
sphere.freezeWorldMatrix();
|
|
sphere.freezeWorldMatrix();
|
|
spheres.push(sphere);
|
|
spheres.push(sphere);
|
|
}
|
|
}
|