* take care of render all texture layers including effects
* to the global textureunistate array
*/
private void renderTextures() {
Texture tex;
TextureAttributes texAttr;
// absolute background
if(layerVis[0]==false) {
polyAttr.setPolygonMode(PolygonAttributes.POLYGON_LINE);
return;
}
else {
polyAttr.setPolygonMode(PolygonAttributes.POLYGON_FILL);
// deactivate
if(1==1) return;
// muss die textur neu erstellt werden?
//TODO: cache funktion ..
// einmaliges pre-rendering der texturen
BufferedImage screen, alpha, layer, tmp;
screen = new BufferedImage(256, 256, BufferedImage.TYPE_4BYTE_ABGR_PRE);
tmp = new BufferedImage(256, 256, BufferedImage.TYPE_4BYTE_ABGR_PRE);
// graphics objekt erstellen
Graphics2D g2 = (Graphics2D)screen.getGraphics();
RenderingHints rh = new RenderingHints(
RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
rh.put(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED);
//g2.setRenderingHints(rh);
// bild holen
MCLY_Entry lData = data.mcly.getLayer(0);
//layer = texLoader.getBitmapNo( lData.getTextureID() );
// rendern
//g2.drawImage(layer, null, 0, 0);
// das selbe f�r alle layer
for(int i=0; i<data.getNLayers()-1; i++) {
lData = data.mcly.getLayer(i+1);
// bild holen
//layer = texLoader.getBitmapNo( lData.getTextureID() );
// lightmap holen
//alpha = createLightMap(i);
// alpha setzen
// NewAlphaFilter filter = new NewAlphaFilter(data.mcal.getLayerNo(i));
//tmp = filter.createCompatibleDestImage(layer, screen.getColorModel());
// filter.filter(layer, tmp);
// rendern
g2.drawImage(tmp, null, 0, 0);
}
// chacen
//saveImage(screen, "screen");
// screen in die textur umwandeln und anzeigen
ImageComponent2D texImage = new ImageComponent2D(
ImageComponent.FORMAT_RGBA4, screen);
tex = new Texture2D(Texture.BASE_LEVEL, Texture.RGB, 256, 256);
tex.setImage(0, texImage);
texAttr = new TextureAttributes();
texAttr.setTextureMode(TextureAttributes.MODULATE);
textureUnitState[0] = new TextureUnitState(tex, texAttr, null);
textureUnitState[0].setCapability(TextureUnitState.ALLOW_STATE_WRITE);
}
}