|
AGX Dynamics
2.37.3.2
|
This class performs raycasting against the source geometry to get height data for tiles. More...
#include <TerrainDataSource.h>
Inheritance diagram for agxTerrain::TerrainRasterizer:Public Member Functions | |
| TerrainRasterizer (agx::Real sampleRayLength=1000.0) | |
| Constructor. More... | |
| bool | addSourceGeometry (agxCollide::Geometry *geom) |
| The rasterizer can have one or more source geometries which are used when creating the terrain tiles. More... | |
| virtual TerrainHeightType | fetchTerrainTile (const TileSpecification &ts, agxTerrain::TileId id) override |
| Return height data for requested tile according to the TileSpecification. More... | |
| const char * | getClassName () const override |
| agx::Real | getRayLength () const |
| agxStream::StorageAgent * | getStorageAgent () const override |
| virtual bool | raycast (agx::Vec3 start, agx::Vec3 end, agx::Vec3 &raycastResult) override |
| Overload of TerrainDataSource::raycast for testing against source geometry. More... | |
| bool | removeSourceGeometry (agxCollide::Geometry *geom) |
| Removes a geometry from the TerrainRasterizer. More... | |
| virtual void | restore (agxStream::InputArchive &in) override |
| void | setRayLength (agx::Real length) |
| Set the length of the ray. More... | |
| virtual void | store (agxStream::OutputArchive &out) const override |
Public Member Functions inherited from agxTerrain::TerrainDataSource | |
| bool | addTerrainMaterialSourceGeometry (agxCollide::Geometry *geom, agx::UInt32 terrainMaterialIndex) |
| AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE (agxTerrain::TerrainDataSource) | |
| virtual TerrainMaterialsType | fetchTerrainMaterials (const TileSpecification &ts, agxTerrain::TileId id, agx::Real maxHeight) |
| Return assigned terrain material geometries in the requested tile. More... | |
| bool | removeMaterialSourceGeometry (agxCollide::Geometry *geom) |
| Removes a geometry from the TerrainRasterizer. More... | |
Public Member Functions inherited from agx::Referenced | |
| Referenced () | |
| Default constructor. More... | |
| Referenced (const Referenced &) | |
| template<typename T > | |
| T * | as () |
| Subclass casting. More... | |
| template<typename T > | |
| const T * | as () const |
| template<typename T > | |
| T * | asSafe () |
| Safe subclass casting, return nullptr if template type does not match. More... | |
| template<typename T > | |
| const T * | asSafe () const |
| int | getReferenceCount () const |
| template<typename T > | |
| bool | is () const |
| Subclass test. More... | |
| Referenced & | operator= (const Referenced &) |
| Assignment operator. Will increment the number of references to the referenced object. More... | |
| void | reference (void *ptr=nullptr) const |
| Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More... | |
| void | unreference (void *ptr=nullptr) const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. More... | |
| void | unreference_nodelete () const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. More... | |
Public Member Functions inherited from agxStream::Serializable | |
| virtual | ~Serializable () |
| Destructor for normal C++ use but hidden from SWIG bindings. More... | |
| bool | getEnableSerialization () const |
| bool | getEnableUuidGeneration () |
| agx::UInt32 | getIndex () const |
| This index is given at creation of this object. More... | |
| agx::Uuid | getUuid () const |
| bool | isFinished () const |
| void | setEnableSerialization (bool flag) |
| Set to false to disable serialization of this object. More... | |
| void | setFinished () |
| Tells this class that it is restored correctly and should not be deleted during destruction of an Archive. More... | |
| void | setUuid (const agx::Uuid &uuid) |
| Explicitly set a Uuid on a serializable object. More... | |
Static Public Member Functions | |
| static agxStream::Serializable * | create () |
| static agxStream::Serializable * | create (agxStream::InputArchive &) |
| static const char * | getConstructClassId () |
Static Public Member Functions inherited from agx::Referenced | |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Static Public Member Functions inherited from agxStream::Serializable | |
| static void | setEnableUuidGeneration (bool flag) |
| Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled. More... | |
Protected Member Functions | |
| ~TerrainRasterizer () | |
Protected Member Functions inherited from agx::Referenced | |
| virtual | ~Referenced () |
| Destructor. More... | |
| void | allocateObserverVector () const |
| void | deleteUsingDeleteHandler () const |
Protected Member Functions inherited from agxStream::Serializable | |
| Serializable () | |
| Default constructor. More... | |
| Serializable (const Serializable &other) | |
| Copy constructor. More... | |
| void | generateUuid () |
Additional Inherited Members | |
Public Types inherited from agxTerrain::TerrainDataSource | |
| typedef agx::RealVector | TerrainHeightType |
| Datatype used for returning height values. More... | |
| typedef agx::Vector< std::pair< agxCollide::Geometry *, agx::UInt32 > > | TerrainMaterialsType |
Static Protected Member Functions inherited from agx::Referenced | |
| static DeleteHandler * | getDeleteHandler () |
| static void | setDeleteHandler (DeleteHandler *handler) |
| Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More... | |
Protected Attributes inherited from agxTerrain::TerrainDataSource | |
| agx::ReaderWriterLock | m_rwLock |
Protected Attributes inherited from agx::Referenced | |
| Mutex | m_mutex |
| ObserverContainer | m_observers |
| AtomicValue | m_refCount |
This class performs raycasting against the source geometry to get height data for tiles.
The reference position for the grid tiles defined by the TileSpecification is used to determine where to sample the source geometry. This defines the local X- and Y-coordinates. The local height values are not known and depends on the source geometry.
Therefor a sampleRayLength should be defined so that a ray from 0.5 * sampleRayLength to -0.5 * sampleRayLength hits the source geometry.
Changing the ray length will only affect future tiles that will be sampled, not any previous requested tiles that are cached.
The TerrainRasterizer will only return height data for a terrain tile when it was able to sample the entire tile. If parts of the tile or the entire tile is lacking source geometry, no data will be returned and the TerrainPager will not be able to page in a terrain instace for that region.
Definition at line 151 of file TerrainDataSource.h.
| agxTerrain::TerrainRasterizer::TerrainRasterizer | ( | agx::Real | sampleRayLength = 1000.0 | ) |
Constructor.
|
protected |
| bool agxTerrain::TerrainRasterizer::addSourceGeometry | ( | agxCollide::Geometry * | geom | ) |
The rasterizer can have one or more source geometries which are used when creating the terrain tiles.
These geometries are not required to be part of a agxSDK::Simulation or agxCollide::Space. They will be used directly by the rasterizer.
It is required that they are positioned correctly in the world and it should not be repositioned after it has been given to the rasterizer.
|
inlinestatic |
Definition at line 212 of file TerrainDataSource.h.
|
inlinestatic |
Definition at line 212 of file TerrainDataSource.h.
|
overridevirtual |
Return height data for requested tile according to the TileSpecification.
| ts | - The specification of how new tiles are created by the data source |
| id | - The id or position of the tile relative to other paged terrain tiles |
Implements agxTerrain::TerrainDataSource.
|
inlineoverridevirtual |
Reimplemented from agxStream::Serializable.
Definition at line 212 of file TerrainDataSource.h.
|
inlinestatic |
Definition at line 212 of file TerrainDataSource.h.
| agx::Real agxTerrain::TerrainRasterizer::getRayLength | ( | ) | const |
Definition at line 275 of file TerrainDataSource.h.
|
inlineoverridevirtual |
Implements agxStream::Serializable.
Definition at line 212 of file TerrainDataSource.h.
|
overridevirtual |
Overload of TerrainDataSource::raycast for testing against source geometry.
| start | - The start position of the raycast |
| end | - The end position of the raycast |
| raycastResult | - A reference to a Vec3 in which to store the point where the raycast hits the data source, |
Reimplemented from agxTerrain::TerrainDataSource.
| bool agxTerrain::TerrainRasterizer::removeSourceGeometry | ( | agxCollide::Geometry * | geom | ) |
Removes a geometry from the TerrainRasterizer.
Areas that has been sampled which hit the geometry being removed will not be resampled and cached heights will still be used.
|
overridevirtual |
Reimplemented from agxTerrain::TerrainDataSource.
| void agxTerrain::TerrainRasterizer::setRayLength | ( | agx::Real | length | ) |
Set the length of the ray.
Definition at line 280 of file TerrainDataSource.h.
|
overridevirtual |
Reimplemented from agxTerrain::TerrainDataSource.