Panda3D
Classes | 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. 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...
 

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_nodeThe main scene camera

Definition at line 45 of file tagStateManager.cxx.

◆ ~TagStateManager()

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().

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

Definition at line 70 of file tagStateManager.I.

◆ 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 122 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_nameName of the render-pass
Returns
Bit mask of the render pass

Definition at line 86 of file tagStateManager.I.

References BitMask< WType, nbits >::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
sourceCamera which will be used to render shadows

Definition at line 38 of file tagStateManager.I.

◆ 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
sourceCamera to unregister

Definition at line 52 of file tagStateManager.I.


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