arx-tools / arx-level-generator

A node.js library for creating maps for the video game Arx Fatalis
MIT License
6 stars 0 forks source link

Adding or removing ArxPolygonFlags.Tiled from a texture does not invalidate its cache #33

Closed meszaros-lajos-gyorgy closed 1 month ago

meszaros-lajos-gyorgy commented 1 month ago

I have a non-square texture

let texture = new Texture({
  filename: 'hamster-[stone].jpg',
  isNative: false,
  width: 1280,
  height: 853,
  sourcePath: './textures/',
})

texture = Material.fromTexture(texture, {
  flags: ArxPolygonFlags.Tiled,
})

const mesh = createPlaneMesh({
  size: new Vector2(200, 200),
  tileSize: 50,
  texture,
  tileUV: true
})

When the ArxPolygonFlags.Tiled is assigned to the texture then the edges of the texture are cropped off and the texture also gets resized. Removing the flag will make the texture stay in its original dimensions. Switching between the two modes does not change the contents of the cache folder which requires manual clearing of the cache by deleting the file from it.

The __hashes.json file should keep track of this information as well and invalidate the cache if tiling is changed.

meszaros-lajos-gyorgy commented 1 month ago

Once the issue have been resolved don't forget to update /docs/examples/textures.md

meszaros-lajos-gyorgy commented 1 month ago

EntityModel uses the same cache service to cache ftl files, so adding an isTileable parameter to every cache function will not be general enough here.

meszaros-lajos-gyorgy commented 1 month ago

Fixed in 9d333a8ca7d64b0a13966cdcf29a4d08e1d1dada and released as v21.0.0-alpha.25