1
0
Fork 0

farby sa daj prepinat prepisanim v kernely

master 0.2.0
Dušan Poizl 12 years ago
parent eccdf05b4f
commit 02e51f7d5c
  1. 24
      kernels/synchr.cl

@ -50,12 +50,34 @@ __kernel void takeStep(__global CellType *cells, int which)
which = (which+1)&1;
cells[(y*w+x)*2+which] = node/NUM_STATES;
}
// prepina farby ktore sa zobrazuju WIREWORLD LIFE JVN
#define WIREWORLD
//#define JVN
//#define LIFE
#ifdef LIFE
__constant uint4 colors2[] = { (uint4)(0, 0, 0, 0), (uint4)(255, 255, 255, 255) };
#endif
#ifdef JVN
__constant uint4 colors2[] = { (uint4)(48,48,48,0), (uint4)(255,0,0,0), (uint4)(255,125,0,0), (uint4)(255,150,25,0), (uint4)(255,175,50,0),
(uint4)(255,200,75,0), (uint4)(255,225,100,0), (uint4)(255,250,125,0), (uint4)(251,255,0,0), (uint4)(89,89,255,0),
(uint4)(106,106,255,0), (uint4)(122,122,255,0), (uint4)(139,139,255,0), (uint4)(27,176,27,0), (uint4)(36,200,36,0),
(uint4)(73,255,73,0), (uint4)(106,255,106,0), (uint4)(255,36,36,0), (uint4)(255,56,56,0), (uint4)(255,73,73,0),
(uint4)(255,89,89,0), (uint4)(185,56,255,0), (uint4)(191,73,255,0), (uint4)(197,89,255,0), (uint4)(203,106,255,0),
(uint4)(0,255,128,0), (uint4)(255,128,64,0), (uint4)(255,255,128,0), (uint4)(33,215,215,0) };
#endif
#ifdef WIREWORLD
__constant uint4 colors2[] = { (uint4)(48,48,48,0),(uint4)(0,128,255,0),(uint4)(255,255,255,0),(uint4)(255,128,0,0) };
#endif
__kernel void renderToTexture(__global CellType *cells, int which, __write_only image2d_t tex)
{
int2 coord = (int2)(get_global_id(0), get_global_id(1));
int w = get_global_size(0);
int state = cells[(coord.y*w+coord.x)*2+which];
float4 color = (float4)(convert_float4(colors[state])/255.0f);
float4 color = (float4)(convert_float4(colors2[state])/255.0f);
write_imagef(tex, coord, color);
}

Loading…
Cancel
Save