|
From: <tre...@us...> - 2007-09-03 00:22:15
|
Revision: 343
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=343&view=rev
Author: trevorolio
Date: 2007-09-02 17:22:17 -0700 (Sun, 02 Sep 2007)
Log Message:
-----------
Fixed a bug in ObjParser which barfed if the mtl file is references but missing.
Fixed a bug in the integration tests around space membership which assumed that there were no existing memberships and confused the space owner web client with the member web client.
Added destruct and cleanup functions to template scripts, so that templates may tidy up during space shutdown or thing removal, respectively.
Modified Paths:
--------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/obj/ObjParser.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/obj/ObjParser.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/obj/ObjParser.java 2007-09-03 00:22:14 UTC (rev 342)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/obj/ObjParser.java 2007-09-03 00:22:17 UTC (rev 343)
@@ -49,7 +49,7 @@
this.geoProvider = geoProvider;
objStream = geoProvider.getGeometryStream(lodIndex);
- if(objStream == null) {
+ if (objStream == null) {
throw new IOException("No geometry from " + geoProvider);
}
objTokenizer = new LineTokenizer(objStream);
@@ -62,6 +62,7 @@
public Obj parse() throws ObjParseException, IOException {
String[] tokens = null;
while ((tokens = objTokenizer.readNextLine()) != null) {
+ toString(tokens);
if ("v".equals(tokens[0])) {
parseV(tokens);
} else if ("vt".equals(tokens[0])) {
@@ -102,9 +103,11 @@
}
String fileName = toString(tokens, 1, tokens.length - 1);
InputStream materialStream = geoProvider.getSubGeometryStream(fileName);
- MtlParser parser = new MtlParser(fileName, materialStream, geoProvider);
- ObjMtl mtl = parser.parse();
- obj.setMtl(mtl);
+ if (materialStream != null) {
+ MtlParser parser = new MtlParser(fileName, materialStream, geoProvider);
+ ObjMtl mtl = parser.parse();
+ obj.setMtl(mtl);
+ }
}
private void closeWorkingSmoothingGroup() {
@@ -177,7 +180,7 @@
private void parseG(String[] tokens) throws ObjParseException {
String groupName = "defaultGroup";
- if(tokens.length > 1) {
+ if (tokens.length > 1) {
groupName = tokens[1];
if (tokens.length >= 3) { //handle weird moving texture name in group line
if (tokens[1].indexOf("Texture") != -1) {
@@ -226,7 +229,7 @@
continue;
}
results[i] = Integer.parseInt(inputs[i]);
- if(results[i] < 0) {
+ if (results[i] < 0) {
results[i] = obj.vertexCount() + results[i] + 1; //handle relative negative indices (which I originally thought was non-spec)
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|