This class handles all different tag states. More...
#include "tagStateManager.h"
Public Member Functions | |
TagStateManager (NodePath main_cam_node) | |
Constructs a new TagStateManager. More... | |
~TagStateManager () | |
Destructs the TagStateManager. More... | |
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. More... | |
void | cleanup_states () |
Cleans up all registered states. More... | |
BitMask32 | get_mask (const std::string &container_name) |
Returns the render mask for the given state. More... | |
void | register_camera (const std::string &state, Camera *source) |
RenderPipeline. More... | |
void | unregister_camera (const std::string &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.
Definition at line 50 of file tagStateManager.h.
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.
main_cam_node | The main scene camera |
Definition at line 45 of file tagStateManager.cxx.
TagStateManager::~TagStateManager | ( | ) |
Destructs the TagStateManager.
This destructs the TagStateManager, and cleans up all resources used.
Definition at line 65 of file tagStateManager.cxx.
References cleanup_states().
|
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.
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 70 of file tagStateManager.I.
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 122 of file tagStateManager.cxx.
Referenced by ~TagStateManager().
|
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.
container_name | Name of the render-pass |
Definition at line 86 of file tagStateManager.I.
References BitMask< WType, nbits >::bit().
|
inline |
RenderPipeline.
Copyright (c) 2014-2016 tobspr tobia s.sp ringe r1@g mail. 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.
source | Camera which will be used to render shadows |
Definition at line 38 of file tagStateManager.I.
|
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.
source | Camera to unregister |
Definition at line 52 of file tagStateManager.I.