JavaView® v2.00.008

jv.loader
Class PgObjLoader

java.lang.Object
  |
  +--jv.loader.PgObjLoader

public class PgObjLoader
extends java.lang.Object

Loader for geometry files given in Wavefront's OBJ file format. This reader supports a subset of the commands, similar to the subset supported by Java3d. For details see the webpage on supported file formats.

Version:
18.02.00, 1.30 extended (sk) for field specific entries 27.11.99, 1.20 revised (kp) Parsing of elements and polygons separated.
22.11.99, 1.10 revised (kp) Check incomplete data, obj extended.
00.00.98, 1.00 created (kp)
Author:
Konrad Polthier, Samy Khadem-Al-Charieh

Field Summary
protected static boolean m_bElements
           
protected static boolean m_bPolygonColors
           
protected static boolean m_bPolygonNormals
           
protected static boolean m_bPolygons
           
protected static boolean m_bVertexNormals
           
protected static boolean m_bVertexTextures
           
protected static boolean m_bVertexVector
           
protected  int m_dimOfElements
          Dimension of elements.
protected  int m_dimOfPolygons
          Dimension of polygons.
protected  int[] m_meshType
          Mesh type information.
protected  int m_numElements
           
protected  int m_numMeshType
           
protected  int m_numPolygons
           
protected  int m_numVertexNormals
           
protected  int m_numVertexTextures
           
protected  int m_numVertexVectors
           
protected  int m_numVertices
           
protected  java.util.Vector m_vElement
          List of parsed elements, element connectivity.
protected  java.util.Vector m_vElementColor
          List of parsed element colors.
protected  PiVector m_vElementColorInd
          List of parsed element color indices.
protected  java.util.Vector m_vElementNormal
          List of parsed element normals.
protected  java.util.Vector m_vPolygon
          List of parsed polygons.
protected  java.util.Vector m_vPolygonColor
          List of parsed polygon colors.
protected  PiVector m_vPolygonColorInd
          List of parsed polygon color indices.
protected  java.util.Vector m_vVertex
          List of parsed vertices.
protected  java.util.Vector m_vVertexColor
          List of parsed vertex colors.
protected  PiVector m_vVertexColorInd
          List of parsed vertex color indices.
protected  java.util.Vector m_vVertexNormal
          List of parsed vertex normals.
protected  java.util.Vector m_vVertexTexture
          List of parsed vertex textures.
protected  java.util.Vector m_vVertexVector
          List of parsed vertex vectors or vertex used data.
 
Constructor Summary
PgObjLoader()
           
 
Method Summary
protected  boolean parse(java.io.BufferedReader bufReader)
          Parse a wavefront .obj file and fill instance variables of this class.
 PgJvxSrc read(java.io.BufferedReader in)
          Read geometry file in Wavefront's OBJ file format.
 PgJvxSrc read(java.lang.String fileName)
          Read geometry file in Wavefront's OBJ file format.
static java.lang.String write(PgJvxSrc geom)
           
protected static java.lang.String writeElements(int num, PiVector[] element)
          Write list of elements and element normals into string.
protected static java.lang.String writePdVectors(java.lang.String type, java.lang.String id, int num, PdVector[] vector)
          Write list of double vectors into string.
protected static java.lang.String writePolygons(int num, PiVector[] polygon)
          Write list of polygons and polygon normals into string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_numVertices

protected int m_numVertices

m_numVertexNormals

protected int m_numVertexNormals

m_numVertexTextures

protected int m_numVertexTextures

m_numVertexVectors

protected int m_numVertexVectors

m_numPolygons

protected int m_numPolygons

m_numElements

protected int m_numElements

m_numMeshType

protected int m_numMeshType

m_vVertex

protected java.util.Vector m_vVertex
List of parsed vertices.

m_vVertexColor

protected java.util.Vector m_vVertexColor
List of parsed vertex colors.

m_vVertexColorInd

protected PiVector m_vVertexColorInd
List of parsed vertex color indices.

m_vVertexNormal

protected java.util.Vector m_vVertexNormal
List of parsed vertex normals.

m_vVertexTexture

protected java.util.Vector m_vVertexTexture
List of parsed vertex textures.

m_vVertexVector

protected java.util.Vector m_vVertexVector
List of parsed vertex vectors or vertex used data.

m_meshType

protected int[] m_meshType
Mesh type information.

m_dimOfElements

protected int m_dimOfElements
Dimension of elements.

m_vElement

protected java.util.Vector m_vElement
List of parsed elements, element connectivity.

m_vElementColor

protected java.util.Vector m_vElementColor
List of parsed element colors.

m_vElementColorInd

protected PiVector m_vElementColorInd
List of parsed element color indices.

m_vElementNormal

protected java.util.Vector m_vElementNormal
List of parsed element normals.

m_dimOfPolygons

protected int m_dimOfPolygons
Dimension of polygons.

m_vPolygon

protected java.util.Vector m_vPolygon
List of parsed polygons.

m_vPolygonColor

protected java.util.Vector m_vPolygonColor
List of parsed polygon colors.

m_vPolygonColorInd

protected PiVector m_vPolygonColorInd
List of parsed polygon color indices.

m_bVertexNormals

protected static boolean m_bVertexNormals

m_bVertexTextures

protected static boolean m_bVertexTextures

m_bVertexVector

protected static boolean m_bVertexVector

m_bElements

protected static boolean m_bElements

m_bPolygons

protected static boolean m_bPolygons

m_bPolygonColors

protected static boolean m_bPolygonColors

m_bPolygonNormals

protected static boolean m_bPolygonNormals
Constructor Detail

PgObjLoader

public PgObjLoader()
Method Detail

read

public PgJvxSrc read(java.lang.String fileName)
Read geometry file in Wavefront's OBJ file format.

read

public PgJvxSrc read(java.io.BufferedReader in)
Read geometry file in Wavefront's OBJ file format.

parse

protected boolean parse(java.io.BufferedReader bufReader)
                 throws java.io.IOException
Parse a wavefront .obj file and fill instance variables of this class. This is a helper routine of read.
See Also:
PgObjLoader#read(PgGeometry, String)

write

public static java.lang.String write(PgJvxSrc geom)

writePdVectors

protected static java.lang.String writePdVectors(java.lang.String type,
                                                 java.lang.String id,
                                                 int num,
                                                 PdVector[] vector)
Write list of double vectors into string. Numbers with absolute value less than EPS are shown as zero. This avoids the annoying fact that double precision numbers fill the whole text area hiding the exponent, which hides their small value.

writeElements

protected static java.lang.String writeElements(int num,
                                                PiVector[] element)
Write list of elements and element normals into string. Numbers with absolute value less than EPS are shown as zero. This avoids the anoying fact that double precision numbers fill the whole text area hiding the exponent, which hides their small value.

writePolygons

protected static java.lang.String writePolygons(int num,
                                                PiVector[] polygon)
Write list of polygons and polygon normals into string. Numbers with absolute value less than EPS are shown as zero. This avoids the anoying fact that double precision numbers fill the whole text area hiding the exponent, which hides their small value.

JavaView® v2.00.008

The software JavaView® is copyright protected. All Rights Reserved.