Panda3D
|
00001 // Filename: occluderNode.I 00002 // Created by: jenes (11Mar11) 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: OccluderNode::set_vertices 00018 // Access: Published 00019 // Description: Replaces the four vertices of the occluder polygon. 00020 // The vertices should be defined in a counterclockwise 00021 // orientation when looking at the face of the occluder. 00022 //////////////////////////////////////////////////////////////////// 00023 INLINE void OccluderNode:: 00024 set_vertices(const LPoint3 &v0, const LPoint3 &v1, 00025 const LPoint3 &v2, const LPoint3 &v3) { 00026 _vertices.clear(); 00027 _vertices.reserve(4); 00028 _vertices.push_back(v0); 00029 _vertices.push_back(v1); 00030 _vertices.push_back(v2); 00031 _vertices.push_back(v3); 00032 } 00033 00034 //////////////////////////////////////////////////////////////////// 00035 // Function: OccluderNode::get_num_vertices 00036 // Access: Published 00037 // Description: Returns the number of vertices in the occluder 00038 // polygon. This should always return 4. 00039 //////////////////////////////////////////////////////////////////// 00040 INLINE int OccluderNode:: 00041 get_num_vertices() const { 00042 return _vertices.size(); 00043 } 00044 00045 //////////////////////////////////////////////////////////////////// 00046 // Function: OccluderNode::get_vertex 00047 // Access: Published 00048 // Description: Returns the nth vertex of the occluder polygon. 00049 //////////////////////////////////////////////////////////////////// 00050 INLINE const LPoint3 &OccluderNode:: 00051 get_vertex(int n) const { 00052 nassertr(n >= 0 && n < (int)_vertices.size(), LPoint3::zero()); 00053 return _vertices[n]; 00054 } 00055 00056 //////////////////////////////////////////////////////////////////// 00057 // Function: OccluderNode::set_double_sided 00058 // Access: Published 00059 // Description: If true, the back-face will also be used to occlude 00060 //////////////////////////////////////////////////////////////////// 00061 INLINE void OccluderNode::set_double_sided(bool value) { 00062 _double_sided = value; 00063 } 00064 00065 //////////////////////////////////////////////////////////////////// 00066 // Function: OccluderNode::is_double_sided 00067 // Access: Published 00068 // Description: Is this occluder double-sided 00069 //////////////////////////////////////////////////////////////////// 00070 INLINE bool OccluderNode::is_double_sided() { 00071 return _double_sided; 00072 } 00073 00074 //////////////////////////////////////////////////////////////////// 00075 // Function: OccluderNode::set_min_coverage 00076 // Access: Published 00077 // Description: Minimum screen coverage needed before occluder used. 00078 // Range should be 0 to 1. For example, setting to 0.2 00079 // would mean that the occluder needs to cover 20% of 00080 // the screen to be considered. 00081 //////////////////////////////////////////////////////////////////// 00082 INLINE void OccluderNode::set_min_coverage(PN_stdfloat value) { 00083 _min_coverage = value; 00084 } 00085 00086 //////////////////////////////////////////////////////////////////// 00087 // Function: OccluderNode::get_min_coverage 00088 // Access: Published 00089 // Description: Returns the minimum screen coverage. 00090 //////////////////////////////////////////////////////////////////// 00091 INLINE PN_stdfloat OccluderNode::get_min_coverage() { 00092 return _min_coverage; 00093 }