00001 #ifndef NODE_SHAPE_H 00002 #define NODE_SHAPE_H 00003 00004 /* 00005 00006 GLT OpenGL C++ Toolkit (LGPL) 00007 Copyright (C) 2000-2002 Nigel Stewart 00008 00009 Email: nigels.com@gmail.com 00010 WWW: http://www.nigels.com/glt/ 00011 00012 This library is free software; you can redistribute it and/or 00013 modify it under the terms of the GNU Lesser General Public 00014 License as published by the Free Software Foundation; either 00015 version 2.1 of the License, or (at your option) any later version. 00016 00017 This library is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 Lesser General Public License for more details. 00021 00022 You should have received a copy of the GNU Lesser General Public 00023 License along with this library; if not, write to the Free Software 00024 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00025 00026 */ 00027 00034 #include <glt/color.h> 00035 00036 #include <math/vector3.h> 00037 #include <math/matrix4.h> 00038 #include <math/bbox.h> 00039 00040 #include <misc/refcount.h> 00041 00042 #include <node/fields.h> 00043 00044 #include <string> 00045 #include <vector> 00046 00048 00055 class GltShape; 00056 typedef ReferenceCountPtr<GltShape> GltShapePtr; 00057 00058 class GltShape 00059 { 00060 public: 00061 00063 virtual ~GltShape(); 00064 00066 virtual void draw() const = 0; 00067 00069 virtual GLdouble volume() const; 00070 00072 virtual bool inside(const Vector &pos) const; 00073 00075 virtual void boundingBox(BoundingBox &box) const; 00076 00078 virtual bool intersects(const GltShape &shape) const; 00079 00081 virtual std::string description() const; 00082 00084 virtual GltFieldPtr settings(); 00085 00087 virtual bool povrayExport(std::ostream &os) const; 00088 00090 virtual void flushExpired(); 00091 00093 Matrix &transformation(); 00095 GltColor &color(); 00097 bool &solid(); 00099 bool &visible(); 00101 std::string &name(); 00103 int &convexity(); 00105 bool &inheritColor(); 00107 bool &inheritSolid(); 00109 bool &expired(); 00110 00112 const Matrix &transformation() const; 00114 const GltColor &color() const; 00116 const bool &solid() const; 00118 const bool &visible() const; 00120 const std::string &name() const; 00122 const int &convexity() const; 00124 const bool &inheritColor() const; 00126 const bool &inheritSolid() const; 00128 const bool &expired() const; 00129 00130 protected: 00131 00133 GltShape(const bool solid = true); 00134 00136 void transformPoints(std::vector<Vector> &v) const; 00137 00139 void glColor() const; 00140 00141 private: 00142 00143 Matrix _transformation; 00144 GltColor _color; 00145 bool _solid; 00146 bool _visible; 00147 std::string _name; 00148 int _convexity; 00149 bool _inheritColor; 00150 bool _inheritSolid; 00151 bool _expired; 00152 }; 00153 00154 #endif