00001 // Filename: occluderEffect.I 00002 // Created by: drose (17Mar11) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: OccluderEffect::Constructor 00018 // Access: Protected 00019 // Description: Use OccluderEffect::make() to construct a new 00020 // OccluderEffect object. 00021 //////////////////////////////////////////////////////////////////// 00022 INLINE OccluderEffect:: 00023 OccluderEffect() { 00024 } 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Function: OccluderEffect::Copy Constructor 00028 // Access: Protected 00029 // Description: Use OccluderEffect::make() to construct a new 00030 // OccluderEffect object. The copy constructor is only 00031 // defined to facilitate methods like add_on_occluder(). 00032 //////////////////////////////////////////////////////////////////// 00033 INLINE OccluderEffect:: 00034 OccluderEffect(const OccluderEffect ©) : 00035 _on_occluders(copy._on_occluders) 00036 { 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function: OccluderEffect::get_num_on_occluders 00041 // Access: Published 00042 // Description: Returns the number of occluders that are enabled by 00043 // the effectute. 00044 //////////////////////////////////////////////////////////////////// 00045 INLINE int OccluderEffect:: 00046 get_num_on_occluders() const { 00047 return _on_occluders.size(); 00048 } 00049 00050 //////////////////////////////////////////////////////////////////// 00051 // Function: OccluderEffect::get_on_occluder 00052 // Access: Published 00053 // Description: Returns the nth occluder enabled by the effectute, 00054 // sorted in render order. 00055 //////////////////////////////////////////////////////////////////// 00056 INLINE NodePath OccluderEffect:: 00057 get_on_occluder(int n) const { 00058 nassertr(n >= 0 && n < (int)_on_occluders.size(), NodePath::fail()); 00059 return _on_occluders[n]; 00060 } 00061 00062 //////////////////////////////////////////////////////////////////// 00063 // Function: OccluderEffect::has_on_occluder 00064 // Access: Published 00065 // Description: Returns true if the indicated occluder is enabled by 00066 // the effect, false otherwise. 00067 //////////////////////////////////////////////////////////////////// 00068 INLINE bool OccluderEffect:: 00069 has_on_occluder(const NodePath &occluder) const { 00070 return _on_occluders.find(occluder) != _on_occluders.end(); 00071 } 00072 00073 //////////////////////////////////////////////////////////////////// 00074 // Function: OccluderEffect::is_identity 00075 // Access: Published 00076 // Description: Returns true if this is an identity effect: it does 00077 // not change the set of occluders in use. 00078 //////////////////////////////////////////////////////////////////// 00079 INLINE bool OccluderEffect:: 00080 is_identity() const { 00081 return _on_occluders.empty(); 00082 }