Got it. What a journey. Many complicated approaches. TileSet UV re-mapping, collision calcs for irregular hexagons, magic numbers, lots of overengineered nonsense.
Then while reading shader docs I realized a much better way:
// returns true if this pixel is within the hexagon
bool isInBounds(sampler2D tex, vec2 uv) {
return texture(tex, uv).a > .0001;
}
void fragment() {
// ...
if (!isInBounds(TEXTURE, UV)) {
COLOR = vec4(0.,0.,0.,0.);
}
}
The tilesheet alpha channel already knows whether we want to draw there.
