mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Fix wave on different dps
This commit is contained in:
parent
f9f893f3fc
commit
9283d14a3d
3 changed files with 13 additions and 10 deletions
|
@ -14,11 +14,6 @@
|
|||
#include "Common/Log.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
enum {
|
||||
// Enough?
|
||||
MAX_VERTS = 65536,
|
||||
};
|
||||
|
||||
DrawBuffer::DrawBuffer() : count_(0), atlas(0) {
|
||||
verts_ = new Vertex[MAX_VERTS];
|
||||
fontscalex = 1.0f;
|
||||
|
|
|
@ -13,6 +13,11 @@
|
|||
|
||||
struct Atlas;
|
||||
|
||||
enum {
|
||||
// Enough?
|
||||
MAX_VERTS = 65536,
|
||||
};
|
||||
|
||||
enum {
|
||||
ALIGN_LEFT = 0,
|
||||
ALIGN_RIGHT = 16,
|
||||
|
|
|
@ -89,18 +89,21 @@ public:
|
|||
dc.Flush();
|
||||
dc.BeginNoTex();
|
||||
|
||||
// Be sure to not overflow our vertex buffer
|
||||
const float step = ceil(24*bounds.w/pixel_in_dps_x) > MAX_VERTS ? 24*bounds.w/(MAX_VERTS-48) : pixel_in_dps_x;
|
||||
|
||||
t *= speed;
|
||||
for (int x = 0; x < bounds.w; ++x) {
|
||||
for (float x = 0; x < bounds.w; x += step) {
|
||||
float i = x * 1280/bounds.w;
|
||||
|
||||
float wave0 = sin(i*0.005+t*0.8)*0.05 + sin(i*0.002+t*0.25)*0.02 + sin(i*0.001+t*0.3)*0.03 + 0.625;
|
||||
float wave1 = sin(i*0.0044+t*0.4)*0.07 + sin(i*0.003+t*0.1)*0.02 + sin(i*0.001+t*0.3)*0.01 + 0.625;
|
||||
dc.Draw()->RectVGradient(x, wave0*bounds.h, pixel_in_dps_x, (1.0-wave0)*bounds.h, color, 0x00000000);
|
||||
dc.Draw()->RectVGradient(x, wave1*bounds.h, pixel_in_dps_x, (1.0-wave1)*bounds.h, color, 0x00000000);
|
||||
dc.Draw()->RectVGradient(x, wave0*bounds.h, step, (1.0-wave0)*bounds.h, color, 0x00000000);
|
||||
dc.Draw()->RectVGradient(x, wave1*bounds.h, step, (1.0-wave1)*bounds.h, color, 0x00000000);
|
||||
|
||||
// Add some "antialiasing"
|
||||
dc.Draw()->RectVGradient(x, wave0*bounds.h-3*pixel_in_dps_y, pixel_in_dps_x, 3*pixel_in_dps_y, 0x00000000, color);
|
||||
dc.Draw()->RectVGradient(x, wave1*bounds.h-3*pixel_in_dps_y, pixel_in_dps_x, 3*pixel_in_dps_y, 0x00000000, color);
|
||||
dc.Draw()->RectVGradient(x, wave0*bounds.h-3*pixel_in_dps_y, step, 3*pixel_in_dps_y, 0x00000000, color);
|
||||
dc.Draw()->RectVGradient(x, wave1*bounds.h-3*pixel_in_dps_y, step, 3*pixel_in_dps_y, 0x00000000, color);
|
||||
}
|
||||
|
||||
dc.Flush();
|
||||
|
|
Loading…
Add table
Reference in a new issue