PointNode.hh

00001 /*===========================================================================*\
00002  *                                                                           *
00003  *                              OpenFlipper                                  *
00004  *      Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen      *
00005  *                           www.openflipper.org                             *
00006  *                                                                           *
00007  *---------------------------------------------------------------------------*
00008  *  This file is part of OpenFlipper.                                        *
00009  *                                                                           *
00010  *  OpenFlipper is free software: you can redistribute it and/or modify      *
00011  *  it under the terms of the GNU Lesser General Public License as           *
00012  *  published by the Free Software Foundation, either version 3 of           *
00013  *  the License, or (at your option) any later version with the              *
00014  *  following exceptions:                                                    *
00015  *                                                                           *
00016  *  If other files instantiate templates or use macros                       *
00017  *  or inline functions from this file, or you compile this file and         *
00018  *  link it with other files to produce an executable, this file does        *
00019  *  not by itself cause the resulting executable to be covered by the        *
00020  *  GNU Lesser General Public License. This exception does not however       *
00021  *  invalidate any other reasons why the executable file might be            *
00022  *  covered by the GNU Lesser General Public License.                        *
00023  *                                                                           *
00024  *  OpenFlipper is distributed in the hope that it will be useful,           *
00025  *  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
00026  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
00027  *  GNU Lesser General Public License for more details.                      *
00028  *                                                                           *
00029  *  You should have received a copy of the GNU LesserGeneral Public          *
00030  *  License along with OpenFlipper. If not,                                  *
00031  *  see <http://www.gnu.org/licenses/>.                                      *
00032  *                                                                           *
00033 \*===========================================================================*/
00034 
00035 /*===========================================================================*\
00036  *                                                                           *
00037  *   $Revision: 8548 $                                                       *
00038  *   $Author: moebius $                                                      *
00039  *   $Date: 2010-02-12 14:40:13 +0100 (Fr, 12. Feb 2010) $                   *
00040  *                                                                           *
00041 \*===========================================================================*/
00042 
00043 
00044 
00045 
00046 //=============================================================================
00047 //
00048 //  CLASS PointNode
00049 //
00050 //=============================================================================
00051 
00052 
00053 #ifndef ACG_POINTNODE_HH
00054 #define ACG_POINTNODE_HH
00055 
00056 
00057 //== INCLUDES =================================================================
00058 
00059 #include "BaseNode.hh"
00060 #include "DrawModes.hh"
00061 #include <vector>
00062 
00063 //== NAMESPACES ===============================================================
00064 
00065 namespace ACG {
00066 namespace SceneGraph {
00067 
00068 //== CLASS DEFINITION =========================================================
00069 
00070               
00071 
00080 class ACGDLLEXPORT PointNode : public BaseNode
00081 {
00082 public:
00083    
00084   // typedefs
00085   typedef std::vector<ACG::Vec3f>      PointVector;
00086   typedef PointVector::iterator        PointIter;
00087   typedef PointVector::const_iterator  ConstPointIter;
00088   typedef std::vector<ACG::Vec3uc>     ColorVector;
00089   typedef ColorVector::iterator        ColorIter;
00090   typedef ColorVector::const_iterator  ConstColorIter;
00091 
00092 
00094   PointNode( BaseNode*         _parent=0,
00095              std::string  _name="<PointNode>" )
00096     : BaseNode(_parent, _name)
00097   {}
00098  
00100   ~PointNode() {}
00101 
00103   ACG_CLASSNAME(PointNode);
00104 
00106   DrawModes::DrawMode availableDrawModes() const;
00107 
00109   void boundingBox(Vec3d& _bbMin, Vec3d& _bbMax);
00110 
00112   void draw(GLState& _state, DrawModes::DrawMode _drawMode);
00113 
00115   void reserve(unsigned int _np, unsigned int _nn, unsigned int _nc) {
00116     points_.reserve(_np); normals_.reserve(_nn); colors_.reserve(_nc);
00117   }
00118 
00120   void add_point(const ACG::Vec3f& _p) { points_.push_back(_p); }
00122   void add_normal(const ACG::Vec3f& _n) { normals_.push_back(_n); }
00124   void add_color(const ACG::Vec3uc& _c) { colors_.push_back(_c); }
00125 
00127   unsigned int n_points() const { return points_.size(); }
00128 
00130   void clear_points() { points_.clear(); }
00132   void clear_normals() { normals_.clear(); }
00134   void clear_colors() { colors_.clear(); }
00136   void clear() { clear_points(); clear_normals(); clear_colors(); }
00137 
00139   PointVector& points() { return points_; }
00141   PointVector& normals() { return normals_; }
00143   ColorVector& colors() { return colors_; }
00144 
00145 
00146 private:
00147   
00148   PointVector  points_, normals_;
00149   ColorVector  colors_;
00150 };
00151 
00152 
00153 //=============================================================================
00154 } // namespace SceneGraph
00155 } // namespace ACG
00156 //=============================================================================
00157 #endif // ACG_POINTNODE_HH defined
00158 //=============================================================================

acg pic Project OpenFlipper, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .