Prechádzať zdrojové kódy

improved CameraHelper such that it does require to pass camera via .update(camera) if camera is already defined in the object's constructor

zz85 13 rokov pred
rodič
commit
2f3a71940d
1 zmenil súbory, kde vykonal 6 pridanie a 0 odobranie
  1. 6 0
      src/extras/helpers/CameraHelper.js

+ 6 - 0
src/extras/helpers/CameraHelper.js

@@ -73,6 +73,8 @@ THREE.CameraHelper = function ( camera ) {
 	addLine( "cf1", "cf2", hexCross );
 	addLine( "cf3", "cf4", hexCross );
 
+	this.camera = camera;
+
 	function addLine( a, b, hex ) {
 
 		addPoint( a, hex );
@@ -102,6 +104,10 @@ THREE.CameraHelper.prototype.constructor = THREE.CameraHelper;
 
 THREE.CameraHelper.prototype.update = function ( camera ) {
 
+	if (camera !== undefined) {
+		camera = this.camera;
+	}
+
 	var w = 1;
 	var h = 1;