| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2610,14 +2610,15 @@ void rawPolys() { | |||
| 2610 | 2610 | raw.noStroke(); | |
| 2611 | 2611 | raw.beginShape(TRIANGLES); | |
| 2612 | 2612 | ||
| 2613 | - sortTriangles(); | ||
| 2613 | + | ||
| 2614 | + //sortTriangles(); | ||
| 2614 | 2615 | ||
| 2615 | 2616 | float[] vertices = tessGeo.polyVertices; | |
| 2616 | 2617 | int[] color = tessGeo.polyColors; | |
| 2617 | 2618 | float[] uv = tessGeo.polyTexCoords; | |
| 2618 | - //short[] indices = tessGeo.polyIndices; // unused [fry] | ||
| 2619 | - | ||
| 2619 | + short[] indices = tessGeo.polyIndices; // unused [fry] | ||
| 2620 | 2620 | ||
| 2621 | + /* | ||
| 2621 | 2622 | sortTriangles(); | |
| 2622 | 2623 | for (int i = 0; i < sortedTriangleCount; i++) { | |
| 2623 | 2624 | Triangle tri = sortedPolyTriangles[i]; | |
@@ -2697,9 +2698,9 @@ void rawPolys() { | |||
| 2697 | 2698 | } | |
| 2698 | 2699 | ||
| 2699 | 2700 | } | |
| 2701 | + */ | ||
| 2700 | 2702 | ||
| 2701 | 2703 | ||
| 2702 | - /* | ||
| 2703 | 2704 | for (int i = 0; i < texCache.size; i++) { | |
| 2704 | 2705 | PImage textureImage = texCache.getTextureImage(i); | |
| 2705 | 2706 | ||
@@ -2791,7 +2792,7 @@ void rawPolys() { | |||
| 2791 | 2792 | } | |
| 2792 | 2793 | } | |
| 2793 | 2794 | } | |
| 2794 | - */ | ||
| 2795 | + | ||
| 2795 | 2796 | ||
| 2796 | 2797 | raw.endShape(); | |
| 2797 | 2798 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -369,6 +369,7 @@ protected void initSurface(int antialias) { | |||
| 369 | 369 | canvasAWT = null; | |
| 370 | 370 | } | |
| 371 | 371 | ||
| 372 | + pg.parent.defaultSize = false; | ||
| 372 | 373 | registerListeners(); | |
| 373 | 374 | ||
| 374 | 375 | fboLayerCreated = false; | |
@@ -384,6 +385,7 @@ protected void reinitSurface() { | |||
| 384 | 385 | fboLayerCreated = false; | |
| 385 | 386 | fboLayerInUse = false; | |
| 386 | 387 | firstFrame = true; | |
| 388 | + pg.parent.defaultSize = false; | ||
| 387 | 389 | } | |
| 388 | 390 | ||
| 389 | 391 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -116,7 +116,7 @@ public class PShader implements PConstants { | |||
| 116 | 116 | protected int transformMatLoc; | |
| 117 | 117 | protected int modelviewMatLoc; | |
| 118 | 118 | protected int projectionMatLoc; | |
| 119 | - protected int bufferLoc; | ||
| 119 | + protected int ppixelsLoc; | ||
| 120 | 120 | protected int bufferUnit; | |
| 121 | 121 | protected int viewportLoc; | |
| 122 | 122 | ||
@@ -1158,7 +1158,7 @@ protected void loadUniforms() { | |||
| 1158 | 1158 | projectionMatLoc = getUniformLoc("projectionMatrix"); | |
| 1159 | 1159 | ||
| 1160 | 1160 | viewportLoc = getUniformLoc("viewport"); | |
| 1161 | - bufferLoc = getUniformLoc("buffer"); | ||
| 1161 | + ppixelsLoc = getUniformLoc("ppixels"); | ||
| 1162 | 1162 | ||
| 1163 | 1163 | normalMatLoc = getUniformLoc("normalMatrix"); | |
| 1164 | 1164 | ||
@@ -1209,9 +1209,9 @@ protected void setCommonUniforms() { | |||
| 1209 | 1209 | setUniformValue(viewportLoc, x, y, w, h); | |
| 1210 | 1210 | } | |
| 1211 | 1211 | ||
| 1212 | - if (-1 < bufferLoc) { | ||
| 1212 | + if (-1 < ppixelsLoc) { | ||
| 1213 | 1213 | bufferUnit = getLastTexUnit() + 1; | |
| 1214 | - setUniformValue(bufferLoc, bufferUnit); | ||
| 1214 | + setUniformValue(ppixelsLoc, bufferUnit); | ||
| 1215 | 1215 | pgl.activeTexture(PGL.TEXTURE0 + bufferUnit); | |
| 1216 | 1216 | currentPG.bindFrontTexture(); | |
| 1217 | 1217 | } else { | |
@@ -1304,7 +1304,7 @@ protected void unbindTyped() { | |||
| 1304 | 1304 | if (-1 < texCoordLoc) pgl.disableVertexAttribArray(texCoordLoc); | |
| 1305 | 1305 | if (-1 < normalLoc) pgl.disableVertexAttribArray(normalLoc); | |
| 1306 | 1306 | ||
| 1307 | - if (-1 < bufferLoc) { | ||
| 1307 | + if (-1 < ppixelsLoc) { | ||
| 1308 | 1308 | pgl.requestFBOLayer(); | |
| 1309 | 1309 | pgl.activeTexture(PGL.TEXTURE0 + bufferUnit); | |
| 1310 | 1310 | currentPG.unbindFrontTexture(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,7 @@ | |||
| 1 | 1 | // GLSL version of Conway's game of life, ported from GLSL sandbox: | |
| 2 | 2 | // http://glsl.heroku.com/e#207.3 | |
| 3 | - // Exemplifies the use of the buffer uniform in the shader, that gives | ||
| 4 | - // access to the previous frame. | ||
| 3 | + // Exemplifies the use of the ppixels uniform in the shader, that gives | ||
| 4 | + // access to the pixels of the previous frame. | ||
| 5 | 5 | PShader conway; | |
| 6 | 6 | PGraphics pg; | |
| 7 | 7 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,7 @@ precision highp float; | |||
| 9 | 9 | uniform float time; | |
| 10 | 10 | uniform vec2 mouse; | |
| 11 | 11 | uniform vec2 resolution; | |
| 12 | - uniform sampler2D buffer; | ||
| 12 | + uniform sampler2D ppixels; | ||
| 13 | 13 | ||
| 14 | 14 | vec4 live = vec4(0.5,1.0,0.7,1.); | |
| 15 | 15 | vec4 dead = vec4(0.,0.,0.,1.); | |
@@ -28,15 +28,15 @@ void main( void ) { | |||
| 28 | 28 | } | |
| 29 | 29 | } else { | |
| 30 | 30 | float sum = 0.; | |
| 31 | - sum += texture2D(buffer, position + pixel * vec2(-1., -1.)).g; | ||
| 32 | - sum += texture2D(buffer, position + pixel * vec2(-1., 0.)).g; | ||
| 33 | - sum += texture2D(buffer, position + pixel * vec2(-1., 1.)).g; | ||
| 34 | - sum += texture2D(buffer, position + pixel * vec2(1., -1.)).g; | ||
| 35 | - sum += texture2D(buffer, position + pixel * vec2(1., 0.)).g; | ||
| 36 | - sum += texture2D(buffer, position + pixel * vec2(1., 1.)).g; | ||
| 37 | - sum += texture2D(buffer, position + pixel * vec2(0., -1.)).g; | ||
| 38 | - sum += texture2D(buffer, position + pixel * vec2(0., 1.)).g; | ||
| 39 | - vec4 me = texture2D(buffer, position); | ||
| 31 | + sum += texture2D(ppixels, position + pixel * vec2(-1., -1.)).g; | ||
| 32 | + sum += texture2D(ppixels, position + pixel * vec2(-1., 0.)).g; | ||
| 33 | + sum += texture2D(ppixels, position + pixel * vec2(-1., 1.)).g; | ||
| 34 | + sum += texture2D(ppixels, position + pixel * vec2(1., -1.)).g; | ||
| 35 | + sum += texture2D(ppixels, position + pixel * vec2(1., 0.)).g; | ||
| 36 | + sum += texture2D(ppixels, position + pixel * vec2(1., 1.)).g; | ||
| 37 | + sum += texture2D(ppixels, position + pixel * vec2(0., -1.)).g; | ||
| 38 | + sum += texture2D(ppixels, position + pixel * vec2(0., 1.)).g; | ||
| 39 | + vec4 me = texture2D(ppixels, position); | ||
| 40 | 40 | ||
| 41 | 41 | if (me.g <= 0.1) { | |
| 42 | 42 | if ((sum >= 2.9) && (sum <= 3.1)) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,7 @@ IntBuffer envMapTextureID; | |||
| 21 | 21 | int envMapSize = 1024; | |
| 22 | 22 | ||
| 23 | 23 | void setup() { | |
| 24 | - size(640, 640, P3D); | ||
| 24 | + size(640, 640, P3D); | ||
| 25 | 25 | initCubeMap(); | |
| 26 | 26 | } | |
| 27 | 27 | ||
@@ -32,6 +32,7 @@ void draw() { | |||
| 32 | 32 | ||
| 33 | 33 | void drawScene() { | |
| 34 | 34 | background(0); | |
| 35 | + | ||
| 35 | 36 | stroke(255, 0, 0); | |
| 36 | 37 | strokeWeight(2); | |
| 37 | 38 | for (int i = -width; i < 2 * width; i += 50) { | |
@@ -46,6 +47,6 @@ void drawScene() { | |||
| 46 | 47 | translate(mouseX, mouseY, 200); | |
| 47 | 48 | rotateX(frameCount * 0.01); | |
| 48 | 49 | rotateY(frameCount * 0.01); | |
| 49 | - box(100); | ||
| 50 | + box(100); | ||
| 50 | 51 | } | |
| 51 | 52 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments