diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-11-17 19:44:09 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-11-17 19:44:09 (GMT) |
| commit | 058a2edd75debbd0297f92572316daa704bd379f (patch) | |
| tree | ad303f091f9a08b209b91eb34a9fcad996a3de69 /src/simulation/elements/FILT.cpp | |
| parent | e3594aba9e05c6865d396418c028049cda92c2f3 (diff) | |
| parent | 7a21ae192fe19868539956f3fe28e62b2c7c4429 (diff) | |
| download | powder-058a2edd75debbd0297f92572316daa704bd379f.zip powder-058a2edd75debbd0297f92572316daa704bd379f.tar.gz | |
Merge branch 'master' of github.com:FacialTurd/PowderToypp
Diffstat (limited to 'src/simulation/elements/FILT.cpp')
| -rw-r--r-- | src/simulation/elements/FILT.cpp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/simulation/elements/FILT.cpp b/src/simulation/elements/FILT.cpp new file mode 100644 index 0000000..58501c2 --- /dev/null +++ b/src/simulation/elements/FILT.cpp @@ -0,0 +1,77 @@ +#include "simulation/Elements.h" +//#TPT-Directive ElementClass Element_FILT PT_FILT 125 +Element_FILT::Element_FILT() +{ + Identifier = "DEFAULT_PT_FILT"; + Name = "FILT"; + Colour = PIXPACK(0x000056); + MenuVisible = 1; + MenuSection = SC_SOLIDS; + Enabled = 1; + + Advection = 0.0f; + AirDrag = 0.00f * CFDS; + AirLoss = 0.90f; + Loss = 0.00f; + Collision = 0.0f; + Gravity = 0.0f; + Diffusion = 0.00f; + HotAir = 0.000f * CFDS; + Falldown = 0; + + Flammable = 0; + Explosive = 0; + Meltable = 0; + Hardness = 1; + + Weight = 100; + + Temperature = R_TEMP+0.0f +273.15f; + HeatConduct = 251; + Description = "Filter for photons, changes the color."; + + State = ST_SOLID; + Properties = TYPE_SOLID | PROP_NOAMBHEAT; + + LowPressure = IPL; + LowPressureTransition = NT; + HighPressure = IPH; + HighPressureTransition = NT; + LowTemperature = ITL; + LowTemperatureTransition = NT; + HighTemperature = ITH; + HighTemperatureTransition = NT; + + Update = NULL; + Graphics = &Element_FILT::graphics; +} + +//#TPT-Directive ElementHeader Element_FILT static int graphics(GRAPHICS_FUNC_ARGS) +int Element_FILT::graphics(GRAPHICS_FUNC_ARGS) + +{ + int x, temp_bin = (int)((cpart->temp-273.0f)*0.025f); + if (temp_bin < 0) temp_bin = 0; + if (temp_bin > 25) temp_bin = 25; + cpart->ctype = 0x1F << temp_bin; + *colg = 0; + *colb = 0; + *colr = 0; + for (x=0; x<12; x++) { + *colr += (cpart->ctype >> (x+18)) & 1; + *colb += (cpart->ctype >> x) & 1; + } + for (x=0; x<12; x++) + *colg += (cpart->ctype >> (x+9)) & 1; + x = 624/(*colr+*colg+*colb+1); + *cola = 127; + *colr *= x; + *colg *= x; + *colb *= x; + *pixel_mode &= ~PMODE; + *pixel_mode |= PMODE_BLEND; + return 0; +} + + +Element_FILT::~Element_FILT() {} |
