|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.jinx.video.model.ModelUtil
public class ModelUtil
Holds a bunch of utility methods for this package.
API Stability: Stable.
Method Summary | |
---|---|
static Material |
colorToMaterial(java.awt.Color c)
Constructs a Material using a well tested technique to convert a simple color to a Material. |
static Material |
colorToMaterial(java.awt.Color c,
float shine)
Constructs a Material using a well tested technique to convert a simple color to a Material. |
static Material |
colorToMaterial(float r,
float g,
float b)
Constructs a Material using a well tested technique to convert a simple color to a Material. |
static Material |
colorToMaterial(float r,
float g,
float b,
float a)
Constructs a Material using a well tested technique to convert a simple color to a Material. |
static Material |
colorToMaterial(float r,
float g,
float b,
float a,
float shine)
Constructs a Material using a well tested technique to convert a simple color to a Material. |
static Camera |
loadCamera(Hierarchy h)
Constructs a Camera object from the given Hierarchy. |
static Coloration |
loadColoration(Hierarchy h)
Constructs a Coloration object from the given Hierarchy. |
static DemoRotator |
loadDemoRotator(Hierarchy h,
Visible drawable)
Constructs a DemoRotator object from the given Hierarchy for the given Visible. |
static Light |
loadLight(Hierarchy h)
Constructs a Light object from the given Hierarchy. |
static Material |
loadMaterial(Hierarchy h)
Constructs a Material object from the given Hierarchy. |
static MeshElement |
loadMeshElement(Hierarchy h)
Constructs a MeshElement object from the given Hierarchy. |
static MeshElement |
loadMeshElement(Hierarchy h,
boolean reduce)
Constructs a MeshElement object from the given Hierarchy. |
static Model |
loadModel(Hierarchy h)
Constructs a Model object from the given Hierarchy. |
static Model[] |
loadModelPack(java.io.File jar,
TextureManager tm)
Parses a model pack jar file, loading textures and returning the Models. |
static Model[] |
loadModelPack(java.util.jar.JarFile jf,
TextureManager tm)
Parses a model pack jar file, loading textures and returning the Models. |
static Sphere |
loadSphere(Hierarchy h)
Constructs a Sphere object from the given Hierarchy. |
static float[][] |
loadVertexArray(Hierarchy h)
Same as loadVertexArray(Hierarchy, 3). |
static float[][] |
loadVertexArray(Hierarchy h,
int length)
Constructs a Vertex array from the given Hierarchy. |
static VertexColoration |
randomColoration(float[][] vertices,
Material[] sources,
float threshold)
Constructs a semi-random VertexColoration for the given vertices, using the given sources and threshold. |
static VertexColoration |
randomColoration(Model m,
Material[] sources,
float threshold)
Constructs a semi-random VertexColoration for the given Model, using the given sources and threshold. |
static void |
store(Hierarchy h,
Coloration coloration)
Stores a Coloration object to the given Hierarchy. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Material colorToMaterial(java.awt.Color c)
c
- the java.awt.Color object to convert.
return the Material.public static Material colorToMaterial(java.awt.Color c, float shine)
c
- the java.awt.Color object to convert.shine
- the shininess portion of the material.
return the Material.public static Material colorToMaterial(float r, float g, float b)
r
- the red component.g
- the green component.b
- the blue component.
public static Material colorToMaterial(float r, float g, float b, float a)
r
- the red component.g
- the green component.b
- the blue component.a
- the alpha component.
public static Material colorToMaterial(float r, float g, float b, float a, float shine)
r
- the red component.g
- the green component.b
- the blue component.a
- the alpha component.shine
- the shininess part of the material.
public static VertexColoration randomColoration(Model m, Material[] sources, float threshold)
m
- the Model.sources
- the array of Materials to use as the Materials that are
randomly distributed for the Model.threshold
- the probability that a color other than the first one in
the source array will be used. This allows the camoflage to be composed
of a base color along with patches of other colors.
public static VertexColoration randomColoration(float[][] vertices, Material[] sources, float threshold)
vertices
- the vertex array. See the VertexUtil class for more
information on vertex arrays.sources
- the array of Materials to use as the Materials that are
randomly distributed for the vertex array.threshold
- the probability that a color other than the first one in
the source array will be used. This allows the camoflage to be composed
of a base color along with patches of other colors.public static void store(Hierarchy h, Coloration coloration)
h
- the Hierarchy to store the Coloration to.public static Model loadModel(Hierarchy h)
h
- the Hierarchy to load the Model from.public static Model[] loadModelPack(java.io.File jar, TextureManager tm) throws java.io.IOException
jar
- the File to load models and textures from.tm
- the TextureManager to load the images into.
java.io.IOException
- if an I/O error occurs
java.lang.SecurityException
- if access is denied to jar.public static Model[] loadModelPack(java.util.jar.JarFile jf, TextureManager tm)
jf
- the JarFile to load models and textures from.tm
- the TextureManager to load the images into.
public static Coloration loadColoration(Hierarchy h)
h
- the Hierarchy to load the Coloration from.public static MeshElement loadMeshElement(Hierarchy h)
h
- the Hierarchy to load the MeshElement from.public static MeshElement loadMeshElement(Hierarchy h, boolean reduce)
h
- the Hierarchy to load the MeshElement from.reduce
- should the vertex array be reduced (as
VertexUtil.reduce(float[][]))? If true, this method may take alot of
time to complete.public static float[][] loadVertexArray(Hierarchy h)
public static float[][] loadVertexArray(Hierarchy h, int length)
h
- the Hierarchy to load the array from.public static Sphere loadSphere(Hierarchy h)
h
- the Hierarchy to load the Sphere from.public static DemoRotator loadDemoRotator(Hierarchy h, Visible drawable)
h
- the Hierarchy to load the Light from.drawable
- the Visible.public static Camera loadCamera(Hierarchy h)
h
- the Hierarchy to load the Camera from.public static Material loadMaterial(Hierarchy h)
h
- the Hierarchy to load the Material from.public static Light loadLight(Hierarchy h)
h
- the Hierarchy to load the Light from.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |