v0.9.4: removed unnecessary texture reference in TextureFilm

This commit is contained in:
Evan Debenham 2021-07-06 18:19:51 -04:00
parent 001c40f15e
commit 72275d240d
2 changed files with 12 additions and 11 deletions

View File

@ -109,7 +109,7 @@ public class SmartTexture extends Texture {
public RectF uvRect( float left, float top, float right, float bottom ) { public RectF uvRect( float left, float top, float right, float bottom ) {
return new RectF( return new RectF(
left / width, left / width,
top / height, top / height,
right / width, right / width,
bottom / height ); bottom / height );

View File

@ -33,14 +33,12 @@ public class TextureFilm {
private int texWidth; private int texWidth;
private int texHeight; private int texHeight;
private SmartTexture texture;
protected HashMap<Object,RectF> frames = new HashMap<>(); protected HashMap<Object,RectF> frames = new HashMap<>();
public TextureFilm( Object tx ) { public TextureFilm( Object tx ) {
texture = TextureCache.get( tx ); SmartTexture texture = TextureCache.get( tx );
texWidth = texture.width; texWidth = texture.width;
texHeight = texture.height; texHeight = texture.height;
@ -53,8 +51,8 @@ public class TextureFilm {
} }
public TextureFilm( Object tx, int width, int height ) { public TextureFilm( Object tx, int width, int height ) {
texture = TextureCache.get( tx ); SmartTexture texture = TextureCache.get( tx );
texWidth = texture.width; texWidth = texture.width;
texHeight = texture.height; texHeight = texture.height;
@ -73,8 +71,6 @@ public class TextureFilm {
} }
public TextureFilm( TextureFilm atlas, Object key, int width, int height ) { public TextureFilm( TextureFilm atlas, Object key, int width, int height ) {
texture = atlas.texture;
texWidth = atlas.texWidth; texWidth = atlas.texWidth;
texHeight = atlas.texHeight; texHeight = atlas.texHeight;
@ -99,8 +95,13 @@ public class TextureFilm {
frames.put( id, rect ); frames.put( id, rect );
} }
public void add( Object id, int left, int top, int right, int bottom){ public void add( Object id, float left, float top, float right, float bottom){
frames.put( id, texture.uvRect(left, top, right, bottom)); frames.put( id,
new RectF(
left / texWidth,
top / texHeight,
right / texWidth,
bottom / texHeight ));
} }
public RectF get( Object id ) { public RectF get( Object id ) {