Permalink
Browse files

add ctype-based filt shift modes (#351)

  • Loading branch information...
krawthekrow authored and jacob1 committed Oct 24, 2016
1 parent 57f5d0f commit 63b22278027882ed35cdaddf6c89e3eca142b967
Showing with 22 additions and 12 deletions.
  1. +2 −2 src/gui/game/GameView.cpp
  2. +20 −10 src/simulation/elements/FILT.cpp
@@ -2290,8 +2290,8 @@ void GameView::OnDraw()
else if (type == PT_FILT)
{
sampleInfo << c->ElementResolve(type, ctype);
const char* filtModes[] = {"set colour", "AND", "OR", "subtract colour", "red shift", "blue shift", "no effect", "XOR", "NOT", "old QRTZ scattering"};
if (sample.particle.tmp>=0 && sample.particle.tmp<=9)
const char* filtModes[] = {"set colour", "AND", "OR", "subtract colour", "red shift", "blue shift", "no effect", "XOR", "NOT", "old QRTZ scattering", "variable red shift", "variable blue shift"};
if (sample.particle.tmp>=0 && sample.particle.tmp<=11)
sampleInfo << " (" << filtModes[sample.particle.tmp] << ")";
else
sampleInfo << " (unknown mode)";
@@ -89,17 +89,17 @@ int Element_FILT::interactWavelengths(Particle* cpart, int origWl)
case 3:
return origWl & (~filtWl); //Subtract colour of filt from colour of photon
case 4:
{
int shift = int((cpart->temp-273.0f)*0.025f);
if (shift<=0) shift = 1;
return (origWl << shift) & mask; // red shift
}
{
int shift = int((cpart->temp-273.0f)*0.025f);
if (shift<=0) shift = 1;
return (origWl << shift) & mask; // red shift
}
case 5:
{
int shift = int((cpart->temp-273.0f)*0.025f);
if (shift<=0) shift = 1;
return (origWl >> shift) & mask; // blue shift
}
{
int shift = int((cpart->temp-273.0f)*0.025f);
if (shift<=0) shift = 1;
return (origWl >> shift) & mask; // blue shift
}
case 6:
return origWl; // No change
case 7:
@@ -113,6 +113,16 @@ int Element_FILT::interactWavelengths(Particle* cpart, int origWl)
int t3 = ((origWl & 0xFF0000)>>16)+(rand()%5)-2;
return (origWl & 0xFF000000) | (t3<<16) | (t2<<8) | t1;
}
case 10:
{
long long int lsb = filtWl & (-filtWl);
return (origWl * lsb) & 0x3FFFFFFF; //red shift
}
case 11:
{
long long int lsb = filtWl & (-filtWl);
return (origWl / lsb) & 0x3FFFFFFF; // blue shift
}
default:
return filtWl;
}

0 comments on commit 63b2227

Please sign in to comment.