00001 //------------------------------------------------------------------------------ 00002 // This file is part of the OpenStructure project <www.openstructure.org> 00003 // 00004 // Copyright (C) 2008-2011 by the OpenStructure authors 00005 // 00006 // This library is free software; you can redistribute it and/or modify it under 00007 // the terms of the GNU Lesser General Public License as published by the Free 00008 // Software Foundation; either version 3.0 of the License, or (at your option) 00009 // any later version. 00010 // This library is distributed in the hope that it will be useful, but WITHOUT 00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00013 // details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, Inc., 00017 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 //------------------------------------------------------------------------------ 00019 #ifndef OST_GFX_IMPL_FAST_SPHERES_HH 00020 #define OST_GFX_IMPL_FAST_SPHERES_HH 00021 00022 #include <ost/geom/vec3.hh> 00023 #include <ost/gfx/color.hh> 00024 00025 /* 00026 Author: Ansgar Philippsen 00027 */ 00028 00029 #include <vector> 00030 00031 namespace ost { namespace gfx { namespace impl { 00032 00033 class DLLEXPORT_OST_GFX FastSphereRenderer { 00034 public: 00035 struct VData 00036 { 00037 float pos[3]; 00038 float col[4]; 00039 float rad; 00040 }; 00041 00042 typedef std::vector<VData> DataList; 00043 00044 FastSphereRenderer(size_t reserve=0); 00045 FastSphereRenderer(const DataList&); 00046 00047 void Clear(); 00048 void Add(float pos[3], float col[4], float rad); 00049 void Add(const geom::Vec3& pos, const Color& col, float rad); 00050 00051 void RenderGL(); 00052 00053 const DataList& Data() const {return data_;} 00054 00055 private: 00056 DataList data_; 00057 }; 00058 00059 }}} // ns 00060 00061 #endif