| 304 | } |
| 305 | |
| 306 | bool rcCreateHeightfield(rcContext* context, rcHeightfield& heightfield, int sizeX, int sizeZ, |
| 307 | const float* minBounds, const float* maxBounds, |
| 308 | float cellSize, float cellHeight) |
| 309 | { |
| 310 | rcIgnoreUnused(context); |
| 311 | |
| 312 | heightfield.width = sizeX; |
| 313 | heightfield.height = sizeZ; |
| 314 | rcVcopy(heightfield.bmin, minBounds); |
| 315 | rcVcopy(heightfield.bmax, maxBounds); |
| 316 | heightfield.cs = cellSize; |
| 317 | heightfield.ch = cellHeight; |
| 318 | heightfield.spans = (rcSpan**)rcAlloc(sizeof(rcSpan*) * heightfield.width * heightfield.height, RC_ALLOC_PERM); |
| 319 | if (!heightfield.spans) |
| 320 | { |
| 321 | return false; |
| 322 | } |
| 323 | memset(heightfield.spans, 0, sizeof(rcSpan*) * heightfield.width * heightfield.height); |
| 324 | return true; |
| 325 | } |
| 326 | |
| 327 | static void calcTriNormal(const float* v0, const float* v1, const float* v2, float* faceNormal) |
| 328 | { |
no test coverage detected