* OBJ loader now supports multiple spaces or tabs in between vertex/face specifications
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9146 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
512ebfaa1f
commit
f357a7e89f
@ -235,7 +235,7 @@ public final class OBJLoader implements AssetLoader {
|
|||||||
vertList.clear();
|
vertList.clear();
|
||||||
|
|
||||||
String line = scan.nextLine().trim();
|
String line = scan.nextLine().trim();
|
||||||
String[] verticies = line.split(" ");
|
String[] verticies = line.split("\\s ");
|
||||||
for (String vertex : verticies){
|
for (String vertex : verticies){
|
||||||
int v = 0;
|
int v = 0;
|
||||||
int vt = 0;
|
int vt = 0;
|
||||||
@ -243,17 +243,17 @@ public final class OBJLoader implements AssetLoader {
|
|||||||
|
|
||||||
String[] split = vertex.split("/");
|
String[] split = vertex.split("/");
|
||||||
if (split.length == 1){
|
if (split.length == 1){
|
||||||
v = Integer.parseInt(split[0]);
|
v = Integer.parseInt(split[0].trim());
|
||||||
}else if (split.length == 2){
|
}else if (split.length == 2){
|
||||||
v = Integer.parseInt(split[0]);
|
v = Integer.parseInt(split[0].trim());
|
||||||
vt = Integer.parseInt(split[1]);
|
vt = Integer.parseInt(split[1].trim());
|
||||||
}else if (split.length == 3 && !split[1].equals("")){
|
}else if (split.length == 3 && !split[1].equals("")){
|
||||||
v = Integer.parseInt(split[0]);
|
v = Integer.parseInt(split[0].trim());
|
||||||
vt = Integer.parseInt(split[1]);
|
vt = Integer.parseInt(split[1].trim());
|
||||||
vn = Integer.parseInt(split[2]);
|
vn = Integer.parseInt(split[2].trim());
|
||||||
}else if (split.length == 3){
|
}else if (split.length == 3){
|
||||||
v = Integer.parseInt(split[0]);
|
v = Integer.parseInt(split[0].trim());
|
||||||
vn = Integer.parseInt(split[2]);
|
vn = Integer.parseInt(split[2].trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
Vertex vx = new Vertex();
|
Vertex vx = new Vertex();
|
||||||
@ -297,9 +297,9 @@ public final class OBJLoader implements AssetLoader {
|
|||||||
Vector2f v = new Vector2f();
|
Vector2f v = new Vector2f();
|
||||||
|
|
||||||
String line = scan.nextLine().trim();
|
String line = scan.nextLine().trim();
|
||||||
String[] split = line.split(" ");
|
String[] split = line.split("\\s");
|
||||||
v.setX( Float.parseFloat(split[0]) );
|
v.setX( Float.parseFloat(split[0].trim()) );
|
||||||
v.setY( Float.parseFloat(split[1]) );
|
v.setY( Float.parseFloat(split[1].trim()) );
|
||||||
|
|
||||||
// v.setX(scan.nextFloat());
|
// v.setX(scan.nextFloat());
|
||||||
// if (scan.hasNextFloat()){
|
// if (scan.hasNextFloat()){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user