00001 /***************************************************************************** 00002 * SGL: A Scene Graph Library 00003 * 00004 * Copyright (C) 1997-2001 Scott McMillan All Rights Reserved. 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public 00017 * License along with this library; if not, write to the Free 00018 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00019 ***************************************************************************** 00020 * File: sglDiscriminator.hpp 00021 * Created: 21 February 1999 00022 * Summary: use a discriminator mask to select/deselect the entire subtree 00023 *****************************************************************************/ 00024 00025 #ifndef __SGL_DISCRIMINATOR_HPP 00026 #define __SGL_DISCRIMINATOR_HPP 00027 00028 #include <sgl.h> 00029 #include <sglGroup.hpp> 00030 00031 //---------------------------------------------------------------------------- 00032 00056 class SGL_DLL_API sglDiscriminator : public sglGroup 00057 { 00058 public: 00060 sglDiscriminator(); 00062 virtual ~sglDiscriminator(); 00063 00067 void setMask(unsigned int mask) { m_mask = mask; } 00068 00072 unsigned int getMask() const { return m_mask; } 00073 00074 // see sglNode::intersect(f) for details. 00075 virtual sglBound::IntersectResultEnum intersect( 00076 sglIntersectf &isector) const; 00077 00078 // see sglNode::intersect(d) for details. 00079 virtual sglBound::IntersectResultEnum intersect( 00080 sglIntersectd &isector) const; 00081 00082 // see sglNode::pick(f) for details. 00083 virtual void pick(sglPickf &pick_state, unsigned int cull_flags) const; 00084 00085 // see sglNode::pick(d) for details. 00086 virtual void pick(sglPickd &pick_state, unsigned int cull_flags) const; 00087 00088 // See sglNode::clone() for details. 00089 virtual sglNode *clone(unsigned int mode) const; 00090 00091 // See sglObject::printInfo() for details. 00092 virtual void printInfo(ostream &ostrm, const char *indent_string) const; 00093 00094 protected: 00095 // compute the bounding sphere NOT YET IMPLEMENTED (using sglGroup) 00096 //virtual void computeBound(); 00097 00098 // sglNode::cull(f) for details 00099 virtual void cull(sglCull<float> &trav_state, 00100 unsigned int cull_flags) const; 00101 00102 // sglNode::cull(d) for details 00103 virtual void cull(sglCull<double> &trav_state, 00104 unsigned int cull_flags) const; 00105 00106 void copyTo(sglDiscriminator *dst, unsigned int mode) const; 00107 00108 private: // not implemented 00109 sglDiscriminator(const sglDiscriminator &); 00110 sglDiscriminator &operator=(const sglDiscriminator &); 00111 00112 protected: 00113 unsigned int m_mask; 00114 }; 00115 00116 #endif