logs in console, caching in getAgentProps, console createAgent independent of GUI
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import * as THREE from 'three'
|
||||
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'
|
||||
import * as TWEEN from 'three/examples/jsm/libs/tween.module.js'
|
||||
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
||||
|
||||
export class kfArena{
|
||||
|
||||
@@ -21,7 +22,7 @@ export class kfArena{
|
||||
initScene(){
|
||||
// Scene
|
||||
this.scene = new THREE.Scene()
|
||||
|
||||
|
||||
// Camera
|
||||
this.camera = new THREE.PerspectiveCamera(75, this.canvasEl.clientWidth / this.canvasEl.clientHeight, 0.1, 1000)
|
||||
this.camera.position.set(3, 3, 5)
|
||||
@@ -30,11 +31,16 @@ export class kfArena{
|
||||
this.camera.layers.enable(2)
|
||||
|
||||
// Lights
|
||||
const light = new THREE.DirectionalLight(0xffffff, 1)
|
||||
light.position.set(5, 5, 5)
|
||||
this.scene.add(light)
|
||||
this.scene.add(new THREE.AmbientLight(0xffffff, .4))
|
||||
const dLight1 = new THREE.DirectionalLight(0xffffff, 1.5)
|
||||
dLight1.position.set(5, 5, 5)
|
||||
this.scene.add(dLight1)
|
||||
const dLight2 = new THREE.DirectionalLight(0xffffff, 1.5)
|
||||
dLight2.position.set(-5, -5, 5)
|
||||
this.scene.add(dLight2)
|
||||
|
||||
this.scene.add(new THREE.AmbientLight(0xffffff, 1))
|
||||
|
||||
|
||||
this.grid = new THREE.GridHelper(this.sceneSize.x, this.sceneSize.x, 0x8888AA, 0x8888AA)
|
||||
this.grid.layers.set(1)
|
||||
this.scene.add(this.grid)
|
||||
@@ -57,10 +63,6 @@ export class kfArena{
|
||||
this.scene.add(this.axes)
|
||||
|
||||
this.renderer = new THREE.WebGLRenderer({ antialias: true, canvas: this.canvasEl, stencil: true })
|
||||
// this.renderer.physicallyCorrectLights = true
|
||||
// this.renderer.outputColorSpace = THREE.SRGBColorSpace
|
||||
// this.renderer.toneMapping = THREE.ACESFilmicToneMapping
|
||||
// this.renderer.toneMappingExposure = 1
|
||||
|
||||
this.canvasEl.addEventListener('click', this.onSceneClick.bind(this))
|
||||
}
|
||||
@@ -74,6 +76,7 @@ export class kfArena{
|
||||
TWEEN.update()
|
||||
this.animateHighlight3DObj()
|
||||
const resized = this.resizeRendererToDisplaySize()
|
||||
|
||||
this.renderer.render(this.scene, this.camera)
|
||||
requestAnimationFrame(this.render.bind(this))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user