From 758ee8ed80842f1cc01c99673e298b8f7cef64f4 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 24 Oct 2005 18:51:36 +0000 Subject: [PATCH] Changes to fix divide by 0 warning under VS. --- include/osgParticle/Particle | 4 ++-- src/osgParticle/Particle.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/osgParticle/Particle b/include/osgParticle/Particle index b79941af7..430201a8e 100644 --- a/include/osgParticle/Particle +++ b/include/osgParticle/Particle @@ -548,8 +548,8 @@ namespace osgParticle inline void Particle::setTextureTile(int sTile, int tTile, int numTiles) { - _s_tile = 1.0f / static_cast(sTile); - _t_tile = 1.0f / static_cast(tTile); + _s_tile = (sTile>0) ? 1.0f / static_cast(sTile) : 1.0f; + _t_tile = (tTile>0) ? 1.0f / static_cast(tTile) : 1.0f; if (numTiles <= 0) { _num_tile = sTile * tTile; diff --git a/src/osgParticle/Particle.cpp b/src/osgParticle/Particle.cpp index f8c252a5e..288062cfc 100644 --- a/src/osgParticle/Particle.cpp +++ b/src/osgParticle/Particle.cpp @@ -234,7 +234,7 @@ void osgParticle::Particle::setUpTexCoordsAsPartOfConnectedParticleSystem(Partic float s_coord_delta = 0.5f*distance/getCurrentSize(); float s_coord = previousParticle->_s_coord + s_coord_delta; - setTextureTile(0,0,0); + setTextureTile(1,1,0); _cur_tile = 0; _s_coord = s_coord; _t_coord = 0.0f;