Browse Source

Updated the camera object to match the COLLADA schema elements and added orthographic camera support.

John Pywtorak 13 years ago
parent
commit
6d921ff56d
1 changed files with 40 additions and 4 deletions
  1. 40 4
      src/extras/loaders/ColladaLoader.js

+ 40 - 4
src/extras/loaders/ColladaLoader.js

@@ -3665,6 +3665,7 @@ THREE.ColladaLoader = function () {
 
 
 		this.id = "";
 		this.id = "";
 		this.name = "";
 		this.name = "";
+		this.technique = "";
 
 
 	};
 	};
 
 
@@ -3706,7 +3707,9 @@ THREE.ColladaLoader = function () {
 
 
 				for ( var j = 0; j < technique.childNodes.length; j ++ ) {
 				for ( var j = 0; j < technique.childNodes.length; j ++ ) {
 
 
-					if ( technique.childNodes[ j ].nodeName == 'perspective' ) {
+					this.technique = technique.childNodes[ j ].nodeName;
+
+					if ( this.technique == 'perspective' ) {
 
 
 						var perspective = technique.childNodes[ j ];
 						var perspective = technique.childNodes[ j ];
 
 
@@ -3716,14 +3719,47 @@ THREE.ColladaLoader = function () {
 
 
 							switch ( param.nodeName ) {
 							switch ( param.nodeName ) {
 
 
+								case 'yfov':
+									this.yfov = param.textContent;
+									break;
 								case 'xfov':
 								case 'xfov':
-									this.fov = param.textContent;
+									this.xfov = param.textContent;
+									break;
+								case 'znear':
+									this.znear = param.textContent;
+									break;
+								case 'zfar':
+									this.zfar = param.textContent;
+									break;
+								case 'aspect_ratio':
+									this.aspect_ratio = param.textContent;
+									break;
+
+							}
+
+						}
+
+					} else if ( this.technique == 'orthographic' ) {
+
+						var orthographic = technique.childNodes[ j ];
+
+						for ( var k = 0; k < orthographic.childNodes.length; k ++ ) {
+
+							var param = orthographic.childNodes[ k ];
+
+							switch ( param.nodeName ) {
+
+								case 'xmag':
+									this.xmag = param.textContent;
+									break;
+								case 'ymag':
+									this.ymag = param.textContent;
 									break;
 									break;
 								case 'znear':
 								case 'znear':
-									this.znear = .4;//param.textContent;
+									this.znear = param.textContent;
 									break;
 									break;
 								case 'zfar':
 								case 'zfar':
-									this.zfar = 1e15;//param.textContent;
+									this.zfar = param.textContent;
 									break;
 									break;
 								case 'aspect_ratio':
 								case 'aspect_ratio':
 									this.aspect_ratio = param.textContent;
 									this.aspect_ratio = param.textContent;