Panda3D
Public Member Functions | List of all members
TagStateManager Class Reference

This class handles all different tag states. More...

Public Member Functions

 __init__ (NodePath main_cam_node)
 Constructs a new TagStateManager. More...
 
 __init__ (const TagStateManager)
 
 applyState (str state, NodePath np, Shader shader, str name, int sort)
 Applies a given state for a pass to a NodePath. More...
 
 cleanupStates ()
 Cleans up all registered states. More...
 
BitMask32 getMask (str container_name)
 Returns the render mask for the given state. More...
 
 registerCamera (str state, Camera source)
 Registers a new camera which renders a certain pass. More...
 
 unregisterCamera (str state, Camera source)
 Unregisters a camera from the list of shadow cameras. More...
 

Detailed Description

This class handles all different tag states.

The TagStateManager stores a list of RenderStates assigned to different steps in the pipeline. For example, there are a list of shadow states, which are applied whenever objects are rendered from a shadow camera.

The Manager also stores a list of all cameras used in the different stages, to keep track of the states used and to be able to attach new states.

Member Function Documentation

◆ __init__() [1/2]

__init__ ( NodePath  main_cam_node)

Constructs a new TagStateManager.

This constructs a new TagStateManager. The #main_cam_node should refer to the main scene camera, and will most likely be base.cam. It is necessary to pass the camera because the C++ code does not have access to the showbase.

Parameters
main_cam_nodeThe main scene camera

◆ __init__() [2/2]

__init__ ( const  TagStateManager)

◆ applyState()

applyState ( str  state,
NodePath  np,
Shader  shader,
str  name,
int  sort 
)

Applies a given state for a pass to a NodePath.

This applies a shader to the given NodePath which is used when the NodePath is rendered by any registered camera for that pass. It also disables color write depending on the pass.

Parameters
npThe nodepath to apply the shader to
shaderA handle to the shader to apply
nameName of the state, should be a unique identifier
sortDetermines the sort with which the shader will be applied.

◆ cleanupStates()

cleanupStates ( )

Cleans up all registered states.

This cleans up all states which were registered to the TagStateManager. It also calls Camera::clear_tag_states() on the main_cam_node and all attached cameras.

◆ getMask()

BitMask32 getMask ( str  container_name)

Returns the render mask for the given state.

This returns the mask of a given render pass, which can be used to either show or hide objects from this pass.

Parameters
container_nameName of the render-pass
Returns
Bit mask of the render pass

◆ registerCamera()

registerCamera ( str  state,
Camera  source 
)

Registers a new camera which renders a certain pass.

This registers a new camera which will be used to render the given pass. The TagStateManager will keep track of the camera and applies all registered states onto the camera with Camera::set_tag_state. It also applies the appropriate camera mask to the camera, and sets an initial state to disable color write depending on the pass.

Parameters
sourceCamera which will be used to render shadows

◆ unregisterCamera()

unregisterCamera ( str  state,
Camera  source 
)

Unregisters a camera from the list of shadow cameras.

This unregisters a camera from the list of shadows cameras. It also resets all tag states of the camera, and also its initial state.

Parameters
sourceCamera to unregister