Epic Lava Lamp

This commit is contained in:
2024-09-19 15:02:44 -04:00
parent 88b4ce12a7
commit 1ec8cb5b8c

View File

@@ -17,9 +17,10 @@ private:
CaveGame::Core::PerlinNoise noise(0);
int test_tiles[1024][1024];
int test_tiles[512][512];
JGL::Font Jupiteroid;
float z = 0;
class CaveGameWindow : public ReWindow::RWindow
{
@@ -51,9 +52,9 @@ public:
JGL::J2D::Begin();
for (int tx = 0; tx < 1024; tx++)
for (int tx = 0; tx < 512; tx++)
{
for (int ty = 0; ty < 1024; ty++)
for (int ty = 0; ty < 512; ty++)
{
Color4 color = {0,0,0,0};
@@ -74,7 +75,7 @@ public:
JGL::J2D::FillRect(color, {static_cast<float>(tx), static_cast<float>(ty)}, {1, 1});
JGL::J2D::FillRect(color, {static_cast<float>(tx*2), static_cast<float>(ty*2)}, {2, 2});
}
}
JGL::J2D::End();
@@ -88,6 +89,19 @@ public:
void OnRefresh(float elapsed) override
{
z += 0.05;
for (int tx = 0; tx < 512; tx++)
{
for (int ty = 0; ty < 512; ty++)
{
float sx = 20.f, sy = 20.f;
float scale = 5;
auto raw_noise = noise.Noise(tx/sx, ty/sy, z) + 0.5;
test_tiles[tx][ty] = (int)(raw_noise*scale);
}
}
display();
int glError = glGetError();
if (glError != GL_NO_ERROR)
@@ -114,12 +128,11 @@ public:
int main() {
srand(0);
for (int tx = 0; tx < 1024; tx++)
for (int tx = 0; tx < 512; tx++)
{
for (int ty = 0; ty < 1024; ty++)
for (int ty = 0; ty < 512; ty++)
{
float sx = 100.f, sy = 100.f;
float z = 0.5;
float scale = 6;
auto raw_noise = noise.Noise(tx/sx, ty/sy, z) + 0.5;
test_tiles[tx][ty] = (int)(raw_noise*scale);