Panda3D
 All Classes Functions Variables Enumerations
stateMunger.cxx
1 // Filename: stateMunger.cxx
2 // Created by: drose (04May05)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "stateMunger.h"
16 
17 TypeHandle StateMunger::_type_handle;
18 
19 ////////////////////////////////////////////////////////////////////
20 // Function: StateMunger::Destructor
21 // Access: Public, Virtual
22 // Description:
23 ////////////////////////////////////////////////////////////////////
24 StateMunger::
25 ~StateMunger() {
26 }
27 
28 ////////////////////////////////////////////////////////////////////
29 // Function: StateMunger::munge_state
30 // Access: Public
31 // Description: Given an input state, returns the munged state.
32 ////////////////////////////////////////////////////////////////////
34 munge_state(const RenderState *state) {
35  WCPT(RenderState) pt_state = state;
36 
37  StateMap::iterator mi = _state_map.find(pt_state);
38  if (mi != _state_map.end()) {
39  if (!(*mi).first.was_deleted() &&
40  !(*mi).second.was_deleted()) {
41  return (*mi).second.p();
42  }
43  }
44 
45  CPT(RenderState) result = munge_state_impl(state);
46  _state_map[pt_state] = result;
47 
48  return result;
49 }
50 
51 ////////////////////////////////////////////////////////////////////
52 // Function: StateMunger::munge_state_impl
53 // Access: Protected, Virtual
54 // Description: Given an input state, returns the munged state.
55 ////////////////////////////////////////////////////////////////////
57 munge_state_impl(const RenderState *state) {
58  return state;
59 }
This is just a simple derivative of GeomMunger that adds the ability to munge states.
Definition: stateMunger.h:30
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Definition: renderState.h:53
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85