• entries
743
1924
• views
578701

# PolyMap

142 views

Started a new and improved polygon map editor:

It is based on creating everything out of triangles, which makes texturing and rendering easier and also prevents you creating non-convex polygons which would mess up my collision detection in the game.

It is, however, smart enough to realise when you click a counter-clockwise triangle and reverse the order appropriately.

Rather than have a messy and complex GUI, it has a system whereby when you press Tab, a text entry line appears at the bottom of the screen and you type in commands, like "grid 64" or "wireframe off" and so on.

Later, it will be possible to map keys to commands. Probably.

Is this project going to have anything to do with giant space fish - or are you just getting my hopes up with all these "naked" fish?

Giant space fish aren't planned for the game. It just seems that for some reason, when I draw things made of polygons, I draw fish by default.

I'm sure that psychoanalysts would have a field day.

What method are you using to determine whether the winding order of a given triangle is CW or CCW? I haven't given automatic detection any thought for my editor, but it would certainly be a boon for non-me users. [grin]

Quote:
 Original post by EasilyConfused Giant space fish aren't planned for the game. It just seems that for some reason, when I draw things made of polygons, I draw fish by default. I'm sure that psychoanalysts would have a field day.

Awwwwwww!

Quote:
 Original post by HopeDagger What method are you using to determine whether the winding order of a given triangle is CW or CCW? I haven't given automatic detection any thought for my editor, but it would certainly be a boon for non-me users. [grin]

Given a std::vector of three G2D::Vectors (confusing, huh? [smile]):

void NormaliseTriangle(std::vector<G2D::Vector> &P)
{
if(((P[1].X-P[0].X))*((P[2].Y-P[0].Y))<((P[2].X-P[0].X))*((P[1].Y-P[0].Y)))
{
G2D::Vector Temp=P[1]; P[1]=P[2]; P[2]=Temp;
}
}


What's the concept behind it, though? Does it have a name? Or did you just start applying arithmetic operations to the vertices until it worked? :P