10 static constexpr
float D { 256.0F };
12 static constexpr
size_t nbgrid { 6 };
17 static std::array<grid3d *,nbgrid>
grille;
28 v3d center = {0,-17.0,0};
40 static inline unsigned char
41 lighten (
unsigned char value,
float power)
44 float t = (float) val * log10f(power) / 2.0F;
58 auto *color = (
unsigned char *) col;
59 *color =
lighten (*color, power);
61 *color =
lighten (*color, power);
63 *color =
lighten (*color, power);
65 *color =
lighten (*color, power);
69 static inline int ShiftRight(
int x,
int s) {
return (x<0) ? -((-x)>>s) : (x>>s); }
72 int evolutecolor (
unsigned int src,
unsigned int dest,
unsigned int mask,
unsigned int incr) {
73 int color = src & (~mask);
83 return (src&mask)|color;
86 static void pretty_move (
float lcycle,
float *dist,
float *dist2,
float *rotangle) {
87 static float s_distT = 10.0F;
88 static float s_distT2 = 0.0F;
89 static float s_rot = 0.0F;
90 static int s_happens = 0;
91 static int s_lock = 0;
95 else if (s_lock == 0) {
97 s_lock = s_happens * 3 / 2;
102 float tmp = s_happens?8.0F:0;
103 *dist2 = s_distT2 = (
tmp + 15.0F*s_distT2)/16.0F;
105 tmp = 30+
D-90.0F*(1.0F+sinf(lcycle*19/20));
109 *dist = s_distT = (
tmp + 3.0F*s_distT)/4.0F;
115 static int s_rotation {0};
124 if (fabsf(
tmp-s_rot) > fabsf(
tmp-(s_rot+2.0F*
M_PI_F))) {
125 s_rot = (
tmp + 15.0F*(s_rot+2*
M_PI_F)) / 16.0F;
130 else if (fabsf(
tmp-s_rot) > fabsf(
tmp-(s_rot-2.0F*
M_PI_F))) {
131 s_rot = (
tmp + 15.0F*(s_rot-2.0F*
M_PI_F)) / 16.0F;
137 *rotangle = s_rot = (
tmp + 15.0F*s_rot) / 16.0F;
141 static std::array<int,3> s_colors {
146 static float s_lig = 1.15F;
147 static float s_ligs = 0.1F;
151 float rotangle = NAN;
153 if ((!drawit) && (s_ligs>0.0F))
159 if ((s_lig>10.0F) || (s_lig<1.1F))
162 static int s_col = (0x28<<(
ROUGE*8))|(0x2c<<(
VERT*8))|(0x5f<<(
BLEU*8));
163 static int s_dstCol = 0;
165 if ((s_lig<6.3F)&&(
iRAND(30)==0))
168 s_col =
evolutecolor(s_col,s_colors[s_dstCol],0xff,0x01);
169 s_col =
evolutecolor(s_col,s_colors[s_dstCol],0xff00,0x0100);
170 s_col =
evolutecolor(s_col,s_colors[s_dstCol],0xff0000,0x010000);
171 s_col =
evolutecolor(s_col,s_colors[s_dstCol],0xff000000,0x01000000);
174 int colorlow = s_col;
179 rapport = 1.0F + 2.0F * (rapport - 1.0F);