| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c05adf1 commit ef4e1aa
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,38 +1,30 @@ | |||
| 1 | 1 | /** | |
| 2 | - * Landscape | ||
| 3 | - * Simple raymarching shader with camera, originally by Paulo Falcão | ||
| 4 | - * Ported from the webGL version in GLSL Sandbox: | ||
| 5 | - * http://glsl.heroku.com/e#3213.0 | ||
| 6 | - * | ||
| 2 | + * Elevated | ||
| 3 | + * https://www.shadertoy.com/view/MdX3Rr by inigo quilez | ||
| 4 | + * Created by inigo quilez - iq/2013 | ||
| 5 | + * License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. | ||
| 6 | + * Processing port by Raphaël de Courville. | ||
| 7 | 7 | */ | |
| 8 | 8 | ||
| 9 | - PShader landscape; | ||
| 10 | - PGraphics pg; | ||
| 9 | + PShader shader; | ||
| 11 | 10 | ||
| 12 | 11 | void setup() { | |
| 13 | 12 | size(640, 360, P2D); | |
| 14 | - | ||
| 15 | - // This effect can be too demanding on older GPUs, | ||
| 16 | - // so we render it on a smaller res offscreen surface | ||
| 17 | - pg = createGraphics(320, 180, P2D); | ||
| 18 | - pg.noStroke(); | ||
| 19 | - | ||
| 20 | - landscape = loadShader("landscape.glsl"); | ||
| 21 | - landscape.set("resolution", float(width), float(height)); | ||
| 13 | + noStroke(); | ||
| 14 | + | ||
| 15 | + // The code of this shader shows how to integrate shaders from shadertoy | ||
| 16 | + // into Processing with minimal changes. | ||
| 17 | + shader = loadShader("landscape.glsl"); | ||
| 18 | + shader.set("resolution", float(width), float(height)); | ||
| 22 | 19 | } | |
| 23 | 20 | ||
| 24 | 21 | void draw() { | |
| 25 | - landscape.set("time", millis() / 1000.0); | ||
| 26 | - landscape.set("mouse", float(mouseX), height - float(mouseY)); | ||
| 27 | - | ||
| 28 | - // This kind of raymarching effects are entirely implemented in the | ||
| 29 | - // fragment shader, they only need a quad covering the entire view | ||
| 30 | - // area so every pixel is pushed through the shader. | ||
| 31 | - pg.beginDraw(); | ||
| 32 | - pg.shader(landscape); | ||
| 33 | - pg.rect(0, 0, width, height); | ||
| 34 | - pg.endDraw(); | ||
| 22 | + background(0); | ||
| 23 | + | ||
| 24 | + shader.set("time", (float)(millis()/1000.0)); | ||
| 25 | + shader(shader); | ||
| 26 | + rect(0, 0, width, height); | ||
| 35 | 27 | ||
| 36 | - // Scaling up offscreen surface to cover entire screen. | ||
| 37 | - image(pg, 0, 0, width, height); | ||
| 28 | + frame.setTitle("frame: " + frameCount + " - fps: " + frameRate); | ||
| 38 | 29 | } | |
| 30 | + | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments