|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.threed.jpct.FrameBuffer
public class FrameBuffer
The FrameBuffer class provides a buffer into which jPCT renders the scene. The result is basically an Image which could be displayed or modified even further using some post-processing.
Field Summary | |
---|---|
static boolean |
OPAQUE_BLITTING
2D texture-blitting into the framebuffer is done by copying the source 1-to-1 into the destination bitmap |
static boolean |
TRANSPARENT_BLITTING
2D texture-blitting into the framebuffer is done by copying the source into the destination bitmap only at places where the sources bitmap has none-zero color-values. |
Constructor Summary | |
---|---|
FrameBuffer(GL10 glContext,
int x,
int y)
Creates a new framebuffer with a width of x and a height of y. |
Method Summary | |
---|---|
void |
addPostProcessor(IPostProcessor proc)
Adds an IPostProcessor to run a post processing on the framebuffer. |
void |
blit(int[] src,
int srcWidth,
int srcHeight,
int srcX,
int srcY,
int destX,
int destY,
int width,
int height,
boolean transparent)
Copies a part of a bitmap (taken from an int[] containing pixels in RGB-format and with no alpha) into the framebuffer. |
void |
blit(Texture src,
int srcX,
int srcY,
int destX,
int destY,
int width,
int height,
boolean transparent)
Copies a part of a bitmap (taken from a Texture in this case) into the framebuffer. |
void |
blit(Texture src,
int srcX,
int srcY,
int destX,
int destY,
int sourceWidth,
int sourceHeight,
int destWidth,
int destHeight,
int transValue,
boolean additive,
RGBColor addColor)
Special version of blit() that allows for scaling, i.e. it doesn't make 1-to-1 copies but can up- or down-scale. |
void |
clear()
Clears the framebuffer and the z-buffer. |
void |
clear(RGBColor col)
Clears the framebuffer with the given color. |
void |
clearZBufferOnly()
Clears only the ZBuffer, not the color buffer. |
void |
display()
Displays the rendered image. |
void |
dispose()
Should be called before this FrameBuffer won't be used anymore to do some clean up work. |
void |
freeMemory()
Frees some native memory used by the gl context. |
float |
getCenterX()
Returns the x-coord of the midpoint of the framebuffer. |
float |
getCenterY()
Returns the y-coord of the midpoint of the framebuffer. |
int |
getHeight()
Returns the height of the framebuffer. |
java.lang.Long |
getID()
Returns a unique ID for this FrameBuffer. |
int[] |
getPixels()
Returns the raw pixel-data. |
int |
getWidth()
Returns the width of the framebuffer. |
boolean |
isInitialized()
Checks if the FrameBuffer and the renderer have been initialized correctly. |
void |
removeAllPostProcessors()
Removes all post processors from the framebuffer. |
void |
removePostProcessor(IPostProcessor proc)
Removes a post processor from the framebuffer. |
void |
removeRenderTarget()
Removes the render target from the framebuffer. |
void |
runPostProcessors()
Runs all post processors that have been added to this framebuffer. |
void |
setPaintListener(IPaintListener listener)
Adds a listener to the renderer. |
void |
setRenderTarget(int texID)
Sets the render target of the framebuffer to a texture. |
void |
setRenderTarget(int texID,
int left,
int top,
int right,
int bottom,
boolean clearAll)
Sets the render target of the framebuffer to a texture. |
void |
setRenderTarget(Texture tex)
Sets the render target of the framebuffer to a texture. |
void |
setRenderTarget(Texture tex,
int left,
int top,
int right,
int bottom,
boolean clearAll)
Sets the render target of the framebuffer to a texture. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final boolean OPAQUE_BLITTING
public static final boolean TRANSPARENT_BLITTING
Constructor Detail |
---|
public FrameBuffer(GL10 glContext, int x, int y)
glContext
- a valid gl contextx
- the width of the framebuffery
- the height of the framebufferMethod Detail |
---|
public java.lang.Long getID()
public boolean isInitialized()
public void setRenderTarget(int texID)
texID
- the ID of the texture to render into.public void setRenderTarget(int texID, int left, int top, int right, int bottom, boolean clearAll)
texID
- the ID of the texture to render into.left
- the width of the left bordertop
- the width of the upper borderright
- the width of the right borderbottom
- the width of the lower borderclearAll
- if true, the border won't affect the clearing of texture. If
set to false, it will.public void setRenderTarget(Texture tex)
tex
- the texture to render intopublic void setRenderTarget(Texture tex, int left, int top, int right, int bottom, boolean clearAll)
tex
- the texture to render intoleft
- the width of the left bordertop
- the width of the upper borderright
- the width of the right borderbottom
- the width of the lower borderclearAll
- if true, the border won't affect the clearing of texture. If
set to false, it will.public void removeRenderTarget()
public void addPostProcessor(IPostProcessor proc)
proc
- the post processorrunPostProcessors()
,
IPostProcessor
public void removePostProcessor(IPostProcessor proc)
proc
- The post processor to be removedIPostProcessor
public void removeAllPostProcessors()
IPostProcessor
public void runPostProcessors()
IPostProcessor
public void setPaintListener(IPaintListener listener)
listener
- IPaintListener the listener or null to clear itpublic void dispose()
public void freeMemory()
public int getWidth()
public int getHeight()
public float getCenterX()
public float getCenterY()
public void clear()
public void clearZBufferOnly()
public void clear(RGBColor col)
col
- the color the framebuffer is filled withpublic int[] getPixels()
blit(com.threed.jpct.Texture src, int srcX, int srcY, int destX,
int destY, int width, int height, boolean transparent)
,
blit(int[] src, int srcWidth, int srcHeight, int srcX, int srcY,
int destX, int destY, int width, int height, boolean transparent)
public void blit(Texture src, int srcX, int srcY, int destX, int destY, int width, int height, boolean transparent)
src
- the texture that contains the source bitmapsrcX
- the starting x-position in the source bitmapsrcY
- the starting y-position in the source bitmapdestX
- the starting x-position in the destination bitmapdestY
- the starting y-position in the destination bitmapwidth
- the width of the region to copyheight
- the height of the region to copytransparent
- black (or at least almost black) pixels won't be copied if
this is set to TRANSPARENT_BLITTING. Any color-value which
leads to a result of zero when "anded" with #f0f0f0 will be
taken as black unless your texture specifies its own alpha
channel.TRANSPARENT_BLITTING
,
OPAQUE_BLITTING
public void blit(Texture src, int srcX, int srcY, int destX, int destY, int sourceWidth, int sourceHeight, int destWidth, int destHeight, int transValue, boolean additive, RGBColor addColor)
src
- the texture that contains the source bitmapsrcX
- the starting x-position in the source bitmapsrcY
- the starting y-position in the source bitmapdestX
- the starting x-position in the destination bitmapdestY
- the starting y-position in the destination bitmapsourceWidth
- the width of the source region to copysourceHeight
- the height of the source region to copydestWidth
- the width of the copied region in the destination bitmapdestHeight
- the height of the copied region in the destination bitmaptransValue
- the transparency value, -1 is none, 0 is highest transparency.
Higher values mean less transparency.additive
- if true, the blending is additive, otherwise defaultaddColor
- an additional color. If null, Color.WHITE is taken insteadpublic void blit(int[] src, int srcWidth, int srcHeight, int srcX, int srcY, int destX, int destY, int width, int height, boolean transparent)
src
- the int-array that contains the source bitmapsrcWidth
- the width of the source bitmapsrcHeight
- the height of the source bitmapsrcX
- the starting x-position in the source bitmapsrcY
- the starting y-position in the source bitmapdestX
- the starting x-position in the destination bitmapdestY
- the starting y-position in the destination bitmapwidth
- the width of the region to copyheight
- the height of the region to copytransparent
- black (or at least almost black) pixels won't be copied if
this is set to TRANSPARENT_BLITTING. Any color-value which
leads to a result of zero when "anded" with #f0f0f0 will be
taken as black.getPixels()
,
TRANSPARENT_BLITTING
,
OPAQUE_BLITTING
,
Config.glUseIgnorantBlits
public void display()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |