Panda3D
|
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... | |
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.
__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.
main_cam_node | The main scene camera |
__init__ | ( | const | TagStateManager | ) |
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.
np | The nodepath to apply the shader to |
shader | A handle to the shader to apply |
name | Name of the state, should be a unique identifier |
sort | Determines the sort with which the shader will be applied. |
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.
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.
container_name | Name of the render-pass |
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.
source | Camera which will be used to render shadows |
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.
source | Camera to unregister |