11 static constexpr
float D { 256.0F };
13 static constexpr
size_t nbgrid { 6 };
18 static std::array<grid3d *,nbgrid>
grille;
29 v3d center = {0,-17.0,0};
41 static inline unsigned char
42 lighten (
unsigned char value,
float power)
45 float t = (float) val * log10f(power) / 2.0F;
49 return std::min(val, 255);
57 auto *color = (
unsigned char *) col;
58 *color =
lighten (*color, power);
60 *color =
lighten (*color, power);
62 *color =
lighten (*color, power);
64 *color =
lighten (*color, power);
68 static inline int ShiftRight(
int x,
int s) {
return (x<0) ? -((-x)>>s) : (x>>s); }
71 int evolutecolor (
unsigned int src,
unsigned int dest,
unsigned int mask,
unsigned int incr) {
72 int color = src & (~mask);
82 return (src&mask)|color;
85 static void pretty_move (
float lcycle,
float *dist,
float *dist2,
float *rotangle) {
86 static float s_distT = 10.0F;
87 static float s_distT2 = 0.0F;
88 static float s_rot = 0.0F;
89 static int s_happens = 0;
90 static int s_lock = 0;
94 else if (s_lock == 0) {
96 s_lock = s_happens * 3 / 2;
103 float tmp = s_happens?8.0F:0;
104 *dist2 = s_distT2 = (
tmp + 15.0F*s_distT2)/16.0F;
106 tmp = 30+
D-90.0F*(1.0F+sinf(lcycle*19/20));
110 *dist = s_distT = (
tmp + 3.0F*s_distT)/4.0F;
116 static int s_rotation {0};
125 if (fabsf(
tmp-s_rot) > fabsf(
tmp-(s_rot+2.0F*
M_PI_F))) {
126 s_rot = (
tmp + 15.0F*(s_rot+2*
M_PI_F)) / 16.0F;
131 else if (fabsf(
tmp-s_rot) > fabsf(
tmp-(s_rot-2.0F*
M_PI_F))) {
132 s_rot = (
tmp + 15.0F*(s_rot-2.0F*
M_PI_F)) / 16.0F;
138 *rotangle = s_rot = (
tmp + 15.0F*s_rot) / 16.0F;
143 static std::array<int,3> s_colors {
148 static float s_lig = 1.15F;
149 static float s_ligs = 0.1F;
153 float rotangle = NAN;
155 if ((!drawit) && (s_ligs>0.0F))
161 if ((s_lig>10.0F) || (s_lig<1.1F))
164 static int s_col = (0x28<<(
ROUGE*8))|(0x2c<<(
VERT*8))|(0x5f<<(
BLEU*8));
165 static int s_dstCol = 0;
167 if ((s_lig<6.3F)&&(
iRAND(30)==0))
170 s_col =
evolutecolor(s_col,s_colors[s_dstCol],0xff,0x01);
171 s_col =
evolutecolor(s_col,s_colors[s_dstCol],0xff00,0x0100);
172 s_col =
evolutecolor(s_col,s_colors[s_dstCol],0xff0000,0x010000);
173 s_col =
evolutecolor(s_col,s_colors[s_dstCol],0xff000000,0x01000000);
176 int colorlow = s_col;
181 rapport = 1.0F + 2.0F * (rapport - 1.0F);
183 rapport = std::min(rapport, 1.12F);