From 0ff4742ee1d6ac5b481832dfd43fe7c5f8f2632c Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Thu, 17 Nov 2005 00:33:17 +0000 Subject: [PATCH] hack to fix odd sprite particle horizontal flip, as well as passing the set_color() call through to the interpolation manager. --- panda/src/particlesystem/spriteParticleRenderer.I | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/panda/src/particlesystem/spriteParticleRenderer.I b/panda/src/particlesystem/spriteParticleRenderer.I index 8fafbb4c6a..1ad3c1d3e9 100644 --- a/panda/src/particlesystem/spriteParticleRenderer.I +++ b/panda/src/particlesystem/spriteParticleRenderer.I @@ -43,12 +43,14 @@ set_texture(Texture *tex, float texels_per_unit) { _anims.clear(); // Insert the single texture - _anims.push_back(new SpriteAnim(tex,TexCoordf(0.0f, 0.0f),TexCoordf(1.0f, 1.0f))); + // For some reason sprite particles are rendering flipped in the horizontal direction. + // This is a hack to fix it for now. + //_anims.push_back(new SpriteAnim(tex,TexCoordf(0.0f, 0.0f),TexCoordf(1.0f, 1.0f))); + _anims.push_back(new SpriteAnim(tex,TexCoordf(1.0f, 0.0f),TexCoordf(0.0f, 1.0f))); // We scale the particle size by the size of the texture. set_size(tex->get_x_size() / texels_per_unit, tex->get_y_size() / texels_per_unit); - get_last_anim()->set_source_info(tex->get_filename()); } init_geoms(); @@ -79,7 +81,10 @@ add_texture(Texture *tex, float texels_per_unit, bool resize) { } else { if(tex != (Texture *)NULL) { if (tex != (Texture *)NULL) { - _anims.push_back(new SpriteAnim(tex,TexCoordf(0.0f, 0.0f),TexCoordf(1.0f, 1.0f))); + // For some reason sprite particles are rendering flipped in the horizontal direction. + // This is a hack to fix it for now. + //_anims.push_back(new SpriteAnim(tex,TexCoordf(0.0f, 0.0f),TexCoordf(1.0f, 1.0f))); + _anims.push_back(new SpriteAnim(tex,TexCoordf(1.0f, 0.0f),TexCoordf(0.0f, 1.0f))); } if(resize) { // We scale the particle size by the size of the texture. @@ -187,6 +192,7 @@ set_size(float width, float height) { INLINE void SpriteParticleRenderer:: set_color(const Colorf &color) { _color = color; + _color_interpolation_manager->set_default_color(_color); } ////////////////////////////////////////////////////////////////////