directional light position

This commit is contained in:
Adrien MALINGREY 2023-07-07 20:06:25 +02:00
parent a6c48989d0
commit c4979b5890
3 changed files with 20 additions and 15 deletions

6
app.js
View File

@ -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()

View File

@ -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

View File

@ -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