repo: janusweb action: commit revision: path_from: revision_from: 2a3b8feda139ab577f472e65f83f0d42b4994208: path_to: revision_to:
commit 2a3b8feda139ab577f472e65f83f0d42b4994208 Author: James BaicoianuDate: Fri Jun 23 01:56:19 2017 -0700 Light changes to be closer to native, experimental lightmap support diff --git a/scripts/januslight.js b/scripts/januslight.js
--- a/scripts/januslight.js
+++ b/scripts/januslight.js
@@ -7,6 +7,7 @@ elation.require(['janusweb.janusbase'], function() {
light_intensity: { type: 'float', default: 100, set: this.updateLight },
light_cone_angle: { type: 'float', default: 0, set: this.updateLight },
light_cone_exponent: { type: 'float', default: 1, set: this.updateLight },
+ light_shadow: { type: 'boolean', default: true, set: this.updateLight },
});
}
this.createObject3D = function() {
@@ -50,10 +51,19 @@ elation.require(['janusweb.janusbase'], function() {
//this.light.intensity = this.light_intensity / 100;
var avgscale = (this.scale.x + this.scale.y + this.scale.z) / 3;
this.light.color.copy(this.color);
- this.light.color.multiplyScalar(this.light_intensity * avgscale * avgscale);
+ //this.light.color.multiplyScalar(this.light_intensity * avgscale * avgscale);
this.light.range = this.light_range * avgscale;
+ if (this.light_shadow) {
+ this.initShadowmap();
+ }
}
}
+ this.initShadowmap = function() {
+ this.light.castShadow = true;
+ this.light.shadow.camera.near = 40;
+ this.light.shadow.camera.far = 120;
+ this.light.shadow.camera.fov = 50;
+ }
this.getProxyObject = function() {
var proxy = elation.engine.things.janusobject.extendclass.getProxyObject.call(this);
proxy._proxydefs = {
-----END OF PAGE-----