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

sglGeode.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: sglGeode.hpp
00021  *  Created: 11 August 1997
00022  *  Summary: scenegraph leaf node to hold a set of sglGeoSet's.
00023  *****************************************************************************/
00024 
00025 #ifndef __SGL_GEODE_HPP
00026 #define __SGL_GEODE_HPP
00027 
00028 #include <sgl.h>
00029 #include <vector>
00030 
00031 #include <sglNode.hpp>
00032 #include <sglGroup.hpp>  // need this include for Windoze.
00033 
00034 class sglDrawable;
00035 
00036 //============================================================================
00037 
00068 class SGL_DLL_API sglGeode : public sglNode
00069 {
00070 public:
00072    sglGeode();
00074    virtual ~sglGeode();
00075 
00080    unsigned int getNumGeometries() const { return m_geometry_list.size(); }
00081 
00086    bool addGeometry(sglDrawable *geometry);
00087 
00094    bool insertGeometry(unsigned int index, sglDrawable *geometry);
00095 
00101    bool removeGeometry(sglDrawable *geometry);
00102 
00108    sglDrawable *getGeometry(unsigned int index);
00109 
00110    // See sglNode::intersect(f) for details.
00111    virtual sglBound::IntersectResultEnum intersect(
00112       sglIntersectf &isector) const;
00113 
00114    // See sglNode::intersect(d) for details.
00115    virtual sglBound::IntersectResultEnum intersect(
00116       sglIntersectd &segset) const;
00117 
00118    // See sglNode::pick(f) for details.
00119    virtual void pick(sglPickf &pick_state, unsigned int cull_flags) const;
00120 
00121    // See sglNode::pick(d) for details.
00122    virtual void pick(sglPickd &pick_state, unsigned int cull_flags) const;
00123 
00124    // See sglNode::preDraw() for details.
00125    virtual void preDraw(const PreDrawStruct &trav_state);
00126 
00127    // See sglNode::clone() for details.
00128    virtual sglNode *clone(unsigned int mode) const;
00129 
00130    // See sglObject::printInfo() for details.
00131    virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00132 
00133 protected:
00134    // compute the bounding sphere
00135    virtual void computeBound();
00136    virtual void computeBoundsRecursiveDown();
00137 
00138    // See sglNode::cull(f) for details
00139    virtual void cull(sglCull<float> &trav_state,
00140                      unsigned int cull_flags) const;
00141 
00142    // See sglNode::cull(d) for details
00143    virtual void cull(sglCull<double> &trav_state,
00144                      unsigned int cull_flags) const;
00145 
00146    void copyTo(sglGeode *dst, unsigned int mode) const;
00147 
00148 private:
00149    int searchGeometries(sglDrawable *geometry);
00150 
00151    // not implemented
00152    sglGeode(const sglGeode &);
00153    sglGeode &operator=(const sglGeode &);
00154 
00155 protected:
00156    vector<sglDrawable *> m_geometry_list;
00157 };
00158 
00159 #endif

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