55 */
66
77var Class = require ( '../../utils/Class' ) ;
8+ var RGB = require ( '../../display/RGB' ) ;
89var Vector3 = require ( '../../math/Vector3' ) ;
910
1011/**
@@ -23,9 +24,32 @@ var MeshLight = new Class({
2324 function MeshLight ( x , y , z )
2425 {
2526 this . position = new Vector3 ( x , y , z ) ;
26- this . ambient = new Vector3 ( 1 , 1 , 1 ) ;
27- this . diffuse = new Vector3 ( 1 , 1 , 1 ) ;
28- this . specular = new Vector3 ( 1 , 1 , 1 ) ;
27+ this . ambient = new RGB ( 1 , 1 , 1 ) ;
28+ this . diffuse = new RGB ( 1 , 1 , 1 ) ;
29+ this . specular = new RGB ( 1 , 1 , 1 ) ;
30+
31+ // cache structure = position
32+ this . dirtyCache = [ 0 , 0 , 0 ] ;
33+ } ,
34+
35+ isDirty : function ( )
36+ {
37+ var position = this . position ;
38+ var dirtyCache = this . dirtyCache ;
39+
40+ var x = position . x ;
41+ var y = position . y ;
42+ var z = position . z ;
43+
44+ var xCached = dirtyCache [ 0 ] ;
45+ var yCached = dirtyCache [ 1 ] ;
46+ var zCached = dirtyCache [ 2 ] ;
47+
48+ dirtyCache [ 0 ] = x ;
49+ dirtyCache [ 1 ] = y ;
50+ dirtyCache [ 2 ] = z ;
51+
52+ return ( xCached !== x || yCached !== y || zCached !== z ) ;
2953 } ,
3054
3155 setPosition : function ( x , y , z )
0 commit comments