uojs / uodatareader

Provides an API to read MUL/UOP files using Node.js
6 stars 0 forks source link

You can add a method to produce texture square rather than diamond? #10

Closed lamo2k123 closed 7 years ago

kevinhikaruevans commented 7 years ago

I've tried to read the tile into a square 32x32 image but I don't really know how to. I tried reading it pixel-by-pixel into a 32x32 bitmap, but it doesn't look right. Loading a diamond and rotating it 45 degrees would cause the image to be blurry (from interpolation) and not right.

Is there a program that reads the images into a square texture instead of diamond? I could copy the function that the program uses.

kevinhikaruevans commented 7 years ago

Hmm. I think it should be using texmaps.mul to read images instead of art.mul/artidx.mul. I'll need to work on this some more.

Seems like:

lamo2k123 commented 7 years ago

Ok

kevinhikaruevans commented 7 years ago

I added texture.js.

So to get square land now, you can do:

const uodatareader = require('./index')({
    baseDirectory: '../tmp/uo/'
});

const img = uodatareader.texture.loadTexture(2);
img.png().toFile('thing.png');