| 3886 | } |
| 3887 | |
| 3888 | void CandyMixEeffect::renderLine(float x1, float x2, float y, ax::Color4F color, float angle) |
| 3889 | { |
| 3890 | static float WID = 400; |
| 3891 | |
| 3892 | float xMid = (x1 + x2) * 0.5f; |
| 3893 | float r = color.r; |
| 3894 | float g = color.g; |
| 3895 | float b = color.b; |
| 3896 | float rng = 1.0f / (x2 - xMid); |
| 3897 | x1 = MIN(MAX(0.0f, x1), WID - 1); |
| 3898 | x2 = MIN(MAX(0.0f, x2), WID - 1); |
| 3899 | |
| 3900 | float mm = 0.8f; |
| 3901 | |
| 3902 | for (size_t x = x1; x < x2; x++) |
| 3903 | { |
| 3904 | float pos = (x - xMid) * rng; |
| 3905 | float ang = (angle + asin(pos) + (cos((angle + pos * (float)M_PI) * 1.78f) * 0.3f)) + (float)M_PI * 0.5f; |
| 3906 | float sf = 0.2f + 0.8f * MAX(mm - 0.8, MIN(mm, cos(ang))); |
| 3907 | float sp = pow(MAX(0, cos(2 * ang)), 20); |
| 3908 | float rr = MIN(mm, r * sf + sp); |
| 3909 | float gg = MIN(mm, g * sf + sp); |
| 3910 | float bb = MIN(mm, b * sf + sp); |
| 3911 | drawNode->drawPoint(Vec2(y, x - 50), 2.0f, Color4F(rr, gg, bb, 1.0f)); |
| 3912 | } |
| 3913 | } |
| 3914 | |
| 3915 | void CandyMixEeffect::update(float dt) |
| 3916 | { |