Questions about image cropping and image loading

  • Issue 1 Image Cropping
    I have a 1920*1080 image(These are UI buttons but all on one image).

Is there a way in JME to handle cropping these images?(Does Lemur have a way of handling this kind of tiled map?)

  • Question 2 About loading

How do I batch register an entire folder of PNG files to AssetManager?


additions:
ImageRaster (jMonkeyEngine3)
This approach seems to solve the first problem.

1 Like

How exactly are you looking to use these? One option is setting texture coordinates on a custom mesh. E.g. a quad who’s texture coordinates are for the corners of the bit you want to pick out. But it depends a lot on what youre trying to do

1 Like

These are the buttons for the UI they are now all on one diagram, what would you recommend using that way?(Lemurs used)

QuadBackgroundComponent doesn’t easily let you reset texture coordinates on the created quad. I’ve had this on my to-do list for a long time.

However, the quickest way to achieve what you want is probably to fork QuadBackgroundComponent for yourself and add some additional texture coordinates. Add a couple Vector2f fields for uv1 and uv2 and then add the appropriate code in refreshBackground() to set the texture coordinates.

Many of these classes are due for a refactoring to make them easier to extend and add behavior like this. I just haven’t gotten to it yet and code contributions tend to come from other directions.

3 Likes

Accepting something new is always a painful struggle for a while :face_exhaling:

yan wrote a simple example, This gives me a quick lesson on Mesh vs UV.


It looks like it’s working.

jmecn/lemur-sprite-sheet (github.com)

I’m going to add this part to the QuadBackgroundComponent extension

What are your suggestions and additions to this?