Sigurd

Newbies
  • Content Count

    1
  • Joined

  • Last visited

Community Reputation

0
  1. Not using paint.net myself (actually making competing app), but since we're all helping each other out. (Yes, it seems new mesh format isn't saving as much data, width/height are smaller than original width/height) Last bit of my code: if (version === 2) { var width = stream.readUint32(); var height = stream.readUint32(); ... } else // version === 4 { var width = stream.readUint32(); var height = stream.readUint32(); if (width > 32768 || height > 32768) { throw new Error("Liquify Mesh File - width or height too large"); } var _unknown0 = stream.readUint32(); var _unknown1 = stream.readUint32(); var _unknown2 = stream.readUint32(); var _unknown3 = stream.readUint32(); var width2 = stream.readUint32(); var height2 = stream.readUint32(); var _unknown4 = stream.readUint32(); var _unknown5 = stream.readUint32(); var width3 = stream.readUint32(); var height3 = stream.readUint32(); var data = new Float32Array(width*height * 2); for (var y = 0; y < height; ++y) { var x = 0; while (x < width) { var skip = stream.readUint32(); x += skip; if (x >= width) { if (x !== width) { throw new Error("Error in file"); } continue; } var offset = (y * width + x) * 2; var count = stream.readUint32(); for (var xend = x+count; x < xend; ++x) { data[offset++] = stream.readFloat32() / width; data[offset++] = stream.readFloat32() / height; } } } assert(stream.pos === stream.length);