|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectzombie.core.textures.Texture
public class Texture
Nested Class Summary | |
---|---|
static class |
Texture.PZFileformat
|
Field Summary | |
---|---|
static boolean |
autoCreateMask
indicates if all the texture will auto create the masks on load The auto creation works only with the getTexture() methods |
static boolean |
bDoingQuad
|
static int |
BindCount
|
boolean |
flip
|
static float |
la
|
static float |
lb
|
static float |
lg
|
static float |
lr
|
float |
offsetX
|
float |
offsetY
|
static int |
renderQuadBatchCount
|
static int |
startStack
|
static boolean |
WarnFailFindTexture
|
float |
xEnd
internal texture coordinates it's used to get the max border of texture... |
float |
xStart
internal texture coordinates it's used to get the max border of texture... |
float |
yEnd
internal texture coordinates it's used to get the max border of texture... |
float |
yStart
internal texture coordinates it's used to get the max border of texture... |
Constructor Summary | |
---|---|
Texture()
creates an emptiy texture and adds it to the game engine's texture list |
|
Texture(java.awt.image.BufferedImage bImage,
java.lang.String name)
|
|
Texture(int width,
int height)
create a new empty texture. |
|
Texture(int width,
int height,
java.lang.String name)
create a new empty texture. |
|
Texture(java.lang.String file)
LOADS and crete a texture from a file |
|
Texture(java.lang.String file,
boolean useAlphaChannel)
LOADS and crete a texture from a file |
|
Texture(java.lang.String file,
boolean bDelete,
boolean bUseAlpha)
|
|
Texture(java.lang.String name,
java.io.BufferedInputStream b,
boolean bDoMask)
|
|
Texture(java.lang.String name,
java.io.BufferedInputStream b,
boolean bDoMask,
Texture.PZFileformat format)
|
|
Texture(java.lang.String name,
int[] palette)
|
|
Texture(java.lang.String file,
int red,
int green,
int blue)
loads and create a texture from a file and cretes as trasparent the section that have the color equal to the RGB valued spefied |
|
Texture(java.lang.String name,
java.lang.String palette)
|
|
Texture(Texture t)
creates a copy of an existent texture |
|
Texture(TextureID data,
java.lang.String name)
|
Method Summary | |
---|---|
void |
bind()
Blinds the image |
void |
bind(int unit)
bind the current texture object in the specified texture unit |
static void |
bindNone()
|
void |
bindstrip(float a,
float r,
float g,
float b)
|
void |
bindstrip(int unit,
float a,
float r,
float g,
float b)
|
static void |
clearTextures()
|
void |
copyMaskRegion(Texture from,
int x,
int y,
int width,
int height)
|
void |
createMask()
creates the mask of collisions |
void |
createMask(boolean[] mask)
|
void |
createMask(WrappedBuffer buf)
|
void |
destroy()
destroys the image and release all resources |
boolean |
equals(Texture other)
|
WrappedBuffer |
getData()
returns the texture's pixel in a ByteBuffer EXAMPLE: ByteBuffer bb = getData(); byte r, g, b; bb.rewind(); //<-- IMPORTANT!! try { while (true) { bb.mark(); r = bb.get(); g = bb.get(); b = bb.get(); bb.reset(); bb.put((byte)(r+red)); bb.put((byte)(g+green)); bb.put((byte)(b+blue)); bb.get(); // alpha catch (Exception e) { setData(bb); |
int |
getHeight()
returns the height of image |
int |
getHeightHW()
return the height hardware of image |
int |
getHeightOrig()
|
int |
getID()
returns the ID of image in the Vram |
Mask |
getMask()
returns the mask of collisions |
java.lang.String |
getName()
|
static Texture |
getSharedTexture(java.lang.String name)
|
static Texture |
getSharedTexture(java.lang.String name,
boolean bDeleteData)
|
static Texture |
getSharedTexture(java.lang.String name,
int[] palette,
java.lang.String paletteName)
|
static Texture |
getSharedTexture(java.lang.String name,
java.lang.String palette)
|
static Texture |
getTexture(java.lang.String name)
gets a texture from it's name; If the texture isn't already loaded this method will load it. |
TextureID |
getTextureId()
|
boolean |
getUseAlphaChannel()
indicates if the image will use the alpha channel or note |
int |
getWidth()
returns the width of image |
int |
getWidthHW()
return the width Hardware of image |
int |
getWidthOrig()
|
float |
getXEnd()
returns the end X-coordinate |
float |
getXStart()
returns the start X-coordinate |
float |
getYEnd()
returns the end Y-coordinate |
float |
getYStart()
returns the start Y-coordinate |
boolean |
isCollisionable()
indicates if the texture has a mask of collisions or not |
boolean |
isDestroyed()
returns if the texture is destroyed or not |
boolean |
isSolid()
indicates if the texture is solid or not. a non solid texture is a texture that containe an alpha channel |
boolean |
isValid()
|
void |
Load(java.awt.image.BufferedImage image)
|
void |
loadMaskRegion(java.nio.ByteBuffer cache)
|
void |
makeTransp(int red,
int green,
int blue)
sets transparent each pixel that it's equal to the red, green blue value specified |
void |
render(int x,
int y)
|
void |
render(int x,
int y,
int width,
int height)
|
void |
render(int x,
int y,
int width,
int height,
float r,
float g,
float b,
float a)
|
void |
renderdiamond(int x,
int y,
int width,
int height,
float u,
float d,
float l,
float r,
float a)
|
void |
renderdiamond(int x,
int y,
int width,
int height,
float ru,
float gu,
float bu,
float au,
float rd,
float gd,
float bd,
float ad,
float rl,
float gl,
float bl,
float al,
float rr,
float gr,
float br,
float ar)
|
void |
renderdiamond(int x,
int y,
int width,
int height,
int u,
int d,
int l,
int r)
|
void |
renderroofw(int x,
int y,
int width,
int height,
float ru,
float gu,
float bu,
float au,
float rd,
float gd,
float bd,
float ad,
float ru2,
float gu2,
float bu2,
float au2,
float rd2,
float gd2,
float bd2,
float ad2)
|
void |
rendershader(int x,
int y,
int width,
int height,
float r,
float g,
float b,
float a)
|
void |
renderstrip(int x,
int y,
int width,
int height,
float r,
float g,
float b,
float a)
|
void |
renderTest(int x,
int y)
|
void |
renderwalln(int x,
int y,
int width,
int height,
float ru,
float gu,
float bu,
float au,
float rd,
float gd,
float bd,
float ad,
float ru2,
float gu2,
float bu2,
float au2,
float rd2,
float gd2,
float bd2,
float ad2)
|
void |
renderwalln(int x,
int y,
int width,
int height,
int u,
int d,
int u2,
int d2)
|
void |
renderwallw(int x,
int y,
int width,
int height,
float ru,
float gu,
float bu,
float au,
float rd,
float gd,
float bd,
float ad,
float ru2,
float gu2,
float bu2,
float au2,
float rd2,
float gd2,
float bd2,
float ad2)
|
void |
renderwallw(int x,
int y,
int width,
int height,
int u,
int d,
int u2,
int d2)
|
void |
saveMask(java.lang.String name)
|
void |
saveMaskRegion(java.nio.ByteBuffer cache)
|
void |
setAlphaForeach(int red,
int green,
int blue,
int alpha)
sets the specified alpha for each pixel that it's equal to the red, green blue value specified |
void |
setCustomizedTexture()
|
void |
setData(java.nio.ByteBuffer data)
sets the texture's pixel from a ByteBuffer EXAMPLE: ByteBuffer bb = getData(); byte r, g, b; bb.rewind(); //<-- IMPORTANT!! try { while (true) { bb.mark(); r = bb.get(); g = bb.get(); b = bb.get(); bb.reset(); bb.put((byte)(r+red)); bb.put((byte)(g+green)); bb.put((byte)(b+blue)); bb.get(); // alpha catch (Exception e) { setData(bb); |
void |
setMask(Mask mask)
sets the mask of collisions |
void |
setName(java.lang.String name)
|
void |
setRegion(int x,
int y,
int width,
int height)
sets the region of the image |
void |
setUseAlphaChannel(boolean value)
indicates if the texture contains the alpha channel or not |
Texture |
split(int xOffset,
int yOffset,
int width,
int height)
|
Texture[] |
split(int xOffset,
int yOffset,
int row,
int coloumn,
int width,
int height,
int spaceX,
int spaceY)
|
Texture[][] |
split2D(int[] xstep,
int[] ystep)
|
java.lang.String |
toString()
|
static Texture |
trygetTexture(java.lang.String name)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static boolean autoCreateMask
public static int BindCount
public static int renderQuadBatchCount
public static int startStack
public static boolean bDoingQuad
public static float lr
public static float lg
public static float lb
public static float la
public boolean flip
public float offsetX
public float offsetY
public float xEnd
public float yEnd
public float xStart
public float yStart
public static boolean WarnFailFindTexture
Constructor Detail |
---|
public Texture(TextureID data, java.lang.String name)
public Texture(java.awt.image.BufferedImage bImage, java.lang.String name)
public Texture(java.lang.String file)
file
- relative pathpublic Texture(java.lang.String name, java.io.BufferedInputStream b, boolean bDoMask, Texture.PZFileformat format)
public Texture(java.lang.String name, java.io.BufferedInputStream b, boolean bDoMask)
public Texture(java.lang.String file, boolean bDelete, boolean bUseAlpha)
public Texture(java.lang.String name, java.lang.String palette)
public Texture(java.lang.String name, int[] palette)
public Texture(java.lang.String file, boolean useAlphaChannel)
file
- relative pathuseAlphaChannel
- indicates if the image should use or not the alpha channelpublic Texture(int width, int height, java.lang.String name)
width
- size of textureheight
- size of texturepublic Texture(int width, int height)
width
- size of textureheight
- size of texturepublic Texture(java.lang.String file, int red, int green, int blue)
file
- relative pathred
- red value to comparegreen
- green value to compareblue
- blue value to comparepublic Texture(Texture t)
t
- original texturepublic Texture()
Method Detail |
---|
public void Load(java.awt.image.BufferedImage image)
public static void bindNone()
public static void clearTextures()
public static Texture getSharedTexture(java.lang.String name)
public static Texture getSharedTexture(java.lang.String name, boolean bDeleteData)
public static Texture trygetTexture(java.lang.String name)
public static Texture getSharedTexture(java.lang.String name, java.lang.String palette)
public static Texture getSharedTexture(java.lang.String name, int[] palette, java.lang.String paletteName)
public static Texture getTexture(java.lang.String name)
name
- the name of texture
public void bind()
bind
in interface ITexture
public void bind(int unit)
ITexture
bind
in interface ITexture
unit
- the texture unit in witch the current TextureObject will be bindedpublic void bindstrip(float a, float r, float g, float b)
public void bindstrip(int unit, float a, float r, float g, float b)
public void copyMaskRegion(Texture from, int x, int y, int width, int height)
public void createMask()
public void createMask(boolean[] mask)
public void createMask(WrappedBuffer buf)
public void destroy()
destroy
in interface IDestroyable
public boolean equals(Texture other)
public WrappedBuffer getData()
getData
in interface ITexture
public int getHeight()
ITexture
getHeight
in interface ITexture
public int getHeightHW()
ITexture
getHeightHW
in interface ITexture
public int getHeightOrig()
public int getID()
ITexture
getID
in interface ITexture
public Mask getMask()
getMask
in interface IMaskerable
public java.lang.String getName()
public TextureID getTextureId()
public boolean getUseAlphaChannel()
public int getWidth()
ITexture
getWidth
in interface ITexture
public int getWidthHW()
ITexture
getWidthHW
in interface ITexture
public int getWidthOrig()
public float getXEnd()
ITexture
getXEnd
in interface ITexture
public float getXStart()
ITexture
getXStart
in interface ITexture
public float getYEnd()
ITexture
getYEnd
in interface ITexture
public float getYStart()
ITexture
getYStart
in interface ITexture
public boolean isCollisionable()
public boolean isDestroyed()
isDestroyed
in interface IDestroyable
public boolean isSolid()
ITexture
isSolid
in interface ITexture
public boolean isValid()
public void makeTransp(int red, int green, int blue)
ITexture
makeTransp
in interface ITexture
red
- color used in the testgreen
- color used in the testblue
- color used in the testpublic void render(int x, int y, int width, int height)
public void render(int x, int y)
public void render(int x, int y, int width, int height, float r, float g, float b, float a)
public void rendershader(int x, int y, int width, int height, float r, float g, float b, float a)
public void renderdiamond(int x, int y, int width, int height, float u, float d, float l, float r, float a)
public void renderdiamond(int x, int y, int width, int height, float ru, float gu, float bu, float au, float rd, float gd, float bd, float ad, float rl, float gl, float bl, float al, float rr, float gr, float br, float ar)
public void renderdiamond(int x, int y, int width, int height, int u, int d, int l, int r)
public void renderwallw(int x, int y, int width, int height, float ru, float gu, float bu, float au, float rd, float gd, float bd, float ad, float ru2, float gu2, float bu2, float au2, float rd2, float gd2, float bd2, float ad2)
public void renderwallw(int x, int y, int width, int height, int u, int d, int u2, int d2)
public void renderroofw(int x, int y, int width, int height, float ru, float gu, float bu, float au, float rd, float gd, float bd, float ad, float ru2, float gu2, float bu2, float au2, float rd2, float gd2, float bd2, float ad2)
public void renderwalln(int x, int y, int width, int height, float ru, float gu, float bu, float au, float rd, float gd, float bd, float ad, float ru2, float gu2, float bu2, float au2, float rd2, float gd2, float bd2, float ad2)
public void renderwalln(int x, int y, int width, int height, int u, int d, int u2, int d2)
public void renderstrip(int x, int y, int width, int height, float r, float g, float b, float a)
public void setAlphaForeach(int red, int green, int blue, int alpha)
ITexture
setAlphaForeach
in interface ITexture
red
- color used in the testgreen
- color used in the testblue
- color used in the testalpha
- the alpha color that will be setted to the pixel that pass the testpublic void setCustomizedTexture()
public void setData(java.nio.ByteBuffer data)
setData
in interface ITexture
data
- texture's pixel datapublic void setMask(Mask mask)
setMask
in interface ITexture
mask
- the mask of collisions to setpublic void setName(java.lang.String name)
public void setRegion(int x, int y, int width, int height)
ITexture
setRegion
in interface ITexture
x
- xstart positiony
- ystart positionwidth
- width of the regionheight
- height of the regionpublic void setUseAlphaChannel(boolean value)
value
- if true, the image will use the alpha channelpublic Texture split(int xOffset, int yOffset, int width, int height)
public Texture[] split(int xOffset, int yOffset, int row, int coloumn, int width, int height, int spaceX, int spaceY)
public Texture[][] split2D(int[] xstep, int[] ystep)
public java.lang.String toString()
toString
in class java.lang.Object
public void renderTest(int x, int y)
public void saveMask(java.lang.String name)
public void loadMaskRegion(java.nio.ByteBuffer cache)
public void saveMaskRegion(java.nio.ByteBuffer cache)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |