2D Polygon

Im quite new to jME (to 3d actually in general) and what i want to do is to create a map out of tiles. Like a Risk map. Every country would be a tile and every tile could have an arbitrary shape. I want to be able to create a country based on solely x,y coordinates. The height will be something standard, 0.0f or 1.0f.



What i want is something like a Quad, but then for any arbitrary 2d polygon shape. Im wondering whether this is already possible or not. I can maybe write my own class for this, inheriting from the TriMesh class. I imagine it wont be the easiest job to start off with in jME though. I do not want to create the map in Blender or something. I want to be able to load it from, for example, a SVG file.



I want to do this in a 3D environment, because i want to put 3D objects on the 2D tiles.



So, is this already there? I couldnt find it anywhere.  :?

I'm not sure, if I understood this question,



but arent the TestTerrain… classes what you need?



Your terrain you can generate with a heightmap, ther are some tools for creating such stuff.



And you should search for all has to do with terrain in this Forum

Im not aiming to create a terrain. Im trying to build a playing board.

I am pretty sure that there is a triangulation utility somewhere in jME. You'll most probably find it when looking into the Font3D related classes. You should be able to start from there.

You can have a quad represent each tile. Triangulating an SVG file sounds like an overkill, you may want to consider converting it to a texture instead? You could use parallax mapping to make the texture appear to have depth.

If i make a texture out of it, wont i have problems when i want to click on the map? Normally i could use the mouse picking utility and find out what tile i was clicking. If i change it into a texture im not sure how to do that. If i make it a node in the scenegraph, its easier to add RenderStates to it and i can texture every tile differently. Thats why i want to build it this way, but if there are good alternatives im all ears.  :wink:

That's what I meant, you have a grid of tiles, each one can have it's own texture.

Wont i be limited to having only quad tiles if i use quads? And wont i have to create a different texture for every tile if i do it the way youre suggesting?

What about using batik to load your svgs and putting them in a JmeDesktop plane? Then you can place your 3d objects on top of this surface for visualization, and have some kind of control system to fly around the quad. Does that make sense?

Ive been thinking again about this, but Java3D seems to have such a kind of feature. They have implemented the Seidel Triangulation algorithm, is there something like this possible? Triangulating a custom polygon?



EDIT: Where the polygon is just a set of (x,y) coordinates.

Frederick said:

is there something like this possible? Triangulating a custom polygon?


hevee said:

I am pretty sure that there is a triangulation utility somewhere in jME. You'll most probably find it when looking into the Font3D related classes. You should be able to start from there.

Is that not what you want?
hevee said:

Frederick said:

is there something like this possible? Triangulating a custom polygon?


hevee said:

I am pretty sure that there is a triangulation utility somewhere in jME. You'll most probably find it when looking into the Font3D related classes. You should be able to start from there.

Is that not what you want?


I looked it up and couldnt find any points to start from. However, now ive found some stuff that may help me. I guess the last time i checked i didnt do it properly. Sorry for that and thanks for the help. There seems to be a Triangulator class anyways.  :)