diff --git a/app.js b/app.js index b942e44..1b82c7e 100644 --- a/app.js +++ b/app.js @@ -8,8 +8,6 @@ import { TetraControls } from './jsm/TetraControls.js' import { Vortex } from './jsm/Vortex.js' -Array.prototype.pick = function () { return this.splice(Math.floor(Math.random() * this.length), 1)[0] } - HTMLElement.prototype.addNewChild = function (tag, properties) { let child = document.createElement(tag) for (let key in properties) { @@ -58,8 +56,8 @@ scene.camera.position.set(5, 0, 16) scene.ambientLight = new THREE.AmbientLight(0xffffff, 0.2) scene.add(scene.ambientLight) -scene.directionalLight = new THREE.DirectionalLight(0xffffff, 20) -scene.directionalLight.position.set(5, -100, -16) +scene.directionalLight = new THREE.DirectionalLight(0xffffff, 15) +scene.directionalLight.position.set(5, 0, -10) scene.add(scene.directionalLight) const holdQueue = new HoldQueue() diff --git a/jsm/TetraGUI.js b/jsm/TetraGUI.js index d95477f..ecda494 100644 --- a/jsm/TetraGUI.js +++ b/jsm/TetraGUI.js @@ -66,19 +66,24 @@ class TetraGUI extends GUI { if (window.location.search.includes("debug")) { this.debug = this.addFolder("debug") - let cameraPositionFolder = this.debug.addFolder("camera.position") - cameraPositionFolder.add(scene.camera.position, "x") - cameraPositionFolder.add(scene.camera.position, "y") - cameraPositionFolder.add(scene.camera.position, "z") + let cameraPosition = this.debug.addFolder("camera.position") + cameraPosition.add(scene.camera.position, "x") + cameraPosition.add(scene.camera.position, "y") + cameraPosition.add(scene.camera.position, "z") + + let directionalLightPosition = this.debug.addFolder("directionalLight.position") + directionalLightPosition.add(scene.directionalLight.position, "x") + directionalLightPosition.add(scene.directionalLight.position, "y") + directionalLightPosition.add(scene.directionalLight.position, "z") - let lightFolder = this.debug.addFolder("lights intensity") - lightFolder.add(scene.ambientLight, "intensity").name("ambient").min(0).max(20) - lightFolder.add(scene.directionalLight, "intensity").name("directional").min(0).max(20) + let light = this.debug.addFolder("lights intensity") + light.add(scene.ambientLight, "intensity").name("ambient").min(0).max(20) + light.add(scene.directionalLight, "intensity").name("directional").min(0).max(20) - let materialsFolder = this.debug.addFolder("materials opacity") - materialsFolder.add(scene.vortex.darkCylinder.material, "opacity").name("dark").min(0).max(1) - materialsFolder.add(scene.vortex.colorFullCylinder.material, "opacity").name("colorFull").min(0).max(1) - materialsFolder.add(I.prototype.material, "reflectivity").min(0).max(2).onChange(() => { + let materials = this.debug.addFolder("materials opacity") + materials.add(scene.vortex.darkCylinder.material, "opacity").name("dark").min(0).max(1) + materials.add(scene.vortex.colorFullCylinder.material, "opacity").name("colorFull").min(0).max(1) + materials.add(I.prototype.material, "reflectivity").min(0).max(2).onChange(() => { J.prototype.material.reflectivity = I.prototype.material.reflectivity L.prototype.material.reflectivity = I.prototype.material.reflectivity O.prototype.material.reflectivity = I.prototype.material.reflectivity diff --git a/jsm/gamelogic.js b/jsm/gamelogic.js index 750f20c..1b87c96 100644 --- a/jsm/gamelogic.js +++ b/jsm/gamelogic.js @@ -2,6 +2,8 @@ import * as THREE from 'three' import { scheduler } from './scheduler.js' +Array.prototype.pick = function () { return this.splice(Math.floor(Math.random() * this.length), 1)[0] } + let P = (x, y, z = 0) => new THREE.Vector3(x, y, z) const GRAVITY = -20