I'm currently making a test game with LibGDX for Java. In the test, I randomly generate a sort of "height map", resulting in a 2-dimensional set of lines stored in a ChainShape. Basically, everything below the lines will be ground, and everything above. Here's a graphical representation, with the black line being my ChainShape:
I plan on having a single texture for the ground (in this example, it would be solid yellow), which is as tall and wide as the world's bounds.
My problem is this: I need to crop out the ground image so that the ground does not pass the black line and overlap the sky. I was planning on using a TextureRegion, but that can only crop rectangular portions.
Does anyone know of a LibGDX method or workaround that would allow me to use the bounds of a Shape to determine where to crop an image?
Thanks in advance.