kfeditor better light
This commit is contained in:
@@ -2,6 +2,8 @@ import * as THREE from '/app/thirdparty/Three/three.module.js'
|
|||||||
import { EffectComposer } from '/app/thirdparty/Three/postprocessing/EffectComposer.module.js'
|
import { EffectComposer } from '/app/thirdparty/Three/postprocessing/EffectComposer.module.js'
|
||||||
import { RenderPass } from '/app/thirdparty/Three/postprocessing/RenderPass.module.js'
|
import { RenderPass } from '/app/thirdparty/Three/postprocessing/RenderPass.module.js'
|
||||||
import { OutlinePass } from '/app/thirdparty/Three/postprocessing/OutlinePass.module.js'
|
import { OutlinePass } from '/app/thirdparty/Three/postprocessing/OutlinePass.module.js'
|
||||||
|
import { ShaderPass } from '/app/thirdparty/Three/postprocessing/ShaderPass.module.js'
|
||||||
|
import { GammaCorrectionShader } from '/app/thirdparty/Three/shaders/GammaCorrectionShader.module.js'
|
||||||
|
|
||||||
if(!app.helpers) app.helpers = {}
|
if(!app.helpers) app.helpers = {}
|
||||||
/**
|
/**
|
||||||
@@ -130,8 +132,9 @@ app.helpers.helpers3D = {
|
|||||||
|
|
||||||
this.composer.addPass(this.outlinePass)
|
this.composer.addPass(this.outlinePass)
|
||||||
this.highlighted3DObjects = []
|
this.highlighted3DObjects = []
|
||||||
this.outlinePass.selectedObjects = this.highlighted3DObjects
|
this.outlinePass.selectedObjects = this.highlighted3DObjects
|
||||||
|
|
||||||
|
this.composer.addPass(new ShaderPass(GammaCorrectionShader))
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/**
|
||||||
|
* Gamma Correction Shader
|
||||||
|
* http://en.wikipedia.org/wiki/gamma_correction
|
||||||
|
*/
|
||||||
|
|
||||||
|
const GammaCorrectionShader = {
|
||||||
|
|
||||||
|
name: 'GammaCorrectionShader',
|
||||||
|
|
||||||
|
uniforms: {
|
||||||
|
|
||||||
|
'tDiffuse': { value: null }
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
vertexShader: /* glsl */`
|
||||||
|
|
||||||
|
varying vec2 vUv;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
|
||||||
|
vUv = uv;
|
||||||
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||||||
|
|
||||||
|
}`,
|
||||||
|
|
||||||
|
fragmentShader: /* glsl */`
|
||||||
|
|
||||||
|
uniform sampler2D tDiffuse;
|
||||||
|
|
||||||
|
varying vec2 vUv;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
|
||||||
|
vec4 tex = texture2D( tDiffuse, vUv );
|
||||||
|
|
||||||
|
gl_FragColor = sRGBTransferOETF( tex );
|
||||||
|
|
||||||
|
}`
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
export { GammaCorrectionShader };
|
||||||
+2
-3
@@ -206,11 +206,10 @@ export class Threetobus{
|
|||||||
this.cameras.cam2Dtop.layers.enable(1)
|
this.cameras.cam2Dtop.layers.enable(1)
|
||||||
|
|
||||||
// Lights
|
// Lights
|
||||||
const light = new THREE.DirectionalLight(0xffffff, 1)
|
const light = new THREE.DirectionalLight(0xffffff, 2)
|
||||||
light.position.set(5, 5, 5)
|
light.position.set(5, 5, 5)
|
||||||
light.intensity = 2
|
|
||||||
this.scene.add(light)
|
this.scene.add(light)
|
||||||
this.scene.add(new THREE.AmbientLight(0xffffff, 0.4))
|
this.scene.add(new THREE.AmbientLight(0xffffff, 1))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,9 +32,8 @@ export class kfArena{
|
|||||||
// Lights
|
// Lights
|
||||||
const light = new THREE.DirectionalLight(0xffffff, 1)
|
const light = new THREE.DirectionalLight(0xffffff, 1)
|
||||||
light.position.set(5, 5, 5)
|
light.position.set(5, 5, 5)
|
||||||
light.intensity = 2
|
|
||||||
this.scene.add(light)
|
this.scene.add(light)
|
||||||
this.scene.add(new THREE.AmbientLight(0xffffff, 0.4))
|
this.scene.add(new THREE.AmbientLight(0xffffff, .4))
|
||||||
|
|
||||||
this.grid = new THREE.GridHelper(this.sceneSize.x, this.sceneSize.x, 0x8888AA, 0x8888AA)
|
this.grid = new THREE.GridHelper(this.sceneSize.x, this.sceneSize.x, 0x8888AA, 0x8888AA)
|
||||||
this.grid.layers.set(1)
|
this.grid.layers.set(1)
|
||||||
@@ -43,7 +42,7 @@ export class kfArena{
|
|||||||
// Base plane
|
// Base plane
|
||||||
const planeGeo = new THREE.PlaneGeometry(100, 100)
|
const planeGeo = new THREE.PlaneGeometry(100, 100)
|
||||||
const planeMat = new THREE.MeshBasicMaterial({
|
const planeMat = new THREE.MeshBasicMaterial({
|
||||||
color: 0xaaaacc,
|
color: 0x8888aa,
|
||||||
opacity: 0.3,
|
opacity: 0.3,
|
||||||
transparent: true, // needed for opacity < 1 to take effect
|
transparent: true, // needed for opacity < 1 to take effect
|
||||||
side: THREE.DoubleSide
|
side: THREE.DoubleSide
|
||||||
@@ -124,7 +123,7 @@ export class kfArena{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
addAgent(typeId, aid, properties, values){ console.log('==addAgent==>',typeId, aid, properties, values)
|
addAgent(typeId, aid, properties, values){
|
||||||
const agentSprite = this.agentSprites.find(item => item.atp_id==typeId)
|
const agentSprite = this.agentSprites.find(item => item.atp_id==typeId)
|
||||||
if(!agentSprite) {
|
if(!agentSprite) {
|
||||||
console.warn(`No sprite for type: ${typeId}`)
|
console.warn(`No sprite for type: ${typeId}`)
|
||||||
|
|||||||
Reference in New Issue
Block a user