Browse Source

set camera by function

SUNAG 9 years ago
parent
commit
99e2e4e690
1 changed files with 8 additions and 3 deletions
  1. 8 3
      examples/js/materials/nodes/accessors/CameraNode.js

+ 8 - 3
examples/js/materials/nodes/accessors/CameraNode.js

@@ -7,9 +7,7 @@ THREE.CameraNode = function( scope, camera ) {
 	THREE.TempNode.call( this, 'v3' );
 
 	this.setScope( scope || THREE.CameraNode.POSITION );
-	this.camera = camera;
-
-	this.requestUpdate = this.camera !== undefined;
+	this.setCamera( camera );
 
 };
 
@@ -19,6 +17,13 @@ THREE.CameraNode.prototype.constructor = THREE.CameraNode;
 THREE.CameraNode.POSITION = 'position';
 THREE.CameraNode.DEPTH = 'depth';
 
+THREE.CameraNode.prototype.setCamera = function( camera ) {
+
+	this.camera = camera;
+	this.requestUpdate = camera !== undefined;
+
+};
+
 THREE.CameraNode.prototype.setScope = function( scope ) {
 
 	switch ( this.scope ) {