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

sglCallback.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: sglCallback.hpp
00021  *  Created: 21 February 1999
00022  *  Summary: execute a user defined callback during the cull traversal.
00023  *
00024  *           **** THIS DOES NOT WORK AS A DRAW CALLBACK ANY MORE ****
00025  *
00026  *        With access to the source code and ability to subclass nodes, I
00027  *        question the usefulness of this class. - mcmillan
00028  *****************************************************************************/
00029 
00030 #ifndef __SGL_CALLBACK_HPP
00031 #define __SGL_CALLBACK_HPP
00032 
00033 #include <sgl.h>
00034 #include <sglGroup.hpp>
00035 
00036 //============================================================================
00037 
00039 typedef void (*sglCallbackFunc)(void *);
00040 
00041 //============================================================================
00042 
00060 class SGL_DLL_API sglCallback : public sglGroup
00061 {
00062 public:
00064    sglCallback();
00066    virtual ~sglCallback();
00067 
00072    sglCallbackFunc getCallbackFunc() const { return m_callback_func; }
00073 
00078    void setCallbackFunc(sglCallbackFunc cb_func);
00079 
00084    void *getCallbackData() const { return m_callback_data; }
00085 
00089    void setCallbackData(void *data) { m_callback_data = data; }
00090 
00091    // see sglNode::clone() for details.
00092    virtual sglNode *clone(unsigned int mode) const;
00093 
00094    // see sglObject::printInfo() for details.
00095    virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00096 
00097 protected:
00098    // compute the bounding sphere using sglGroup version
00099    //virtual void computeBound();
00100 
00101    // sglNode::cull(f) for details
00102    virtual void cull(sglCull<float> &trav_state,
00103                      unsigned int cull_flags) const;
00104 
00105    // sglNode::cull(d) for details
00106    virtual void cull(sglCull<double> &trav_state,
00107                      unsigned int cull_flags) const;
00108 
00109    void copyTo(sglCallback *dst, unsigned int mode) const;
00110 
00111 private:  // not implemented
00112    sglCallback(const sglCallback &);
00113    sglCallback &operator=(const sglCallback &);
00114 
00115 protected:
00116    sglCallbackFunc m_callback_func;
00117    void *m_callback_data;
00118 };
00119 
00120 #endif

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