[Q] Rendering a geometry multiple times

sign up sign in

Hello Snõwkit!

I am currently toying around with Luxe, and seem to have stumbled upon the very first problem that I have not managed to solve using the documentation.

Essentially, my game has a world that wraps in all directions, and a camera that can move around in it. This world is build from hexagonal tiles. Due to the wrapping, a tile may be in the camera view more than once. As such, I want every instance of a (visible) tile to be able to render itself multiple times per frame, with a different offset for each render.

The way I handle tiles might be a bit unconventional: I have a Field which holds instances of Tile, each Tile holds a reference to an instance of TileData. The camera pans over this Field, and once it reaches a certain threshold it snaps back; the Tiles then get assigned a new TileData. The resulting effect is the illusion of endlessly scrolling in a direction. This image might help explain things(the blue box would be the camera when on a zoomlevel of 1). Depending on world-size, tile-size, offset, and screen-size, a TileData might be referenced never, once, or multiple times. TileData is the instance I would like to handle rendering, as its render function could then be easily overridden for different types of Tiles, while Tile just provides the screen position to render at.

What would be the way to approach this problem? I haven't been able to find a method that renders just one geometry, which I suspect is what I need.

Any help would be greatly appreciated!

Tags
luxequestiongeometry
Written by

the Netherlands