Now I need walls ! But... can't get the courageous to code a real 3D framework, because I know it's far from my coding level and would require some very long learning. I've imagined a trick to do 3D with extruded 2D only.
All shapes now have three rendering values : extrusion height, rotation angle and elevation. In fact, without these values, all shapes are only a montain of 2D polygons overlapping in all directions. It's in the view that the 2D polygons are well placed, with the help of the scenegraph transformation methods.
- First, the polygon is triangulated and converted into a 3D mesh by extrusion in a simple parallel prism,
- Second, the prism is moved at the correct (x,y) coordinates and elevated at the correct altitude,
- Third, the prism rotated around a specified axis.
It's like the egytians building obelisks : first you extract the object from the ground, then you move it and rotate it to its final place.
In the rules class, it is much more easier to set my polygons than digging the stone. Only three params. And because an urban environnement is mostly made of horizontal and vertical shapes, I think this method have some potential. Of course, we will be able to put assets on the scene for more detailled objects that need complex meshes.
Aucun commentaire:
Enregistrer un commentaire