Panda3D
Public Member Functions | Public Attributes | List of all members
ShadowAtlas Class Reference

Class which manages distributing shadow maps in an atlas. More...

Public Member Functions

 __init__ (const ShadowAtlas)
 
 __init__ (int size, int tile_size)
 Constructs a new shadow atlas. More...
 
float getCoverage ()
 Returns the amount of used tiles in percentage. More...
 
int getNumUsedTiles ()
 Returns the amount of used tiles. More...
 

Public Attributes

float coverage
 Returns the amount of used tiles in percentage. More...
 
int num_used_tiles
 Returns the amount of used tiles. More...
 

Detailed Description

Class which manages distributing shadow maps in an atlas.

This class manages the shadow atlas. It handles finding and reserving space for new shadow maps.

Member Function Documentation

◆ __init__() [1/2]

__init__ ( const  ShadowAtlas)

◆ __init__() [2/2]

__init__ ( int  size,
int  tile_size 
)

Constructs a new shadow atlas.

This constructs a new shadow atlas with the given size and tile size.

The size determines the total size of the atlas in pixels. It should be a power-of-two to favour the GPU.

The tile_size determines the smallest unit of tiles the atlas can store. If, for example, a tile_size of 32 is used, then every entry stored must have a resolution of 32 or greater, and the resolution must be a multiple of 32. This is to optimize the search in the atlas, so the atlas does not have to check every pixel, and instead can just check whole tiles.

If you want to disable the use of tiles, set the tile_size to 1, which will make the shadow atlas use pixels instead of tiles.

Parameters
sizeAtlas-size in pixels
tile_sizetile-size in pixels, or 1 to use no tiles.

◆ getCoverage()

float getCoverage ( )

Returns the amount of used tiles in percentage.

This returns in percentage from 0 to 1 how much space of the atlas is used right now. A value of 1 means the atlas is completely full, whereas a value of 0 means the atlas is completely free.

Returns
Atlas usage in percentage

◆ getNumUsedTiles()

int getNumUsedTiles ( )

Returns the amount of used tiles.

Returns the amount of used tiles in the atlas

Returns
Amount of used tiles

Member Data Documentation

◆ coverage

float coverage

Returns the amount of used tiles in percentage.

This returns in percentage from 0 to 1 how much space of the atlas is used right now. A value of 1 means the atlas is completely full, whereas a value of 0 means the atlas is completely free.

Returns
Atlas usage in percentage

◆ num_used_tiles

int num_used_tiles

Returns the amount of used tiles.

Returns the amount of used tiles in the atlas

Returns
Amount of used tiles