Menu

AddTriangle

UltraBas

AddTriangle (surface, v0, v1, v2 )

Creates a new triangle, and adds it to surface; also, it returns the triangle index number (first triangle is 0).

Parameters v0, v1 and v2 are handles to the three vertices of the triangle: to create vertices, the command [AddVertex] can be used (it will also return the handle of the created vertex). Of course, a vertex can also be used in more than one triangle (so, if two triangles are adiacent, they can share one or two vertices).

Every triangle is visible only from one side (backface culling): to render an image faster, there is generally no need to draw the polygons on the sides of the buildings facing away from the camera; they are completely occluded by the sides facing the camera; the order of vertices will determine wich side will be visible; the command [FlipMesh] will swap sides. To make a triangle visible at both sides, the simplest solution is to create a copy of the mesh, and flip it (it will require a double number of triangles, one for each side).


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.