-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eaf1c48
commit d5dbef8
Showing
14 changed files
with
168 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/library/java/gg/generations/rarecandy/pokeutils/reader/TextureLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package gg.generations.rarecandy.pokeutils.reader; | ||
|
||
import gg.generations.rarecandy.renderer.loading.Texture; | ||
import gg.generations.rarecandy.renderer.model.material.CloseableSupplier; | ||
import gg.generations.rarecandy.renderer.model.material.ImageSupplier; | ||
|
||
public abstract class TextureLoader { | ||
private static TextureLoader instance; | ||
|
||
|
||
public static TextureLoader instance() { | ||
return instance; | ||
} | ||
|
||
public static void setInstance(TextureLoader instance) { | ||
TextureLoader.instance = instance; | ||
} | ||
|
||
public abstract CloseableSupplier<Texture> getTexture(String name); | ||
|
||
public abstract void register(String name, TextureReference reference); | ||
|
||
public abstract void remove(String name); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/library/java/gg/generations/rarecandy/renderer/model/material/CloseableSupplier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package gg.generations.rarecandy.renderer.model.material; | ||
|
||
import java.io.Closeable; | ||
import java.util.function.Supplier; | ||
|
||
public interface CloseableSupplier<T> extends Supplier<T>, Closeable { | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
src/library/java/gg/generations/rarecandy/renderer/model/material/ImageSupplier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package gg.generations.rarecandy.renderer.model.material; | ||
|
||
import gg.generations.rarecandy.pokeutils.reader.TextureReference; | ||
import gg.generations.rarecandy.renderer.loading.Texture; | ||
|
||
import java.io.IOException; | ||
|
||
public class ImageSupplier implements CloseableSupplier<Texture> { | ||
public static final CloseableSupplier<Texture> BLANK = new CloseableSupplier<>() { | ||
@Override | ||
public void close() throws IOException { | ||
|
||
} | ||
|
||
@Override | ||
public Texture get() { | ||
return null; | ||
} | ||
}; | ||
|
||
private final TextureReference textureReference; | ||
private Texture texture; | ||
|
||
public ImageSupplier(TextureReference textureReference) { | ||
this.textureReference = textureReference; | ||
} | ||
|
||
@Override | ||
public Texture get() { | ||
if (texture == null) this.texture = new Texture(textureReference); | ||
return texture; | ||
} | ||
|
||
@Override | ||
public void close() throws IOException { | ||
texture.close(); | ||
} | ||
} |
Oops, something went wrong.