@@ -104,16 +104,18 @@ void TriangleMesh__extract(const uniform Shape* uniform _this,
104
104
105
105
vec3f lower = make_vec3f (+ inf);
106
106
vec3f upper = make_vec3f (- inf);
107
- foreach (j= 0 ... this-> numTriangles) {
108
- const vec4i tri = this-> triangle[j];
107
+ // foreach(j=0 ... this->numTriangles) {
108
+ for (uniform int j= 0 ; j< this-> numTriangles; j++ ) {
109
+ const uniform vec4i tri = this-> triangle[j];
109
110
triangles[numTriangles+ j]. v0 = numVertices+ tri. x;
110
111
triangles[numTriangles+ j]. v1 = numVertices+ tri. y;
111
112
triangles[numTriangles+ j]. v2 = numVertices+ tri. z;
112
113
triangles[numTriangles+ j]. id0 = id0;
113
114
triangles[numTriangles+ j]. id1 = j;
114
115
}
115
- foreach (j= 0 ... this-> numPositions) {
116
- const vec3f p = make_vec3f (this-> position[j]);
116
+ // foreach(j=0 ... this->numPositions) {
117
+ for (uniform int j= 0 ; j< this-> numPositions; j++ ) {
118
+ const uniform vec3f p = make_vec3f (this-> position[j]);
117
119
vertices[numVertices+ j]. x = p. x;
118
120
vertices[numVertices+ j]. y = p. y;
119
121
vertices[numVertices+ j]. z = p. z;
@@ -162,32 +164,37 @@ void* uniform TriangleMesh__transform(const uniform Shape* uniform _this, const
162
164
163
165
if (this-> position) {
164
166
mesh-> position = uniform new uniform vec3fa[numVertices];
165
- foreach (i= 0 ... numVertices)
167
+ // foreach(i=0 ... numVertices)
168
+ for (uniform int i= 0 ; i< numVertices; i++ )
166
169
mesh-> position[i] = make_vec3fa (xfmPoint (xfm,make_vec3f (this-> position[i])));
167
170
}
168
171
169
172
if (this-> motion) {
170
173
mesh-> motion = uniform new uniform vec3fa[numVertices];
171
- foreach (i= 0 ... numVertices)
174
+ // foreach(i=0 ... numVertices)
175
+ for (uniform int i= 0 ; i< numVertices; i++ )
172
176
mesh-> motion[i] = make_vec3fa (xfmVector (xfm,make_vec3f (this-> motion[i])));
173
177
}
174
178
175
179
if (this-> normal) {
176
180
uniform LinearSpace3f normal2world = transposed (rcp (xfm. l));
177
181
mesh-> normal = uniform new uniform vec3fa[numVertices];
178
- foreach (i= 0 ... numVertices)
182
+ // foreach(i=0 ... numVertices)
183
+ for (uniform int i= 0 ; i< numVertices; i++ )
179
184
mesh-> normal[i] = make_vec3fa (xfmVector (normal2world,make_vec3f (this-> normal[i])));
180
185
}
181
186
182
187
if (this-> texcoord) {
183
188
mesh-> texcoord = uniform new uniform vec2f[numVertices];
184
- foreach (i= 0 ... numVertices)
189
+ // foreach(i=0 ... numVertices)
190
+ for (uniform int i= 0 ; i< numVertices; i++ )
185
191
mesh-> texcoord[i] = this-> texcoord[i];
186
192
}
187
193
188
194
if (this-> triangle) {
189
195
mesh-> triangle = uniform new uniform vec4i[numTriangles];
190
- foreach (i= 0 ... numTriangles)
196
+ // foreach(i=0 ... numTriangles)
197
+ for (uniform int i= 0 ; i< numTriangles; i++ )
191
198
mesh-> triangle[i] = this-> triangle[i];
192
199
}
193
200
return mesh;
@@ -220,31 +227,36 @@ void TriangleMesh__Constructor(uniform TriangleMesh* uniform this,
220
227
221
228
if (position) {
222
229
this-> position = uniform new uniform vec3fa[numVertices];
223
- foreach (i= 0 ... numVertices)
230
+ // foreach(i=0 ... numVertices)
231
+ for (uniform int i= 0 ; i< numVertices; i++ )
224
232
this-> position[i] = position[i];
225
233
}
226
234
227
235
if (motion) {
228
236
this-> motion = uniform new uniform vec3fa[numVertices];
229
- foreach (i= 0 ... numVertices)
237
+ // foreach(i=0 ... numVertices)
238
+ for (uniform int i= 0 ; i< numVertices; i++ )
230
239
this-> motion[i] = motion[i];
231
240
}
232
241
233
242
if (normal) {
234
243
this-> normal = uniform new uniform vec3fa[numVertices];
235
- foreach (i= 0 ... numVertices)
244
+ // foreach(i=0 ... numVertices)
245
+ for (uniform int i= 0 ; i< numVertices; i++ )
236
246
this-> normal[i] = normal[i];
237
247
}
238
248
239
249
if (texcoord) {
240
250
this-> texcoord = uniform new uniform vec2f[numVertices];
241
- foreach (i= 0 ... numVertices)
251
+ // foreach(i=0 ... numVertices)
252
+ for (uniform int i= 0 ; i< numVertices; i++ )
242
253
this-> texcoord[i] = texcoord[i];
243
254
}
244
255
245
256
if (triangle) {
246
257
this-> triangle = uniform new uniform vec4i[numTriangles];
247
- foreach (i= 0 ... numTriangles)
258
+ // foreach(i=0 ... numTriangles)
259
+ for (uniform int i= 0 ; i< numTriangles; i++ )
248
260
this-> triangle[i] = triangle[i];
249
261
}
250
262
}
0 commit comments