3.2. The 'clothutil.inc' include file
Prev | Chapter 3. MegaPOV Include files | Next

## 3.2. The 'clothutil.inc' include file

This include file comes with MegaPOV and is needed when creating cloth with the simcloth patch.

Here follows a description of the different macros in this file.

`ReadClothFile(`FILE filename`)`;

This macro makes it possible to inform the global variables n1 and n2, as well as the global array Points[n1][n2], which contains all the points defined in the file filename.

`GetNormals(`points, nx, ny`)`;

This macro creates and calculates the global array Normals[nx][ny]. This one contains vectors representing the normals of a mesh which would be constituted of the points of array points[nx][ny]. The normals are calculated according to the global variable Normal_Precision. If this variable is not defined or is equal to 0, the normals are calculated from the 4 closer neighbors. If Normal_Precision is different from 0, the 8 closer neighbors are used.

`DrawTriangles(`points, nx, ny, uvon, file, filename`)`;

As its name indicates it, this macro creates a series of triangle, using the points of table points[nx][ny]. If uvon is true, UV coordinates are added to each triangles. If file is true, then the triangles are not added to the scene, but are written in the file filename. This macro is now obsolete with POVMan0.71.3 (direct mesh creation by simcloth).

`DrawSmoothTriangles(`points, nx, ny, uvon, file, filename`)`;

DrawSmoothTriangles(points, nx, ny, uvon, file, filename) Same operating mode as the preceding macro, but it creates smooth_triangle. The normals are calculated by the macro GetNormals(...), and the Normal_Precision variable is thus taken into account. This macro is now obsolete with POVMan0.71.3 (direct mesh creation by simcloth).

`DrawDoubleSmoothTriangles(`points, nx, ny, ep, uvon, uvep, file, filename`)`;

DrawDoubleSmoothTriangles(points, nx, ny, ep, uvon, uvep, file, filename) This one is similar to both others, but creates a fabric with a thickness ep. In fact, a second table of points is created, each one at a distance ep of points[i][j], in the opposite direction of the normal at this point. uvep is a 2D vector, representing the thickness, in term of UV coordinates, of the joint between the two series of points.

Prev | Up | Next
Chapter 3. MegaPOV Include files | Home | Chapter 4. Tutorials