|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object glmodel.GLMaterialLib
public class GLMaterialLib
Loads a library of materials from a .mtl file into an array of GLMaterial objects.
Field Summary | |
---|---|
java.lang.String |
filename
|
java.lang.String |
filepath
|
Constructor Summary | |
---|---|
GLMaterialLib(java.lang.String mtlFilename)
|
Method Summary | |
---|---|
GLMaterial |
find(java.lang.String materialName)
find a material by name in an array of GLMaterial objects |
int |
findID(java.lang.String materialName)
find a material by name in an array of GLMaterial objects return the array index of the material |
GLMaterial |
getClone(GLMaterial mtl)
return a duplicate of this material. |
GLMaterial[] |
loadMaterials(java.io.BufferedReader br)
MTL file format in a nutshell: |
GLMaterial[] |
loadMaterials(java.lang.String mtlFilename)
|
void |
write(java.io.PrintWriter out,
GLMaterial mtl)
Write one material. |
void |
writeLibe(GLMaterial[] mtls,
java.io.PrintWriter out)
|
void |
writeLibe(GLMaterial[] mtls,
java.lang.String filename)
Write an array of GLMaterial objects to a .mtl file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public java.lang.String filepath
public java.lang.String filename
Constructor Detail |
---|
public GLMaterialLib(java.lang.String mtlFilename)
Method Detail |
---|
public GLMaterial[] loadMaterials(java.lang.String mtlFilename)
public GLMaterial[] loadMaterials(java.io.BufferedReader br)
newmtl white // begin material and specify name Kd 1.0 1.0 1.0 // diffuse rgb Ka 0.2 0.2 0.2 // ambient rgb Ks 0.6 0.6 0.6 // specular rgb Ns 300 // shininess 0-1000 d 0.5 // alpha 0-1 map_Kd texture.jpg // texture file // blank line ends material definition
public void writeLibe(GLMaterial[] mtls, java.lang.String filename)
mtls
- array of materials to write to filefilename
- name of .mtl filepublic void writeLibe(GLMaterial[] mtls, java.io.PrintWriter out)
public void write(java.io.PrintWriter out, GLMaterial mtl)
public GLMaterial getClone(GLMaterial mtl)
public GLMaterial find(java.lang.String materialName)
public int findID(java.lang.String materialName)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |