diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-04-18 15:40:43 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-04-18 15:40:43 (GMT) |
| commit | 43ae47ba773aa97421d11474c769ce9fe1191b06 (patch) | |
| tree | 5e70f8dc38b7c9facdc1bbc3c73ffcbbf8a7d3f1 /src/simulation/Simulation.cpp | |
| parent | a761fa5cbce65f303a068e6587dd8ef891468fcb (diff) | |
| download | powder-43ae47ba773aa97421d11474c769ce9fe1191b06.zip powder-43ae47ba773aa97421d11474c769ce9fe1191b06.tar.gz | |
TPT: Added smudge tool afbe8cf38e
Diffstat (limited to 'src/simulation/Simulation.cpp')
| -rw-r--r-- | src/simulation/Simulation.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 7941d25..aaa4834 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -371,6 +371,28 @@ void Simulation::ApplyDecoration(int x, int y, int colR_, int colG_, int colB_, tg /= 1.0f+(colG*0.1f)*colA; tb /= 1.0f+(colB*0.1f)*colA; } + else if (mode == DECO_SMUDGE) + { + int rx, ry, num = 0; + for (rx=-2; rx<3; rx++) + for (ry=-2; ry<3; ry++) + { + if ((pmap[y+ry][x+rx]&0xFF) && parts[pmap[y+ry][x+rx]>>8].dcolour) + { + 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; + } + } + 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; + } colA_ = ta*255.0f; colR_ = tr*255.0f; |
