Panda3D
|
00001 // Filename: cullPlanes.h 00002 // Created by: drose (23Aug05) 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 #ifndef CULLPLANES_H 00016 #define CULLPLANES_H 00017 00018 #include "pandabase.h" 00019 #include "referenceCount.h" 00020 #include "nodePath.h" 00021 #include "boundingHexahedron.h" 00022 #include "boundingPlane.h" 00023 #include "pointerTo.h" 00024 #include "luse.h" 00025 #include "deletedChain.h" 00026 00027 class ClipPlaneAttrib; 00028 class OccluderEffect; 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Class : CullPlanes 00032 // Description : This represents the set of clip planes and/or 00033 // occluders that are definitely in effect for the 00034 // current node of the CullTraverserData, as well as on 00035 // all child nodes. Any clip planes and occluders in 00036 // this list may be safely culled against. 00037 // 00038 // This does not include the clip planes that are in 00039 // effect now, but might later be turned off by a child 00040 // node, since we can't safely cull against such clip 00041 // planes. 00042 // 00043 // The bounding volumes in this object are transformed 00044 // for each level of the scene graph. 00045 //////////////////////////////////////////////////////////////////// 00046 class EXPCL_PANDA_PGRAPH CullPlanes : public ReferenceCount { 00047 protected: 00048 INLINE CullPlanes(); 00049 INLINE CullPlanes(const CullPlanes ©); 00050 INLINE void operator = (const CullPlanes ©); 00051 00052 public: 00053 INLINE ~CullPlanes(); 00054 ALLOC_DELETED_CHAIN(CullPlanes); 00055 00056 INLINE bool is_empty() const; 00057 00058 static CPT(CullPlanes) make_empty(); 00059 CPT(CullPlanes) xform(const LMatrix4 &mat) const; 00060 CPT(CullPlanes) apply_state(const CullTraverser *trav, 00061 const CullTraverserData *data, 00062 const ClipPlaneAttrib *net_attrib, 00063 const ClipPlaneAttrib *off_attrib, 00064 const OccluderEffect *node_effect) const; 00065 CPT(CullPlanes) do_cull(int &result, CPT(RenderState) &state, 00066 const GeometricBoundingVolume *node_gbv) const; 00067 00068 CPT(CullPlanes) remove_plane(const NodePath &clip_plane) const; 00069 CPT(CullPlanes) remove_occluder(const NodePath &occluder) const; 00070 00071 void write(ostream &out) const; 00072 00073 private: 00074 typedef pmap<NodePath, PT(BoundingPlane) > Planes; 00075 Planes _planes; 00076 00077 typedef pmap<NodePath, PT(BoundingHexahedron) > Occluders; 00078 Occluders _occluders; 00079 }; 00080 00081 #include "cullPlanes.I" 00082 00083 #endif