Lines Matching refs:m

83 void rt_heightfield(void *tex, vector ctr, int m, int n, apiflt *field, apiflt wx, apiflt wy) {  in rt_heightfield()  argument
93 for (xx = 0; xx < (m - 1); xx++) { in rt_heightfield()
94 v0.x = wx * (xx) / (m * 1.0) + xoff; in rt_heightfield()
95 v0.y = field[(yy)*m + (xx)] + zoff; in rt_heightfield()
98 v1.x = wx * (xx + 1) / (m * 1.0) + xoff; in rt_heightfield()
99 v1.y = field[(yy)*m + (xx + 1)] + zoff; in rt_heightfield()
102 v2.x = wx * (xx + 1) / (m * 1.0) + xoff; in rt_heightfield()
103 v2.y = field[(yy + 1) * m + (xx + 1)] + zoff; in rt_heightfield()
108 v0.x = wx * (xx) / (m * 1.0) + xoff; in rt_heightfield()
109 v0.y = field[(yy)*m + (xx)] + zoff; in rt_heightfield()
112 v1.x = wx * (xx) / (m * 1.0) + xoff; in rt_heightfield()
113 v1.y = field[(yy + 1) * m + (xx)] + zoff; in rt_heightfield()
116 v2.x = wx * (xx + 1) / (m * 1.0) + xoff; in rt_heightfield()
117 v2.y = field[(yy + 1) * m + (xx + 1)] + zoff; in rt_heightfield()
126 rt_sheightfield(void *tex, vector ctr, int m, int n, apiflt *field, apiflt wx, apiflt wy) { in rt_sheightfield() argument
133 vertices = (vector *)malloc(m * n * sizeof(vector)); in rt_sheightfield()
134 normals = (vector *)malloc(m * n * sizeof(vector)); in rt_sheightfield()
140 xinc = wx / ((apiflt)m); in rt_sheightfield()
145 for (x = 0; x < m; x++) { in rt_sheightfield()
146 addr = y * m + x; in rt_sheightfield()
153 for (x = 1; x < m; x++) { in rt_sheightfield()
154 normals[x] = normals[(n - 1) * m + x] = rt_vector(0.0, 1.0, 0.0); in rt_sheightfield()
157 normals[y * m] = normals[y * m + (m - 1)] = rt_vector(0.0, 1.0, 0.0); in rt_sheightfield()
160 for (x = 1; x < (m - 1); x++) { in rt_sheightfield()
161 addr = y * m + x; in rt_sheightfield()
165 -(field[addr + m] - field[addr - m]) / (2.0 * yinc)); in rt_sheightfield()
173 for (x = 0; x < (m - 1); x++) { in rt_sheightfield()
174 addr = y * m + x; in rt_sheightfield()
178 vertices[addr + 1 + m], in rt_sheightfield()
181 normals[addr + 1 + m], in rt_sheightfield()
185 vertices[addr + m], in rt_sheightfield()
186 vertices[addr + 1 + m], in rt_sheightfield()
188 normals[addr + m], in rt_sheightfield()
189 normals[addr + 1 + m]); in rt_sheightfield()
252 void rt_landscape(void *tex, int m, int n, vector ctr, apiflt wx, apiflt wy) { in rt_landscape() argument
256 totalsize = m * n; in rt_landscape()
263 for (x = 0; x < m; x++) { in rt_landscape()
264 field[x + y * m] = 0.0; in rt_landscape()
269 field[m - 1] = 1.0 + (rand() % 100) / 100.0; in rt_landscape()
270 field[0 + m * (n - 1)] = 1.0 + (rand() % 100) / 100.0; in rt_landscape()
271 field[m - 1 + m * (n - 1)] = 1.0 + (rand() % 100) / 100.0; in rt_landscape()
273 subdivide(field, m, n, wx, wy, 0, 0, m - 1, n - 1); in rt_landscape()
275 rt_sheightfield(tex, ctr, m, n, field, wx, wy); in rt_landscape()