v0.9.4: fixed rare texture errors in fog of war
This commit is contained in:
parent
a5e50a7d68
commit
b08f3479c1
|
@ -79,7 +79,8 @@ public class TextureCache {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//texture defaults to black and given size, but no assurance is made about this is another already exists
|
//texture is created at given size, but size is not enforced if it already exists
|
||||||
|
//texture contents are also not enforced, make sure you know the texture's state!
|
||||||
public synchronized static SmartTexture create( Object key, int width, int height ) {
|
public synchronized static SmartTexture create( Object key, int width, int height ) {
|
||||||
|
|
||||||
if (all.containsKey( key )) {
|
if (all.containsKey( key )) {
|
||||||
|
@ -88,12 +89,7 @@ public class TextureCache {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Pixmap pixmap = new Pixmap( width, height, Pixmap.Format.RGBA8888 );
|
SmartTexture tx = new SmartTexture(new Pixmap( width, height, Pixmap.Format.RGBA8888 ));
|
||||||
|
|
||||||
pixmap.setColor(0x000000FF);
|
|
||||||
pixmap.fill();
|
|
||||||
|
|
||||||
SmartTexture tx = new SmartTexture( pixmap );
|
|
||||||
|
|
||||||
tx.filter( Texture.LINEAR, Texture.LINEAR );
|
tx.filter( Texture.LINEAR, Texture.LINEAR );
|
||||||
tx.wrap( Texture.CLAMP, Texture.CLAMP );
|
tx.wrap( Texture.CLAMP, Texture.CLAMP );
|
||||||
|
|
|
@ -112,6 +112,11 @@ public class FogOfWar extends Image {
|
||||||
|
|
||||||
String key = "FogOfWar" + width2 + "x" + height2;
|
String key = "FogOfWar" + width2 + "x" + height2;
|
||||||
texture(TextureCache.create(key, width2, height2));
|
texture(TextureCache.create(key, width2, height2));
|
||||||
|
|
||||||
|
//sets contents to all black
|
||||||
|
texture.bitmap.setColor( 0x000000FF );
|
||||||
|
texture.bitmap.fill();
|
||||||
|
|
||||||
texture.bind();
|
texture.bind();
|
||||||
|
|
||||||
scale.set( size, size );
|
scale.set( size, size );
|
||||||
|
|
Loading…
Reference in New Issue
Block a user