Permalink
Browse files

Add lint

  • Loading branch information...
msfeldstein committed May 9, 2017
1 parent d53643b commit c231e159ec2fa384ee3f990ec31419c6b0ff7972
Showing with 412 additions and 395 deletions.
  1. +14 −0 .eslintrc.js
  2. +12 −14 lib/ISFBuffer.js
  3. +18 −18 lib/ISFGLProgram.js
  4. +7 −7 lib/ISFGLState.js
  5. +119 −131 lib/ISFParser.js
  6. +175 −168 lib/ISFRenderer.js
  7. +6 −6 lib/ISFTexture.js
  8. +23 −23 lib/ISFUpgrader.js
  9. +23 −23 lib/MetadataExtractor.js
  10. +3 −3 main.js
  11. +12 −2 package.json
  12. 0 {lib → vendor}/math.js
View
@@ -0,0 +1,14 @@
module.exports = {
"extends": "airbnb-base",
"plugins": [
"import"
],
"rules": {
"no-param-reassign": 0,
"no-plusplus": 0,
"no-continue": 0,
"no-console": 0,
"no-mixed-operators": 0,
"no-restricted-syntax": 0,
}
};
View
@@ -1,4 +1,4 @@
var ISFTexture = require("./ISFTexture.js");
const ISFTexture = require('./ISFTexture.js');
function ISFBuffer(pass, contextState) {
this.contextState = contextState;
@@ -16,40 +16,38 @@ function ISFBuffer(pass, contextState) {
this.flipFlop = false;
}
ISFBuffer.prototype.setSize = function(w, h) {
ISFBuffer.prototype.setSize = function (w, h) {
if (this.width !== w || this.height !== h) {
this.width = w;
this.height = h;
for (var i = 0; i < this.textures.length; i++) {
var texture = this.textures[i];
for (let i = 0; i < this.textures.length; i++) {
const texture = this.textures[i];
texture.setSize(w, h);
}
}
};
ISFBuffer.prototype.readTexture = function() {
ISFBuffer.prototype.readTexture = function () {
if (this.flipFlop) {
return this.textures[1];
} else {
return this.textures[0];
}
return this.textures[0];
};
ISFBuffer.prototype.writeTexture = function() {
ISFBuffer.prototype.writeTexture = function () {
if (!this.flipFlop) {
return this.textures[1];
} else {
return this.textures[0];
}
return this.textures[0];
};
ISFBuffer.prototype.flip = function() {
ISFBuffer.prototype.flip = function () {
this.flipFlop = !this.flipFlop;
};
ISFBuffer.prototype.destroy = function() {
for (var i = 0; i < this.textures.length; i++) {
var texture = this.textures[i];
ISFBuffer.prototype.destroy = function () {
for (let i = 0; i < this.textures.length; i++) {
const texture = this.textures[i];
texture.destroy();
}
this.gl.deleteFramebuffer(this.fbo);
View
@@ -6,66 +6,66 @@ function ISFGLProgram(gl, vs, fs) {
this.locations = {};
}
ISFGLProgram.prototype.use = function() {
ISFGLProgram.prototype.use = function () {
this.gl.useProgram(this.program);
};
ISFGLProgram.prototype.getUniformLocation = function(name) {
ISFGLProgram.prototype.getUniformLocation = function (name) {
return this.gl.getUniformLocation(this.program, name);
};
ISFGLProgram.prototype.setUniform1i = function(uniformName, value) {
ISFGLProgram.prototype.setUniform1i = function (uniformName, value) {
if (locations[uniformName] == null) {
locations[uniformName] = this.getUniformLocation(this.program, uniformName);
}
this.gl.uniform1i(this.paintProgram.texLocation, target.textureUnit);
};
ISFGLProgram.prototype.bindVertices = function() {
ISFGLProgram.prototype.bindVertices = function () {
this.use();
var positionLocation = this.gl.getAttribLocation(this.program, "position");
const positionLocation = this.gl.getAttribLocation(this.program, 'position');
this.buffer = this.gl.createBuffer();
this.gl.bindBuffer(this.gl.ARRAY_BUFFER, this.buffer);
this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array([-1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 1.0]), this.gl.STATIC_DRAW);
this.gl.enableVertexAttribArray(positionLocation);
this.gl.vertexAttribPointer(positionLocation, 2, this.gl.FLOAT, false, 0, 0);
};
ISFGLProgram.prototype.cleanup = function() {
ISFGLProgram.prototype.cleanup = function () {
this.gl.deleteShader(this.fShader);
this.gl.deleteShader(this.vShader);
this.gl.deleteProgram(this.program);
this.gl.deleteBuffer(this.buffer);
};
ISFGLProgram.prototype.createShader = function(src, type) {
var shader = this.gl.createShader(type);
ISFGLProgram.prototype.createShader = function (src, type) {
const shader = this.gl.createShader(type);
this.gl.shaderSource(shader, src);
this.gl.compileShader(shader);
var compiled = this.gl.getShaderParameter(shader, this.gl.COMPILE_STATUS);
const compiled = this.gl.getShaderParameter(shader, this.gl.COMPILE_STATUS);
if (!compiled) {
var lastError = this.gl.getShaderInfoLog(shader);
console.log("Error Compiling Shader ", lastError);
const lastError = this.gl.getShaderInfoLog(shader);
console.log('Error Compiling Shader ', lastError);
throw {
message: lastError,
type: "shader"
type: 'shader',
};
}
return shader;
};
ISFGLProgram.prototype.createProgram = function(vShader, fShader) {
var program = this.gl.createProgram();
ISFGLProgram.prototype.createProgram = function (vShader, fShader) {
const program = this.gl.createProgram();
this.gl.attachShader(program, vShader);
this.gl.attachShader(program, fShader);
this.gl.linkProgram(program);
var linked = this.gl.getProgramParameter(program, this.gl.LINK_STATUS);
const linked = this.gl.getProgramParameter(program, this.gl.LINK_STATUS);
if (!linked) {
var lastError = this.gl.getProgramInfoLog(program);
console.log("Error in program linking", lastError);
const lastError = this.gl.getProgramInfoLog(program);
console.log('Error in program linking', lastError);
throw {
message: lastError,
type: "program"
type: 'program',
};
}
return program;
View
@@ -1,16 +1,16 @@
var ISFGLState = function(gl) {
const ISFGLState = function (gl) {
this.gl = gl;
this.textureIndex = 0;
}
};
ISFGLState.prototype.newTextureIndex = function() {
var i = this.textureIndex;
ISFGLState.prototype.newTextureIndex = function () {
const i = this.textureIndex;
this.textureIndex += 1;
return i;
}
};
ISFGLState.prototype.reset = function() {
ISFGLState.prototype.reset = function () {
this.textureIndex = 0;
}
};
module.exports = ISFGLState;
Oops, something went wrong.

0 comments on commit c231e15

Please sign in to comment.