Skip to content

Commit

Permalink
Revert untested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
donmccurdy committed Mar 8, 2024
1 parent e89aa12 commit 6f54555
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 77 deletions.
19 changes: 8 additions & 11 deletions showcases/ascii/ascii-layer/ascii-filter.js
Expand Up @@ -3,22 +3,21 @@ import GL from '@luma.gl/constants';
import {sortCharactersByBrightness} from './utils';

const vs = `
#version 300 es
#define SHADER_NAME feedback-vertex-shader
uniform sampler2D video;
uniform sampler2D pixelMapTexture;
in vec2 uv;
attribute vec2 uv;
out vec4 instanceIconFrames;
out vec4 instanceColors;
varying vec4 instanceIconFrames;
varying vec4 instanceColors;
float bitColor(float x) {
return floor(x * 4. + 0.5) * 64.;
}
void main(void) {
vec4 pixel = texture(video, uv);
vec4 pixel = texture2D(video, uv);
float luminance = 0.2126 * pixel.r + 0.7152 * pixel.g + 0.0722 * pixel.b;
instanceColors = vec4(
Expand All @@ -28,24 +27,22 @@ void main(void) {
255.0
);
instanceIconFrames = texture(pixelMapTexture, vec2(luminance + 0.5 / 256., 0.5));
instanceIconFrames = texture2D(pixelMapTexture, vec2(luminance + 0.5 / 256., 0.5));
gl_Position = vec4(0.0);
}
`;

const fs = `
#version 300 es
#define SHADER_NAME feedback-fragment-shader
precision highp float;
in vec4 instanceIconFrames;
in vec4 instanceColors;
out vec4 fragColor;
varying vec4 instanceIconFrames;
varying vec4 instanceColors;
void main(void) {
fragColor = vec4(0.0);
gl_FragColor = vec4(0.0);
}
`;

Expand Down
Expand Up @@ -19,16 +19,14 @@
// THE SOFTWARE.

export default `\
#version 300 es
#define SHADER_NAME delaunay-cover-fragment-shader
in vec4 vPosition;
in vec4 vNormal;
in vec4 vColor;
out vec4 fragColor;
varying vec4 vPosition;
varying vec4 vNormal;
varying vec4 vColor;
void main(void) {
float lightWeight = getLightWeight(vPosition.xyz, vNormal.xzy);
fragColor = vec4(vColor.xyz * lightWeight, vColor.a);
gl_FragColor = vec4(vColor.xyz * lightWeight, vColor.a);
}
`;
Expand Up @@ -19,19 +19,18 @@
// THE SOFTWARE.

export default `\
#version 300 es
#define SHADER_NAME delaunay-cover-vertex-shader
#define HEIGHT_FACTOR 25.
uniform vec2 bounds;
in vec3 positions;
in vec3 next;
in vec3 next2;
attribute vec3 positions;
attribute vec3 next;
attribute vec3 next2;
out vec4 vPosition;
out vec4 vNormal;
out vec4 vColor;
varying vec4 vPosition;
varying vec4 vNormal;
varying vec4 vColor;
vec4 getWorldSpacePos(vec3 positions) {
vec2 pos = project_position(positions.xy);
Expand Down
Expand Up @@ -19,16 +19,15 @@
// THE SOFTWARE.

export default `\
#version 300 es
#define SHADER_NAME delaunay-vertex-shader
uniform vec4 bbox;
uniform vec2 size;
in vec3 positions;
in vec3 data;
attribute vec3 positions;
attribute vec3 data;
out vec4 vColor;
varying vec4 vColor;
void main(void) {
float posX = mix(-1., 1., (positions.x - bbox.x) / (bbox.y - bbox.x));
Expand Down
@@ -1,14 +1,11 @@
export default `\
#version 300 es
#define SHADER_NAME elevation-layer-fragment-shader
uniform vec2 elevationRange;
in float lightWeight;
in vec3 vNormal;
in float vAltitude;
out vec4 fragColor;
varying float lightWeight;
varying vec3 vNormal;
varying float vAltitude;
void main() {
if (vAltitude < -90.0) {
Expand All @@ -17,6 +14,6 @@ void main() {
float opacity = smoothstep(elevationRange.x, elevationRange.y / 2.0, vAltitude) * 1.;
fragColor = vec4(vec3(15./70., 26./70., 36./70.) * lightWeight, opacity);
gl_FragColor = vec4(vec3(15./70., 26./70., 36./70.) * lightWeight, opacity);
}
`;
@@ -1,21 +1,20 @@
export default `\
#version 300 es
#define SHADER_NAME elevation-layer-vertex-shader
uniform sampler2D elevationTexture;
uniform vec4 elevationBounds;
uniform vec2 elevationRange;
uniform float zScale;
in vec3 positions;
attribute vec3 positions;
out float lightWeight;
out vec3 vNormal;
out float vAltitude;
varying float lightWeight;
varying vec3 vNormal;
varying float vAltitude;
vec3 getWorldPosition(vec2 lngLat) {
vec2 texCoords = (lngLat - elevationBounds.xy) / (elevationBounds.zw - elevationBounds.xy);
vec4 elevation = texture(elevationTexture, texCoords);
vec4 elevation = texture2D(elevationTexture, texCoords);
float altitude = mix(elevationRange.x, elevationRange.y, elevation.r);
Expand Down
Expand Up @@ -19,14 +19,12 @@
// THE SOFTWARE.

export default `\
#version 300 es
#define SHADER_NAME particle-layer-fragment-shader
precision highp float;
in vec4 vColor;
in float vAltitude;
out vec4 fragColor;
varying vec4 vColor;
varying float vAltitude;
void main(void) {
// if (vColor.a < 0.07) {
Expand All @@ -40,6 +38,6 @@ void main(void) {
if (false && length(diff) > 0.5) {
discard;
}
fragColor = vColor;
gl_FragColor = vColor;
}
`;
Expand Up @@ -19,7 +19,6 @@
// THE SOFTWARE.

export default `\
#version 300 es
#define SHADER_NAME particle-layer-vertex-shader
#define HEIGHT_FACTOR 25.
Expand All @@ -40,16 +39,16 @@ uniform vec4 elevationBounds;
uniform vec2 elevationRange;
uniform float zScale;
in vec3 positions;
in vec4 posFrom;
// in vec3 vertices;
attribute vec3 positions;
attribute vec4 posFrom;
// attribute vec3 vertices;
out vec4 vColor;
out float vAltitude;
varying vec4 vColor;
varying float vAltitude;
float getAltitude(vec2 lngLat) {
vec2 texCoords = (lngLat - elevationBounds.xy) / (elevationBounds.zw - elevationBounds.xy);
vec4 elevation = texture(elevationTexture, texCoords);
vec4 elevation = texture2D(elevationTexture, texCoords);
return mix(elevationRange.x, elevationRange.y, elevation.r);
}
Expand All @@ -59,7 +58,7 @@ void main(void) {
float x = (posFrom.x - bbox.x) / (bbox.y - bbox.x);
float y = (posFrom.y - bbox.z) / (bbox.w - bbox.z);
vec2 coord = vec2(x, 1. - y);
vec4 texel = mix(texture(dataFrom, coord), texture(dataTo, coord), delta);
vec4 texel = mix(texture2D(dataFrom, coord), texture2D(dataTo, coord), delta);
vAltitude = getAltitude(posFrom.xy);
//float wind = (texel.y - bounds1.x) / (bounds1.y - bounds1.x);
Expand Down
Expand Up @@ -19,7 +19,6 @@
// THE SOFTWARE.

export default `\
#version 300 es
#define SHADER_NAME particle-feedback-vertex-shader
#define PI 3.1415926535
Expand All @@ -41,8 +40,8 @@ uniform vec2 bounds0;
uniform vec2 bounds1;
uniform vec2 bounds2;
//in vec3 positions;
in vec4 posFrom;
//attribute vec3 positions;
attribute vec4 posFrom;
float rand(vec2 co){
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
Expand All @@ -53,8 +52,8 @@ void main(void) {
float x = (posFrom.x - bbox.x) / (bbox.y - bbox.x);
float y = (posFrom.y - bbox.z) / (bbox.w - bbox.z);
vec2 coord = vec2(x, 1. - y);
vec4 texel1 = texture(dataFrom, coord);
vec4 texel2 = texture(dataTo, coord);
vec4 texel1 = texture2D(dataFrom, coord);
vec4 texel2 = texture2D(dataTo, coord);
vec4 texel = mix(texel1, texel2, delta);
// angle
Expand Down
12 changes: 5 additions & 7 deletions showcases/wind/src/layers/wind-layer/wind-layer-fragment.js
Expand Up @@ -19,14 +19,12 @@
// THE SOFTWARE.

export default `\
#version 300 es
#define SHADER_NAME wind-layer-fragment-shader
in vec4 vPosition;
in vec4 vNormal;
in vec4 vColor;
in float vAltitude;
out vec4 fragColor;
varying vec4 vPosition;
varying vec4 vNormal;
varying vec4 vColor;
varying float vAltitude;
void main(void) {
if (vColor.a == 0.) {
Expand All @@ -38,6 +36,6 @@ void main(void) {
// discard;
// }
float lightWeight = getLightWeight(vPosition.xyz, vNormal.xzy);
fragColor = vec4(vColor.xyz * lightWeight, 1);
gl_FragColor = vec4(vColor.xyz * lightWeight, 1);
}
`;
21 changes: 10 additions & 11 deletions showcases/wind/src/layers/wind-layer/wind-layer-vertex.js
Expand Up @@ -19,7 +19,6 @@
// THE SOFTWARE.

export default `\
#version 300 es
#define SHADER_NAME wind-layer-vertex-shader
#define PI 3.1415926535
Expand All @@ -41,18 +40,18 @@ uniform vec2 bounds2;
uniform vec4 elevationBounds;
uniform vec2 elevationRange;
in vec3 positions;
in vec3 vertices;
in vec3 normals;
attribute vec3 positions;
attribute vec3 vertices;
attribute vec3 normals;
out vec4 vPosition;
out vec4 vNormal;
out vec4 vColor;
out float vAltitude;
varying vec4 vPosition;
varying vec4 vNormal;
varying vec4 vColor;
varying float vAltitude;
float getAltitude(vec2 lngLat) {
vec2 texCoords = (lngLat - elevationBounds.xy) / (elevationBounds.zw - elevationBounds.xy);
vec4 elevation = texture(elevationTexture, texCoords);
vec4 elevation = texture2D(elevationTexture, texCoords);
return mix(elevationRange.x, elevationRange.y, elevation.r);
}
Expand All @@ -62,8 +61,8 @@ void main(void) {
float x = (positions.x - bbox.x) / (bbox.y - bbox.x);
float y = (positions.y - bbox.z) / (bbox.w - bbox.z);
vec2 coord = vec2(x, 1. - y);
vec4 texel1 = texture(dataFrom, coord);
vec4 texel2 = texture(dataTo, coord);
vec4 texel1 = texture2D(dataFrom, coord);
vec4 texel2 = texture2D(dataTo, coord);
vec4 texel = mix(texel1, texel2, delta);
// angle
Expand Down

0 comments on commit 6f54555

Please sign in to comment.