I am taking a break with avarra gui (i'll go back on it later) and i decided to implement the basic stuff for a start of a beginning of a ... you know, the basis of the basis, for a doom engine based on jme.
Here is the result so far
There is still bugs (especially with textures: i don't load them correctly, i need to talk to someone that already done something like that to understand some details), some of them directly from the WAD file (files used by the doom engine), like non-closed sectors (~ polygons. It's more complicate than that actually, it's like non-convex polygons that can contains holes with inside non-convex-polygons etc) and missing texture on some walls. The hole you can see at 0:27, for example, is a missing texture.
The physic is just charactercontrol and basic bulletappstate, i didn't spend a lot of time on it.
The ground tesselation is done by me (wasn't in the wad file. If you want to know, the doom engine actually render wireframe of sectors (kind of) and use a floodfill algorithm to add the texture), with a homemade algorithm.
The basic idea is this:
With two special case that i will not explain here (i'll do it later).
1) you take a segment (AB) (the thing-most (top-most, left-most, right-most, bottom-most ... whatever) segment).
2) you take a segment (BC) that follow it.
3) if the angle between the two segment is > 180° : go to 2) with the "follow" segment being the "first segment" (or, more clearly: skip the first segment you chose, make BC be your first segment) (Action : "skip")
4) consider the triangle ABC. if it does not contains points : bingo, remove AB and BC, add AC and make it be your first segment. (validate the triangle ABC) (Action: "remove")
5) if it contains points, take the closest point to AB (let's call it P). Add AP and PB in your segment pool.
Remove the segment AB, validate the triangle ABP. (Action : "split")
Rince and repeat.
Details: a line has a right and a left side. It's important as it's the only way to make a difference between the inside and the outside of your polygon. For example you can decide that when you go from A to B, the inside of the polygon is on your left, and the outside is on your right.
Also: the "add segment" is actually "add if it doesn't exists. If it exists, remove". This is because a line always has a "polygon-side" and a "empty-side". If there was no line, you are adding an empty side, it's ok. If there was already a line, you are emptying it's polygon-side. So remove it.
There is also two special case: the "nail" and the "annoying point".
I'll not explain what they ARE but how to solve them:
nail: when you make a ABC triangle, you must check that no segment going to B cross AC.
annoying point: when you are doing "split" action, let's call P the closest point you took. You must check that no segment starting from A cross PB.