es.ucm.look.ar.ar3D.parser
Class MeshObjParser

java.lang.Object
  extended by es.ucm.look.ar.ar3D.parser.MeshObjParser

public class MeshObjParser
extends java.lang.Object

A parser for *.obj 3D files. It supports vertices, faces, normals and textures. It does NOT support materials


Constructor Summary
MeshObjParser()
           
 
Method Summary
 Point3 getCenter()
          Returns the center point for the mesh
 short[] getFaceIndeces()
          Returns the faces array, in the form { f1.v1, f1.v2, f1.v3, f2.v1, f2.v2, f2.v3... } and so on
 java.lang.String getName()
          Returns mesh name
 float[] getNormals()
          Returns the normals array, in the form { n1.x, n1.y, n1.z, n2.x, n2.y, ... } and so on
 float getRadius()
          Returns the radius of the sphere that, with its center in getCenter(), contains all the mesh
 float[] getTextureCoords()
          Returns the texture vertices array, in the form { t1.x, t1.y, t2.x, t2.y, ... } and so on
 float[] getVertices()
          Returns the vertex array, in the form { v1.x, v1.y, v1.z, v2.x, v2.y, v2.z ... } and so on
 boolean parse(java.io.InputStream input)
          Parse an *.obj file and fill vertex arrays, which can be accessed by getVertices(), getNormals(), etc
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MeshObjParser

public MeshObjParser()
Method Detail

getCenter

public Point3 getCenter()
Returns the center point for the mesh

Returns:
the center point for the mesh

getFaceIndeces

public short[] getFaceIndeces()
Returns the faces array, in the form { f1.v1, f1.v2, f1.v3, f2.v1, f2.v2, f2.v3... } and so on

Returns:
the faces array

getName

public java.lang.String getName()
Returns mesh name

Returns:
mesh name

getNormals

public float[] getNormals()
Returns the normals array, in the form { n1.x, n1.y, n1.z, n2.x, n2.y, ... } and so on

Returns:
the normals array

getRadius

public float getRadius()
Returns the radius of the sphere that, with its center in getCenter(), contains all the mesh

Returns:

getTextureCoords

public float[] getTextureCoords()
Returns the texture vertices array, in the form { t1.x, t1.y, t2.x, t2.y, ... } and so on

Returns:
the texture vertices array

getVertices

public float[] getVertices()
Returns the vertex array, in the form { v1.x, v1.y, v1.z, v2.x, v2.y, v2.z ... } and so on

Returns:
the vertex array

parse

public boolean parse(java.io.InputStream input)
Parse an *.obj file and fill vertex arrays, which can be accessed by getVertices(), getNormals(), etc

Parameters:
resources - General resources from the app
resourceId - Resource id
Returns:
true if everything was OK