Skip to content

Commit

Permalink
engine/esm/graphics/shaders.js: avoid blank first lines in shader text
Browse files Browse the repository at this point in the history
The `#version` command, if present, needs to be on the first line of the
shader program, so our previous formatting wasn't fully working.
  • Loading branch information
pkgw committed Aug 18, 2023
1 parent 683dd38 commit 2263ae2
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions engine/esm/graphics/shaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ SimpleLineShader._prog = null;
SimpleLineShader.init = function (renderContext) {
var gl = renderContext.gl;

const fragShaderText = `
const fragShaderText = `\
precision highp float;
uniform vec4 lineColor;
Expand All @@ -31,7 +31,7 @@ SimpleLineShader.init = function (renderContext) {
}
`;

const vertexShaderText = `
const vertexShaderText = `\
attribute vec3 aVertexPosition;
uniform mat4 uMVMatrix;
Expand Down Expand Up @@ -111,7 +111,7 @@ SimpleLineShader2D._prog = null;
SimpleLineShader2D.init = function (renderContext) {
var gl = renderContext.gl;

const fragShaderText = `
const fragShaderText = `\
precision highp float;
uniform vec4 lineColor;
Expand All @@ -120,7 +120,7 @@ SimpleLineShader2D.init = function (renderContext) {
}
`;

const vertexShaderText = `
const vertexShaderText = `\
attribute vec3 aVertexPosition;
void main(void) {
Expand Down Expand Up @@ -194,7 +194,7 @@ OrbitLineShader._prog = null;
OrbitLineShader.init = function (renderContext) {
var gl = renderContext.gl;

const fragShaderText = `
const fragShaderText = `\
precision highp float;
uniform vec4 lineColor;
varying lowp vec4 vColor;
Expand All @@ -204,7 +204,7 @@ OrbitLineShader.init = function (renderContext) {
}
`;

const vertexShaderText = `
const vertexShaderText = `\
attribute vec3 aVertexPosition;
attribute vec4 aVertexColor;
Expand Down Expand Up @@ -292,7 +292,7 @@ LineShaderNormalDates._prog = null;
LineShaderNormalDates.init = function (renderContext) {
var gl = renderContext.gl;

const fragShaderText = `
const fragShaderText = `\
precision highp float;
uniform vec4 lineColor;
varying lowp vec4 vColor;
Expand All @@ -303,7 +303,7 @@ LineShaderNormalDates.init = function (renderContext) {
}
`;

const vertexShaderText = `
const vertexShaderText = `\
attribute vec3 aVertexPosition;
attribute vec4 aVertexColor;
attribute vec2 aTime;
Expand Down Expand Up @@ -420,7 +420,7 @@ TimeSeriesPointSpriteShader._prog = null;
TimeSeriesPointSpriteShader.init = function (renderContext) {
var gl = renderContext.gl;

const fragShaderText = `
const fragShaderText = `\
precision mediump float;
uniform vec4 lineColor;
varying lowp vec4 vColor;
Expand All @@ -434,7 +434,7 @@ TimeSeriesPointSpriteShader.init = function (renderContext) {
}
`;

const vertexShaderText = `
const vertexShaderText = `\
attribute vec3 aVertexPosition;
attribute vec4 aVertexColor;
attribute vec2 aTime;
Expand Down Expand Up @@ -593,7 +593,7 @@ KeplerPointSpriteShader._prog = null;
KeplerPointSpriteShader.init = function (renderContext) {
var gl = renderContext.gl;

const fragShaderText = `
const fragShaderText = `\
precision mediump float;
uniform vec4 lineColor;
varying lowp vec4 vColor;
Expand All @@ -607,7 +607,7 @@ KeplerPointSpriteShader.init = function (renderContext) {
}
`;

const vertexShaderText = `
const vertexShaderText = `\
attribute vec3 ABC;
attribute vec3 abc;
attribute float PointSize;
Expand Down Expand Up @@ -801,7 +801,7 @@ EllipseShader._prog = null;
EllipseShader.init = function (renderContext) {
var gl = renderContext.gl;

const fragShaderText = `
const fragShaderText = `\
precision mediump float;
varying lowp vec4 vColor;
Expand All @@ -811,7 +811,7 @@ EllipseShader.init = function (renderContext) {
}
`;

const vertexShaderText = `
const vertexShaderText = `\
attribute vec3 Angle;
uniform mat4 matWVP;
uniform mat4 matPosition;
Expand Down Expand Up @@ -916,7 +916,7 @@ ModelShader.atmosphereColor = Color.fromArgb(0, 0, 0, 0);
ModelShader.init = function (renderContext) {
var gl = renderContext.gl;

const fragShaderText = `
const fragShaderText = `\
precision mediump float;
varying vec2 vTextureCoord;
Expand Down Expand Up @@ -944,7 +944,7 @@ ModelShader.init = function (renderContext) {
}
`;

const vertexShaderText = `
const vertexShaderText = `\
attribute vec3 aVertexPosition;
attribute vec3 aNormal;
attribute vec2 aTextureCoord;
Expand Down Expand Up @@ -1081,7 +1081,7 @@ ModelShaderTan.atmosphereColor = Color.fromArgb(0, 0, 0, 0);
ModelShaderTan.init = function (renderContext) {
var gl = renderContext.gl;

const fragShaderText = `
const fragShaderText = `\
precision mediump float;
varying vec2 vTextureCoord;
Expand Down Expand Up @@ -1109,7 +1109,7 @@ ModelShaderTan.init = function (renderContext) {
}
`;

const vertexShaderText = `
const vertexShaderText = `\
attribute vec3 aVertexPosition;
attribute vec3 aNormal;
attribute vec2 aTextureCoord;
Expand Down Expand Up @@ -1245,7 +1245,7 @@ TileShader.atmosphereColor = Color.fromArgb(0, 0, 0, 0);
TileShader.init = function (renderContext) {
var gl = renderContext.gl;

const fragShaderText = `
const fragShaderText = `\
precision mediump float;
varying vec2 vTextureCoord;
Expand Down Expand Up @@ -1273,7 +1273,7 @@ TileShader.init = function (renderContext) {
}
`;

const vertexShaderText = `
const vertexShaderText = `\
attribute vec3 aVertexPosition;
attribute vec2 aTextureCoord;
Expand Down Expand Up @@ -1434,7 +1434,7 @@ FitsShader.scaleType = 0;
FitsShader.init = function (renderContext) {
var gl = renderContext.gl;

const fragShaderText = `
const fragShaderText = `\
#version 300 es
precision mediump float;
Expand Down Expand Up @@ -1494,7 +1494,7 @@ FitsShader.init = function (renderContext) {
}
`;

const vertexShaderText = `
const vertexShaderText = `\
#version 300 es
in vec3 aVertexPosition;
Expand Down Expand Up @@ -1639,7 +1639,7 @@ ImageShader._prog = null;
ImageShader.init = function (renderContext) {
var gl = renderContext.gl;

const fragShaderText = `
const fragShaderText = `\
precision mediump float;
varying vec2 vTextureCoord;
Expand All @@ -1653,7 +1653,7 @@ ImageShader.init = function (renderContext) {
}
`;

const vertexShaderText = `
const vertexShaderText = `\
attribute vec3 aVertexPosition;
attribute vec2 aTextureCoord;
Expand Down Expand Up @@ -1761,7 +1761,7 @@ ImageShader2._prog = null;
ImageShader2.init = function (renderContext) {
var gl = renderContext.gl;

const fragShaderText = `
const fragShaderText = `\
precision mediump float;
varying vec2 vTextureCoord;
Expand All @@ -1775,7 +1775,7 @@ ImageShader2.init = function (renderContext) {
}
`;

const vertexShaderText = `
const vertexShaderText = `\
attribute vec3 aVertexPosition;
attribute vec2 aTextureCoord;
Expand Down Expand Up @@ -1884,7 +1884,7 @@ SpriteShader._prog = null;
SpriteShader.init = function (renderContext) {
var gl = renderContext.gl;

const fragShaderText = `
const fragShaderText = `\
precision mediump float;
varying vec2 vTextureCoord;
Expand All @@ -1896,7 +1896,7 @@ SpriteShader.init = function (renderContext) {
}
`;

const vertexShaderText = `
const vertexShaderText = `\
attribute vec3 aVertexPosition;
attribute vec2 aTextureCoord;
attribute lowp vec4 aColor;
Expand Down Expand Up @@ -1993,7 +1993,7 @@ ShapeSpriteShader._prog = null;
ShapeSpriteShader.init = function (renderContext) {
var gl = renderContext.gl;

const fragShaderText = `
const fragShaderText = `\
precision mediump float;
varying lowp vec4 vColor;
Expand All @@ -2003,7 +2003,7 @@ ShapeSpriteShader.init = function (renderContext) {
}
`;

const vertexShaderText = `
const vertexShaderText = `\
attribute vec3 aVertexPosition;
attribute lowp vec4 aColor;
Expand Down Expand Up @@ -2088,7 +2088,7 @@ TextShader._prog = null;
TextShader.init = function (renderContext) {
var gl = renderContext.gl;

const fragShaderText = `
const fragShaderText = `\
precision mediump float;
varying vec2 vTextureCoord;
Expand All @@ -2100,7 +2100,7 @@ TextShader.init = function (renderContext) {
}
`;

const vertexShaderText = `
const vertexShaderText = `\
attribute vec3 aVertexPosition;
attribute vec2 aTextureCoord;
Expand Down

0 comments on commit 2263ae2

Please sign in to comment.