File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -244,6 +244,8 @@ var Shader = new Class({
244244 }
245245 }
246246
247+ this . pointer = null ;
248+
247249 this . _rendererWidth = renderer . width ;
248250 this . _rendererHeight = renderer . height ;
249251
@@ -314,6 +316,13 @@ var Shader = new Class({
314316 return this ;
315317 } ,
316318
319+ setPointer : function ( pointer )
320+ {
321+ this . pointer = pointer ;
322+
323+ return this ;
324+ } ,
325+
317326 /**
318327 * Sets up an orthographics projection matrix
319328 *
@@ -493,6 +502,15 @@ var Shader = new Class({
493502
494503 this . uniforms . time . value = this . renderer . game . loop . time / 1000 ;
495504
505+ if ( this . pointer )
506+ {
507+ var px = this . pointer . x / this . width ;
508+ var py = 1 - this . pointer . y / this . height ;
509+
510+ this . uniforms . mouse . value . x = px . toFixed ( 2 ) ;
511+ this . uniforms . mouse . value . y = py . toFixed ( 2 ) ;
512+ }
513+
496514 this . syncUniforms ( ) ;
497515
498516 // Draw
You can’t perform that action at this time.
0 commit comments