Panda3D

Loading...
Searching...
No Matches
Public Member Functions | List of all members
TagStateManager Class Reference

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

`#include "tagStateManager.h"`

## Public Member Functions
| TagStateManager (NodePath main_cam_node)
| Constructs a new TagStateManager.
| ~TagStateManager ()
| Destructs the TagStateManager.
void | apply_state (const std::string &state, NodePath np, Shader *shader, const std::string &name, int sort)
| Applies a given state for a pass to a NodePath.
void | cleanup_states ()
| Cleans up all registered states.
BitMask32 | get_mask (const std::string &container_name)
| Returns the render mask for the given state.
void | register_camera (const std::string &state, Camera *source)
| RenderPipeline.
void | unregister_camera (const std::string &state, Camera *source)
| Unregisters a camera from the list of shadow cameras.

## 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.

Definition at line 50 of file tagStateManager.h.

## Constructor & Destructor Documentation

## ◆ TagStateManager()

TagStateManager::TagStateManager | ( | 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_node | The main scene camera

Definition at line 44 of file tagStateManager.cxx.

References BitMask< uint32_t, 32 >::bit(), NodePath::is_empty(), and NodePath::node().

## ◆ ~TagStateManager()

TagStateManager::~TagStateManager | ( |  | ) |

Destructs the TagStateManager.

This destructs the TagStateManager, and cleans up all resources used.

Definition at line 64 of file tagStateManager.cxx.

References cleanup_states().

## Member Function Documentation

## ◆ apply_state()

void TagStateManager::apply_state | ( | const std::string & | state,
|  | NodePath | np,
|  | Shader * | shader,
|  | const std::string & | name,
|  | int | sort )
| inline

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

  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.

Definition at line 69 of file tagStateManager.I.

References apply_state().

Referenced by apply_state().

## ◆ cleanup_states()

void TagStateManager::cleanup_states | ( |  | ) |

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.

Definition at line 121 of file tagStateManager.cxx.

Referenced by ~TagStateManager().

## ◆ get_mask()

BitMask32 TagStateManager::get_mask | ( | const std::string & | container_name | ) |
| inline

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_name | Name of the render-pass

Returns
  Bit mask of the render pass

Definition at line 85 of file tagStateManager.I.

References BitMask< uint32_t, 32 >::bit().

## ◆ register_camera()

void TagStateManager::register_camera | ( | const std::string & | name,
|  | Camera * | source )
| inline

RenderPipeline.

Copyright (c) 2014-2016 tobspr tobia.nosp@m.s.sp.nosp@m.ringe.nosp@m.r1@g.nosp@m.mail..nosp@m.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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

  source | Camera which will be used to render shadows

Definition at line 37 of file tagStateManager.I.

References register_camera().

Referenced by register_camera().

## ◆ unregister_camera()

void TagStateManager::unregister_camera | ( | const std::string & | name,
|  | Camera * | source )
| inline

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

  source | Camera to unregister

Definition at line 51 of file tagStateManager.I.

References unregister_camera().

Referenced by unregister_camera().

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

- contrib/src/rplight/tagStateManager.h
- contrib/src/rplight/tagStateManager.cxx
- contrib/src/rplight/tagStateManager.I