cesium-native  0.41.0
Cesium3DTilesSelection::IPrepareRendererResources Class Referenceabstract

When implemented for a rendering engine, allows renderer resources to be created and destroyed under the control of a Tileset. More...

#include <Cesium3DTilesSelection/IPrepareRendererResources.h>

Inheritance diagram for Cesium3DTilesSelection::IPrepareRendererResources:
CesiumRasterOverlays::IPrepareRasterOverlayRendererResources

Public Member Functions

virtual CesiumAsync::Future< TileLoadResultAndRenderResourcesprepareInLoadThread (const CesiumAsync::AsyncSystem &asyncSystem, TileLoadResult &&tileLoadResult, const glm::dmat4 &transform, const std::any &rendererOptions)=0
 Prepares renderer resources for the given tile. This method is invoked in the load thread. More...
 
virtual void * prepareInMainThread (Tile &tile, void *pLoadThreadResult)=0
 Further prepares renderer resources. More...
 
virtual void free (Tile &tile, void *pLoadThreadResult, void *pMainThreadResult) noexcept=0
 Frees previously-prepared renderer resources. More...
 
virtual void attachRasterInMainThread (const Tile &tile, int32_t overlayTextureCoordinateID, const CesiumRasterOverlays::RasterOverlayTile &rasterTile, void *pMainThreadRendererResources, const glm::dvec2 &translation, const glm::dvec2 &scale)=0
 Attaches a raster overlay tile to a geometry tile. More...
 
virtual void detachRasterInMainThread (const Tile &tile, int32_t overlayTextureCoordinateID, const CesiumRasterOverlays::RasterOverlayTile &rasterTile, void *pMainThreadRendererResources) noexcept=0
 Detaches a raster overlay tile from a geometry tile. More...
 
- Public Member Functions inherited from CesiumRasterOverlays::IPrepareRasterOverlayRendererResources
virtual void * prepareRasterInLoadThread (CesiumGltf::ImageAsset &image, const std::any &rendererOptions)=0
 Prepares a raster overlay tile. More...
 
virtual void * prepareRasterInMainThread (RasterOverlayTile &rasterTile, void *pLoadThreadResult)=0
 Further preprares a raster overlay tile. More...
 
virtual void freeRaster (const RasterOverlayTile &rasterTile, void *pLoadThreadResult, void *pMainThreadResult) noexcept=0
 Frees previously-prepared renderer resources for a raster tile. More...
 

Detailed Description

When implemented for a rendering engine, allows renderer resources to be created and destroyed under the control of a Tileset.

It is not supposed to be used directly by clients. It is implemented for specific rendering engines to provide an infrastructure for preparing the data of a Tile so that it can be used for rendering.

Instances of this class are associated with a Tileset, in the TilesetExternals structure that can be obtained via Tileset::getExternals.

Definition at line 51 of file IPrepareRendererResources.h.

Member Function Documentation

◆ attachRasterInMainThread()

virtual void Cesium3DTilesSelection::IPrepareRendererResources::attachRasterInMainThread ( const Tile tile,
int32_t  overlayTextureCoordinateID,
const CesiumRasterOverlays::RasterOverlayTile rasterTile,
void *  pMainThreadRendererResources,
const glm::dvec2 &  translation,
const glm::dvec2 &  scale 
)
pure virtual

Attaches a raster overlay tile to a geometry tile.

Parameters
tileThe geometry tile.
overlayTextureCoordinateIDThe ID of the overlay texture coordinate set to use.
rasterTileThe raster overlay tile to add. The raster tile will have been previously prepared with a call to prepareRasterInLoadThread followed by prepareRasterInMainThread.
pMainThreadRendererResourcesThe renderer resources for this raster tile, as created and returned by prepareRasterInMainThread.
translationThe translation to apply to the texture coordinates identified by overlayTextureCoordinateID. The texture coordinates to use to sample the raster image are computed as overlayTextureCoordinates * scale + translation.
scaleThe scale to apply to the texture coordinates identified by overlayTextureCoordinateID. The texture coordinates to use to sample the raster image are computed as overlayTextureCoordinates * scale + translation.

◆ detachRasterInMainThread()

virtual void Cesium3DTilesSelection::IPrepareRendererResources::detachRasterInMainThread ( const Tile tile,
int32_t  overlayTextureCoordinateID,
const CesiumRasterOverlays::RasterOverlayTile rasterTile,
void *  pMainThreadRendererResources 
)
pure virtualnoexcept

Detaches a raster overlay tile from a geometry tile.

Parameters
tileThe geometry tile.
overlayTextureCoordinateIDThe ID of the overlay texture coordinate set to which the raster tile was previously attached.
rasterTileThe raster overlay tile to remove.
pMainThreadRendererResourcesThe renderer resources for this raster tile, as created and returned by prepareRasterInMainThread.

◆ free()

virtual void Cesium3DTilesSelection::IPrepareRendererResources::free ( Tile tile,
void *  pLoadThreadResult,
void *  pMainThreadResult 
)
pure virtualnoexcept

Frees previously-prepared renderer resources.

This method is always called from the thread that called Tileset::updateView or deleted the tileset.

Parameters
tileThe tile for which to free renderer resources.
pLoadThreadResultThe result returned by prepareInLoadThread. If prepareInMainThread has already been called, this parameter will be nullptr.
pMainThreadResultThe result returned by prepareInMainThread. If prepareInMainThread has not yet been called, this parameter will be nullptr.

◆ prepareInLoadThread()

virtual CesiumAsync::Future<TileLoadResultAndRenderResources> Cesium3DTilesSelection::IPrepareRendererResources::prepareInLoadThread ( const CesiumAsync::AsyncSystem asyncSystem,
TileLoadResult &&  tileLoadResult,
const glm::dmat4 &  transform,
const std::any &  rendererOptions 
)
pure virtual

Prepares renderer resources for the given tile. This method is invoked in the load thread.

Parameters
asyncSystemThe AsyncSystem used to do work in threads.
tileLoadResultThe tile data loaded so far.
transformThe tile's transformation.
rendererOptionsRenderer options associated with the tile from TilesetOptions::rendererOptions.
Returns
A future that resolves to the loaded tile data along with arbitrary "render resources" data representing the result of the load process. The loaded data may be the same as was originally given to this method, or it may be modified. The render resources are passed to prepareInMainThread as the pLoadThreadResult parameter.

◆ prepareInMainThread()

virtual void* Cesium3DTilesSelection::IPrepareRendererResources::prepareInMainThread ( Tile tile,
void *  pLoadThreadResult 
)
pure virtual

Further prepares renderer resources.

This is called after prepareInLoadThread, and unlike that method, this one is called from the same thread that called Tileset::updateView.

Parameters
tileThe tile to prepare.
pLoadThreadResultThe value returned from prepareInLoadThread.
Returns
Arbitrary data representing the result of the load process. Note that the value returned by prepareInLoadThread will not be automatically preserved and passed to free. If you need to free that value, do it in this method before returning. If you need that value later, add it to the object returned from this method.

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