Converting a texture image into ProtonSDK standard texture.
- Node.js v14+
npm
npm install rtpackjs
or using yarn
yarn add rtpackjs
const { RTTEX } = require("rtpackjs");
const { writeFileSync, readFileSync } = require("fs");
const sample = readFileSync("./test/image.rttex");
(async () => {
const decoded = await RTTEX.decode(sample);
writeFileSync("./test/image.png", decoded);
const encoded = await RTTEX.encode(decoded);
writeFileSync("./test/new_image.rttex", encoded);
})();
(async () => {
const rttex = new RTTEX(sample);
console.log(rttex);
console.log(rttex.parseRTPACK());
console.log(rttex.parseRTTXTR());
})();