mirror of
https://github.com/wahyd4/three.js.git
synced 2026-08-24 20:36:00 +10:00
More cleanup of WebGLRenderer.
This commit is contained in:
@@ -55,6 +55,16 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
|
||||
_vector3 = new THREE.Vector4(),
|
||||
|
||||
// light arrays cache
|
||||
|
||||
_lights = {
|
||||
|
||||
ambient: [ 0, 0, 0 ],
|
||||
directional: { length: 0, colors: new Array(), positions: new Array() },
|
||||
point: { length: 0, colors: new Array(), positions: new Array() }
|
||||
|
||||
},
|
||||
|
||||
// parameters defaults
|
||||
|
||||
antialias = true,
|
||||
@@ -79,14 +89,6 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
|
||||
//alert( dumpObject( getGLParams() ) );
|
||||
|
||||
this.lights = {
|
||||
|
||||
ambient: [ 0, 0, 0 ],
|
||||
directional: { length: 0, colors: new Array(), positions: new Array() },
|
||||
point: { length: 0, colors: new Array(), positions: new Array() }
|
||||
|
||||
};
|
||||
|
||||
this.setSize = function ( width, height ) {
|
||||
|
||||
_canvas.width = width;
|
||||
@@ -148,7 +150,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
var l, ll, light, r = 0, g = 0, b = 0,
|
||||
color, position, intensity,
|
||||
|
||||
zlights = _this.lights,
|
||||
zlights = _lights,
|
||||
|
||||
dcolors = zlights.directional.colors,
|
||||
dpositions = zlights.directional.positions,
|
||||
@@ -1453,7 +1455,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
material instanceof THREE.MeshLambertMaterial ) {
|
||||
|
||||
setupLights( program, lights );
|
||||
refreshUniformsLights( m_uniforms, _this.lights );
|
||||
refreshUniformsLights( m_uniforms, _lights );
|
||||
|
||||
}
|
||||
|
||||
@@ -1902,7 +1904,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
|
||||
scene.update( undefined, false, camera );
|
||||
|
||||
this.initWebGLObjects( scene, camera );
|
||||
this.initWebGLObjects( scene );
|
||||
|
||||
setRenderTarget( renderTarget );
|
||||
|
||||
@@ -2117,7 +2119,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
||||
|
||||
};
|
||||
|
||||
this.initWebGLObjects = function ( scene, camera ) {
|
||||
this.initWebGLObjects = function ( scene ) {
|
||||
|
||||
if ( !scene.__webglObjects ) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user