panda3d._rplight.ShadowManager

class ShadowManager

Bases: ReferenceCount

Inheritance diagram

Inheritance diagram of ShadowManager

__init__() → None

This constructs a new shadow atlas. There are a set of properties which should be set before calling ShadowManager.init(), see the set-Methods. After all properties are set, ShadowManager.init() should get called. ShadowManager.update() should get called on a per frame basis.

__init__(param0: ShadowManager) → None
setMaxUpdates(max_updates: size_t) → None

This controls the maximum amount of updated ShadowSources per frame. The ShadowManager will take the first <max_updates> ShadowSources, and generate shadow maps for them every frame. If there are more ShadowSources waiting to get updated than available updates, the sources are sorted by priority, and the update of the less important sources is delayed to the next frame.

If the update count is set too low, and there are a lot of ShadowSources waiting to get updated, artifacts will occur, and there might be ShadowSources which never get updated, due to low priority.

If an update count of 0 is passed, no updates will happen. This also means that there are no shadows. This is not recommended.

If an update count < 0 is passed, undefined behaviour occurs.

This method has to get called before ShadowManager.init(), otherwise an assertion will get triggered.

setScene(scene_parent: NodePath) → None

This sets the target scene for rendering shadows. All shadow cameras will be parented to this scene to render shadows.

Usually the scene will be ShowBase.render. If the scene is an empty or invalid NodePath, an assertion will be triggered.

This method has to get called before calling ShadowManager.init(), or an assertion will get triggered.

setTagStateManager(tag_mgr: TagStateManager) → None

This sets the handle to the TagStateManager used by the pipeline. Usually this is RenderPipeline.get_tag_mgr().

This has to get called before ShadowManager.init(), otherwise an assertion will get triggered.

setAtlasGraphicsOutput(graphics_output: GraphicsOutput) → None

This sets the handle to the GraphicsOutput of the shadow atlas. Usually this is RenderTarget.get_internal_buffer(), whereas the RenderTarget is the target of the ShadowStage.

This is used for creating display regions and attaching cameras to them, for performing shadow updates.

This has to get called before ShadowManager.init(), otherwise an assertion will be triggered.

setAtlasSize(atlas_size: size_t) → None

This sets the desired shadow atlas size. It should be big enough to store all important shadow sources, with some buffer, because the shadow maps usually won’t be fitted perfectly, so gaps can occur.

This has to get called before calling ShadowManager.init(). When calling this method after initialization, an assertion will get triggered.

getAtlasSize() → size_t

This returns the shadow atlas size previously set with ShadowManager.setAtlasSize().

Return type

size_t

getNumUpdateSlotsLeft() → size_t

This returns how many update slots are left. You can assume the next n calls to add_update will succeed, whereas n is the value returned by this function.

Return type

size_t

getAtlas() → ShadowAtlas

This returns a handle to the internal shadow atlas instance. This is only valid after calling ShadowManager.init(). Calling this earlier will trigger an assertion and undefined behaviour.

Return type

ShadowAtlas

init() → None

This initializes the ShadowManager. All properties should have been set before calling this, otherwise assertions will get triggered.

This setups everything required for rendering shadows, including the shadow atlas and the various shadow cameras. After calling this method, no properties can be changed anymore.

update() → None

This updates the ShadowManager, processing all shadow sources which need to get updated.

This first collects all sources which require an update, sorts them by priority, and then processes the first <max_updates> ShadowSources.

This may not get called before ShadowManager.init(), or an assertion will be thrown.

property atlas_size
Getter

This returns the shadow atlas size previously set with ShadowManager.setAtlasSize().

Setter

This sets the desired shadow atlas size. It should be big enough to store all important shadow sources, with some buffer, because the shadow maps usually won’t be fitted perfectly, so gaps can occur.

This has to get called before calling ShadowManager.init(). When calling this method after initialization, an assertion will get triggered.

Return type

size_t

property num_update_slots_left

This returns how many update slots are left. You can assume the next n calls to add_update will succeed, whereas n is the value returned by this function.

Return type

size_t

property atlas

This returns a handle to the internal shadow atlas instance. This is only valid after calling ShadowManager.init(). Calling this earlier will trigger an assertion and undefined behaviour.

Return type

ShadowAtlas