Skip to content

Commit

Permalink
Add frag and vert shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
yuri-kiss authored Sep 24, 2024
1 parent 59b3e3e commit 9d343f3
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/ShaderManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ class ShaderManager {
this._shaderCache[modeName] = [];
}
}

/* eslint-disable global-require */
this.exports = {
/**
* Sprite shader exports
*/
sprite: {
vert: require('raw-loader!./shaders/sprite.vert'),
frag: require('raw-loader!./shaders/sprite.frag')
},
};
/* eslint-enable global-require */
}

/**
Expand Down Expand Up @@ -63,10 +75,8 @@ class ShaderManager {

const definesText = `${defines.join('\n')}\n`;

/* eslint-disable global-require */
const vsFullText = definesText + require('raw-loader!./shaders/sprite.vert');
const fsFullText = definesText + require('raw-loader!./shaders/sprite.frag');
/* eslint-enable global-require */
const vsFullText = definesText + this.exports.sprite.vert;
const fsFullText = definesText + this.exports.sprite.frag;

return twgl.createProgramInfo(this._gl, [vsFullText, fsFullText]);
}
Expand Down

0 comments on commit 9d343f3

Please sign in to comment.