public class TextureHelper extends AbstractBlenderHelper
Modifier and Type | Field and Description |
---|---|
static int |
TEX_BLEND |
static int |
TEX_CLOUDS |
static int |
TEX_DISTNOISE |
static int |
TEX_ENVMAP |
static int |
TEX_IMAGE |
static int |
TEX_MAGIC |
static int |
TEX_MARBLE |
static int |
TEX_MUSGRAVE |
static int |
TEX_NOISE |
static int |
TEX_NONE |
static int |
TEX_OCEAN |
static int |
TEX_PLUGIN |
static int |
TEX_POINTDENSITY |
static int |
TEX_STUCCI |
static int |
TEX_VORONOI |
static int |
TEX_VOXELDATA |
static int |
TEX_WOOD |
static VertexBuffer.Type[] |
TEXCOORD_TYPES |
blenderContext, blenderVersion, fixUpAxis, upAxisRotationQuaternion
Constructor and Description |
---|
TextureHelper(java.lang.String blenderVersion,
BlenderContext blenderContext)
This constructor parses the given blender version and stores the result.
|
Modifier and Type | Method and Description |
---|---|
java.awt.geom.AffineTransform |
createAffineTransform(Vector2f[] source,
Vector2f[] dest,
int[] sourceSize,
int[] targetSize)
This method creates the affine transform that is used to transform a
triangle defined by one UV coordinates into a triangle defined by
different UV's.
|
int |
getPixelPosition(float pos,
int size)
This method returns the proper pixel position on the image.
|
Image |
getSubimage(Image image,
int minX,
int minY,
int maxX,
int maxY)
This method returns subimage of the give image.
|
Texture |
getTexture(Structure textureStructure,
Structure mTex,
BlenderContext blenderContext)
This class returns a texture read from the file or from packed blender
data.
|
Texture |
loadImageAsTexture(Structure imageStructure,
int imaflag,
BlenderContext blenderContext)
This class returns a texture read from the file or from packed blender
data.
|
protected Texture |
loadImageFromFile(java.lang.String name,
int imaflag,
BlenderContext blenderContext)
This method loads the texture from outside the blend file using the
AssetManager that the blend file was loaded with.
|
java.util.List<CombinedTexture> |
readTextureData(Structure structure,
float[] diffuseColorArray,
boolean skyTexture)
Reads the texture data from the given material or sky structure.
|
applyProperties, loadLibrary, loadProperties
public static final int TEX_NONE
public static final int TEX_CLOUDS
public static final int TEX_WOOD
public static final int TEX_MARBLE
public static final int TEX_MAGIC
public static final int TEX_BLEND
public static final int TEX_STUCCI
public static final int TEX_NOISE
public static final int TEX_IMAGE
public static final int TEX_PLUGIN
public static final int TEX_ENVMAP
public static final int TEX_MUSGRAVE
public static final int TEX_VORONOI
public static final int TEX_DISTNOISE
public static final int TEX_POINTDENSITY
public static final int TEX_VOXELDATA
public static final int TEX_OCEAN
public static final VertexBuffer.Type[] TEXCOORD_TYPES
public TextureHelper(java.lang.String blenderVersion, BlenderContext blenderContext)
blenderVersion
- the version read from the blend fileblenderContext
- the blender contextpublic Texture getTexture(Structure textureStructure, Structure mTex, BlenderContext blenderContext) throws BlenderFileException
textureStructure
- texture structure filled with datablenderContext
- the blender contextBlenderFileException
- this exception is thrown when the blend file structure is
somehow invalid or corruptedpublic Texture loadImageAsTexture(Structure imageStructure, int imaflag, BlenderContext blenderContext) throws BlenderFileException
imageStructure
- image structure filled with dataimaflag
- the image flagblenderContext
- the blender contextBlenderFileException
- this exception is thrown when the blend file structure is
somehow invalid or corruptedpublic java.awt.geom.AffineTransform createAffineTransform(Vector2f[] source, Vector2f[] dest, int[] sourceSize, int[] targetSize)
source
- source UV coordinatesdest
- target UV coordinatessourceSize
- the width and height of the source imagetargetSize
- the width and height of the target imagepublic int getPixelPosition(float pos, int size)
pos
- the relative position (value of range [0, 1] (both inclusive))size
- the size of the line the pixel lies on (width, height or
depth)public Image getSubimage(Image image, int minX, int minY, int maxX, int maxY)
image
- the image to be subimagedminX
- minimum X positionminY
- minimum Y positionmaxX
- maximum X positionmaxY
- maximum Y positionprotected Texture loadImageFromFile(java.lang.String name, int imaflag, BlenderContext blenderContext)
name
- the path to the imageimaflag
- the image flagblenderContext
- the blender contextpublic java.util.List<CombinedTexture> readTextureData(Structure structure, float[] diffuseColorArray, boolean skyTexture) throws BlenderFileException
structure
- the structure of material or skydiffuseColorArray
- array of diffuse colorsskyTexture
- indicates it we're going to read sky texture or notBlenderFileException
- an exception is thrown when problems with reading the blend file occur