public class MaterialHelper extends AbstractBlenderHelper
Modifier and Type | Class and Description |
---|---|
static class |
MaterialHelper.DiffuseShader
The type of the material's diffuse shader.
|
static class |
MaterialHelper.SpecularShader
The type of the material's specular shader.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.Integer |
ALPHA_MASK_CIRCLE |
static java.lang.Integer |
ALPHA_MASK_CONE |
static java.lang.Integer |
ALPHA_MASK_HYPERBOLE |
static java.lang.Integer |
ALPHA_MASK_NONE |
protected java.util.Map<java.lang.Integer,com.jme3.scene.plugins.blender.materials.IAlphaMask> |
alphaMasks |
protected static float |
DEFAULT_SHININESS |
static java.lang.String |
TEXTURE_TYPE_ALPHA |
static java.lang.String |
TEXTURE_TYPE_COLOR |
static java.lang.String |
TEXTURE_TYPE_DIFFUSE |
static java.lang.String |
TEXTURE_TYPE_GLOW |
static java.lang.String |
TEXTURE_TYPE_LIGHTMAP |
static java.lang.String |
TEXTURE_TYPE_NORMAL |
static java.lang.String |
TEXTURE_TYPE_SPECULAR |
blenderContext, blenderVersion, fixUpAxis, upAxisRotationQuaternion
Constructor and Description |
---|
MaterialHelper(java.lang.String blenderVersion,
BlenderContext blenderContext)
This constructor parses the given blender version and stores the result.
|
Modifier and Type | Method and Description |
---|---|
MaterialContext[] |
getMaterials(Structure structureWithMaterials,
BlenderContext blenderContext)
This method returns the table of materials connected to the specified structure.
|
Material |
getParticlesMaterial(Material material,
java.lang.Integer alphaMaskIndex,
BlenderContext blenderContext)
This method converts the given material into particles-usable material.
|
void |
hsvToRgb(float h,
float s,
float v,
float[] rgb)
This method converts rgb values to hsv values.
|
void |
rgbToHsv(float r,
float g,
float b,
float[] hsv)
This method converts rgb values to hsv values.
|
MaterialContext |
toMaterialContext(Structure structure,
BlenderContext blenderContext)
This method converts the material structure to jme Material.
|
applyProperties, loadLibrary, loadProperties
protected static final float DEFAULT_SHININESS
public static final java.lang.String TEXTURE_TYPE_COLOR
public static final java.lang.String TEXTURE_TYPE_DIFFUSE
public static final java.lang.String TEXTURE_TYPE_NORMAL
public static final java.lang.String TEXTURE_TYPE_SPECULAR
public static final java.lang.String TEXTURE_TYPE_GLOW
public static final java.lang.String TEXTURE_TYPE_ALPHA
public static final java.lang.String TEXTURE_TYPE_LIGHTMAP
public static final java.lang.Integer ALPHA_MASK_NONE
public static final java.lang.Integer ALPHA_MASK_CIRCLE
public static final java.lang.Integer ALPHA_MASK_CONE
public static final java.lang.Integer ALPHA_MASK_HYPERBOLE
protected final java.util.Map<java.lang.Integer,com.jme3.scene.plugins.blender.materials.IAlphaMask> alphaMasks
public MaterialHelper(java.lang.String blenderVersion, BlenderContext blenderContext)
blenderVersion
- the version read from the blend fileblenderContext
- the blender contextpublic MaterialContext toMaterialContext(Structure structure, BlenderContext blenderContext) throws BlenderFileException
structure
- structure with material datablenderContext
- the blender contextBlenderFileException
- an exception is throw when problems with blend file occurpublic Material getParticlesMaterial(Material material, java.lang.Integer alphaMaskIndex, BlenderContext blenderContext)
material
- the source materialblenderContext
- the blender contextpublic MaterialContext[] getMaterials(Structure structureWithMaterials, BlenderContext blenderContext) throws BlenderFileException
structureWithMaterials
- the structure containing the mesh datablenderContext
- the blender contextBlenderFileException
- this exception is thrown when the blend file structure is somehow invalid or corruptedpublic void rgbToHsv(float r, float g, float b, float[] hsv)
r
- red value of the colorg
- green value of the colorb
- blue value of the colorhsv
- hsv values of a color (this table contains the result of the transformation)public void hsvToRgb(float h, float s, float v, float[] rgb)
h
- hues
- saturationv
- valuergb
- rgb result vector (should have 3 elements)