Class TextureUnit
- java.lang.Object
-
- be.yildizgames.module.graphic.material.TextureUnit
-
public abstract class TextureUnit extends Object
A texture unit is the base part of a material.- Author:
- Grégory Van Den Borre
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTextureUnit.ColorOperationPossible color operations.static classTextureUnit.LayerBlendOperationExPossible layer blend operations.static classTextureUnit.LayerBlendSourcePossible layer blend sources.static classTextureUnit.TextureFilterFilter to apply on texture.
-
Constructor Summary
Constructors Modifier Constructor Description protectedTextureUnit()Protected constructor, only called from children.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidscroll(float x, float y)Set the unit animation scroll speed.abstract voidsetAlphaOperation(TextureUnit.LayerBlendOperationEx operation, TextureUnit.LayerBlendSource source1, TextureUnit.LayerBlendSource source2)Set alpha operation.voidsetColor(be.yildizgames.module.color.Color color)abstract voidsetColorOperation(TextureUnit.ColorOperation op)Set the unit color operation.abstract voidsetColorOperationEx(TextureUnit.LayerBlendOperationEx op, TextureUnit.LayerBlendSource src1, TextureUnit.LayerBlendSource src2)Set the unit color operation.abstract voidsetColorOperationEx(TextureUnit.LayerBlendOperationEx op, TextureUnit.LayerBlendSource source1, TextureUnit.LayerBlendSource source2, be.yildizgames.module.color.Color color)Set the unit color operation.abstract voidsetCoordinateSet(int set)voidsetScale(float scale)Scale uniformly the texture.voidsetScale(float xScale, float yScale)Scale the texture.protected abstract voidsetScaleImpl(float xScale, float yScale)Call implementation to set the scale.TextureUnitsetTexture(String path)Set a new texture.abstract TextureUnitsetTextureAnimated(String basePath, int numberOfFrames, int duration)protected abstract voidsetTextureImpl(String path)Call implementation to set the texture.
-
-
-
Method Detail
-
setTexture
public final TextureUnit setTexture(String path)
Set a new texture.- Parameters:
path- Image path.- Returns:
- This object.
-
setTextureAnimated
public abstract TextureUnit setTextureAnimated(String basePath, int numberOfFrames, int duration)
- Parameters:
basePath- Image path, expected format is path/name.extension, and the files will be path/nameX.extension, X being the image number(0,1,...). i.e. for files img0.tga, img1.tga..., path is img.tga.numberOfFrames- Number of frames to play.duration- Animation duration, in seconds.- Returns:
- This object.
-
setColorOperation
public abstract void setColorOperation(TextureUnit.ColorOperation op)
Set the unit color operation.- Parameters:
op- Color operation.
-
setColorOperationEx
public abstract void setColorOperationEx(TextureUnit.LayerBlendOperationEx op, TextureUnit.LayerBlendSource src1, TextureUnit.LayerBlendSource src2)
Set the unit color operation.- Parameters:
op- Color operation.src1- Operation source 1.src2- Operation source 2.
-
setColorOperationEx
public abstract void setColorOperationEx(TextureUnit.LayerBlendOperationEx op, TextureUnit.LayerBlendSource source1, TextureUnit.LayerBlendSource source2, be.yildizgames.module.color.Color color)
Set the unit color operation.- Parameters:
op- Color operation.source1- Operation source 1.source2- Operation source 2.color- Color to set.
-
scroll
public abstract void scroll(float x, float y)Set the unit animation scroll speed.- Parameters:
x- Animation X speed.y- Animation Y speed.
-
setScale
public final void setScale(float scale)
Scale uniformly the texture.- Parameters:
scale- Scale factor.
-
setScale
public final void setScale(float xScale, float yScale)Scale the texture.- Parameters:
xScale- Scale factor for width.yScale- Scale factor for height.
-
setScaleImpl
protected abstract void setScaleImpl(float xScale, float yScale)Call implementation to set the scale.- Parameters:
xScale- Width scale.yScale- Height scale.
-
setTextureImpl
protected abstract void setTextureImpl(String path)
Call implementation to set the texture.- Parameters:
path- Image path.
-
setAlphaOperation
public abstract void setAlphaOperation(TextureUnit.LayerBlendOperationEx operation, TextureUnit.LayerBlendSource source1, TextureUnit.LayerBlendSource source2)
Set alpha operation.- Parameters:
operation- Alpha operation.source1- Operation source 1.source2- Operation source 2.
-
setCoordinateSet
public abstract void setCoordinateSet(int set)
-
setColor
public final void setColor(be.yildizgames.module.color.Color color)
-
-