Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void draw_wave(int start_y, unsigned int color, float amplitude, float frequency, float lambda, float time)
- {
- sceGuDisable(GU_TEXTURE_2D);
- #define STEP_SIZE 2
- float _2A = 2.0f * amplitude;
- float k = _2PI/lambda;
- float omega = _2PI*frequency;
- int x;
- for (x = 0; x < 480; x += STEP_SIZE) {
- float y = _2A*cosf(k*x)*sinf(omega*time);
- struct ya2d_vertex_1ui3s *vertices = sceGuGetMemory(4 * sizeof(struct ya2d_vertex_1ui3s));
- vertices[0].color = color;
- vertices[0].x = x;
- vertices[0].y = 272;
- vertices[0].z = 0;
- vertices[1].color = color;
- vertices[1].x = x;
- vertices[1].y = start_y + y;
- vertices[1].z = 0;
- vertices[2].color = color;
- vertices[2].x = x + STEP_SIZE;
- vertices[2].y = 272;
- vertices[2].z = 0;
- vertices[3].color = color;
- vertices[3].x = x + STEP_SIZE;
- vertices[3].y = start_y + y;
- vertices[3].z = 0;
- sceGumDrawArray(GU_TRIANGLE_STRIP, GU_COLOR_8888|GU_VERTEX_16BIT|GU_TRANSFORM_2D, 4, 0, vertices);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement