Vortex Studio SDK Classes Documentation
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
VxTerrain::VxPagedTerrainProducer Class Reference

Class for paged terrain producer It feeds the Vortex dynamics with parts and collision geometries but only in the areas where collisions are possible. More...

#include <VxTerrain/VxPagedTerrainProducer.h>

+ Inheritance diagram for VxTerrain::VxPagedTerrainProducer:

Public Member Functions

 VxPagedTerrainProducer ()
 Constructor.
 
virtual ~VxPagedTerrainProducer ()
 Destructor.
 
bool containsTerrain (int sourceId)
 Determines whether there is any active part or CG for the given sourceId. More...
 
void deleteAllTerrains ()
 Delete all paged terrains.
 
int getCacheOutFrames () const
 Gets the number of frames before a cell can be paged out.
 
virtual const char * getClassName () const
 Gets class name.
 
VxSpatialForecastergetForecaster ()
 Gets the spatial forecaster.
 
VxPagedTerrainInterfacegetInterface ()
 Gets the paged terrain interface object.
 
int getUpAxis ()
 Gets the "up" axis. More...
 
void insertTerrain (int sourceId, int requestId)
 Links the specified parts and CGs to the area of a given request with the received source ID Use when the terrain element is already present, but overlaps another area.
 
void insertTerrain (int sourceId, int requestId, std::vector< Vx::VxPart * > &parts, std::vector< Vx::VxCollisionGeometry * > &cgs)
 Adds the specified parts and CGs to the area of a given request with the received source ID. More...
 
virtual void preStep ()
 It gets the collision geometries of the parts, maps the terrain requests, sets request priorities before stepping.
 
void printDebugInfo ()
 
void setCacheOutFrames (int cacheOutFrames)
 Specifies the number of frames before a cell can be paged out. More...
 
void setForecaster (VxSpatialForecaster *forecaster)
 Specifies the forecaster to use. More...
 
void setInterface (VxPagedTerrainInterface *terrainInterface)
 Specifies the terrain source to use. More...
 
void setTerrainCellSize (double uSize, double vSize)
 Set terrain cell size.
 
bool setUpAxis (int axis)
 Specifies the "up" axis. More...
 
 VX_PERSISTENCE_DECLARE_MEMBER ()
 
- Public Member Functions inherited from VxTerrain::VxTerrainProducer
 VxTerrainProducer ()
 Constructor.
 
virtual ~VxTerrainProducer ()
 Destructor.
 
Vx::VxAssemblygetAssembly () const
 Gets the assembly of this terrain producer.
 
VxTerrainProducerFactorygetFactory () const
 Gets a pointer to the terrain producer factory in which this terrain was created.
 
Vx::VxPartgetReferencePart () const
 Gets the reference part of this terrain producer.
 
const Vx::VxTransformgetTerrainTransform ()
 Gets the transform of this terrain producer. More...
 
void setTerrainTransform (const Vx::VxTransform &tm)
 Sets the transform of this terrain producer. More...
 
virtual void transform (const Vx::VxTransform &delta)
 Transforms the terrain.
 
- Public Member Functions inherited from Vx::VxDynamicsExtension
 VxDynamicsExtension ()
 Default constructor.
 
virtual ~VxDynamicsExtension ()
 Destructor.
 
VxDynamicsExtensionStatecreateState () const
 Creates a state that can later be restored. More...
 
VxDynamicsExtensionContainergetContainer () const
 Gets the container which has this extension on its list of extensions. More...
 
VxDynamicsExtensionFactorygetFactory () const
 Gets the factory this extension came from.
 
VxUniversegetUniverse () const
 Gets the universe this extension is in. More...
 
virtual void postStep ()
 Determines what happens just after each step in the simulation. More...
 
virtual void preCollision ()
 Determines what happens before collision detection in the simulation. More...
 
bool restoreState (VxDynamicsExtensionState *state)
 Restores a previously created state. More...
 
virtual void step ()
 Determines what happens during each step in the simulation. More...
 
- Public Member Functions inherited from Vx::VxBaseUserData
VXCORE_SYMBOL VxBaseUserData ()
 Default constructor.
 
virtual VXCORE_SYMBOL ~VxBaseUserData ()
 Destructor.
 
void * getUserDataPtr () const
 Get pointer to generic user data.
 
void setUserDataPtr (void *dataPtr)
 Set pointer to generic user data. More...
 
VXCORE_SYMBOL const
VxUserDataContainer
userData () const
 Accessor for user data (const version)
 
VXCORE_SYMBOL VxUserDataContaineruserData ()
 Accessor for user data.
 
- Public Member Functions inherited from Vx::VxBase
void addSubscriber (Event event, Subscriber *subscriber)
 
void addSubscriber (Subscriber *subscriber)
 
unsigned int getCreationIndex () const
 Access the creation index of the instance.
 
const char * getName () const
 Retrieves the name. More...
 
bool hasName () const
 
bool isSubscribed (Event event, Subscriber *subscriber) const
 
bool isSubscribed (Subscriber *subscriber) const
 
void removeSubscriber (Event event, Subscriber *subscriber)
 
void removeSubscriber (Subscriber *subscriber)
 
void setCombinedName (const char *base, const char *name, size_t i=0)
 Utility to set the name to a concatenate string = base_name_i.
 
virtual void setName (const char *name)
 Sets the name.
 

Protected Member Functions

virtual void _initialize ()
 
bool checkConnectivity (std::set< VxTerrainCoord2D > &coords, std::set< VxTerrainCoord2D > &disconnected)
 Determines whether whether the tiles in coords are connected through adjacent tiles or shared collision geometries. More...
 
Vx::VxCompositeCollisionGeometrygetCompositeFor (int requestId)
 Gets composite collision geometry for a request identifier.
 
int getRequestIdForTile (int x, int y)
 Gets the request identifier for a specific tile location.
 
void getTilesFor (const VxTerrainRequest &req, std::vector< std::pair< int, int > > &outTiles)
 Gets the tiles to which a given terrain request maps.
 
void insertTerrainInternal (int sourceId, int requestId)
 Inserts the terrain so there are live parts in the request.
 
void mergeComposites (Vx::VxCompositeCollisionGeometry *composites[], int compositeCount)
 Transfers all the collision geometries in all the specified composites to the first one. More...
 
void processCacheOut ()
 Searches for tiles that can be cached out and caches them out.
 
void removeCompositeMappings (VxTerrainCoord2D coord)
 Removes a coordinate from the composite mapping, checks connectivity, and splits off new composites for the disconnected sections.
 
void runTest ()
 
bool sourceAlsoHasOtherRequest (int sourceId, int requestId)
 Determines whether the same source identifier already exists in another requested tile.
 
void splitNewComposite (const std::set< VxTerrainCoord2D > &coords, Vx::VxCompositeCollisionGeometry *composite)
 Splits of the collision geometries associated with coordinate tiles from the composite and then allocates a new composite for them.
 
- Protected Member Functions inherited from VxTerrain::VxTerrainProducer
virtual void onUniverseChanged (Vx::VxUniverse *previousUniverse, Vx::VxUniverse *currentUniverse)
 Called just after the universe changes. More...
 
- Protected Member Functions inherited from Vx::VxDynamicsExtension
virtual VxDynamicsExtensionStatecreateStateImpl () const
 Creates a state that can be later restored. More...
 
virtual void onContainerChanged (VxDynamicsExtensionContainer *previousContainer, VxDynamicsExtensionContainer *currentContainer)
 Called just after the container changes. More...
 
virtual void restoreStateImpl (VxDynamicsExtensionState *state)
 Restores a previously created state. More...
 

Additional Inherited Members

- Public Types inherited from Vx::VxBase
enum  Event { kEventDestroy = 0, kEventCreate, EVENT_NUM }
 
- Static Public Member Functions inherited from Vx::VxBase
static Subscriber * getConstructorSubscriber ()
 Returns default static VxBase Subscriber that is be called each time an instance of VxBase is create.
 
static bool getEnableMemoryTracking ()
 
static Vx::VxArray< Vx::VxBase * > & getVxBaseList ()
 
static bool isVxBaseValid (VxBase *base)
 
static void setConstructorSubscriber (Subscriber *inSub)
 Sets a default static VxBase Subscriber that will be called each time an instance of VxBase is create.
 
static void setEnableMemoryTracking (bool enabled)
 
- Static Protected Member Functions inherited from Vx::VxBase
static void resetVxBaseCounter ()
 

Detailed Description

Class for paged terrain producer It feeds the Vortex dynamics with parts and collision geometries but only in the areas where collisions are possible.

Member Function Documentation

bool VxTerrain::VxPagedTerrainProducer::checkConnectivity ( std::set< VxTerrainCoord2D > &  coords,
std::set< VxTerrainCoord2D > &  disconnected 
)
protected

Determines whether whether the tiles in coords are connected through adjacent tiles or shared collision geometries.

Modifies coords to contain the reached ones and disconnected to contain all the unreached tiles.

bool VxTerrain::VxPagedTerrainProducer::containsTerrain ( int  sourceId)

Determines whether there is any active part or CG for the given sourceId.

Provides mechanism for the terrain source to know if a given terrain element is already present.

int VxTerrain::VxPagedTerrainProducer::getUpAxis ( )

Gets the "up" axis.

0 is x, 1 is y, 2 is z. Terrain requests produced will have the specified axis set to 0 in the AABBs and should be read as meaning "any value for this axis". Defaults to up z.

void VxTerrain::VxPagedTerrainProducer::insertTerrain ( int  sourceId,
int  requestId,
std::vector< Vx::VxPart * > &  parts,
std::vector< Vx::VxCollisionGeometry * > &  cgs 
)

Adds the specified parts and CGs to the area of a given request with the received source ID.

Use when the terrain element is not already present.

void VxTerrain::VxPagedTerrainProducer::mergeComposites ( Vx::VxCompositeCollisionGeometry composites[],
int  compositeCount 
)
protected

Transfers all the collision geometries in all the specified composites to the first one.

Updates the mapping and then deletes the composites once empty.

void VxTerrain::VxPagedTerrainProducer::setCacheOutFrames ( int  cacheOutFrames)
inline

Specifies the number of frames before a cell can be paged out.

Defaults to 1000 frames.

void VxTerrain::VxPagedTerrainProducer::setForecaster ( VxSpatialForecaster forecaster)

Specifies the forecaster to use.

Note
Accepts a pointer; does not take ownership.
void VxTerrain::VxPagedTerrainProducer::setInterface ( VxPagedTerrainInterface terrainInterface)

Specifies the terrain source to use.

Note
Accepts a pointer; does not take ownership.
bool VxTerrain::VxPagedTerrainProducer::setUpAxis ( int  axis)

Specifies the "up" axis.

0 is x, 1 is y, 2 is z. Terrain requests produced will have the specified axis set to 0 in the AABBs and should be read as meaning "any value for this axis". Defaults to up z.