You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
764 B
35 lines
764 B
10 years ago
|
package com.mykaruga.models.wavefront.parser.obj;
|
||
|
|
||
|
|
||
|
import com.mykaruga.models.wavefront.loader.RenderModel;
|
||
|
import com.mykaruga.models.wavefront.loader.Vertex;
|
||
|
import com.mykaruga.models.wavefront.parser.LineParser;
|
||
|
|
||
|
|
||
|
|
||
|
public class VertexParser extends LineParser {
|
||
|
|
||
|
Vertex vertex = null;
|
||
|
|
||
|
public VertexParser() {}
|
||
|
|
||
|
@Override
|
||
|
public void parse() {
|
||
|
vertex = new Vertex();
|
||
|
|
||
|
try {
|
||
|
vertex.setX(Float.parseFloat(words[1]));
|
||
|
vertex.setY(Float.parseFloat(words[2]));
|
||
|
vertex.setZ(Float.parseFloat(words[3]));
|
||
|
} catch (Exception e) {
|
||
|
throw new RuntimeException("VertexParser Error");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void incoporateResults(RenderModel wavefrontObject) {
|
||
|
wavefrontObject.getVertices().add(vertex);
|
||
|
}
|
||
|
|
||
|
}
|