+ 1

How to convert the .pde file to HTML?

I created a 3D Terrain Generator with processing and i did like to put on the HTML. How i can do? There is the code: int cols,rows; int scl = 20; int w = 2000; int h = 1600; float flying = 0; float[][] terrain; void setup() { size(600, 600, P3D); cols = w / scl; rows = h/ scl; terrain = new float[cols][rows]; } void draw() { flying -= 0.1; float yoff = flying; for (int y = 0; y < rows; y++) { float xoff = 0; for (int x = 0; x < cols; x++) { terrain[x][y] = map(noise(xoff, yoff), 0, 1, -100, 100); xoff += 0.2; } yoff += 0.2; } background(0); stroke(255); noFill(); translate(width/2, height/2+50); rotateX(PI/3); frameRate(1); translate(-w/2, -h/2); for (int y = 0; y < rows-1; y++) { beginShape(TRIANGLE_STRIP); for (int x = 0; x < cols; x++) { vertex(x*scl, y*scl, terrain[x][y+1]); vertex(x*scl, (y+1)*scl, terrain[x][y+1]); //rect(x*scl, y*scl, scl, scl); } endShape(); } }

12th Oct 2019, 12:53 PM
Tanjil Khan
Tanjil Khan - avatar
1 Respuesta