public class PolygonObjParser extends AbstractObjParser
Modifier and Type | Class and Description |
---|---|
static class |
PolygonObjParser.Face
Class representing an OBJ face definition.
|
static class |
PolygonObjParser.VertexAttributes
Class representing a set of attributes for a face vertex.
|
Constructor and Description |
---|
PolygonObjParser(Reader reader)
Construct a new instance for parsing OBJ content from the given reader.
|
PolygonObjParser(SimpleTextParser parser)
Construct a new instance for parsing OBJ content from the given text parser.
|
Modifier and Type | Method and Description |
---|---|
int |
getTextureCoordinateCount()
Get the number of
texture coordinate keywords parsed
so far. |
int |
getVertexCount()
Get the number of
vertex keywords parsed
so far. |
int |
getVertexNormalCount()
Get the number of
vertex normal keywords parsed
so far. |
protected void |
handleKeyword(String keywordValue)
Method called when a keyword is encountered in the parsed OBJ content.
|
boolean |
isFailOnNonPolygonKeywords()
Return true if the instance is configured to throw an
IllegalStateException when OBJ keywords
not commonly used with files containing only polygon data are encountered. |
PolygonObjParser.Face |
readFace()
Read an OBJ face definition from the current line.
|
void |
setFailOnNonPolygonKeywords(boolean failOnNonPolygonKeywords)
Set the flag determining if the instance should throw an
IllegalStateException when encountering
keywords not commonly used with OBJ files containing only polygon data. |
discardDataLine, discardDataLineWhitespace, getCurrentKeyword, getTextParser, nextDataLineContent, nextDouble, nextKeyword, readDataLine, readDoubles, readVector
public PolygonObjParser(Reader reader)
reader
- reader to parser content frompublic PolygonObjParser(SimpleTextParser parser)
parser
- text parser to read content frompublic int getVertexCount()
vertex keywords
parsed
so far.public int getVertexNormalCount()
vertex normal keywords
parsed
so far.public int getTextureCoordinateCount()
texture coordinate keywords
parsed
so far.public boolean isFailOnNonPolygonKeywords()
IllegalStateException
when OBJ keywords
not commonly used with files containing only polygon data are encountered. The default value is false
,
meaning that no keyword validation is performed. When set to true, only the following keywords are
accepted:
v
vn
vt
f
o
g
s
mtllib
usemtl
public void setFailOnNonPolygonKeywords(boolean failOnNonPolygonKeywords)
IllegalStateException
when encountering
keywords not commonly used with OBJ files containing only polygon data. If true, only the following keywords
are accepted:
v
vn
vt
f
o
g
s
mtllib
usemtl
failOnNonPolygonKeywords
- new flag valueprotected void handleKeyword(String keywordValue)
handleKeyword
in class AbstractObjParser
keywordValue
- keyword encountered in the OBJ contentpublic PolygonObjParser.Face readFace()
IllegalStateException
- if a face definition is not able to be parsedUncheckedIOException
- if an I/O error occursCopyright © 2016–2021 The Apache Software Foundation. All rights reserved.