diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-24 14:56:01 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-24 14:56:01 (GMT) |
| commit | d50d45ecffcd0bba038c2413c3c159e85516ba27 (patch) | |
| tree | e55821071bf15ec0e6f25e8993f957735406ab5d /src/simulation/Simulation.cpp | |
| parent | da77cb809bf692794a70b680f24455f73ce7a396 (diff) | |
| download | powder-d50d45ecffcd0bba038c2413c3c159e85516ba27.zip powder-d50d45ecffcd0bba038c2413c3c159e85516ba27.tar.gz | |
Fix deco smudge tool
Diffstat (limited to 'src/simulation/Simulation.cpp')
| -rw-r--r-- | src/simulation/Simulation.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 9aece76..dcb1e42 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -750,19 +750,20 @@ void Simulation::ApplyDecoration(int x, int y, int colR_, int colG_, int colB_, { if ((pmap[y+ry][x+rx]&0xFF) && parts[pmap[y+ry][x+rx]>>8].dcolour) { + Particle part = parts[pmap[y+ry][x+rx]>>8]; num++; - ta += float((parts[pmap[y+ry][x+rx]>>8].dcolour>>24)&0xFF)/255.0f; - tr += float((parts[pmap[y+ry][x+rx]>>8].dcolour>>16)&0xFF)/255.0f; - tg += float((parts[pmap[y+ry][x+rx]>>8].dcolour>>8)&0xFF)/255.0f; - tb += float((parts[pmap[y+ry][x+rx]>>8].dcolour)&0xFF)/255.0f; + ta += float((part.dcolour>>24)&0xFF)/255.0f; + tr += float((part.dcolour>>16)&0xFF)/255.0f; + tg += float((part.dcolour>>8)&0xFF)/255.0f; + tb += float((part.dcolour)&0xFF)/255.0f; } } if (num == 0) return; - ta = ta/float(num)+0.5f; - tr = tr/float(num)+0.5f; - tg = tg/float(num)+0.5f; - tb = tb/float(num)+0.5f; + ta = ta/float(num+1); + tr = tr/float(num+1); + tg = tg/float(num+1); + tb = tb/float(num+1); } colA_ = ta*255.0f; |
