Solar System - demo scence

Functions

void model_plane_vertices (const float length, const unsigned int divisions, float *points)
 
unsigned int model_plane_nVertices (const unsigned int divisions)
 
void model_plane_write (const char *filepath, const float length, const unsigned int divisions)
 

Detailed Description

Function Documentation

◆ model_plane_nVertices()

unsigned int model_plane_nVertices ( const unsigned int  divisions)
inline
77{ return divisions * divisions * 12; }

Referenced by model_plane_write().

◆ model_plane_vertices()

void model_plane_vertices ( const float  length,
const unsigned int  divisions,
float *  points 
)
46 {
47 const float o = -length / 2.0f;
48 const float d = length / (float) divisions;
49
50 unsigned int pos = 0;
51
52 for (unsigned int m = 1; m <= divisions; m++) {
53 for (unsigned int n = 1; n <= divisions; n++) {
54 float i = (float) m;
55 float j = (float) n;
56
57 points_vertex(o + d * (i - 1), 0, o + d * (j - 1), &pos, points); //P1
58 points_vertex(o + d * (i - 1), 0, o + d * j, &pos, points); //P1'z
59 points_vertex(o + d * i, 0, o + d * (j - 1), &pos, points); //P1'x
60
61 points_vertex(o + d * i, 0, o + d * (j - 1), &pos, points); //P1'x
62 points_vertex(o + d * (i - 1), 0, o + d * j, &pos, points); //P1'z
63 points_vertex(o + d * i, 0, o + d * j, &pos, points); //P2
64
65 /*Cull face*/
66 points_vertex(o + d * (i - 1), 0, o + d * j, &pos, points); //P1'z
67 points_vertex(o + d * (i - 1), 0, o + d * (j - 1), &pos, points); //P1
68 points_vertex(o + d * i, 0, o + d * (j - 1), &pos, points); //P1'x
69
70 points_vertex(o + d * (i - 1), 0, o + d * j, &pos, points); //P1'z
71 points_vertex(o + d * i, 0, o + d * (j - 1), &pos, points); //P1'x
72 points_vertex(o + d * i, 0, o + d * j, &pos, points); //P2
73 }
74 }
75}
void points_vertex(const float x, const float y, const float z, unsigned int *pos, float points[])
Definition: generator.cpp:20

References points_vertex().

Referenced by model_plane_write().

◆ model_plane_write()

void model_plane_write ( const char *  filepath,
const float  length,
const unsigned int  divisions 
)
79 {
80 const unsigned int nVertices = model_plane_nVertices(divisions);
81 float points[3 * nVertices];
82 model_plane_vertices(length, divisions, points);
83 points_write(filepath, nVertices, points);
84}
void model_plane_vertices(const float length, const unsigned int divisions, float *points)
Definition: generator.cpp:46
unsigned int model_plane_nVertices(const unsigned int divisions)
Definition: generator.cpp:77
void points_write(const char *filename, const unsigned int nVertices, const float points[])
Definition: generator.cpp:27

References model_plane_nVertices(), model_plane_vertices(), and points_write().

Referenced by main().