From 3a862e1057c9db1c5b8a6b25287ff58a2aab1bc2 Mon Sep 17 00:00:00 2001
From: Ansgar Philippsen <ansgar.philippsen@gmail.com>
Date: Tue, 26 Jun 2012 13:45:44 -0400
Subject: [PATCH] fixed fast sphere rendering

---
 modules/gfx/src/impl/cpk_renderer.cc | 1 +
 modules/gfx/src/impl/fast_spheres.cc | 5 +++++
 modules/gfx/src/impl/fast_spheres.hh | 1 +
 3 files changed, 7 insertions(+)

diff --git a/modules/gfx/src/impl/cpk_renderer.cc b/modules/gfx/src/impl/cpk_renderer.cc
index dce0cccb0..b0aff5ec6 100644
--- a/modules/gfx/src/impl/cpk_renderer.cc
+++ b/modules/gfx/src/impl/cpk_renderer.cc
@@ -64,6 +64,7 @@ void CPKRenderer::PrepareRendering(GfxView& view, IndexedVertexArray& va, bool i
 #if OST_SHADER_SUPPORT_ENABLED
       if(options_->GetSphereMode()==1 || options_->GetSphereMode()==2) {
         FastSphereRenderer& fsr = is_sel ? sel_fsr_ : fsr_;
+        fsr.Clear();
         for(AtomEntryMap::const_iterator it=view.atom_map.begin();it!=view.atom_map.end();++it) {
           fsr.Add(it->second.atom.GetPos(),
                   is_sel? sel_clr : it->second.color,
diff --git a/modules/gfx/src/impl/fast_spheres.cc b/modules/gfx/src/impl/fast_spheres.cc
index af8745b6d..e10ac2d03 100644
--- a/modules/gfx/src/impl/fast_spheres.cc
+++ b/modules/gfx/src/impl/fast_spheres.cc
@@ -41,6 +41,11 @@ namespace ost { namespace gfx { namespace impl {
     data_(d)
   {}
 
+  void FastSphereRenderer::Clear()
+  {
+    data_.clear();
+  }
+
   void FastSphereRenderer::Add(float pos[3], float col[4], float rad)
   {
     static VData data;
diff --git a/modules/gfx/src/impl/fast_spheres.hh b/modules/gfx/src/impl/fast_spheres.hh
index 054b4ffcb..2cef93d65 100644
--- a/modules/gfx/src/impl/fast_spheres.hh
+++ b/modules/gfx/src/impl/fast_spheres.hh
@@ -44,6 +44,7 @@ namespace ost { namespace gfx { namespace impl {
     FastSphereRenderer(size_t reserve=0);
     FastSphereRenderer(const DataList&);
 
+    void Clear();
     void Add(float pos[3], float col[4], float rad);
     void Add(const geom::Vec3& pos, const Color& col, float rad);
 
-- 
GitLab