Explorar o código

Setters for elements drawn and mtl

Iñigo Valentin %!s(int64=12) %!d(string=hai) anos
pai
achega
69de368837
Modificáronse 1 ficheiros con 28 adicións e 0 borrados
  1. 28 0
      script/ObJS.js

+ 28 - 0
script/ObJS.js

@@ -75,6 +75,7 @@ function ObJS(){
 	/********************************************************************
 	 * Booleans to indicate if mtl file should be used.                 *
 	 ********************************************************************/
+	var hasMtl = true;
 	var useMtl = true;
 	
 	/********************************************************************
@@ -224,6 +225,31 @@ function ObJS(){
 		readMtlFile(mtlContent);
 		draw();
 	};
+	/********************************************************************
+	 * Getters that determine if an element is being drawn.             *
+	 ********************************************************************/
+	this.isBackgroungDrawn = function(){
+		return dBackg;
+	};
+	
+	this.isVertexDrawn = function(){
+		return dVerts;
+	};
+	
+	this.isEdgeDrawn = function(){
+		return dEdges;
+	};
+	
+	this.isFaceDrawn = function(){
+		return dFaces;
+	};
+	
+	/********************************************************************
+	 * Getters that determine if the model has associated materials.    *
+	 ********************************************************************/
+	this.isBackgroungDrawn = function(){
+		return dBackg;
+	};
 	
 	/********************************************************************
 	 * Functions switching the elements drawn (dVerts, dEdges, dFaces). *
@@ -624,6 +650,8 @@ function ObJS(){
 			text = text.substring(text.indexOf("\n") + 1);
 		}
 		totalMaterial = material.length;
+		if (totalMaterial == 0)
+			hasMtl = false;
 	};
 	
 	/********************************************************************