Chipmunk2D Pro API Reference  7.0.1
 All Classes Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
Instance Methods | Properties | List of all members
ChipmunkAbstractTileCache Class Reference

A tile cache enables an efficient means of updating a large deformable terrain. More...

#import <ChipmunkTileCache.h>

Inherits NSObject.

Inherited by ChipmunkBasicTileCache.

Instance Methods

(id) - initWithSampler:space:tileSize:samplesPerTile:cacheSize:
 Create the cache from the given sampler, space to add the generated segments to, size of the tiles, and the number of samples for each tile. More...
 
(void) - resetCache
 Clear out all the cached tiles to force a full regen.
 
(void) - markDirtyRect:
 Mark a region as needing an update. More...
 
(void) - ensureRect:
 Ensure that the given rect has been fully generated and contains no dirty rects.
 
(cpPolyline *) - simplify:
 Override this in a subclass to make custom polygon simplification behavior. More...
 
(ChipmunkSegmentShape *) - makeSegmentFor:from:to:
 Override this method to construct the segment shapes. More...
 

Properties

bool marchHard
 Should the marching be hard or soft? See cpMarchHard() and cpMarchSoft() for more information. More...
 
cpVect tileOffset
 Offset of the tile grid origin.
 
ChipmunkAbstractSamplersampler
 The sampling function to use.
 

Detailed Description

A tile cache enables an efficient means of updating a large deformable terrain.

General usage would be to pass a rectangle covering the viewport to ensureRect: and calling markDirtyRect: each time a change is made that requires an area to be resampled.

Method Documentation

- (id) initWithSampler: (ChipmunkAbstractSampler *)  sampler
space: (ChipmunkSpace *)  space
tileSize: (cpFloat tileSize
samplesPerTile: (NSUInteger)  samplesPerTile
cacheSize: (NSUInteger)  cacheSize 

Create the cache from the given sampler, space to add the generated segments to, size of the tiles, and the number of samples for each tile.

- (ChipmunkSegmentShape *) makeSegmentFor: (ChipmunkBody *)  staticBody
from: (cpVect a
to: (cpVect b 

Override this method to construct the segment shapes.

By default, it creates a 0 radius segment and sets 1.0 for friction and elasticity and nothing else.

- (void) markDirtyRect: (cpBB bounds

Mark a region as needing an update.

Geometry is not regenerated until ensureRect: is called.

- (cpPolyline *) simplify: (cpPolyline *)  polyline

Override this in a subclass to make custom polygon simplification behavior.

Defaults to cpPolylineSimplifyCurves(polyline, 2.0f)

Property Documentation

- (bool) marchHard
readwritenonatomicassign

Should the marching be hard or soft? See cpMarchHard() and cpMarchSoft() for more information.


The documentation for this class was generated from the following file: