Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

sglSwitch.hpp

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: sglSwitch.hpp
00021  *  Created: 14 November 1998
00022  *  Summary: select (or not) the children to be traversed
00023  *****************************************************************************/
00024 
00025 #ifndef __SGL_SWITCH_HPP
00026 #define __SGL_SWITCH_HPP
00027 
00028 #include <sgl.h>
00029 #include <sglGroup.hpp>
00030 
00031 //----------------------------------------------------------------------------
00032 
00094 //----------------------------------------------------------------------------
00095 
00096 class SGL_DLL_API sglSwitch : public sglGroup
00097 {
00098 public:
00100    enum
00101    {
00103       eOFF = -2,
00104 
00106       eON  = -1
00107    };
00108 
00109 public:
00111    sglSwitch();
00113    virtual ~sglSwitch();
00114 
00118    void setVal(int val) {m_switch_val = val;}
00119 
00123    int  getVal() const  {return m_switch_val;}
00124 
00125    // See sglNode::intersect(f) for details.
00126    virtual sglBound::IntersectResultEnum intersect(
00127       sglIntersectf &isector) const;
00128 
00129    // See sglNode::intersect(d) for details.
00130    virtual sglBound::IntersectResultEnum intersect(
00131       sglIntersectd &isector) const;
00132 
00133    // See sglNode::pick(f) for details.
00134    virtual void pick(sglPickf &pick_state, unsigned int cull_flags) const;
00135 
00136    // See sglNode::pick(d) for details.
00137    virtual void pick(sglPickd &pick_state, unsigned int cull_flags) const;
00138 
00139    // See sglNode::clone() for details.
00140    virtual sglNode *clone(unsigned int mode) const;
00141 
00142    // See sglObject::printInfo() for details.
00143    virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00144 
00145 protected:
00146    // See sglNode::cull(f) for details
00147    virtual void cull(sglCull<float> &trav_state,
00148                      unsigned int cull_flags) const
00149       {
00150          cull(trav_state, cull_flags, m_switch_val);
00151       }
00152 
00153    // See sglNode::cull(d) for details
00154    virtual void cull(sglCull<double> &trav_state,
00155                      unsigned int cull_flags) const
00156       {
00157          cull(trav_state, cull_flags, m_switch_val);
00158       }
00159 
00160    // reentrant versions of the draw{Culled} functions for multithreading
00161    void cull(sglCull<float> &trav_state,
00162              unsigned int cull_flags, int switch_val) const;
00163    void cull(sglCull<double> &trav_state,
00164              unsigned int cull_flags, int switch_val) const;
00165 
00166    void copyTo(sglSwitch *dst, unsigned int mode) const;
00167 
00168 private:
00169    sglSwitch(const sglSwitch &);            // not implemented
00170    sglSwitch &operator=(const sglSwitch &); // not implemented
00171 
00172 protected:
00173    int m_switch_val;
00174 };
00175 
00176 #endif

Generated at Mon Jul 1 18:00:06 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001