use of net.runelite.cache.TextureManager in project runelite by runelite.
the class ObjExporterTest method testExport.
@Test
@Ignore
public void testExport() throws Exception {
try (Store store = new Store(StoreLocation.LOCATION)) {
store.load();
TextureManager tm = new TextureManager(store);
tm.load();
ModelLoader loader = new ModelLoader();
ModelDefinition model = loader.load(9638, Files.readAllBytes(new File("D:\\rs\\07\\cache\\models\\9638.model").toPath()));
ObjExporter exporter = new ObjExporter(tm, model);
try (PrintWriter objWriter = new PrintWriter(new FileWriter(new File("D:\\rs\\07\\temp\\9638.obj")));
PrintWriter mtlWriter = new PrintWriter(new FileWriter(new File("D:\\rs\\07\\temp\\9638.mtl")))) {
exporter.export(objWriter, mtlWriter);
}
}
}
use of net.runelite.cache.TextureManager in project runelite by runelite.
the class ItemSpriteFactoryTest method test.
@Test
@Ignore
public void test() throws IOException {
File base = StoreLocation.LOCATION, outDir = folder.newFolder();
int count = 0;
try (Store store = new Store(base)) {
store.load();
ItemManager itemManager = new ItemManager(store);
itemManager.load();
ModelProvider modelProvider = new ModelProvider() {
@Override
public ModelDefinition provide(int modelId) throws IOException {
Index models = store.getIndex(IndexType.MODELS);
Archive archive = models.getArchive(modelId);
byte[] data = archive.decompress(store.getStorage().loadArchive(archive));
ModelDefinition inventoryModel = new ModelLoader().load(modelId, data);
return inventoryModel;
}
};
SpriteManager spriteManager = new SpriteManager(store);
spriteManager.load();
TextureManager textureManager = new TextureManager(store);
textureManager.load();
for (ItemDefinition itemDef : itemManager.getItems()) {
if (itemDef.name == null || itemDef.name.equalsIgnoreCase("null")) {
continue;
}
try {
BufferedImage sprite = ItemSpriteFactory.createSprite(itemManager, modelProvider, spriteManager, textureManager, itemDef.id, 1, 1, 3153952, false);
File out = new File(outDir, itemDef.id + ".png");
BufferedImage img = sprite;
ImageIO.write(img, "PNG", out);
++count;
} catch (Exception ex) {
log.warn("error dumping item {}", itemDef.id, ex);
}
}
}
log.info("Dumped {} item images to {}", count, outDir);
}
Aggregations