|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectglmodel.GLModel
public class GLModel
This class loads and renders a mesh from an OBJ file format. The mesh can have multiple materials, including texture images. Uses GL_Mesh to load a .obj file and GLMaterialLIb to load the .mtl file. It assumes the .obj .mtl and any texture images are present in the same folder. Also has a function, renderTextured() to draw a mesh with no groups or materials. The entire mesh will be drawn as one group of triangles with one texture.
| Field Summary | |
|---|---|
static GLMaterial |
defaultMtl
|
int |
displayListID
|
GLMaterial[] |
groupMaterials
|
GL_Mesh |
mesh
|
| Constructor Summary | |
|---|---|
GLModel(java.lang.String filename)
|
|
| Method Summary | |
|---|---|
int |
getDisplayListID()
return the display list ID created by makeDisplayList() |
GL_Mesh |
loadMesh(java.lang.String filename)
read the given .obj file into a GL_Mesh object |
void |
makeDisplayList()
Render mesh into a displaylist and store the listID in the flowercenter object. |
void |
regenerateNormals()
recalculate normals on the mesh object |
void |
render()
Draw the model. |
void |
render(GL_Mesh m)
Render a mesh with materials. |
void |
renderGroup(java.lang.String groupName)
Draw one group from the mesh. |
void |
renderMeshNormals()
|
void |
renderTextured(int textureHandle)
This is a simple way to render a mesh with no materials. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static GLMaterial defaultMtl
public GL_Mesh mesh
public int displayListID
public GLMaterial[] groupMaterials
| Constructor Detail |
|---|
public GLModel(java.lang.String filename)
| Method Detail |
|---|
public GL_Mesh loadMesh(java.lang.String filename)
filename - (must end in .obj)
public void makeDisplayList()
PR - PetalRing to drawpublic int getDisplayListID()
public void regenerateNormals()
GL_Mesh.regenerateNormals(),
GL_Mesh.setSmoothingAngle()public void render()
public void renderGroup(java.lang.String groupName)
groupName - name of group (from obj file)public void renderTextured(int textureHandle)
o - mesh object to renderpublic void render(GL_Mesh m)
public void renderMeshNormals()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||