Browse Source

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 năm trước cách đây
mục cha
commit
2f3a71940d
1 tập tin đã thay đổi với 6 bổ sung0 xóa
  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;