~rebel/horde3d/trunk

« back to all changes in this revision

Viewing changes to trunk/Tools/Dependencies/RecastNavigation/Recast/Source/RecastLayers.cpp

  • Committer: felix
  • Date: 2015-07-07 12:57:07 UTC
  • Revision ID: svn-v4:5ce291ac-9df0-446f-9e4f-d57731c4dda7::1699
- Updated RecastNavigation to latest version and fixed multiple issues.
- Adapted GameDetourComponent, GameDetourCrowdComponent, DetourCrowdDemo and AAA accordingly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
        unsigned char layerId;          // Layer ID
39
39
        unsigned char nlayers;          // Layer count
40
40
        unsigned char nneis;            // Neighbour count
41
 
        unsigned char base;                     // Flag indicating if the region is hte base of merged regions.
 
41
        unsigned char base;             // Flag indicating if the region is the base of merged regions.
42
42
};
43
43
 
44
44
 
293
293
        for (int i = 0; i < nregs; ++i)
294
294
        {
295
295
                rcLayerRegion& root = regs[i];
296
 
                // Skip alreadu visited.
 
296
                // Skip already visited.
297
297
                if (root.layerId != 0xff)
298
298
                        continue;
299
299
 
325
325
                                        continue;
326
326
                                // Skip if the height range would become too large.
327
327
                                const int ymin = rcMin(root.ymin, regn.ymin);
328
 
                                const int ymax = rcMin(root.ymax, regn.ymax);
 
328
                                const int ymax = rcMax(root.ymax, regn.ymax);
329
329
                                if ((ymax - ymin) >= 255)
330
330
                                         continue;
331
331
 
368
368
                                rcLayerRegion& rj = regs[j];
369
369
                                if (!rj.base) continue;
370
370
                                
371
 
                                // Skip if teh regions are not close to each other.
 
371
                                // Skip if the regions are not close to each other.
372
372
                                if (!overlapRange(ri.ymin,ri.ymax+mergeHeight, rj.ymin,rj.ymax+mergeHeight))
373
373
                                        continue;
374
374
                                // Skip if the height range would become too large.
375
375
                                const int ymin = rcMin(ri.ymin, rj.ymin);
376
 
                                const int ymax = rcMin(ri.ymax, rj.ymax);
 
376
                                const int ymax = rcMax(ri.ymax, rj.ymax);
377
377
                                if ((ymax - ymin) >= 255)
378
378
                                  continue;
379
379
                                                  
380
 
                                // Make sure that there is no overlap when mergin 'ri' and 'rj'.
 
380
                                // Make sure that there is no overlap when merging 'ri' and 'rj'.
381
381
                                bool overlap = false;
382
382
                                // Iterate over all regions which have the same layerId as 'rj'
383
383
                                for (int k = 0; k < nregs; ++k)
417
417
                                        // Add overlaid layers from 'rj' to 'ri'.
418
418
                                        for (int k = 0; k < rj.nlayers; ++k)
419
419
                                                addUnique(ri.layers, ri.nlayers, rj.layers[k]);
420
 
                                        // Update heigh bounds.
 
420
                                        // Update height bounds.
421
421
                                        ri.ymin = rcMin(ri.ymin, rj.ymin);
422
422
                                        ri.ymax = rcMax(ri.ymax, rj.ymax);
423
423
                                }
481
481
        for (int i = 0; i < lset.nlayers; ++i)
482
482
        {
483
483
                unsigned char curId = (unsigned char)i;
484
 
                
485
 
                // Allocate memory for the current layer.
 
484
 
486
485
                rcHeightfieldLayer* layer = &lset.layers[i];
487
 
                memset(layer, 0, sizeof(rcHeightfieldLayer));
488
486
 
489
487
                const int gridSize = sizeof(unsigned char)*lw*lh;
490
488
 
528
526
                layer->cs = chf.cs;
529
527
                layer->ch = chf.ch;
530
528
                
531
 
                // Adjust the bbox to fit the heighfield.
 
529
                // Adjust the bbox to fit the heightfield.
532
530
                rcVcopy(layer->bmin, bmin);
533
531
                rcVcopy(layer->bmax, bmax);
534
532
                layer->bmin[1] = bmin[1] + hmin*chf.ch;
542
540
                layer->miny = layer->height;
543
541
                layer->maxy = 0;
544
542
                
545
 
                // Copy height and area from compact heighfield. 
 
543
                // Copy height and area from compact heightfield. 
546
544
                for (int y = 0; y < lh; ++y)
547
545
                {
548
546
                        for (int x = 0; x < lw; ++x)